1 package org.omg.mof.Model; 2 3 import org.omg.CosNaming.*; 4 import org.omg.CORBA.*; 5 import org.omg.PortableServer.*; 6 import org.omg.PortableServer.POA ; 7 8 public class Server { 9 10 public static void main(String args[]) { 11 try { 12 ORB orb = ORB.init(args, null); 14 15 POA rootpoa = 17 POAHelper.narrow(orb.resolve_initial_references("RootPOA")); 18 rootpoa.the_POAManager().activate(); 19 20 org.omg.mof.Model.ModelPackageFactoryImpl _model_package_factory = 22 new org.omg.mof.Model.ModelPackageFactoryImpl(); 23 24 org.omg.CORBA.Object ref = 26 rootpoa.servant_to_reference(_model_package_factory); 27 org.omg.mof.Model.ModelPackageFactory href = 28 org.omg.mof.Model.ModelPackageFactoryHelper.narrow(ref); 29 30 org.omg.CORBA.Object objRef = 33 orb.resolve_initial_references("NameService"); 34 NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); 37 38 String name = "ModFactServer"; 40 NameComponent path[] = ncRef.to_name(name); 41 ncRef.rebind(path, href); 42 43 System.out.println("Hello: Server is ready and waiting ..."); 44 45 orb.run(); 47 } catch (Exception e) { 48 System.err.println("ERROR: " + e); 49 e.printStackTrace(System.out); 50 } 51 52 System.out.println("HelloServer Exiting ..."); 53 54 } 55 } | Popular Tags |