use of org.cristalise.kernel.entity.proxy.ItemProxy in project kernel by cristal-ise.
the class ModuleManager method registerModules.
public void registerModules() throws ModuleException {
ItemProxy serverItem;
try {
serverItem = Gateway.getProxyManager().getProxy(new DomainPath("/servers/" + Gateway.getProperties().getString("ItemServer.name")));
} catch (ObjectNotFoundException e) {
throw new ModuleException("Cannot find local server name.");
}
Logger.msg(3, "ModuleManager.registerModules() - Registering modules");
boolean reset = Gateway.getProperties().getBoolean("Module.reset", false);
for (Module thisMod : modules) {
if (Bootstrap.shutdown)
return;
Logger.msg("ModuleManager.registerModules() - Registering module " + thisMod.getName());
try {
String thisResetKey = "Module." + thisMod.getNamespace() + ".reset";
boolean thisReset = reset;
if (Gateway.getProperties().containsKey(thisResetKey)) {
thisReset = Gateway.getProperties().getBoolean(thisResetKey);
}
thisMod.setModuleXML(modulesXML.get(thisMod.getNamespace()));
thisMod.importAll(serverItem, agent, thisReset);
} catch (Exception e) {
Logger.error(e);
throw new ModuleException("Error importing items for module " + thisMod.getName());
}
Logger.msg("ModuleManager.registerModules() - Module " + thisMod.getName() + " registered");
try {
thisMod.runScript("startup", agent, true);
} catch (ScriptingEngineException e) {
Logger.error(e);
throw new ModuleException("Error in startup script for module " + thisMod.getName());
}
}
}
Aggregations