Search in sources :

Example 6 with Administrator

use of si.ijs.maci.Administrator 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 7 with Administrator

use of si.ijs.maci.Administrator 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 8 with Administrator

use of si.ijs.maci.Administrator 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)8 AdministratorPOATie (si.ijs.maci.AdministratorPOATie)4 SystemException (org.omg.CORBA.SystemException)3 NotConnectedToManagerException (alma.acs.commandcenter.meta.IMaciSupervisor.NotConnectedToManagerException)1 LogRecord (java.util.logging.LogRecord)1 Logger (java.util.logging.Logger)1 ORB (org.omg.CORBA.ORB)1 ClientInfo (si.ijs.maci.ClientInfo)1 ComponentInfo (si.ijs.maci.ComponentInfo)1 ContainerInfo (si.ijs.maci.ContainerInfo)1 Manager (si.ijs.maci.Manager)1 SynchronousAdministratorOperations (si.ijs.maci.SynchronousAdministratorOperations)1 SynchronousAdministratorPOATie (si.ijs.maci.SynchronousAdministratorPOATie)1