use of org.omg.CosNaming.NameComponent in project cxf by apache.
the class Server method run.
static int run(ORB orb, String[] args) throws UserException {
// Resolve Root POA
POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
// Get a reference to the POA manager
POAManager manager = poa.the_POAManager();
// Create implementation object
HelloWorldImpl hwImpl = new HelloWorldImpl(poa);
byte[] oid = "HelloWorld".getBytes();
poa.activate_object_with_id(oid, hwImpl);
org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, HelloWorldHelper.id());
// Register in NameService
org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
NameComponent[] nc = rootContext.to_name("HelloWorld");
rootContext.rebind(nc, ref);
// Run implementation
manager.activate();
System.out.println("Server ready...");
orb.run();
return 0;
}
use of org.omg.CosNaming.NameComponent in project Payara by payara.
the class POAProtocolMgr method initializeRemoteNaming.
@Override
public void initializeRemoteNaming(Remote remoteNamingProvider) throws Exception {
try {
org.omg.CORBA.Object provider = getRemoteNamingReference(remoteNamingProvider);
// put object in NameService
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
// XXX use constant for SerialContextProvider name
NameComponent nc = new NameComponent("SerialContextProvider", "");
NameComponent[] path = { nc };
ncRef.rebind(path, provider);
} catch (Exception ex) {
_logger.log(Level.SEVERE, "enterprise_naming.excep_in_insertserialcontextprovider", ex);
RemoteException re = new RemoteException("initSerialCtxProvider error", ex);
throw re;
}
}
Aggregations