1 package demo.outparam; 2 3 import org.omg.CosNaming.*; 4 5 public class Server 6 { 7 public static void main( String [] args ) 8 { 9 org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); 10 try 11 { 12 org.omg.PortableServer.POA poa = 13 org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA")); 14 poa.the_POAManager().activate(); 15 org.omg.PortableServer.Servant servant = new serverImpl(); 16 org.omg.CORBA.Object o = poa.servant_to_reference(servant ); 17 18 NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); 20 NameComponent [] name = new NameComponent[]{ new NameComponent( "ParamServer", "service")}; 21 nc.rebind(name, o); 22 } 23 catch ( Exception e ) 24 { 25 e.printStackTrace(); 26 } 27 orb.run(); 28 } 29 } 30 | Popular Tags |