Package org.omg.PortableServer

Examples of org.omg.PortableServer.POAManager


        // Need to indicate that this ORB can't be destroyed while we are using it
        CorbaBindingHelper.keepORBAlive(location);
       
        try {
            POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager poaManager = rootPOA.the_POAManager();

            try {
                bindingPOA = rootPOA.find_POA("BindingPOA", true);
            } catch (org.omg.PortableServer.POAPackage.AdapterNonExistent ex) {
                // An AdapterNonExistent exception will be thrown if the POA does not exist.  If
                // this is the case, then we'll create one.
                Policy[] policies = new Policy[ orbConfig.isPersistentPoa() ? 3 : 2];
                policies[0] = rootPOA
                .create_id_uniqueness_policy(
                    org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID);
                policies[1] = rootPOA
                        .create_implicit_activation_policy(
                            org.omg.PortableServer.ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION);
                if (orbConfig.isPersistentPoa()) {
                    policies[2] = rootPOA
                        .create_lifespan_policy(org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
                }
                bindingPOA = rootPOA.create_POA("BindingPOA", poaManager, policies);
            }
           
            if (bindingPOA == null) {
                throw new CorbaBindingException("Unable to create CXF CORBA Binding POA");
            }

            CorbaDSIServant servant = new CorbaDSIServant();
            servant.init(orb, bindingPOA, this, incomingObserver, typeMap);
            objectId = bindingPOA.activate_object(servant);
            obj = bindingPOA.id_to_reference(objectId);
           
            if (location.startsWith("relfile:")) {
                URI iorFile = new URI(location.substring(3));
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else if (location.startsWith("file:")) {
                URI uri = new URI(location);
                CorbaUtils.exportObjectReferenceToFile(obj, orb, uri);
            } else if (location.startsWith("corbaloc")) {
                // Try add the key to the boot manager.  This is required for a corbaloc
                addKeyToBootManager(location, obj);
            } else if (location.startsWith("corbaname")) {
                addKeyToNameservice(location, obj);
            } else {
                String ior = orb.object_to_string(obj);
                address.setLocation(ior);
                URI uri = new URI("endpoint.ior");
                CorbaUtils.exportObjectReferenceToFile(obj, orb, uri);
            }
            populateEpr(orb.object_to_string(obj));
            LOG.info("Object Reference: " + orb.object_to_string(obj));
            // TODO: Provide other export mechanisms?
            poaManager.activate();
        } catch (Exception ex) {
            throw new CorbaBindingException("Unable to activate CORBA servant", ex);
        }
    }
View Full Code Here


    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;
    }
View Full Code Here

        orb = getORB(orbArgs, location, props);       
       

        try {
            POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager poaManager = rootPOA.the_POAManager();
            try {
                bindingPOA = rootPOA.find_POA(poaName, false);
            } catch (org.omg.PortableServer.POAPackage.AdapterNonExistent ex) {
                // do nothing
            }

            // When using object references, we can run into a situation where
            // we are implementing
            // multiple instances of the same port type such that we would end
            // up using the same
            // poaname for each when persistance is used. Handle this case by
            // not throwing an
            // exception at this point during the activation, we should see an
            // exception if we try
            // an activate two objects with the same servant ID instead.
            if (bindingPOA != null && !isPersistent && serviceId == null) {
                throw new CorbaBindingException(
                        "Corba Port activation failed because the poa "
                                + poaName + " already exists");
            } else if (bindingPOA == null) {
                bindingPOA = createPOA(poaName, rootPOA, poaManager);
            }
                       
            if (bindingPOA == null) {
                throw new CorbaBindingException("Unable to create CXF CORBA Binding POA");
            }

            CorbaDSIServant servant = new CorbaDSIServant();
            servant.init(orb, bindingPOA, this, incomingObserver, typeMap);
            if (serviceId != null) {
                objectId = serviceId.getBytes();
                try {
                    bindingPOA.activate_object_with_id(objectId, servant);
                } catch (org.omg.PortableServer.POAPackage.ObjectAlreadyActive ex) {
                    if (!isPersistent) {
                        throw new CorbaBindingException("Object "
                                                        + serviceId
                                                        + " already active for non-persistent poa");
                    }
                }
            } else {               
                objectId = bindingPOA.activate_object(servant);
            }
            bindingPOA.set_servant(servant);
            obj = bindingPOA.id_to_reference(objectId);
            orbConfig.exportObjectReference(orb, obj, location, address);
           
            populateEpr(orb.object_to_string(obj));
            LOG.info("Object Reference: " + orb.object_to_string(obj));
            // TODO: Provide other export mechanisms?
            poaManager.activate();
        } catch (Exception ex) {
            throw new CorbaBindingException("Unable to activate CORBA servant", ex);
        }
    }
