Search in sources :

Example 1 with AdministratorPOATie

use of si.ijs.maci.AdministratorPOATie in project ACS by ACS-Community.

the class ContainerTestUtil method loginToManager.

public void loginToManager() throws AcsJContainerEx {
    if (adminProxy == null) {
        AdministratorPOATie adminpoa = new AdministratorPOATie(new ManagerAdminClient(containerServices.getName(), logger));
        Administrator adminCorbaObj = adminpoa._this(containerServices.getAdvancedContainerServices().getORB());
        adminProxy = managerProxy.createInstance();
        adminProxy.loginToManager(adminCorbaObj, 1);
        int adminManagerHandle = adminProxy.getManagerHandle();
        Assert.assertTrue(adminManagerHandle > 0);
    }
}
Also used : Administrator(si.ijs.maci.Administrator) AdministratorPOATie(si.ijs.maci.AdministratorPOATie)

Example 2 with AdministratorPOATie

use of si.ijs.maci.AdministratorPOATie in project ACS by ACS-Community.

the class ContainerUtil method loginToManager.

/////////////////////////////////////////////////////////////////////
// Manager login 
/////////////////////////////////////////////////////////////////////
public void loginToManager() throws AcsJContainerEx {
    if (!loggedInToManager) {
        managerAdminClient = new ManagerAdminClient(containerServices.getName(), logger);
        AdministratorPOATie adminpoa = new AdministratorPOATie(managerAdminClient);
        Administrator adminCorbaObj = adminpoa._this(orb);
        adminProxy.loginToManager(adminCorbaObj, 1);
        int adminManagerHandle = adminProxy.getManagerHandle();
        Assert.assertTrue(adminManagerHandle > 0);
        loggedInToManager = true;
    }
}
Also used : Administrator(si.ijs.maci.Administrator) AdministratorPOATie(si.ijs.maci.AdministratorPOATie)

Example 3 with AdministratorPOATie

use of si.ijs.maci.AdministratorPOATie in project ACS by ACS-Community.

the class ContainerTestUtil method loginToManager.

public void loginToManager() throws AcsJContainerEx {
    if (adminProxy == null) {
        AdministratorPOATie adminpoa = new AdministratorPOATie(new ManagerAdminClient(containerServices.getName(), logger));
        Administrator adminCorbaObj = adminpoa._this(containerServices.getAdvancedContainerServices().getORB());
        adminProxy = managerProxy.createInstance();
        adminProxy.loginToManager(adminCorbaObj, 1);
        int adminManagerHandle = adminProxy.getManagerHandle();
        Assert.assertTrue(adminManagerHandle > 0);
    }
}
Also used : Administrator(si.ijs.maci.Administrator) AdministratorPOATie(si.ijs.maci.AdministratorPOATie)

Example 4 with AdministratorPOATie

use of si.ijs.maci.AdministratorPOATie in project ACS by ACS-Community.

the class AdvancedContainerServicesImpl method connectManagerAdmin.

/**
	 * Allows to connect a manager admin object to the manager, to receive notifications etc.
	 * <p>
	 * This method accepts and distinguishes <code>AdministratorOperations</code> objects and the subtyped
	 * {@link SynchronousAdministratorOperations} objects.
	 * <p>
	 * TODO: (1) container could implement a single proxy/interceptor admin client so that we only have at most one such
	 *          login on the manager, even if many components register their admin clients. 
	 *       (2) Discuss if the <code>retryConnectOnFailure</code> flag makes sense, or if such a specialized component that uses this method
	 *          should implement its own retry strategy and should rather be notified quickly if there are problems.
	 * 
	 * @param adminOp
	 *            admin object for manager callbacks.
	 * @param retryConnectOnFailure
	 *            retry if the manager is not available or the connection failed.
	 * @throws AcsJContainerEx
	 * @throws IllegalArgumentException
	 *             if adminOp == <code>null</code>.
	 */
public void connectManagerAdmin(AdministratorOperations adminOp, boolean retryConnectOnFailure) throws AcsJContainerEx {
    if (adminOp == null) {
        throw new IllegalArgumentException("adminOp == null not allowed.");
    }
    synchronized (adminClientsToManagerProxy) {
        if (adminClientsToManagerProxy.containsKey(adminOp)) {
            logger.info("Attempt to connect manager admin of type " + adminOp.getClass().getName() + " again will be ignored.");
            return;
        }
        // need to create our own manager proxy
        AcsManagerProxy acsManagerProxy = this.containerServicesImpl.m_acsManagerProxy.createInstance();
        // for CORBA activation we cannot use polymorphism, but have to choose the correct poa skeleton class.
        // The use of "instanceof" is certainly unsatisfying, but saves us from exposing a specialized second method
        // in the
        // AdvancedContainerServices interface.
        Administrator admin = null;
        if (adminOp instanceof SynchronousAdministratorOperations) {
            SynchronousAdministratorPOATie adminpoa = new SynchronousAdministratorPOATie((SynchronousAdministratorOperations) adminOp);
            admin = adminpoa._this(getORB());
        } else {
            AdministratorPOATie adminpoa = new AdministratorPOATie(adminOp);
            admin = adminpoa._this(getORB());
        }
        int attempts = (retryConnectOnFailure) ? 0 : 1;
        acsManagerProxy.loginToManager(admin, attempts);
        adminClientsToManagerProxy.put(adminOp, acsManagerProxy);
    }
}
Also used : Administrator(si.ijs.maci.Administrator) AdministratorPOATie(si.ijs.maci.AdministratorPOATie) SynchronousAdministratorPOATie(si.ijs.maci.SynchronousAdministratorPOATie) SynchronousAdministratorOperations(si.ijs.maci.SynchronousAdministratorOperations) SynchronousAdministratorPOATie(si.ijs.maci.SynchronousAdministratorPOATie)

Aggregations

Administrator (si.ijs.maci.Administrator)4 AdministratorPOATie (si.ijs.maci.AdministratorPOATie)4 SynchronousAdministratorOperations (si.ijs.maci.SynchronousAdministratorOperations)1 SynchronousAdministratorPOATie (si.ijs.maci.SynchronousAdministratorPOATie)1