Search in sources :

Example 11 with Manager

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

the class ACSRemoteAccess method initialize.

/**
	 * Initialize the connection.
	 * 
	 * @param theORB The ORB. 
	 *               If it is null then a new CORBA connection is initialized.
	 * @param manager A reference to the Manager
	 *                If it is null a reference is built by reading the properties.
	 */
public void initialize(ORB theORB, Manager manager) {
    isExternalORB = (theORB != null);
    this.orb = theORB;
    if (orb == null) {
        listenersDispatcher.publishReport("Initializing CORBA...");
        // ORB stanza
        java.util.Properties orbprops = java.lang.System.getProperties();
        orb = ORB.init(new String[0], orbprops);
        // POA stanza -- use RootPOA
        POA rootPOA = null;
        try {
            rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        } catch (org.omg.CORBA.ORBPackage.InvalidName in) {
            throw new IllegalStateException("Cannot resolve RootPOA: " + in);
        }
        POAManager poaManager = rootPOA.the_POAManager();
        try {
            poaManager.activate();
        } catch (Exception e) {
            throw new IllegalStateException("POAManager activation failed." + e);
        }
        // setup ORB profiling
        try {
            if (orb instanceof AcsProfilingORB) {
                AcsORBProfiler profiler = new AcsORBProfilerImplBase(logger);
                ((AcsProfilingORB) orb).registerAcsORBProfiler(profiler);
                logger.finer("Orb profiling set up, using class " + AcsORBProfilerImplBase.class.getName());
            }
        } catch (Throwable th) {
            logger.log(Level.WARNING, "Failed to setup ORB profiling.", th);
        }
        // end of CORBA stanza
        listenersDispatcher.publishReport("CORBA initialized.");
    }
    Manager maciManager = manager;
    if (maciManager == null) {
        maciManager = resolveManagerReference();
        if (maciManager == null) {
            // HSO: Ale, should this not throw an exception?
            return;
        }
    }
    NamingContext namingContext = resolveNamingServiceContext(maciManager);
    if (namingContext == null) {
        return;
    }
    if (!resolveNotifyChannel(LOGGING_XML_CHANNEL, namingContext)) {
        return;
    }
    boolean isConsumerAdminCreated = createConsumerAdmin();
    if (!isConsumerAdminCreated) {
        return;
    }
    isInitialized = createStructuredPushConsumer();
}
Also used : AcsORBProfilerImplBase(alma.acs.profiling.orb.AcsORBProfilerImplBase) POA(org.omg.PortableServer.POA) POAManager(org.omg.PortableServer.POAManager) Manager(si.ijs.maci.Manager) NamingContext(org.omg.CosNaming.NamingContext) AcsORBProfiler(org.jacorb.orb.acs.AcsORBProfiler) POAManager(org.omg.PortableServer.POAManager) AcsProfilingORB(org.jacorb.orb.acs.AcsProfilingORB)

Example 12 with Manager

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

the class ACSRemoteAccess method resolveManagerReference.

private si.ijs.maci.Manager resolveManagerReference() {
    listenersDispatcher.publishReport("Resolving " + MANAGER_PROPERTY + " manager reference...");
    org.omg.CORBA.Object obj = null;
    si.ijs.maci.Manager manager;
    try {
        if (MANAGER_PROPERTY == null)
            throw new IllegalStateException("Manager system property ACS.manager is null.");
        obj = orb.string_to_object(MANAGER_PROPERTY);
        //if (obj == null) throw new IllegalStateException("Could not resolve Manager reference from the ACS.manager system property (" + MANAGER_PROPERTY + ").");
        manager = si.ijs.maci.ManagerHelper.narrow(obj);
    } catch (Exception e) {
        listenersDispatcher.publishReport("Exception occurred when resolving manager reference.");
        System.out.println("Exception in ACSRemoteAccess::resolveManagerReference(): " + e);
        return null;
    }
    listenersDispatcher.publishReport("Manager reference resolved.");
    return manager;
}
Also used : Manager(si.ijs.maci.Manager)

Example 13 with Manager

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

the class BlockingPingClient method resolveManager.

/**
	 * Resolves manager reference.
	 * @return manager reference, <code>null</code> on failure.
	 */
