StatefulHandleImplpublic class StatefulHandleImpl extends Object implements javax.ejb.HandleAn EJB stateful session bean handle. |
Fields Summary |
---|
private static final Logger | log | static final long | serialVersionUIDSerial Version Identifier. | protected static final Method | GET_EJB_OBJECTA reference to {@link Handle#getEJBObject}. | private Object | invokerIDThe value of our local Invoker.ID to detect when we are local. | public int | objectNameThe identity of the bean. | public String | jndiName | public String | invokerProxyBinding | public org.jboss.invocation.Invoker | invoker | public Object | id | protected Hashtable | jndiEnvThe JNDI env in effect when the home handle was created |
Constructors Summary |
---|
public StatefulHandleImpl()Initialize Handle method references.
try
{
GET_EJB_OBJECT = Handle.class.getMethod("getEJBObject", new Class[0]);
}
catch(Exception e)
{
e.printStackTrace();
throw new ExceptionInInitializerError(e);
}
| public StatefulHandleImpl(int objectName, String jndiName, org.jboss.invocation.Invoker invoker, String invokerProxyBinding, Object id, Object invokerID)Create an ejb handle for a stateful session bean.
this.jndiName = jndiName;
this.id = id;
this.jndiEnv = (Hashtable) NamingContextFactory.lastInitialContextEnv.get();
try
{
String property = System.getProperty("org.jboss.ejb.sfsb.handle.V327");
if (property != null)
{
this.invokerProxyBinding = invokerProxyBinding;
this.invokerID = invokerID;
this.objectName = objectName;
this.invoker = invoker;
}
}
catch (AccessControlException ignored)
{
}
|
Methods Summary |
---|
public javax.ejb.EJBObject | getEJBObject()Handle implementation.
This differs from Stateless and Entity handles which just invoke
standard methods (create and findByPrimaryKey
respectively) on the Home interface (proxy).
There is no equivalent option for stateful SBs, so a direct invocation
on the container has to be made to locate the bean by its id (the
stateful SB container provides an implementation of
getEJBObject).
This means the security context has to be set here just as it would
be in the Proxy.
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.Object | getID()
return id;
| public java.lang.String | getJNDIName()
return jndiName;
|
|