Package org.omg.CORBA

Examples of org.omg.CORBA.ORB


//      args[3] = InetAddress.getLocalHost().getHostAddress();
      args[3] = "129.132.208.221";
      System.out.println("used address: " + args[3]);
     
      // create and init the ORB
        ORB orb = ORB.init(args, null);

        // Get reference to rootpoa & activate the POAManager
        POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        rootpoa.the_POAManager().activate();

        // test
        String accNum = "0234.234432.50L";
        AccountImpl accountImpl = new AccountImpl(accNum);
        AccountPOATie tie = new AccountPOATie(accountImpl, rootpoa);
       
        Account account = tie._this(orb);
        org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
        NamingContextExt namingCtx = NamingContextExtHelper.narrow(objRef);

        NameComponent path[] = namingCtx.to_name( accNum );
        namingCtx.rebind(path, account);

        System.out.println("AccountServer ready and waiting ...");
        orb.run();
    }
View Full Code Here


    public static ORB orb;

  public static void main(String args[]) throws Exception {

        // create and init the ORB
        ORB orb = ORB.init(args, null);

        // get the root naming context
        org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
        NamingContextExt namingCtx = NamingContextExtHelper.narrow(objRef);
  
        // resolve the object reference
        String accNum = "0234.234432.50L";
        Account account = AccountHelper.narrow(namingCtx.resolve_str(accNum));
View Full Code Here

    // props.put("org.omg.CORBA.ORBInitialPort", "5555");
    // props.put("org.omg.CORBA.ORBInitialHost", "129.132.208.221");

    // create and init the ORB
    // ORB orb = ORB.init((String[])null, props);
    ORB orb = ORB.init(args, null);

    // get reference to rootpoa & activate the POAManager
    POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
    rootpoa.the_POAManager().activate();
    LOG.info("RootPOA activated");

    // create the bank
    BankImpl bankImpl = new BankImpl();
    LOG.info("Bank created");

    // get object reference from the servant
    org.omg.CORBA.Object ref = rootpoa.servant_to_reference(bankImpl);
    Bank bankRef = BankHelper.narrow(ref);
    LOG.info("Bank reference created");

    // get the NameService
    org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
    NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
    LOG.info("NamingContext created");

    // bind the Object Reference in Naming
    NameComponent path[] = ncRef.to_name(BANKNAME);
    ncRef.rebind(path, bankRef);
    LOG.info("Bank reference bound");

    // wait for invocations from clients
    LOG.info("BankServer ready and waiting ...");
    orb.run();
  }
View Full Code Here

                objectImpl._get_delegate();
            } catch (BAD_OPERATION e) {
                try {
                    // Reconnect
                    final Stub stub = (Stub) object;
                    final ORB orb = (ORB) new InitialContext().lookup("java:comp/ORB");
                    stub.connect(orb);
                } catch (NamingException ne) {
                    throw new IOException("Unable to lookup java:comp/ORB");
                }
            }
