Search in sources :

Example 36 with NameComponent

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;
}
Also used : POA(org.omg.PortableServer.POA) POAManager(org.omg.PortableServer.POAManager) NameComponent(org.omg.CosNaming.NameComponent) NamingContextExt(org.omg.CosNaming.NamingContextExt)

Example 37 with NameComponent

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;
    }
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) NamingContext(org.omg.CosNaming.NamingContext) RemoteException(java.rmi.RemoteException) TransactionRequiredLocalException(javax.ejb.TransactionRequiredLocalException) TransactionRolledbackLocalException(javax.ejb.TransactionRolledbackLocalException) RemoteException(java.rmi.RemoteException) NoSuchObjectLocalException(javax.ejb.NoSuchObjectLocalException)

Aggregations

NameComponent (org.omg.CosNaming.NameComponent)37 NamingContext (org.omg.CosNaming.NamingContext)13 NotFound (org.omg.CosNaming.NamingContextPackage.NotFound)10 InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)9 CannotProceed (org.omg.CosNaming.NamingContextPackage.CannotProceed)8 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)3 NamingException (javax.naming.NamingException)3 NamingContextExt (org.omg.CosNaming.NamingContextExt)3 POA (org.omg.PortableServer.POA)3 AcsJUnexpectedExceptionEx (alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx)2 EventChannel (gov.sandia.NotifyMonitoringExt.EventChannel)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 Properties (java.util.Properties)2 CannotProceedException (javax.naming.CannotProceedException)2 Name (javax.naming.Name)2 NameNotFoundException (javax.naming.NameNotFoundException)2 ORB (org.omg.CORBA.ORB)2 Object (org.omg.CORBA.Object)2 AlreadyBound (org.omg.CosNaming.NamingContextPackage.AlreadyBound)2