[Enterprise Extensions only]
  Next topic

Writing a WebSphere Enterprise JavaBean as a CORBA client, contacting the client-side ORB

To use a CORBA server running on a third-party ORB, an enterprise bean in the WebSphere environment must explicitly make contact with the client-side ORB so that it can issue remote method invocations to the server.

The enterprise bean described in this example makes use of a class called ClientOrb, which provides most of the logic needed for using the client-side ORB. This class includes the appropriate auxiliary files and methods The methods include the getOrb method, which returns a reference to the client-side ORB, and the related getOrbProperties method, which is used to read the values used in initializing the ORB from a properties file specified at startup. The ClientOrb class does the following:

  1. Includes the resources in the source code. For the ClientOrb class, these include standard Java resources, CORBA naming resources, and some application-specific utilities.
    package com.ibm.orb.interop.samples;
    
    // Java
    import java.io.FileReader;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.util.Properties;
    
    // CORBA
    import org.omg.CORBA.ORB;
    import org.omg.CosNaming.NameComponent;
    import org.omg.CosNaming.NamingContext;
    import org.omg.CosNaming.NamingContextHelper;
    
    // Application-specific
    import com.ibm.orb.interop.samples.Defs;
    import com.ibm.orb.interop.samples.util.Logger;
    import com.ibm.orb.interop.samples.util.Report;
    import com.ibm.orb.interop.samples.util.UserReport;
    
  2. Provides the getOrb method, which obtains a reference to the client-side ORB if one is not already available. If the method obtains a new reference, it also intializes the ORB by passing a set of properties. The client-side ORB is the IBM ORB, not the third-party ORB.
    public ORB getORB()
    {
       if (orb==null)
       {
          ...
          com.ibm.ejs.oa.EJSORB.getORBInstance();
          if (orb==null)
             orb = ORB.init((String[]) null, getOrbProperties());
       }
       return orb;
    }
    
  Next topic