View Full Code Here

            } else {
                name = earApplicationName == null || earApplicationName.isEmpty() ? "" : earApplicationName + "/";
                name = name + component.getModuleName() + "/" + component.getDistinctName() + "/" + component.getComponentName();
            }
            name = name.replace(".", "_");
            final ORB orb = this.orb.getValue();
            if (interfaceRepositorySupported) {
                // Create a CORBA interface repository for the enterprise bean
                iri = new InterfaceRepository(orb, irPoa.getValue(), name);
                // Add bean interface info to the interface repository
                iri.mapClass(remoteView.getValue().getViewClass());
                iri.mapClass(homeView.getValue().getViewClass());
                iri.finishBuild();
                logger.info("CORBA interface repository for " + name + ": " + orb.object_to_string(iri.getReference()));
            }

            // Create csiv2Policy for both home and remote containing IorSecurityConfigMetadata
            final Any secPolicy = orb.create_any();
            /*
            IORSecurityConfigMetaData securityConfig =  container.getBeanMetaData().getIorSecurityConfigMetaData();
            // if no security metadata was found, get the default metadata from the registry.
            if (securityConfig == null) {
                securityConfig = (IORSecurityConfigMetaData) Registry.lookup(CorbaORBService.IOR_SECURITY_CONFIG);
            }
            */
            //TODO: setup security config
            final IORSecurityConfigMetaData securityConfig = null;
            secPolicy.insert_Value(securityConfig);
            csiv2Policy = null; // = orb.create_policy(CSIv2Policy.TYPE, secPolicy);

            // Create SSLPolicy
            //    (SSL_REQUIRED ensures home and remote IORs
            //     will have port 0 in the primary address)
            boolean sslRequired = false;
            if (securityConfig != null) {
                IORTransportConfigMetaData tc = securityConfig.getTransportConfig();
                sslRequired = tc.getIntegrity() ==
                        IORTransportConfigMetaData.INTEGRITY_REQUIRED
                        || tc.getConfidentiality() ==
                        IORTransportConfigMetaData.CONFIDENTIALITY_REQUIRED
                        || tc.getEstablishTrustInClient() ==
                        IORTransportConfigMetaData.ESTABLISH_TRUST_IN_CLIENT_REQUIRED;
            }
            final Any sslPolicyValue = orb.create_any();
            SSLPolicyValueHelper.insert(sslPolicyValue, (sslRequired) ? SSLPolicyValue.SSL_REQUIRED : SSLPolicyValue.SSL_NOT_REQUIRED);
            sslPolicy = null; //orb.create_policy(SSL_POLICY_TYPE.value, sslPolicyValue);
            logger.debug("container's SSL policy: " + sslPolicy);

            // Get the POACurrent object
            poaCurrent = CurrentHelper.narrow(orb.resolve_initial_references("POACurrent"));

            Policy[] policies = {};
            /*
            if (codebasePolicy == null)
                policies = new Policy[]{sslPolicy, csiv2Policy};
View Full Code Here

     *
     * @param stub stub for manual connection to the orb
     */
    public void connectStub(Remote stub) throws TestException {
        try {
            ORB o = ORB.init(new String[0], null);
            ((Stub) stub).connect(o);
        } catch (Exception ex) {
            throw new TestException (
                "Unable to manually connect stub to the ORB.", ex);
        }
View Full Code Here

                    if (obj instanceof PortableRemoteObject && obj instanceof Remote) {
                        Tie tie = javax.rmi.CORBA.Util.getTie((Remote) obj);
                        if (tie == null) {
                            throw new IOException("Unable to serialize PortableRemoteObject; object has not been exported: " + obj);
                        }
                        ORB orb = getORB();
                        tie.orb(orb);
                        obj = PortableRemoteObject.toStub((Remote) obj);
                    }
                    out.write(L);
                    out.writeObject(type);
View Full Code Here

                    case L:
                        clazz = (Class) in.readObject();
                        obj = in.readObject();
                        if (obj instanceof Stub) {
                            Stub stub = (Stub)obj;
                            ORB orb = getORB();
                            stub.connect(orb);
                        }
                        break;
                    default:
                        throw new IOException("Unkown data type: " + type);
View Full Code Here

      String path = url.getURLPath();
      String ior = IOR_CONTEXT;
      if (path.startsWith(ior))
      {
         String encoded = path.substring(ior.length());
         ORB orb = getORB(environment);
         Object object = orb.string_to_object(encoded);
         return narrowRMIServerStub(object);
      }
      throw new MalformedURLException("Unsupported binding: " + url);
   }
View Full Code Here

   }

   public Object bindClient(Object client, Map environment) throws IOException
   {
      Stub stub = (Stub)client;
      ORB orb = null;
      try
      {
         orb = stub._orb();
      }
      catch (BAD_OPERATION x)
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.