Fields Summary |
---|
private String | _process |
private String | _configFile |
private String | _classpathExcludes |
private String | _classpathIncludes |
private String | _classpathLibDir |
private String | _classpathPrefix |
private String | _classpathJ2se14Prefix |
private String | _classpathJ2se15OrLaterPrefix |
private String | _mainClass |
private com.sun.enterprise.util.i18n.StringManager | _strMgr |
private Properties | _sysProperties |
private static boolean | bDebug |
private static final String | PROCESS |
private static final String | SYSTEM_PROPERTY |
private static final String | MAIN_CLASS |
private static final String | MAIN_CLASS_CLASSNAME |
private static final String | CLASSPATH |
private static final String | CLASSPATH_INCLUDES |
private static final String | CLASSPATH_EXCLUDES |
private static final String | CLASSPATH_PREFIX |
private static final String | CLASSPATH_J2SE1_4_PREFIX |
private static final String | CLASSPATH_J2SE1_5_OR_LATER_PREFIX |
private static final String | CLASSPATH_DIR |
Methods Summary |
---|
protected java.lang.String | getClasspathExcludes()
return _classpathExcludes;
|
protected java.lang.String | getClasspathIncludes()
return _classpathIncludes;
|
protected java.lang.String | getClasspathJ2se14Prefix()
return _classpathJ2se14Prefix;
|
protected java.lang.String | getClasspathJ2se15OrLaterPrefix()
return _classpathJ2se15OrLaterPrefix;
|
protected java.lang.String | getClasspathLibDir()
return _classpathLibDir;
|
protected java.lang.String | getClasspathPrefix()
return _classpathPrefix;
|
protected java.lang.String | getConfigFile()
return _configFile;
|
protected java.lang.String | getMainClass()
return _mainClass;
|
protected java.util.Properties | getSystemProperties()
return _sysProperties;
|
protected void | initializeConfig(java.lang.String configFile, java.lang.String process)This method read the processLauncher.xml file and calls a method that loads the named process configuration into
the a struncture that can be used by the processlauncher
// set internal variables
_configFile=configFile;
_process=process;
_sysProperties=new Properties();
_strMgr=StringManager.getManager(ASLauncherConfig.class);
try {
// read in config
boolean bFoundProcess=false;
String key=null;
Document doc=readDOM(configFile);
Element element=null;
NodeList nl=doc.getElementsByTagName(PROCESS);
for(int ii=0;ii < nl.getLength(); ii++) {
// find correct process
element=(Element)nl.item(ii);
key=element.getAttribute("name");
if(key.equals(process)) {
// found correct process, extract information
bFoundProcess=true;
loadProcess(element);
}
}
if(!bFoundProcess) {
// error flaguser
throw new ConfigException(_strMgr.getString("launcher.process_launcher_config_not_found",
new String[]{process, configFile}));
}
} catch (ConfigException ce) {
throw ce;
} catch (Exception e) {
throw new ConfigException(_strMgr.getString("launcher.process_launcher_config_exception", _configFile), e);
}
|
protected void | loadProcess(org.w3c.dom.Element process)This methods digests the name process into a struncture that can be used by the ProcessLauncer
// read in process
String key=null, value=null, ifx=null;
Element element=null;
// load system properties specificaly for this process
NodeList nl=process.getChildNodes();
for(int ii=0;ii < nl.getLength(); ii++) {
if(nl.item(ii) instanceof Element) {
element=(Element)nl.item(ii);
if(element.getTagName().equals(SYSTEM_PROPERTY)) {
// system_properties and add to config
key=element.getAttribute("key");
value=element.getAttribute("value");
ifx=element.getAttribute("if");
// get attribte always returns "" if it doesn't exist
if(!key.equals("")) {
// check to see if there is a condition on the property
if(ifx.equals("") || System.getProperty(ifx) != null) {
// add system properties
_sysProperties.setProperty(key, RelativePathResolver.resolvePath(value));
}
}
} else if(element.getTagName().equals(MAIN_CLASS)) {
// main class add to config
_mainClass=element.getAttribute(MAIN_CLASS_CLASSNAME);
} else if(element.getTagName().equals(CLASSPATH)) {
// classpath add to config
_classpathLibDir=element.getAttribute(CLASSPATH_DIR);
_classpathIncludes=element.getAttribute(CLASSPATH_INCLUDES);
_classpathExcludes=element.getAttribute(CLASSPATH_EXCLUDES);
_classpathPrefix=element.getAttribute(CLASSPATH_PREFIX);
_classpathJ2se14Prefix=element.getAttribute(CLASSPATH_J2SE1_4_PREFIX);
_classpathJ2se15OrLaterPrefix=element.getAttribute(CLASSPATH_J2SE1_5_OR_LATER_PREFIX);
}
}
}
|
protected org.w3c.dom.Document | readDOM(java.lang.String file)readDOM - This method reads in XML into a DOM
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db=dbf.newDocumentBuilder();
return db.parse(new File(file));
|