Below is the current version of BeanProxy so you can get a feel for my style.
Any comments are welcome.

--jason

----8<----
/**
 * jBoss, the OpenSource EJB server
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */

package org.jboss.ejb.plugins.jrmp.interfaces;

import java.lang.reflect.*;
import javax.naming.*;
import javax.ejb.*;

/**
 * An abstract base proxy class from which all bean proxys extend from.
 *
 * @version $Revision: 1.7 $
 * @author  Jason Dillon <a 
href="mailto:[EMAIL PROTECTED]">&lt;[EMAIL PROTECTED]&gt;</a>
 */
public abstract class BeanProxy
   extends GenericProxy
{
   /** <code>EJBObject.getPrimaryKey()</code> method reference. */
   protected static Method getPrimaryKey;

   /** <code>EJBObject.getHandle()</code> method reference. */
   protected static Method getHandle;

   /** <code>EJBObject.getEJBHome()</code> method reference. */
        protected static Method getEJBHome;

   /** <code>EJBObject.isIdentical()</code> method reference. */
   protected static Method isIdentical;

   /**
    * Initialize <code>EJBObject</code> method references.
    */
   static {
      try {
         Class[] empty = new Class[0];
         Class type = EJBObject.class;

                        getPrimaryKey = type.getMethod("getPrimaryKey", empty);
                        getHandle = type.getMethod("getHandle", empty);
                        getEJBHome = type.getMethod("getEJBHome", empty);
                        isIdentical = type.getMethod("isIdentical", new Class[] { type 
});
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }

   /**
    * Default constructor for externalization.
    */
   public BeanProxy() {}

   /**
    * Initialze a BeanProxy.
    *
    * @param name       <code>EJBHome</code> <i>JNDI</i> name.
    * @param container  ???
    * @param optimize   ???
    */
   protected BeanProxy(String name, ContainerRemote container,
                       boolean optimize)
   {
      super(name, container, optimize);
   }

   /**
    * Get a <code>EJBHome</code> reference for this proxy.
    *
    * @return  <code>EJBHome</code> reference.
    *
    * @throws NamingException    Failed to create InitalContext or lookup
    *                            EJBHome reference.
    */
   protected EJBHome getEJBHome() throws NamingException {
      InitialContext ctx = createInitialContext();
      EJBHome home;

      try {
         home = (EJBHome)ctx.lookup(name);
      }
      finally {
         ctx.close();
      }

      return home;
   }
}

---->8----


Reply via email to