/* Usage: jaco -classpath ./classes -DOAIAddr=127.0.0.1 -DOAPort=1060 server You need to specify the address and port properties before the name of the class (server) you want to run, otherwise the properties are ignored. Or you can set the properties in the jacorb.properties file. IOR is dumped in unreadable format but you can copy and paste it onto command line for "dior" command and you'll see a nice representation with host port and object key indicated. The url for the client to use is: "corbaloc::127.0.0.1:1060/StandardImplName/helloPOA/terriImpl" I guess StandardImplName is the root POA name? Specified in jacorb.properties. */ import java.io.*; import org.omg.CORBA.*; import org.omg.PortableServer.*; // TODO: some objectKeyMap thing? public class server { static public void main(String args[]) throws UserException, FileNotFoundException { System.out.println("calling orb init"); ORB orb = ORB.init(args, null); POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); // create a persistent, single threaded poa with user assigned id policy. POA poa = PoaUtil.create_basic_POA(rootPOA, rootPOA.the_POAManager(), "helloPOA", false, true); rootPOA.the_POAManager().activate(); String name1 = new String("terriImpl"); byte[] oid1 = name1.getBytes(); HelloImpl impl1 = new HelloImpl(name1); poa.activate_object_with_id(oid1, impl1); org.omg.CORBA.Object obj1 = poa.id_to_reference(oid1); System.out.println(orb.object_to_string(obj1)); //PrintWriter ps = new PrintWriter(new FileOutputStream(new File("iorfile1.txt")), true); //ps.println(orb.object_to_string(obj1)); String name2 = new String("berryImpl"); byte[] oid2 = name2.getBytes(); HelloImpl impl2 = new HelloImpl(name2); poa.activate_object_with_id(oid2, impl2); org.omg.CORBA.Object obj2 = poa.id_to_reference(oid2); System.out.println(orb.object_to_string(obj2)); //ps = new PrintWriter(new FileOutputStream(new File("iorfile2.txt")), true); //ps.println(orb.object_to_string(obj2)); orb.run(); } }; class HelloImpl extends helloPOA { String m_id; public HelloImpl(String id) { m_id = id; } public void say_hello(java.lang.String name) { System.out.println(m_id + " says hello to" + name); } };