this.configFile = config.containerConfig;
Collection<ContainerConfig.Container> containers = null;
try {
containers = ContainerConfig.getContainers(configFile);
if (UtilValidate.isEmpty(containers)) {
throw new StartupException("No containers loaded; problem with configuration");
}
} catch (ContainerException e) {
throw new StartupException(e);
}
for (ContainerConfig.Container containerCfg : containers) {
if (this.unloading) {
return;
}
Container tmpContainer = loadContainer(containerCfg, args);
this.loadedContainers.add(tmpContainer);
containerMap.put(containerCfg.name, tmpContainer);
// TODO: Put container-specific code in the container.
// This is only used in case of OFBiz running in Geronimo or WASCE. It allows to use the RMIDispatcher
if (containerCfg.name.equals("rmi-dispatcher") && configFile.equals("limited-containers.xml")) {
try {
ContainerConfig.Container.Property initialCtxProp = containerCfg.getProperty("use-initial-context");
String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value;
if (!useCtx.equalsIgnoreCase("true")) {
//system.setProperty("java.security.policy", "client.policy"); maybe used if needed...
if (System.getSecurityManager() == null) { // needed by WASCE with a client.policy file.
System.setSecurityManager(new java.rmi.RMISecurityManager());
}
tmpContainer.start();
}
} catch (ContainerException e) {
throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
} catch (java.lang.AbstractMethodError e) {
throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
}
}
}
if (this.unloading) {
return;
}
// Get hot-deploy container configuration files
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Enumeration<URL> resources;
try {
resources = loader.getResources("hot-deploy-containers.xml");
while (resources.hasMoreElements() && !this.unloading) {
URL xmlUrl = resources.nextElement();
Debug.logInfo("Loading hot-deploy containers from " + xmlUrl, module);
Collection<ContainerConfig.Container> hotDeployContainers = ContainerConfig.getContainers(xmlUrl);
for (ContainerConfig.Container containerCfg : hotDeployContainers) {
if (this.unloading) {
return;
}
Container tmpContainer = loadContainer(containerCfg, args);
this.loadedContainers.add(tmpContainer);
containerMap.put(containerCfg.name, tmpContainer);
}
}
} catch (Exception e) {
Debug.logError(e, "Could not load hot-deploy-containers.xml", module);
throw new StartupException(e);
}
loaded = true;
}