View Full Code Here

    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;
    }
View Full Code Here

        orb = getORB(orbArgs, location, props);       
       

        try {
            POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager poaManager = rootPOA.the_POAManager();
            try {
                bindingPOA = rootPOA.find_POA(poaName, false);
            } catch (org.omg.PortableServer.POAPackage.AdapterNonExistent ex) {
                // do nothing
            }

            // When using object references, we can run into a situation where
            // we are implementing
            // multiple instances of the same port type such that we would end
            // up using the same
            // poaname for each when persistance is used. Handle this case by
            // not throwing an
            // exception at this point during the activation, we should see an
            // exception if we try
            // an activate two objects with the same servant ID instead.
            if (bindingPOA != null && !isPersistent && serviceId == null) {
                throw new CorbaBindingException(
                        "Corba Port activation failed because the poa "
                                + poaName + " already exists");
            } else if (bindingPOA == null) {
                bindingPOA = createPOA(poaName, rootPOA, poaManager);
            }
                       
            if (bindingPOA == null) {
                throw new CorbaBindingException("Unable to create CXF CORBA Binding POA");
            }

            CorbaDSIServant servant = new CorbaDSIServant();
            servant.init(orb, bindingPOA, this, incomingObserver, typeMap);
            if (serviceId != null) {
                objectId = serviceId.getBytes();
                try {
                    bindingPOA.activate_object_with_id(objectId, servant);
                } catch (org.omg.PortableServer.POAPackage.ObjectAlreadyActive ex) {
                    if (!isPersistent) {
                        throw new CorbaBindingException("Object "
                                                        + serviceId
                                                        + " already active for non-persistent poa");
                    }
                }
            } else {               
                objectId = bindingPOA.activate_object(servant);
            }
            bindingPOA.set_servant(servant);
            obj = bindingPOA.id_to_reference(objectId);
            orbConfig.exportObjectReference(orb, obj, location, address);
           
            populateEpr(orb.object_to_string(obj));
            LOG.info("Object Reference: " + orb.object_to_string(obj));
            // TODO: Provide other export mechanisms?
            poaManager.activate();
        } catch (Exception ex) {
            throw new CorbaBindingException("Unable to activate CORBA servant", ex);
        }
    }
View Full Code Here

        orb = getORB(orbArgs, location, props);       
       

        try {
            POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager poaManager = rootPOA.the_POAManager();
            try {
                bindingPOA = rootPOA.find_POA(poaName, false);
            } catch (org.omg.PortableServer.POAPackage.AdapterNonExistent ex) {
                // do nothing
            }

            // When using object references, we can run into a situation where
            // we are implementing
            // multiple instances of the same port type such that we would end
            // up using the same
            // poaname for each when persistance is used. Handle this case by
            // not throwing an
            // exception at this point during the activation, we should see an
            // exception if we try
            // an activate two objects with the same servant ID instead.
            if (bindingPOA != null && !isPersistent && serviceId == null) {
                throw new CorbaBindingException(
                        "Corba Port activation failed because the poa "
                                + poaName + " already exists");
            } else if (bindingPOA == null) {
                bindingPOA = createPOA(poaName, rootPOA, poaManager);
            }
                       
            if (bindingPOA == null) {
                throw new CorbaBindingException("Unable to create CXF CORBA Binding POA");
            }

            CorbaDSIServant servant = new CorbaDSIServant();
            servant.init(orb, bindingPOA, this, incomingObserver, typeMap);
            if (serviceId != null) {
                objectId = serviceId.getBytes();
                try {
                    bindingPOA.activate_object_with_id(objectId, servant);
                } catch (org.omg.PortableServer.POAPackage.ObjectAlreadyActive ex) {
                    if (!isPersistent) {
                        throw new CorbaBindingException("Object "
                                                        + serviceId
                                                        + " already active for non-persistent poa");
                    }
                }
            } else {               
                objectId = bindingPOA.activate_object(servant);
            }
            bindingPOA.set_servant(servant);
            obj = bindingPOA.id_to_reference(objectId);
            orbConfig.exportObjectReference(orb, obj, location, address);
           
            populateEpr(orb.object_to_string(obj));
            LOG.info("Object Reference: " + orb.object_to_string(obj));
            // TODO: Provide other export mechanisms?
            poaManager.activate();
        } catch (Exception ex) {
            throw new CorbaBindingException("Unable to activate CORBA servant", ex);
        }
    }
