Search in sources :

Example 11 with RolePath

use of org.cristalise.kernel.lookup.RolePath in project kernel by cristal-ise.

the class StandardServer method resetAgentIORs.

public static void resetAgentIORs(RolePath root) throws ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException {
    Logger.msg("StandardServer.resetAgentIORs() - root:" + root);
    Iterator<Path> roles = Gateway.getLookup().getChildren(root);
    while (roles.hasNext()) {
        RolePath role = (RolePath) roles.next();
        resetAgentIORs(role);
        for (AgentPath agent : Gateway.getLookup().getAgents(role)) {
            Logger.msg("StandardServer.resetAgentIORs() - setting IOR for role:" + role + " agent:" + agent.getAgentName() + " " + agent.getItemPath());
            Gateway.getLookupManager().setIOR(agent.getItemPath(), Gateway.getORB().object_to_string(Gateway.getCorbaServer().getAgentIOR(agent)));
        }
    }
}
Also used : RolePath(org.cristalise.kernel.lookup.RolePath) DomainPath(org.cristalise.kernel.lookup.DomainPath) Path(org.cristalise.kernel.lookup.Path) AgentPath(org.cristalise.kernel.lookup.AgentPath) AgentPath(org.cristalise.kernel.lookup.AgentPath) RolePath(org.cristalise.kernel.lookup.RolePath)

Example 12 with RolePath

use of org.cristalise.kernel.lookup.RolePath in project kernel by cristal-ise.

the class StandardServer method standardInitialisation.

/**
 * Initialise the server
 *
 * @param props initiliased Properties
 * @param res the instantiated ResourceLoader
 * @throws Exception throw whatever happens
 */
public static void standardInitialisation(Properties props, ResourceLoader res) throws Exception {
    isServer = true;
    // read args and init Gateway
    Gateway.init(props, res);
    // connect to LDAP as root
    Gateway.connect();
    // start console
    Logger.initConsole("ItemServer");
    // initialize the server objects
    Gateway.startServer();
    if (Gateway.getProperties().containsKey(AbstractMain.MAIN_ARG_RESETIOR)) {
        Logger.msg(5, "StandardServer.standardInitialisation() - RESETTING IORs");
        resetItemIORs(new DomainPath(""));
        resetAgentIORs(new RolePath());
        AbstractMain.shutdown(0);
    } else {
        // start checking bootstrap & module items
        Bootstrap.run();
    }
    Logger.msg(5, "StandardServer.standardInitialisation() - complete.");
}
Also used : DomainPath(org.cristalise.kernel.lookup.DomainPath) RolePath(org.cristalise.kernel.lookup.RolePath)

Example 13 with RolePath

use of org.cristalise.kernel.lookup.RolePath in project kernel by cristal-ise.

the class CastorXMLTest method testCastorRolePath.

@Test
public void testCastorRolePath() throws Exception {
    CastorXMLUtility marshaller = Gateway.getMarshaller();
    RolePath role = new RolePath("Minion", false);
    RolePath rolePrime = (RolePath) marshaller.unmarshall(marshaller.marshall(role));
    assertEquals(role.getStringPath(), rolePrime.getStringPath());
    assertEquals(role.hasJobList(), rolePrime.hasJobList());
    Logger.msg(marshaller.marshall(rolePrime));
}
Also used : CastorXMLUtility(org.cristalise.kernel.utils.CastorXMLUtility) RolePath(org.cristalise.kernel.lookup.RolePath) MainTest(org.cristalise.kernel.test.process.MainTest) Test(org.junit.Test)

Aggregations

RolePath (org.cristalise.kernel.lookup.RolePath)13 AgentPath (org.cristalise.kernel.lookup.AgentPath)5 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)4 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)4 CannotManageException (org.cristalise.kernel.common.CannotManageException)3 ArrayList (java.util.ArrayList)2 ObjectAlreadyExistsException (org.cristalise.kernel.common.ObjectAlreadyExistsException)2 ObjectCannotBeUpdated (org.cristalise.kernel.common.ObjectCannotBeUpdated)2 ActiveEntity (org.cristalise.kernel.entity.agent.ActiveEntity)2 DomainPath (org.cristalise.kernel.lookup.DomainPath)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 UUID (java.util.UUID)1 AccessRightsException (org.cristalise.kernel.common.AccessRightsException)1 CorbaServer (org.cristalise.kernel.entity.CorbaServer)1 ImportRole (org.cristalise.kernel.entity.imports.ImportRole)1 AgentProxy (org.cristalise.kernel.entity.proxy.AgentProxy)1 InvalidAgentPathException (org.cristalise.kernel.lookup.InvalidAgentPathException)1 InvalidItemPathException (org.cristalise.kernel.lookup.InvalidItemPathException)1