*/
protected void addApplicationInfo(CasProcessorConfiguration aCasProcessorConfiguration,
CpeCasProcessor aCasProcessor) throws ResourceConfigurationException {
try {
if (aCasProcessor instanceof CpeLocalCasProcessor) {
CasProcessorRunInSeperateProcess rip = ((CpeLocalCasProcessor) aCasProcessor)
.getRunInSeperateProcess();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"+++++++++++++++++++++++++++++++++++++++++++++++++");
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"+++++++++++++++++++++++++++++++++++++++++++++++++");
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"Operating System is::::" + System.getProperty("os.name"));
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"+++++++++++++++++++++++++++++++++++++++++++++++++");
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"+++++++++++++++++++++++++++++++++++++++++++++++++");
}
executable = rip.getExecutable().getExecutable();
List<CasProcessorRuntimeEnvParam> descrptrEnvVars = rip.getExecutable().getEnvs();
exec = new Execute();
try {
sysEnvVars = SystemEnvReader.getEnvVars();
if (System.getProperty("DEBUG") != null) {
printSysEnvironment();
}
} catch (Throwable e) {
e.printStackTrace();
}
environment.clear();
boolean pathDone = false;
boolean classpathDone = false;
if (descrptrEnvVars != null) {
// First copy all env vars from the CPE Descriptor treating PATH and CLASSPATH as special
// cases
for (CasProcessorRuntimeEnvParam descrptrEv : descrptrEnvVars) {
String key = descrptrEv.getEnvParamName();
String value = descrptrEv.getEnvParamValue();
// Special Cases for PATH and CLASSPATH
if (key.equalsIgnoreCase("PATH")) {
String path = getSysEnvVarValue(key);
if (path != null) {
environment.add(key + "=" + value + System.getProperty("path.separator") + path);
} else {
environment.add(key + "=" + value + System.getProperty("path.separator"));
}
pathDone = true;
continue;
}
if (key.equalsIgnoreCase("CLASSPATH")) {
String classpath = getSysEnvVarValue(key);
if (classpath != null) {
environment.add(key + "=" + value + System.getProperty("path.separator")
+ classpath);
} else {
environment.add(key + "=" + value + System.getProperty("path.separator"));
}
classpathDone = true;
continue;
}
environment.add(key + "=" + value);
}
}
// Now, copy all env vars from the current environment
if (sysEnvVars != null) {
Enumeration envKeys = sysEnvVars.keys();
while (envKeys.hasMoreElements()) {
String key = (String) envKeys.nextElement();
// Skip those vars that we've already setup above
if ((key.equalsIgnoreCase("PATH") && pathDone) ||
(key.equalsIgnoreCase("CLASSPATH") && classpathDone)) {
continue;
}
environment.add(key + "=" + sysEnvVars.getProperty(key));
}
}
String[] envArray = new String[environment.size()];
environment.toArray(envArray);
exec.setEnvironment(envArray);
CasProcessorExecArg[] args = rip.getExecutable().getAllCasProcessorExecArgs();
for (int i = 0; args != null && i < args.length; i++) {
argList.add(args[i]);
}
}