FileDocCategorySizeDatePackage
BaseServiceProxyFactory.javaAPI DocJBoss 4.2.13276Fri Jul 13 20:53:50 BST 2007org.jboss.ejb3.service

BaseServiceProxyFactory

public abstract class BaseServiceProxyFactory extends Object implements org.jboss.ejb3.ProxyFactory
author
Kabir Khan
version
$Revision: 57207 $

Fields Summary
protected Class
proxyClass
protected Constructor
proxyConstructor
protected Context
proxyFactoryContext
protected String
jndiName
protected org.jboss.ejb3.Container
container
protected org.jboss.aop.Advisor
advisor
Constructors Summary
Methods Summary
public java.lang.ObjectcreateHomeProxy()

      throw new UnsupportedOperationException("service can't have a home interface");
   
public java.lang.ObjectcreateProxy(java.lang.Object id)

      if(id != null)
         throw new IllegalArgumentException("service proxy must not have an id");
      return createProxy();
   
protected abstract java.lang.Class[]getInterfaces()

protected abstract voidinitializeJndiName()

public voidsetContainer(org.jboss.ejb3.Container container)

      this.container = container;
      this.advisor = (Advisor) container;
   
public voidstart()

      initializeJndiName();
      Class[] interfaces = getInterfaces();
      Class proxyClass = java.lang.reflect.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
      final Class[] constructorParams =
              {InvocationHandler.class};
      proxyConstructor = proxyClass.getConstructor(constructorParams);

      try
      {
         Util.rebind(container.getInitialContext(), jndiName, createProxy());
      } catch (NamingException e)
      {
         NamingException namingException = new NamingException("Could not bind service proxy factory for EJB container with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName);
         namingException.setRootCause(e);
         throw namingException;
      }
   
public voidstop()

      Util.unbind(container.getInitialContext(), jndiName);