Search in sources :

Example 6 with ItemProxy

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());
        }
    }
}
Also used : DomainPath(org.cristalise.kernel.lookup.DomainPath) ItemProxy(org.cristalise.kernel.entity.proxy.ItemProxy) ScriptingEngineException(org.cristalise.kernel.scripting.ScriptingEngineException) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) ScriptingEngineException(org.cristalise.kernel.scripting.ScriptingEngineException)

Aggregations

ItemProxy (org.cristalise.kernel.entity.proxy.ItemProxy)6 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)5 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)3 DomainPath (org.cristalise.kernel.lookup.DomainPath)3 ItemPath (org.cristalise.kernel.lookup.ItemPath)2 LookupManager (org.cristalise.kernel.lookup.LookupManager)2 CollectionArrayList (org.cristalise.kernel.collection.CollectionArrayList)1 CollectionMember (org.cristalise.kernel.collection.CollectionMember)1 CompositeActivityDef (org.cristalise.kernel.lifecycle.CompositeActivityDef)1 CompositeActivity (org.cristalise.kernel.lifecycle.instance.CompositeActivity)1 Outcome (org.cristalise.kernel.persistency.outcome.Outcome)1 Viewpoint (org.cristalise.kernel.persistency.outcome.Viewpoint)1 ResourceImportHandler (org.cristalise.kernel.process.resource.ResourceImportHandler)1 Property (org.cristalise.kernel.property.Property)1 PropertyArrayList (org.cristalise.kernel.property.PropertyArrayList)1 PropertyDescription (org.cristalise.kernel.property.PropertyDescription)1 PropertyDescriptionList (org.cristalise.kernel.property.PropertyDescriptionList)1 ScriptingEngineException (org.cristalise.kernel.scripting.ScriptingEngineException)1