View Full Code Here

        try
        {
            org.omg.CORBA.Object poa_obj =
                myorb.resolve_initial_references("RootPOA");
            POA root_poa = POAHelper.narrow(poa_obj);
            POAManager pm = root_poa.the_POAManager();
            SampleImpl servant = new SampleImpl();
            root_poa.activate_object(servant);
            pm.activate();
            myorb.destroy();
        }
        catch(INITIALIZE e)
        {
            // this exception is thrown if IPv6 is not available on the machine
View Full Code Here

        //init POA
        POA poa =
        POAHelper.narrow( orb.resolve_initial_references( "RootPOA" ));

        POAManager poa_manager = poa.the_POAManager();

        // Create a PERSISTENT POA named 'simple_persistent', beneath the root
        //
        org.omg.CORBA.Policy[] policies=new org.omg.CORBA.Policy[4];

        policies[0]=poa.create_lifespan_policy(org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
        policies[1]=poa.create_id_assignment_policy(org.omg.PortableServer.IdAssignmentPolicyValue.USER_ID);
        policies[2]=poa.create_servant_retention_policy(org.omg.PortableServer.ServantRetentionPolicyValue.NON_RETAIN);
        policies[3]=poa.create_request_processing_policy(
            org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER);

        org.omg.PortableServer.POA persistent_poa=
        poa.create_POA("simple_persistent",
                       poa_manager,
                       policies);

        // ServantLocator
        ServantLocatorImpl servantLocatorImpl = new ServantLocatorImpl(persistent_poa, piCurrent);

        // Set servant manager
        persistent_poa.set_servant_manager(servantLocatorImpl);

        // create a TestObjectImpl
        TestObjectImpl testObjectImpl = new TestObjectImpl(orb);
        obj = servantLocatorImpl.registerObject(TestObjectHelper.id(), TestObjectHelper.id(), testObjectImpl);

        poa_manager.activate();

        System.out.println ("SERVER IOR: " + orb.object_to_string(obj));
        System.out.flush();

        // wait for requests
View Full Code Here

        props.put ("jacorb.logfile", getLogFilename("jacorb.log"));
        props.put ("jacorb.log.default.verbosity", "2");

        ORB orb = this.getAnotherORB(props);
        POA rootPOA = POAHelper.narrow(orb.resolve_initial_references( "RootPOA" ));
        POAManager poaManager = rootPOA.the_POAManager();

        poaManager.activate();

        BasicServerImpl servant = new BasicServerImpl();

        rootPOA.activate_object(servant);
View Full Code Here

        ORB orb = ORB.init(args, props);
        POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

        Policy[] policies = new Policy[1];
        policies[0] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
        POAManager poa_manager = rootPOA.the_POAManager();
        POA child = rootPOA.create_POA ("thePOA", poa_manager, policies);

        poa_manager.activate();

        Servant impl = new NIOTestServer();
        child.activate_object_with_id(objID.getBytes(), impl);

        // Manually create a persistent based corbaloc.
View Full Code Here

TOP

Related Classes of org.omg.PortableServer.POAManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.