package nsInProcess; import com.sssw.jbroker.api.naming.NameService; import com.sssw.jbroker.api.naming.AccessPolicy; import com.sssw.jbroker.api.naming.NameServiceFactory; import org.omg.CORBA.ORB; import org.omg.CosNaming.NamingContext; import org.omg.PortableServer.POA; import org.omg.PortableServer.LifespanPolicyValue; import com.sssw.jbroker.api.bootstrap.InitialReferencesService; public class MyNameServer { public static void main(String[] args) { | try { | | // create the ORB | | ORB orb = (ORB) org.omg.CORBA.ORB.init(args, null); | | | | // get the NameService Factory | | NameServiceFactory factory = (NameServiceFactory) orb. | | resolve_initial_references("NameServiceFactory"); | | | | // get the root POA | | POA rootPOA = (POA) orb.resolve_initial_references("RootPOA"); | | | | // create a transient in-process NameService | | NameService nameService = factory.createNameService( | | rootPOA, "ns1", LifespanPolicyValue.TRANSIENT, null, null); | | | | // print the root naming context | | NamingContext rootCtx = nameService.getRootNamingContext(); | | System.out.println(orb.object_to_string(rootCtx)); | | | | // publish root naming context in initial naming | | InitialReferencesService irs = (InitialReferencesService) orb. | | resolve_initial_references("InitialReferencesService"); | | irs.bind("NameService", rootCtx, false); | | | | // wait for invocations | | orb.run(); | | | } catch (Exception ex) { | | ex.printStackTrace(); | } } }
Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.