Package org.omg.CORBA

Examples of org.omg.CORBA.ORB


import org.omg.CORBA.ORB;
import org.apache.openejb.loader.SystemInstance;

public class OrbFactory {
    public ORB create() {
        ORB orb = SystemInstance.get().getComponent(ORB.class);
        if (orb == null) {
           // todo add support for args and properties
           orb = ORB.init();
           SystemInstance.get().setComponent(ORB.class, orb);
        }
View Full Code Here


            TypeDescriptor elemDesc = getTypeRepository().getDescriptor(
                    elementType);

            String elemRepID = elemDesc.getRepositoryID();

            ORB orb = org.omg.CORBA.ORB.init();
            TypeCode memberTC = orb.create_sequence_tc(0, elemDesc
                    .getTypeCode());

            _value_members[0] = new ValueMember("", // member has no name!
                    elemRepID, this.getRepositoryID(), "1.0", memberTC, null,
                    (short) 1);
View Full Code Here

        stream_arguments = true;
        continue;
    }

    final RMIState target_state = servant.getRMIState();
    final ORB orb = target_state.getORB();

    Object return_value = null;
    boolean same_state;

    RMIState currentState = RMIState.current();
View Full Code Here

  /**
   * @param args
   */
  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));
    writer.close();
    orb.run();
  }
