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

StatelessLocalProxyFactory

public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
Comment
author
Bill Burke
version
$Revision: 61301 $

Fields Summary
private static final Logger
log
Constructors Summary
Methods Summary
protected booleanbindHomeAndBusinessTogether(org.jboss.ejb3.EJBContainer container)

      return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(ProxyFactoryHelper.getLocalJndiName(container));
   
public java.lang.ObjectcreateProxy()

      return constructProxy(new StatelessLocalProxy(container));
   
protected StatelessHandleImplgetHandle()

      StatelessHandleImpl handle = new StatelessHandleImpl();
      LocalBinding localBinding = (LocalBinding) advisor.resolveAnnotation(LocalBinding.class);
      if (localBinding != null)
         handle.jndiName = localBinding.jndiBinding();

      return handle;
   
protected java.lang.Class[]getInterfaces()


     
   
      Class[] interfaces;
      
      EJBContainer statelessContainer = (EJBContainer) container;
      LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
      
      boolean bindTogether = false;
      
      if (localHome != null && bindHomeAndBusinessTogether(statelessContainer))
         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 voidinitializeJndiName()

      jndiName = ProxyFactoryHelper.getLocalJndiName(container);
   
public voidstart()

      super.start();
      EJBContainer statelessContainer = (EJBContainer) container;
      LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
      if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
      {
         Class[] interfaces = {localHome.value()};
         Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(),
                                                                     interfaces, new StatelessLocalProxy(container));
         NonSerializableFactory.rebind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container), homeProxy);
      }
   
public voidstop()

      super.stop();
      EJBContainer statelessContainer = (EJBContainer) container;
      LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
      if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
      {
         NonSerializableFactory.unbind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container));
      }