Package org.omg.PortableServer

Examples of org.omg.PortableServer.POA


     */
    class ServantRegistryWithTransientPOAPerServant implements ServantRegistry {

        public ReferenceFactory bind(final String name, final Servant servant, final Policy[] policies) throws Exception {
            final Policy[] poaPolicies = concatPolicies(transientPoaPolicies, policies);
            final POA poa = rootPOA.getValue().create_POA(name, null, poaPolicies);
            transientPoaMap.put(name, poa);
            poa.set_servant(servant);
            poa.the_POAManager().activate();
            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }
View Full Code Here


            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }

        public ReferenceFactory bind(final String name, final Servant servant) throws Exception {
            final POA poa = rootPOA.getValue().create_POA(name, null, transientPoaPolicies);
            transientPoaMap.put(name, poa);
            poa.set_servant(servant);
            poa.the_POAManager().activate();
            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }
View Full Code Here

            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }

        public void unbind(final String name) throws Exception {
            final POA poa = transientPoaMap.remove(name);
            if (poa != null) {
                poa.the_POAManager().deactivate(false, true);
                poa.destroy(false, false);
            }
        }
View Full Code Here

     */
    class ServantRegistryWithPersistentPOAPerServant implements ServantRegistry {

        public ReferenceFactory bind(final String name, final Servant servant, final Policy[] policies) throws Exception {
            final Policy[] poaPolicies = concatPolicies(persistentPoaPolicies, policies);
            final POA poa = rootPOA.getValue().create_POA(name, null, poaPolicies);
            persistentPoaMap.put(name, poa);
            poa.set_servant(servant);
            poa.the_POAManager().activate();
            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }
View Full Code Here

            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }

        public ReferenceFactory bind(final String name, final Servant servant) throws Exception {
            final POA poa = rootPOA.getValue().create_POA(name, null, persistentPoaPolicies);
            persistentPoaMap.put(name, poa);
            poa.set_servant(servant);
            poa.the_POAManager().activate();
            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }
View Full Code Here

            return new PoaReferenceFactory(poa); // no servantName: in this case
            // name is the POA name
        }

        public void unbind(final String name) throws Exception {
            final POA poa = persistentPoaMap.remove(name);
            if (poa != null) {
                poa.the_POAManager().deactivate(false, true);
                poa.destroy(false, false);
            }
        }
View Full Code Here

        if (orb == null) {
            throw new NullPointerException("ORB is null");
        }
       
        try {
            POA rootPoa = (POA) orb.resolve_initial_references("RootPOA");
      poa = rootPoa.create_POA(name, null, new Policy[0]);
      poa.the_POAManager().activate();
  } catch (AdapterAlreadyExists e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  } catch (InvalidPolicy e) {
View Full Code Here

     * @exception TransientServiceException
     */
    public void initialize(ORB orb) throws TransientServiceException {
        try {
            // get the root POA.  We're going to re
            POA rootPOA = (POA) orb.resolve_initial_references("RootPOA");
            rootPOA.the_POAManager().activate();

            // we need to create a POA to manage this named instance, and then activate
            // a context on it.
            Policy[] policy = new Policy[3];
            policy[0] = rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
            policy[1] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
            policy[2] = rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);

            POA nameServicePOA = rootPOA.create_POA("TNameService", null, policy );
            nameServicePOA.the_POAManager().activate();

            // create our initial context, and register that with the ORB as the name service
            initialContext = new TransientNamingContext(orb, nameServicePOA);

            //
View Full Code Here

  public static void main(String[] args) throws Exception {
    // Initialize ORB
    ORB orb = ORB.init(new String[0], null);
    System.out.println("ORB: " + orb.getClass().getName());
   
    POA rootPoa = (POA) orb.resolve_initial_references("RootPOA");
   
    // Create a POA
    Policy[] tpolicy = new Policy[3];
    tpolicy[0] = rootPoa.create_lifespan_policy(
        LifespanPolicyValue.TRANSIENT );
    tpolicy[1] = rootPoa.create_request_processing_policy(
        RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY );
    tpolicy[2] = rootPoa.create_servant_retention_policy(
        ServantRetentionPolicyValue.RETAIN);
    POA poa = rootPoa.create_POA("SamplePOA", null, tpolicy);

    poa.the_POAManager().activate();
   
    // Create a SampleImpl and bind it to the POA
    Sample sample = new SampleImpl();
   
    Tie tie = javax.rmi.CORBA.Util.getTie(sample);
   
    byte[] id = poa.activate_object((Servant) tie);
    org.omg.CORBA.Object obj = poa.create_reference_with_id(id, ((Servant)tie)._all_interfaces(poa, id)[0]);
   
    // Write a IOR to a file so the client can obtain a reference to the Sample
    File sampleRef = new File("Sample.ref");
    PrintWriter writer = new PrintWriter(new FileOutputStream(sampleRef));
    writer.write(orb.object_to_string(obj));
View Full Code Here

  }
 
  public static void main(String[] args) throws Exception {
    // Initialize ORB
    final org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[0], null);
    POA rootPoa = (POA) orb.resolve_initial_references("RootPOA");
    rootPoa.the_POAManager().activate();
    System.out.println("ORB: " + orb.getClass().getName());
   
    // Bind a sample CORBA object
    SampleCorba_impl sampleCorba = new SampleCorba_impl();
    byte [] id = rootPoa.activate_object(sampleCorba);
    org.omg.CORBA.Object sampleCorbaRef = rootPoa.create_reference_with_id(id, sampleCorba._all_interfaces(rootPoa, id)[0]);

    // Get IOR to Sample on server
    BufferedReader reader = new BufferedReader(new FileReader("Sample.ref"));
    String ref = reader.readLine();
    org.omg.CORBA.Object sampleRef = orb.string_to_object(ref);
View Full Code Here

TOP

Related Classes of org.omg.PortableServer.POA

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.