View Full Code Here

  private CorbaReceiverImpl(EventListener eventListener,
      OrbManagement orbManagement, Properties properties, int cd,
      ResponseMonitor responseMonitor) throws ConnectionException {
    log.debug("ClientCallbackImpl constructor");
    ORB orb = orbManagement.getOrb();
    POA poa = orbManagement.getRootPoa();
    this.eventListener = eventListener;
    this.cd = cd;
    this.responseMonitor = responseMonitor;

    try {
      try {
        Policy[] policies = new Policy[0];
        m_default_poa = poa.create_POA("TODO", poa.the_POAManager(),
            policies);
      } catch (AdapterAlreadyExists e) {
        m_default_poa = poa.find_POA("TODO", true);
      }
      log.debug("JABSession createCallbackObject");
      activate_object = m_default_poa.activate_object(this);
      log.debug("activated this " + this);

      org.omg.CORBA.Object tmp_ref = m_default_poa
          .servant_to_reference(this);
      log.debug("created reference " + tmp_ref);
      AtmiBroker.EndpointQueue clientCallback = AtmiBroker.EndpointQueueHelper
          .narrow(tmp_ref);
      log.debug("narrowed reference " + clientCallback);
      callbackIOR = orb.object_to_string(clientCallback);
      log.debug("Created:" + callbackIOR);
    } catch (Throwable t) {
      throw new ConnectionException(Connection.TPESYSTEM,
          "Cannot create the receiver", t);
    }
View Full Code Here

     *
     * @return An ORB instance configured for the CORBABean.
     * @exception ConfigException
     */
    public ORB createServerORB(CORBABean serverthrows ConfigException {
        ORB orb = createORB(server.getURI(), server, translateToArgs(server), translateToProps(server));

        // check the tss config for a transport mech definition.  If we have one, then
        // the port information will be passed in that config, and the port in the IIOP profile
        // needs to be zero.
        TSSConfig config = server.getTssConfig();
        TSSTransportMechConfig transportMech = config.getTransport_mech();
        if (transportMech != null) {
            if (transportMech instanceof TSSSSLTransportConfig) {
                Any any = orb.create_any();
                any.insert_boolean(true);

                try {
                    Policy portPolicy = orb.create_policy(ZERO_PORT_POLICY_ID.value, any);
                    Policy[] overrides = new Policy [] { portPolicy };
                    server.setPolicyOverrides(overrides);
                } catch (org.omg.CORBA.PolicyError e) {
                    // shouldn't happen, but we'll let things continue with no policy set.
                }
View Full Code Here

    {
        if (target == null || source == null) {
            throw new NullPointerException("invalid argument");
        }

        ORB orb = null;
        try {
            if (StubAdapter.isStub( source )) {
                orb = StubAdapter.getORB( source ) ;
            } else {
                // Is this a servant that was exported to iiop?
                Tie tie = Util.getTie(source);
                if (tie == null) {
                    /* loadTie always succeeds for dynamic RMI-IIOP
                    // No, can we get a tie for it?  If not,
                    // assume that source is a JRMP object...
                    if (Utility.loadTie(source) != null) {
                        // Yes, so it is an iiop object which
                        // has not been exported...
                        throw new RemoteException(
                            "'source' object not exported");
                    }
                    */
                } else {
                    orb = tie.orb();
                }
            }
        } catch (SystemException e) {
            throw new RemoteException("'source' object not connected", e );
        }

        boolean targetIsIIOP = false ;
        Tie targetTie = null;
        if (StubAdapter.isStub(target)) {
            targetIsIIOP = true;
        } else {
            targetTie = Util.getTie(target);
            if (targetTie != null) {
                targetIsIIOP = true;
            } else {
                /* loadTie always succeeds for dynamic RMI-IIOP
                if (Utility.loadTie(target) != null) {
                    throw new RemoteException("'target' servant not exported");
                }
                */
            }
        }

        if (!targetIsIIOP) {
            // Yes. Do we have an ORB from the source object?
            // If not, we're done - there is nothing to do to
            // connect a JRMP object. If so, it is an error because
            // the caller mixed JRMP and IIOP...
            if (orb != null) {
                throw new RemoteException(
                    "'source' object exported to IIOP, 'target' is JRMP");
            }
        } else {
            // The target object is IIOP. Make sure we have a
            // valid ORB from the source object...
            if (orb == null) {
                throw new RemoteException(
                    "'source' object is JRMP, 'target' is IIOP");
            }

            // And, finally, connect it up...
            try {
                if (targetTie != null) {
                    // Is the tie already connected?
                    try {
                        ORB existingOrb = targetTie.orb();

                        // Yes. Is it the same orb?
                        if (existingOrb == orb) {

                            // Yes, so nothing to do...
View Full Code Here

      if (orb == null)
      {
         throw new Exception("orb is not injected");
      }
      System.out.print("ORB is injected: "+orb);
      ORB orb2 = (ORB) ServiceLocator.lookup("java:comp/ORB");
      if (orb2 == null)
      {
         throw new Exception("java:comp/ORB lookup is null");
      }
   }
View Full Code Here

                    if (tie == null)
                        throw wrapper.connectNoTie() ;

                    // Is the tie already connected?  If it is, check that it's
                    // connected to the same ORB, otherwise connect it.
                    ORB existingOrb = orb ;
                    try {
                        existingOrb = tie.orb();
                    } catch (BAD_OPERATION exc) {
                        // Thrown when tie is an ObjectImpl and its delegate is not set.
                        tie.orb(orb);
View Full Code Here

         (StatelessSessionHome)PortableRemoteObject.narrow(
                    getInitialContext().lookup(StatelessSessionHome.JNDI_NAME),
                    StatelessSessionHome.class);
      StatelessSession session = home.create();
      //----------------------------------------------------------------------
      final ORB orb = ORB.init(new String[0], System.getProperties());
      POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
      IdlInterfaceServant servant = new IdlInterfaceServant();
      org.omg.CORBA.Object original = servant._this_object(orb);
      poa.the_POAManager().activate();
      new Thread(
         new Runnable() {
            public void run() {
               orb.run();
            }
         },
         "ORB thread"
      ).start();
      org.omg.CORBA.Object echoedBack = session.testCorbaObject(original);
      assertEquals(orb.object_to_string(original),
                   orb.object_to_string(echoedBack));
      //----------------------------------------------------------------------
      session.remove();
   }
View Full Code Here

TOP

Related Classes of org.omg.CORBA.ORB

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.