Package org.omg.PortableServer

Examples of org.omg.PortableServer.POAManager


    java.util.Properties props = System.getProperties();

    ORB orb = ORB.init(new String[ 0 ], props);

    POA root = TestUtil.GetRootPOA(orb);
    POAManager manager = root.the_POAManager();
    try
      {
        manager.activate();
      }
    catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
View Full Code Here


      org.omg.CORBA.Object obj = orb_.resolve_initial_references( "RootPOA" );           
            rootPOA_ = org.omg.PortableServer.POAHelper.narrow( obj );
            if (rootPOA_ == null) return false;
           
            //activate the POA manager
            POAManager poaMgr = rootPOA_.the_POAManager();
            poaMgr.activate();
           
            //create persistent POA
      Policy policies[] = new Policy[2];
      policies[0] = rootPOA_.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
      policies[1] = rootPOA_.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
View Full Code Here

            throw wrapper.getDelegateWrongPolicy( wp ) ;
        }

        // Make sure that the POAManager is activated if no other
        // POAManager state management has taken place.
        POAManager mgr = poa.the_POAManager() ;
        if (mgr instanceof POAManagerImpl) {
            POAManagerImpl mgrImpl = (POAManagerImpl)mgr ;
            mgrImpl.implicitActivation() ;
        }
View Full Code Here

      throw wrapper.getDelegateWrongPolicy( wp ) ;
  }

  // Make sure that the POAManager is activated if no other
  // POAManager state management has taken place.
  POAManager mgr = poa.the_POAManager() ;
  if (mgr instanceof POAManagerImpl) {
      POAManagerImpl mgrImpl = (POAManagerImpl)mgr ;
      mgrImpl.implicitActivation() ;
  }
View Full Code Here

        }

        org.omg.CORBA.Object obj = null;
        try {
            POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager poaManager = rootPOA.the_POAManager();

            Policy[] policies = new Policy[3];
            policies[0] = rootPOA
                    .create_lifespan_policy(
                        org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
            policies[1] = rootPOA
                    .create_implicit_activation_policy(
                        org.omg.PortableServer.ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION);
            policies[2] = rootPOA
                    .create_id_uniqueness_policy(
                        org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID);

            POA bindingPOA = rootPOA.create_POA("BindingPOA", poaManager, policies);
            CorbaDSIServant servant = new CorbaDSIServant(orb, bindingPOA, this, sbeCallback);
            byte[] objectId = bindingPOA.activate_object(servant);
            obj = bindingPOA.id_to_reference(objectId);
           
            if (location.startsWith("relfile:")) {
                String iorFile = location.substring("relfile:".length(), location.length());
                // allow for up to 3 '/' to match common uses of relfile url format
                for (int n = 0; n < 3; n++) {
                    if (iorFile.charAt(0) != '/') {
                        break;
                    } else {
                        iorFile = iorFile.substring(1);
                    }
                }

                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else if (location.startsWith("file:")) {
                String iorFile = location.substring("file:".length(), location.length());
                // allow for up to 3 '/' to match common uses of file url format
                for (int n = 0; n < 3; n++) {
                    if (iorFile.charAt(0) != '/') {
                        break;
                    } else {
                        iorFile = iorFile.substring(1);
                    }
                }
                // to match the ORB, file must have complete path information, therefore we add
                // a '/' prefix to the address
                //iorFile = "/" + iorFile;
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else if (location.startsWith("corbaloc")) {
                // Try add the key to the boot manager.  This is required for a corbaloc
                try {
                    int keyIndex = location.indexOf('/');
                    String key = location.substring(keyIndex + 1);
                    org.apache.yoko.orb.OB.BootManager bootManager =
                        org.apache.yoko.orb.OB.BootManagerHelper.narrow(
                            orb.resolve_initial_references("BootManager"));
                    bootManager.add_binding(key.getBytes(), obj);
                    LOG.info("Added key " + key + " to bootmanager");
                } catch (Exception ex) {
                    // TODO: Continue without for now
                }
                String ior = orb.object_to_string(obj);
                address.setLocation(ior);
                String iorFile = "endpoint.ior";
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else {
                String ior = orb.object_to_string(obj);
                address.setLocation(ior);
                String iorFile = "endpoint.ior";
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
                LOG.info("Object Reference: " + orb.object_to_string(obj));
            }
            // TODO: Provide other export mechanisms?
           
            poaManager.activate();
        } catch (Exception ex) {
            // TODO: Throw appropriate exception
            throw new CorbaBindingException("Unable to active CORBA servant", ex);
        }
    }
View Full Code Here

    static int run(ORB orb, String[] args) throws UserException {
        // Resolve Root POA
        POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

        // Get a reference to the POA manager
        POAManager manager = rootPOA.the_POAManager();

        // Create implementation object
        HelloWorldImpl hwImpl = new HelloWorldImpl(rootPOA);
        HelloWorld hello = hwImpl._this(orb);

        // Add reference to the boot manager
        try {
            byte[] oid = ("hw").getBytes();
            BootManager bootManager = BootManagerHelper.narrow(
                orb.resolve_initial_references("BootManager"));
            bootManager.add_binding(oid, hello);
        } catch (InvalidName ex) {
            throw new RuntimeException();
        } catch (AlreadyExists ex) {
            throw new RuntimeException();
        }

        // Run implementation
        manager.activate();
        System.out.println("Server ready...");
        orb.run();

        return 0;
    }
View Full Code Here

            throw wrapper.getDelegateWrongPolicy( wp ) ;
        }

        // Make sure that the POAManager is activated if no other
        // POAManager state management has taken place.
        POAManager mgr = poa.the_POAManager() ;
        if (mgr instanceof POAManagerImpl) {
            POAManagerImpl mgrImpl = (POAManagerImpl)mgr ;
            mgrImpl.implicitActivation() ;
        }
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

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

        //
        // Get a reference to the POA manager
        //
        POAManager manager = poa.the_POAManager();

        //
        // Create implementation object
        //
        BankImpl bankImpl = new BankImpl(poa);

        byte[] oid = "Bank".getBytes();
        poa.activate_object_with_id(oid, bankImpl);

        org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, BankHelper.id());

        // Register in NameService
        org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
        NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
        NameComponent[] nc = rootContext.to_name("Bank");
        rootContext.rebind(nc, ref);

        //
        // Run implementation
        //
        manager.activate();
        System.out.println("Server ready...");
        orb.run();

        return 0;
    }
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.