private Manager resolveManager() {
    if (orb == null)
        return null;
    String managerReference = System.getProperty("ACS.manager");
    if (managerReference == null)
        managerReference = "corbaloc::localhost:3000/Manager";
    System.out.println("Resolving manager reference '" + managerReference + "'.");
    try {
        org.omg.CORBA.Object obj = orb.string_to_object(managerReference);
        if (obj == null)
            throw new NullPointerException("'null' reference returned.");
        Manager manager = ManagerHelper.narrow(obj);
        if (manager == null)
            throw new NullPointerException("'null' narrowed reference returned.");
        System.out.println("Manager reference successfully resolved.");
        return manager;
    } catch (Exception ex) {
        ex.printStackTrace();
        System.out.println("Failed to resolve manager reference.");
        return null;
    }
}
Also used : POAManager(org.omg.PortableServer.POAManager) Manager(si.ijs.maci.Manager)

Example 14 with Manager

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

the class BlockingPingClient method execute.

/**
	 * Main  routine.
	 */
public void execute(long sleepTimeMs) {
    initializeCORBA();
    Manager manager = resolveManager();
    if (manager != null) {
        ClientInfo clientInfo = login(manager, sleepTimeMs);
        if (clientInfo != null) {
            System.out.println("All initialization done.");
            run();
            logout(manager, clientInfo);
        }
    }
    finalizeCORBA();
}
Also used : ClientInfo(si.ijs.maci.ClientInfo) POAManager(org.omg.PortableServer.POAManager) Manager(si.ijs.maci.Manager)

Example 15 with Manager

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

the class ManagerDynComponentTest method test.

/**
	 * Main test routine.
	 */
public void test() {
    initializeCORBA();
    Manager manager = resolveManager();
    if (manager != null) {
        ClientInfo clientInfo = login(manager);
        if (clientInfo != null) {
            System.out.println("All initialization done.");
            try {
                /* ------------------------------------------------- */
                manager.restart_component(clientInfo.h, "invalid");
                manager.get_component(clientInfo.h, "MOUNT1", true);
                manager.restart_component(clientInfo.h, "MOUNT1");
                try {
                    manager.get_default_component(clientInfo.h, "invalid");
                    System.err.println("NoDefaultComponent exception expected.");
                } catch (NoDefaultComponentEx nde) {
                // this is OK
                }
                try {
                    manager.get_dynamic_component(clientInfo.h, new ComponentSpec("*", "invalidType", "*", "*"), true);
                    System.err.println("InvalidComponentSpec exception expected.");
                } catch (InvalidComponentSpecEx ics) {
                // this is OK
                }
                /* ------------------------------------------------- */
                ComponentInfo componentInfo = manager.get_dynamic_component(clientInfo.h, new ComponentSpec("FULL_DYNAMIC", "IDL:alma/PS/PowerSupply:1.0", "acsexmplPS", "Container"), true);
                System.out.println(componentInfo.h);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            logout(manager, clientInfo);
        }
    }
    finalizeCORBA();
}
Also used : InvalidComponentSpecEx(alma.maciErrType.InvalidComponentSpecEx) ClientInfo(si.ijs.maci.ClientInfo) ComponentInfo(si.ijs.maci.ComponentInfo) POAManager(org.omg.PortableServer.POAManager) Manager(si.ijs.maci.Manager) ComponentSpec(si.ijs.maci.ComponentSpec) NoDefaultComponentEx(alma.maciErrType.NoDefaultComponentEx)

Aggregations

Manager (si.ijs.maci.Manager)17 POAManager (org.omg.PortableServer.POAManager)11 ClientInfo (si.ijs.maci.ClientInfo)6 ComponentInfo (si.ijs.maci.ComponentInfo)3 ContainerInfo (si.ijs.maci.ContainerInfo)3 CBDescIn (alma.ACS.CBDescIn)2 CompletionHolder (alma.ACSErr.CompletionHolder)2 LoggingConfigurableOperations (alma.Logging.LoggingConfigurableOperations)2 LogPaneNotFoundException (alma.acs.gui.loglevel.LogPaneNotFoundException)2 SwingWorker (javax.swing.SwingWorker)2 ORB (org.omg.CORBA.ORB)2 Monitor (alma.ACS.Monitor)1 MonitorstringSeq (alma.ACS.MonitorstringSeq)1 ROstring (alma.ACS.ROstring)1 ROstringSeq (alma.ACS.ROstringSeq)1 ClientLogManager (alma.acs.logging.ClientLogManager)1 AcsORBProfilerImplBase (alma.acs.profiling.orb.AcsORBProfilerImplBase)1 InvalidComponentSpecEx (alma.maciErrType.InvalidComponentSpecEx)1 NoDefaultComponentEx (alma.maciErrType.NoDefaultComponentEx)1 NoPermissionEx (alma.maciErrType.NoPermissionEx)1