FileDocCategorySizeDatePackage
HomeHandleImpl.javaAPI DocJBoss 4.2.14351Fri Jul 13 20:53:52 BST 2007org.jboss.ejb3.proxy.handle

HomeHandleImpl

public class HomeHandleImpl extends Object implements javax.ejb.HomeHandle
An EJB home handle implementation.
author
Marc Fleury.
author
Scott.Stark@jboss.org
version
$Revision: 60233 $

Fields Summary
static final long
serialVersionUID
Serial Version Identifier.
private static final ObjectStreamField[]
serialPersistentFields
The persistent field defintions
private String
jndiName
The JNDI name of the home inteface binding
private Hashtable
jndiEnv
The JNDI env in effect when the home handle was created
Constructors Summary
public HomeHandleImpl(String jndiName)
Construct a HomeHandleImpl.

param
handle The initial context handle that will be used to restore the naming context or null to use a fresh InitialContext object.
param
name JNDI name.


   // Static --------------------------------------------------------

   // Constructors --------------------------------------------------

                                                                               
     
   
      this.jndiName = jndiName;
      this.jndiEnv = (Hashtable) NamingContextFactory.lastInitialContextEnv.get();
   
Methods Summary
public javax.ejb.EJBHomegetEJBHome()
HomeHandle implementation.

return
EJBHome reference.
throws
ServerException Could not get EJBObject.
throws
RemoteException

      try
      {
         InitialContext ic = null;
         if( jndiEnv != null )
            ic = new InitialContext(jndiEnv);
         else
            ic = new InitialContext();
         EJBHome home = (EJBHome) ic.lookup(jndiName);
         return home;
      }
      catch (NamingException e)
      {
         throw new ServerException("Could not get EJBHome", e);
      }
   
public java.lang.StringgetJNDIName()

return
the jndi name

      return jndiName;
   
private voidreadObject(java.io.ObjectInputStream ois)

      ObjectInputStream.GetField getField = ois.readFields();
      jndiName = (String) getField.get("jndiName", null);
      jndiEnv = (Hashtable) getField.get("jndiEnv", null);
   
private voidwriteObject(java.io.ObjectOutputStream oos)

      ObjectOutputStream.PutField putField = oos.putFields();
      putField.put("jndiName", jndiName);
      putField.put("jndiEnv", jndiEnv);
      oos.writeFields();