1 package demo.poa_monitor.root_poa; 2 3 import demo.poa_monitor.foox.*; 4 import org.omg.CORBA.ORB ; 5 import org.omg.PortableServer.*; 6 import org.omg.CosNaming.*; 7 import java.io.*; 8 9 public class Server 10 { 11 public static String description = "Root-POA only"; 12 13 public static void main(String [] args) 14 { 15 try 16 { 17 ORB orb = org.omg.CORBA.ORB.init(args, null); 18 POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); 19 POAManager poaMgr = rootPOA.the_POAManager(); 20 21 FooFactoryImpl servant = new FooFactoryImpl(); 22 FooFactory reference = servant._this(orb); 23 24 29 NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); 31 NameComponent [] name = new NameComponent[1]; 32 name[0] = new NameComponent("FooFactory", "service"); 33 nc.bind(name, reference); 34 35 poaMgr.activate(); 36 System.out.println("[ Server ready ]"); 37 orb.run(); 38 39 } 40 catch (Exception e) 41 { 42 e.printStackTrace(); 43 } 44 } 45 } 46 47 48 | Popular Tags |