Methods Summary |
---|
protected boolean | bindHomeAndBusinessTogether(StatefulContainer container)
return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(ProxyFactoryHelper.getLocalJndiName(container));
|
public java.lang.Object | createProxy()
try
{
StatefulContainer sfsb = (StatefulContainer) container;
StatefulBeanContext ctx = sfsb.getCache().create();
ctx.setInUse(false);
Object id = ctx.getId();
Object[] args = {new StatefulLocalProxy(container, id)};
return proxyConstructor.newInstance(args);
}
catch (InstantiationException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalArgumentException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
}
|
public java.lang.Object | createProxy(java.lang.Object id)
try
{
StatefulContainer sfsb = (StatefulContainer) container;
Object[] args = {new StatefulLocalProxy(container, id)};
return proxyConstructor.newInstance(args);
}
catch (InstantiationException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalArgumentException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
}
|
public java.lang.Object | createProxy(java.lang.Class[] initTypes, java.lang.Object[] initValues)
try
{
StatefulContainer sfsb = (StatefulContainer) container;
Object id = sfsb.createSession(initTypes, initValues);
Object[] args = {new StatefulLocalProxy(container, id)};
return proxyConstructor.newInstance(args);
}
catch (InstantiationException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalArgumentException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
}
|
protected StatefulHandleImpl | getHandle()
StatefulHandleImpl handle = new StatefulHandleImpl();
LocalBinding remoteBinding = (LocalBinding) advisor.resolveAnnotation(LocalBinding.class);
if (remoteBinding != null)
handle.jndiName = remoteBinding.jndiBinding();
return handle;
|
protected java.lang.Class[] | getInterfaces()
Class[] interfaces;
StatefulContainer statefulContainer = (StatefulContainer) container;
LocalHome localHome = (LocalHome) statefulContainer.resolveAnnotation(LocalHome.class);
boolean bindTogether = false;
if (localHome != null && bindHomeAndBusinessTogether(statefulContainer))
bindTogether = true;
Class[] localInterfaces = ProxyFactoryHelper.getLocalInterfaces(container);
if (bindTogether)
interfaces = new Class[localInterfaces.length + 3];
else
interfaces = new Class[localInterfaces.length + 2];
System.arraycopy(localInterfaces, 0, interfaces, 0, localInterfaces.length);
interfaces[localInterfaces.length] = JBossProxy.class;
interfaces[localInterfaces.length + 1] = javax.ejb.EJBLocalObject.class;
if (bindTogether)
interfaces[localInterfaces.length + 2] = localHome.value();
return interfaces;
|
protected void | initializeJndiName()
jndiName = ProxyFactoryHelper.getLocalJndiName(container);
|
public void | start()
super.start();
try
{
NonSerializableFactory.rebind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME, this);
}
catch (NamingException e)
{
NamingException namingException = new NamingException("Could not bind stateful local proxy with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
namingException.setRootCause(e);
throw namingException;
}
StatefulContainer statefulContainer = (StatefulContainer) container;
LocalHome localHome = (LocalHome) ((EJBContainer) container).resolveAnnotation(LocalHome.class);
if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
{
Class[] interfaces = {localHome.value()};
Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(),
interfaces, new StatefulLocalHomeProxy(container));
NonSerializableFactory.rebind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container), homeProxy);
}
|
public void | stop()
super.stop();
NonSerializableFactory.unbind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME);
StatefulContainer statefulContainer = (StatefulContainer) container;
LocalHome localHome = (LocalHome) ((EJBContainer) container).resolveAnnotation(LocalHome.class);
if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
{
NonSerializableFactory.unbind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container));
}
|