Search in sources :

Example 1 with POAManager

use of org.omg.PortableServer.POAManager in project ACS by ACS-Community.

the class PropertyDoubleTest method initCORBA.

/**
	 * Initialize CORBA.
	 */
private void initCORBA() throws Exception {
    orb = ORB.init(new String[0], System.getProperties());
    // POA stanza, use rootPOA
    try {
        // resolve RootPOA
        rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        // activate POA
        POAManager manager = rootPOA.the_POAManager();
        manager.activate();
        // spawn ORB thread	
        new Thread(new Runnable() {

            public void run() {
                orb.run();
            }
        }, "CORBA").start();
    } catch (Exception e) {
        throw e;
    }
}
Also used : POAManager(org.omg.PortableServer.POAManager)

Example 2 with POAManager

use of org.omg.PortableServer.POAManager in project ACS by ACS-Community.

the class SimpleMasterComponentTest method initializeCORBA.

/**
	 * Initializes CORBA.
	 */
private void initializeCORBA() {
    System.out.println("Initializing CORBA...");
    // ORB stanza
    java.util.Properties orbprops = java.lang.System.getProperties();
    // to make code completely independed, properties have to be set using JVM -D mechanism
    // ORBacus
    //orbprops.put("org.omg.CORBA.ORBClass", "com.ooc.CORBA.ORB");
    //orbprops.put("org.omg.CORBA.ORBSingletonClass", "com.ooc.CORBA.ORBSingleton");
    // JacORB
    //orbprops.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
    //orbprops.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
    // Java JDK (none)
    orb = org.omg.CORBA.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 manager = rootPOA.the_POAManager();
    try {
        // activate POA
        manager.activate();
        // start CORBA event-handler thread 
        orbThread = new Thread(this);
        orbThread.start();
    } catch (Exception e) {
        throw new IllegalStateException("POAManager activation failed: " + e);
    }
    System.out.println("CORBA initialized.");
}
Also used : CBstringSeqPOA(alma.ACS.CBstringSeqPOA) POA(org.omg.PortableServer.POA) ClientPOA(si.ijs.maci.ClientPOA) POAManager(org.omg.PortableServer.POAManager)

Example 3 with POAManager

use of org.omg.PortableServer.POAManager in project ACS by ACS-Community.

the class BuildingTest method initializeCORBA.

/**
	 * Initializes CORBA.
	 */
private void initializeCORBA() {
    System.out.println("Initializing CORBA...");
    // ORB stanza
    java.util.Properties orbprops = java.lang.System.getProperties();
    // to make code completely independed, properties have to be set using JVM -D mechanism
    // ORBacus
    //orbprops.put("org.omg.CORBA.ORBClass", "com.ooc.CORBA.ORB");
    //orbprops.put("org.omg.CORBA.ORBSingletonClass", "com.ooc.CORBA.ORBSingleton");
    // JacORB
    //orbprops.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
    //orbprops.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
    // Java JDK (none)
    orb = org.omg.CORBA.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 manager = rootPOA.the_POAManager();
    try {
        // activate POA
        manager.activate();
        // start CORBA event-handler thread 
        orbThread = new Thread(this);
        orbThread.start();
    } catch (Exception e) {
        throw new IllegalStateException("POAManager activation failed: " + e);
    }
    System.out.println("CORBA initialized.");
}
Also used : CBstringPOA(alma.ACS.CBstringPOA) POA(org.omg.PortableServer.POA) ClientPOA(si.ijs.maci.ClientPOA) POAManager(org.omg.PortableServer.POAManager)

Example 4 with POAManager

use of org.omg.PortableServer.POAManager in project ACS by ACS-Community.

the class DumpManagerState method initializeCORBA.

/**
	 * Initializes CORBA.
	 */
