Examples of POA


Examples of org.omg.PortableServer.POA

        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

Examples of org.omg.PortableServer.POA

        // Get the address that the DSI servant should be publishing
        String location = address.getLocation();

        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, observer);
            CorbaDSIServant servant = new CorbaDSIServant();
            servant.init(orb, bindingPOA, this, observer);
            byte[] objectId = bindingPOA.activate_object(servant);
            obj = bindingPOA.id_to_reference(objectId);
           
            // Register the object reference so we can support passing references as
            // parameters and return types.  Note that we need the actual endpoint that
            // this object reference has been created on.  This is available through the
            // endpointInfo object passed during construction.
View Full Code Here

Examples of org.omg.PortableServer.POA

  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

Examples of org.omg.PortableServer.POA

  }
 
  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

Examples of org.omg.PortableServer.POA

  return _orb();
    }

    public void orb(org.omg.CORBA.ORB orb) {
        try {
            POA _poa = POAHelper.narrow(orb
                    .resolve_initial_references("RootPOA"));

            _poa.activate_object(this);
        } catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
            throw new RuntimeException("ORB must have POA support");
        } catch (org.omg.PortableServer.POAPackage.WrongPolicy ex) {
            throw new RuntimeException("wrong policy: " + ex);
        } catch (org.omg.PortableServer.POAPackage.ServantAlreadyActive ex) {
View Full Code Here

Examples of org.omg.PortableServer.POA

import org.apache.yoko.orb.OB.BootManagerPackage.AlreadyExists;

public class Server {
    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);
View Full Code Here

Examples of org.omg.PortableServer.POA

{
  void run(ORB orb, POA root)
  {
    org.omg.CORBA.Object obj;
    Policy[] policies = new Policy[ 0 ];
    POA poa;
    POA parent;
    POA poa2;
    POA poa3;
    POAManager mgr;
    String str;

    POAManager rootMgr = root.the_POAManager();
    TEST(rootMgr != null);

    //
    // Create child POA
    //
    try
      {
        poa = root.create_POA("poa1", rootMgr, policies);
      }
    catch (InvalidPolicy ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
      }
    catch (AdapterAlreadyExists ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
      }

    //
    // Test: find_POA
    //
    try
      {
        poa2 = root.find_POA("poa1", false);
      }
    catch (AdapterNonExistent ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
      }
    TEST(poa2 != null);
    TEST(poa2._is_equivalent(poa));

    //
    // Test: AdapterNonExistent exception
    //
    try
      {
        poa2 = root.find_POA("poaX", false);
        TEST(false); // find_POA should not have succeeded
      }
    catch (AdapterNonExistent ex)
      {
        // expected
      }

    //
    // Create child POA
    //
    try
      {
        poa2 = root.create_POA("poa2", rootMgr, policies);
      }
    catch (InvalidPolicy ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
      }
    catch (AdapterAlreadyExists ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
      }

    //
    // Test: Confirm parent knows about child
    //
    try
      {
        poa3 = root.find_POA("poa2", false);
      }
    catch (AdapterNonExistent ex)
      {
        fail(ex);
        throw new RuntimeException(ex);
      }

    TEST(poa3 != null);
    TEST(poa3._is_equivalent(poa2));
  }
View Full Code Here

Examples of org.omg.PortableServer.POA

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

    POA root = TestUtil.GetRootPOA(orb);

    //
    // Run the test
    //
    run(orb, root);
View Full Code Here

Examples of org.omg.PortableServer.POA

    //
    // Create ORB
    //
    orb = ORB.init(args, props);

    POA root = TestUtil.GetRootPOA(orb);

    POA poa;
    Policy[] policies;

    POAManager manager = root.the_POAManager();

    //
    // Create POAs
    //
    policies = new Policy[ 4 ];
    policies [ 0 ] =
      root.create_id_assignment_policy(org.omg.PortableServer.IdAssignmentPolicyValue.USER_ID);
    policies [ 1 ] =
      root.create_id_uniqueness_policy(org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID);
    policies [ 2 ] =
      root.create_servant_retention_policy(org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN);
    policies [ 3 ] =
      root.create_request_processing_policy(org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER);

    try
      {
        poa = root.create_POA("poa", manager, policies);
      }
    catch (AdapterAlreadyExists ex)
      {
        throw new RuntimeException(ex);
      }
    catch (InvalidPolicy ex)
      {
        throw new RuntimeException(ex);
      }

    TestLocationForwardActivator_impl activatorImpl =
      new TestLocationForwardActivator_impl();
    org.omg.PortableServer.ServantActivator activator =
      activatorImpl._this(orb);

    try
      {
        poa.set_servant_manager(activator);
      }
    catch (WrongPolicy ex)
      {
        throw new RuntimeException(ex);
      }

    byte[] oid = "test".getBytes();
    org.omg.CORBA.Object obj =
      poa.create_reference_with_id(oid, "IDL:Test:1.0");

    TestLocationForward_impl testImpl = new TestLocationForward_impl(orb);

    activatorImpl.setActivatedServant(testImpl);
View Full Code Here

Examples of org.omg.PortableServer.POA

  }

  public void deactivate_servant()
  {
    byte[] oid = null;
    POA poa = null;

    try
      {
        oid = delegate_.current_.get_object_id();
        poa = delegate_.current_.get_POA();
      }
    catch (org.omg.PortableServer.CurrentPackage.NoContext ex)
      {
        throw new RuntimeException(ex);
      }

    try
      {
        poa.deactivate_object(oid);
      }
    catch (WrongPolicy ex)
      {
        throw new RuntimeException(ex);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.