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;
}
}
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.");
}
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.");
}
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.");
}
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);
}
Aggregations