use of org.cristalise.kernel.process.module.ModuleManager in project kernel by cristal-ise.
the class Gateway method init.
/**
* Initialises the Gateway and all of the client objects it holds, with
* the exception of the Lookup, which is initialised during connect()
*
* @param props - java.util.Properties containing all application properties.
* If null, the java system properties are used
* @param res - ResourceLoader for the kernel to use to resolve all class resource requests
* such as for bootstrap descriptions and version information
* @throws InvalidDataException - invalid properties caused a failure in initialisation
*/
public static void init(Properties props, ResourceLoader res) throws InvalidDataException {
// Init properties & resources
mC2KProps.clear();
orbDestroyed = false;
mResource = res;
if (mResource == null)
mResource = new Resource();
// report version info
Logger.msg("Gateway.init() - Kernel version: " + getKernelVersion());
// the application to be able to configure castor
try {
mMarshaller = new CastorXMLUtility(mResource, props, mResource.getKernelResourceURL("mapFiles/"));
} catch (MalformedURLException e1) {
throw new InvalidDataException("Invalid Resource Location");
}
Properties allModuleProperties;
// init module manager
try {
mModules = new ModuleManager(AbstractMain.isServer);
allModuleProperties = mModules.loadModules(mResource.getModuleDefURLs());
} catch (Exception e) {
Logger.error(e);
throw new InvalidDataException("Could not load module definitions.");
}
// merge in module props
for (Enumeration<?> e = allModuleProperties.propertyNames(); e.hasMoreElements(); ) {
String propName = (String) e.nextElement();
mC2KProps.put(propName, allModuleProperties.get(propName));
}
// Overwrite with argument props
if (props != null)
mC2KProps.putAll(props);
// dump properties
Logger.msg("Gateway.init() - DONE");
dumpC2KProps(7);
}
Aggregations