FileDocCategorySizeDatePackage
StatelessHandleImpl.javaAPI DocJBoss 4.2.14068Fri Jul 13 20:53:52 BST 2007org.jboss.ejb3.stateless

StatelessHandleImpl

public class StatelessHandleImpl extends Object implements javax.ejb.Handle
An EJB stateless session bean handle.
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
public 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 StatelessHandleImpl()


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

    
   
      
   
public StatelessHandleImpl(String jndiName)
Construct a StatelessHandleImpl.

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.

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

      try
      {
         InitialContext ic = null;
         if( jndiEnv != null )
            ic = new InitialContext(jndiEnv);
         else
            ic = new InitialContext();
    
         Proxy proxy = (Proxy) ic.lookup(jndiName);

         return (EJBObject) proxy;
      }
      catch (Throwable t)
      {
         t.printStackTrace();
         throw new RemoteException("Error during getEJBObject", t);
      }
   
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();