Package org.omg.CORBA

Examples of org.omg.CORBA.ORB


      Util.gc(2);
      int threadsBefore = ThreadLister.countThreads();
      for (int ii=0; ii<20; ii++) {
         System.out.println("Hit a key for ORB #" + ii + "/20");
         try { System.in.read(); } catch(java.io.IOException e) {}
         ORB orb = OrbInstanceFactory.createOrbInstance(glob, new String[0], null, new CallbackAddress(glob));
         try {
            POA rootPOA = org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            rootPOA.the_POAManager().activate();
         }
         catch (Throwable e) {
            e.printStackTrace();
            System.out.println("ERROR: " + e.toString());
         }
         // Without orb.shutdown we use 2 threads for each loop!
         orb.shutdown(true);
      }
      Util.gc(2);
      assertEquals("JacORB has a thread leak", threadsBefore, ThreadLister.countThreads());
   }
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

      // debug
      log.debug("Begin java:comp/env for EJB: " + beanMetaData.getEjbName());
      ClassLoader tcl = SecurityActions.getContextClassLoader();
      log.debug("TCL: " + tcl);

      ORB orb = null;
      HandleDelegate hd = null;
      try
      {
         orb = (ORB)server.getAttribute(ORB_NAME, "ORB");
         hd = (HandleDelegate)server.getAttribute(ORB_NAME, "HandleDelegate");
View Full Code Here

   //=========================== Microcontainer lifecycle methods ========================//
  
   public void start() throws Exception
   {
      Context ctx;
      ORB orb;
      POA rootPOA;

      try {
         ctx = new InitialContext();
      }
      catch (NamingException e) {
         throw new RuntimeException("Cannot get intial JNDI context: " + e);
      }
      try {
         orb = (ORB)ctx.lookup("java:/" + CorbaORBService.ORB_NAME);
      }
      catch (NamingException e) {
         throw new RuntimeException("Cannot lookup java:/"
                                    + CorbaORBService.ORB_NAME + ": " + e);
      }
      try {
         rootPOA = (POA)ctx.lookup("java:/" + CorbaORBService.POA_NAME);
      }
      catch (NamingException e) {
         throw new RuntimeException("Cannot lookup java:/"
                                    + CorbaORBService.POA_NAME + ": " + e);
      }

      // Create the naming server POA as a child of the root POA
      Policy[] policies = new Policy[2];
      policies[0] =
         rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
      policies[1] =
         rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
      namingPOA = rootPOA.create_POA("Naming", null, policies);
      namingPOA.the_POAManager().activate();

      // Create the naming service
      org.jacorb.naming.NamingContextImpl.init(orb, rootPOA);
      NamingContextImpl ns = new NamingContextImpl(namingPOA);
      Configuration config = ((org.jacorb.orb.ORB)orb).getConfiguration();
      ns.configure(config); // configure the name service using the ORB config
      byte[] rootContextId = "root".getBytes();
      namingPOA.activate_object_with_id(rootContextId, ns);
      namingService = NamingContextExtHelper.narrow(
                  namingPOA.create_reference_with_id(rootContextId,
                                "IDL:omg.org/CosNaming/NamingContextExt:1.0"));
      bind(NAMING_NAME, "org.omg.CosNaming.NamingContextExt");
      log.info("CORBA Naming Started");
      log.debug("Naming: ["+orb.object_to_string(namingService)+"]");
   }
View Full Code Here

      {
         // Build default SSL component with minimum SSL options
         SSL ssl = new SSL((short) MIN_SSL_OPTIONS, /* supported options */
            (short) 0, /* required options  */
            (short) sslPort);
         ORB orb = ORB.init();
         Any any = orb.create_any();
         SSLHelper.insert(any, ssl);
         byte[] componentData = codec.encode_value(any);
         defaultSSLComponent = new TaggedComponent(TAG_SSL_SEC_TRANS.value,
            componentData);
         // Get the default IOR security metadata from the system registry.
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

        } catch (Exception ex) {
            ex.printStackTrace();           
        }
        OutputStream os = message.getContent(OutputStream.class);
        assertTrue("OutputStream should not be null", os != null);       
        ORB orb = (ORB)message.get("orb");
        assertTrue("Orb should not be null", orb != null);
        Object obj = message.get("endpoint");
        assertTrue("EndpointReferenceType should not be null", obj != null)
    }
View Full Code Here

        List<Interceptor> outfault = binding.getFaultOutInterceptors();
        assertNotNull(outfault);
        Message message = binding.createMessage();
        message.put(ORB.class, orb);
        assertNotNull(message);
        ORB corbaORB = message.get(ORB.class);
        assertNotNull(corbaORB);       
        MessageImpl mesage = new MessageImpl();
        mesage.put(ORB.class, orb);
        Message msg = binding.createMessage(mesage);       
        assertNotNull(msg);               
        ORB corbaOrb = msg.get(ORB.class);
        assertNotNull(corbaOrb);
        /*List<Interceptor> infault = binding.getInFaultInterceptors();
        assertEquals(1, infault.size());
        List<Interceptor> outfault = binding.getOutFaultInterceptors();
        assertEquals(1, fault.size());*/   
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

  /**
   * @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

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.