| 1 package Map; 2 3 5 import java.io.*; 6 import org.omg.PortableServer.*; 7 import org.omg.CosNaming.*; 8 9 public class Server 10 { 11 12 public static void main(String [] args) 13 throws Exception 14 { 15 org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( args , null ); 17 18 POA rootPoa = POAHelper.narrow( orb.resolve_initial_references("RootPOA")); 20 rootPoa.the_POAManager().activate(); 21 22 org.omg.CORBA.Policy [] policies = { 24 rootPoa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT) 25 }; 26 27 POA serverPoa = 29 rootPoa.create_POA("serverPoa", rootPoa.the_POAManager(), policies ); 30 31 PointManagerImpl pointManager = 32 new PointManagerImpl("PointManager1", true); 33 34 byte [] oid = serverPoa.activate_object(pointManager); 36 org.omg.CORBA.Object o = serverPoa.id_to_reference( oid ); 37 38 40 NamingContextExt nc = 41 NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); 42 nc.bind( nc.to_name("PointManager1.example"), o); 43 44 System.out.println("PointManager is ready."); 45 46 orb.run(); 48 49 } 50 51 } 52 53 | Popular Tags |