1 55 package org.lateralnz.panther.container; 56 57 import java.util.Properties ; 58 import javax.naming.Context ; 59 import javax.naming.InitialContext ; 60 61 import org.apache.log4j.Logger; 62 63 import org.lateralnz.common.util.Constants; 64 import org.lateralnz.common.util.JNDIUtils; 65 import org.lateralnz.common.util.StringUtils; 66 import org.lateralnz.panther.util.ContextUtils; 67 68 77 public abstract class Container implements Constants { 78 private static final Logger log = Logger.getLogger(Container.class.getName()); 79 80 private static final String DEPLOY_DIRECTORY = "deploy_directory"; 81 private static final String WORKING_DIRECTORY = "working_directory"; 82 private static final String CONF_DIRECTORY = "conf_directory"; 83 84 87 public static Context initContext = null; 88 89 protected String pantherHome = null; 90 91 94 protected String workingDir; 95 96 99 protected String deployDir; 100 101 104 protected String confDir; 105 106 protected Context envContext; 107 108 111 public Container(Properties props, Object parent) throws Exception { 112 if (initContext == null) { 113 initContext = new InitialContext (); 114 } 115 116 envContext = ContextUtils.getCompEnv(initContext); 117 118 workingDir = props.getProperty(WORKING_DIRECTORY); 119 if (!StringUtils.isEmpty(workingDir)) { 120 workingDir = StringUtils.toDirectory(workingDir); 121 } 122 123 deployDir = props.getProperty(DEPLOY_DIRECTORY); 124 if (!StringUtils.isEmpty(deployDir)) { 125 deployDir = StringUtils.toDirectory(deployDir); 126 } 127 128 confDir = props.getProperty(CONF_DIRECTORY); 129 if (!StringUtils.isEmpty(confDir)) { 130 confDir = StringUtils.toDirectory(confDir); 131 } 132 133 pantherHome = System.getProperty("PANTHER_HOME"); 134 if (StringUtils.isEmpty(pantherHome)) { 135 pantherHome = System.getProperty("panther_home"); 136 } 137 pantherHome = StringUtils.toDirectory(pantherHome); 138 } 139 140 } | Popular Tags |