User: reverbel
  Date: 01/11/21 04:34:50

  Added:       iiop/src/main/org/jboss/ejb/plugins/iiop HandleImpl.java
  Log:
  IIOP-specific implementation of the EJBObject interface.
  
  Revision  Changes    Path
  1.1                  contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/HandleImpl.java
  
  Index: HandleImpl.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.ejb.plugins.iiop;
  
  import java.rmi.RemoteException;
  import java.util.Properties;
  import javax.ejb.EJBObject;
  import javax.ejb.Handle;
  import javax.rmi.PortableRemoteObject;
  import org.omg.CORBA.ORB;
  
  /**
   * A CORBA-based EJBObject handle implementation.
   *      
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Rickard Öberg</a>.
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Francisco Reverbel</a>
   * @version $Revision: 1.1 $
   */
  public class HandleImpl
      implements Handle
  {
     private static ORB orb;
     
     static {
        Properties props = System.getProperties();
        orb = ORB.init(new String[0], props);
     }
  
     /**
      * This handle encapsulates an stringfied CORBA reference for an 
      * <code>EJBObject</code>. 
      */
     private String ior;
     
     /**
      * Constructs an <code>HandleImpl</code>.
      *
      * @param ior An stringfied CORBA reference for an <code>EJBObject</code>.
      */
     public HandleImpl(String ior) 
     {
        this.ior = ior;
     }
     
     /**
      * Constructs an <tt>HandleImpl</tt>.
      *
      * @param obj An <code>EJBObject</code>.
      */
     public HandleImpl(EJBObject obj) 
     {
        this((org.omg.CORBA.Object)obj);
     }
     
     /**
      * Constructs an <tt>HandleImpl</tt>.
      *
      * @param obj A CORBA reference for an <code>EJBObject</code>.
      */
     public HandleImpl(org.omg.CORBA.Object obj) 
     {
        this.ior = orb.object_to_string(obj);
     }
     
     // Public --------------------------------------------------------
     
     // Handle implementation -----------------------------------------
     
     /**
      * Obtains the <code>EJBObject</code> represented by this handle.
      *
      * @return  a reference to an <code>EJBObject</code>.
      *
      * @throws RemoteException
      */
     public EJBObject getEJBObject() 
           throws RemoteException 
     {
        try {
           return (EJBObject)PortableRemoteObject.narrow(
                                     orb.string_to_object(ior), EJBObject.class);
        }
        catch (Exception e) {
           throw new RemoteException("Could not get EJBObject from Handle");
        }
     }
  
  }
  
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to