private void initializeCORBA() {
    System.out.println("Initializing CORBA...");
    // ORB stanza
    java.util.Properties orbprops = java.lang.System.getProperties();
    // to make code completely independed, properties have to be set using JVM -D mechanism
    // ORBacus
    //orbprops.put("org.omg.CORBA.ORBClass", "com.ooc.CORBA.ORB");
    //orbprops.put("org.omg.CORBA.ORBSingletonClass", "com.ooc.CORBA.ORBSingleton");
    // JacORB
    //orbprops.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
    //orbprops.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
    // Java JDK (none)
    orb = org.omg.CORBA.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 manager = rootPOA.the_POAManager();
    try {
        // activate POA
        manager.activate();
        // start CORBA event-handler thread 
        orbThread = new Thread(this);
        orbThread.start();
    } catch (Exception e) {
        throw new IllegalStateException("POAManager activation failed: " + e);
    }
    System.out.println("CORBA initialized.");
}
Also used : POA(org.omg.PortableServer.POA) AdministratorPOA(si.ijs.maci.AdministratorPOA) POAManager(org.omg.PortableServer.POAManager)

Example 5 with POAManager

use of org.omg.PortableServer.POAManager in project ACS by ACS-Community.

the class ManagerImplSerializationTest method testContainerDie.

public void testContainerDie() throws Throwable {
    // should be something else then deafault because
    // the default is in use by the Manager
    Properties table = new Properties();
    table.put("OAPort", "12121");
    // new ORB instance
    ORB ourOrb = ORB.init(new String[0], table);
    try {
        POA rootPOA = POAHelper.narrow(ourOrb.resolve_initial_references("RootPOA"));
        // activate POA
        POAManager manager = rootPOA.the_POAManager();
        manager.activate();
    } catch (Exception e) {
        e.printStackTrace();
    }
    ContainerProxyImpl activator = new ContainerProxyImpl(clientName);
    si.ijs.maci.ClientInfo clientInfo = manager.login(activator._this(ourOrb));
    if (clientInfo == null || clientInfo.h == 0)
        fail("Unable to login to manager");
    // just destroy its ORB
    ourOrb.shutdown(true);
    // get object as it is stored in recovery store
    ManagerImpl newManager = (ManagerImpl) deserializeManager(new ManagerImpl());
    HandleDataStore activators = newManager.getContainers();
    // the client now is still in stored data
    assertEquals(activators.first(), 1);
    newManager.initialize(null, null, null, null, null);
    // now wait for timer task to remove client
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
        fail();
    }
    // since the client died the menager automaticaly log it out    
    activators = newManager.getClients();
    // not any more
    assertEquals(activators.first(), 0);
}
Also used : POA(org.omg.PortableServer.POA) POAManager(org.omg.PortableServer.POAManager) ManagerImpl(com.cosylab.acs.maci.manager.ManagerImpl) HandleDataStore(com.cosylab.acs.maci.manager.HandleDataStore) Properties(java.util.Properties) ORB(org.omg.CORBA.ORB)

Aggregations

POAManager (org.omg.PortableServer.POAManager)18 POA (org.omg.PortableServer.POA)12 Properties (java.util.Properties)5 ClientPOA (si.ijs.maci.ClientPOA)5 ORB (org.omg.CORBA.ORB)3 HandleDataStore (com.cosylab.acs.maci.manager.HandleDataStore)2 ManagerImpl (com.cosylab.acs.maci.manager.ManagerImpl)2 CBstringPOA (alma.ACS.CBstringPOA)1 CBstringSeqPOA (alma.ACS.CBstringSeqPOA)1 AcsJException (alma.acs.exceptions.AcsJException)1 AcsORBProfilerImplBase (alma.acs.profiling.orb.AcsORBProfilerImplBase)1 StopWatch (alma.acs.util.StopWatch)1 ClientProxyImpl (com.cosylab.acs.maci.plug.ClientProxyImpl)1 IOException (java.io.IOException)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 CorbaDSIServant (org.apache.cxf.binding.corba.runtime.CorbaDSIServant)1 AcsORBProfiler (org.jacorb.orb.acs.AcsORBProfiler)1 AcsProfilingORB (org.jacorb.orb.acs.AcsProfilingORB)1