org.jboss.proxy.ejb
Class ProxyFactory

java.lang.Object
  extended by org.jboss.proxy.ejb.ProxyFactory
All Implemented Interfaces:
AllowedOperationsFlags, ContainerPlugin, EJBProxyFactory, GenericEntityObjectFactory, org.jboss.system.Service

public class ProxyFactory
extends Object
implements EJBProxyFactory

As we remove the one one association between container STACK and invoker we keep this around. IN the future the creation of proxies is a task done on a container basis but the container as a logical representation. In other words, the container "Entity with RMI/IIOP" is not a container stack but an association at the invocation level that points to all metadata for a given container.

In other words this is here for legacy reason and to not disrupt the container at once. In particular we declare that we "implement" the container invoker interface when we are just implementing the Proxy generation calls. Separation of concern.

todo eliminate this class, at least in its present form.

Version:
$Revision: 57209 $
Author:
Marc Fleury, Scott Stark/a>, Thomas Diesler/a>

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.ejb.GenericEntityObjectFactory
GenericEntityObjectFactory.UTIL
 
Field Summary
protected static String BEAN_INTERCEPTOR
           
protected  ArrayList beanInterceptorClasses
          The proxy-config/client-interceptors/bean stack
protected  Invoker beanInvoker
           
protected  Container container
           
 javax.ejb.EJBMetaData ejbMetaData
           
protected  javax.ejb.EJBHome home
           
protected static String HOME_INTERCEPTOR
           
protected  ArrayList homeInterceptorClasses
          The proxy-config/client-interceptors/home stack
protected  Invoker homeInvoker
           
protected  boolean includeIClientIface
          A flag indicating if the IClientContainer interface should be added
protected  InvokerProxyBindingMetaData invokerMetaData
           
protected  boolean isServiceEndpointOnly
           
protected  javax.management.ObjectName jmxName
           
protected  int jmxNameHash
           
protected  String jndiBinding
           
protected static String LIST_ENTITY_INTERCEPTOR
           
protected  ArrayList listEntityInterceptorClasses
          The proxy-config/client-interceptors/entity-list stack
protected static org.jboss.logging.Logger log
           
protected  Constructor proxyClassConstructor
           
protected  javax.ejb.EJBObject statelessObject
           
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Constructor Summary
ProxyFactory()
           
 
Method Summary
protected  void bindProxy()
          The bindProxy method creates the home proxy and binds the home into jndi.
 void create()
           
 void destroy()
           
 Object getEJBHome()
          This method is called whenever the EJBHome implementation for this container is needed.
 javax.ejb.EJBMetaData getEJBMetaData()
          This method is called whenever the metadata for this container is needed.
 Collection getEntityCollection(Collection ids)
          Create a Collection EJBObject proxies for an entity given its primary keys.
 Object getEntityEJBObject(Object id)
          Create an EJBObject proxy for an entity given its primary key.
 Object getStatefulSessionEJBObject(Object id)
          Create an EJBObject proxy for a stateful session given its session id.
 Object getStatelessSessionEJBObject()
          Return the EJBObject proxy for stateless sessions.
protected  void initInterceptorClasses()
          Load the client interceptor classes
 boolean isIdentical(Container container, Invocation mi)
          Protocol specific isIdentical implementation
protected  void loadInterceptorChain(ArrayList chain, ClientContainer client)
          The loadInterceptorChain create instances of interceptor classes previously loaded in loadInterceptorClasses
protected  void loadInterceptorClasses(ArrayList classes, Element interceptors)
          The loadInterceptorClasses load an interceptor classes from configuration
protected  void rebindHomeProxy()
           
 void setContainer(Container con)
          This callback is set by the container so that the plugin may access it
 void setInvokerBinding(String binding)
          Set the invoker jndi binding
 void setInvokerMetaData(InvokerProxyBindingMetaData metadata)
          Set the invoker meta data so that the ProxyFactory can initialize properly
protected  void setupInvokers()
          Lookup the invokers in the object registry.
 void start()
          Become fully available.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOME_INTERCEPTOR

protected static final String HOME_INTERCEPTOR
See Also:
Constant Field Values

BEAN_INTERCEPTOR

protected static final String BEAN_INTERCEPTOR
See Also:
Constant Field Values

LIST_ENTITY_INTERCEPTOR

protected static final String LIST_ENTITY_INTERCEPTOR
See Also:
Constant Field Values

log

protected static org.jboss.logging.Logger log

ejbMetaData

public javax.ejb.EJBMetaData ejbMetaData

isServiceEndpointOnly

protected boolean isServiceEndpointOnly

home

protected javax.ejb.EJBHome home

statelessObject

protected javax.ejb.EJBObject statelessObject

jndiBinding

protected String jndiBinding

jmxName

protected javax.management.ObjectName jmxName

jmxNameHash

protected int jmxNameHash

beanInvoker

protected Invoker beanInvoker

homeInvoker

protected Invoker homeInvoker

invokerMetaData

protected InvokerProxyBindingMetaData invokerMetaData

homeInterceptorClasses

protected ArrayList homeInterceptorClasses
The proxy-config/client-interceptors/home stack


beanInterceptorClasses

protected ArrayList beanInterceptorClasses
The proxy-config/client-interceptors/bean stack


listEntityInterceptorClasses

protected ArrayList listEntityInterceptorClasses
The proxy-config/client-interceptors/entity-list stack


includeIClientIface

protected boolean includeIClientIface
A flag indicating if the IClientContainer interface should be added


container

protected Container container

proxyClassConstructor

protected Constructor proxyClassConstructor
Constructor Detail

ProxyFactory

public ProxyFactory()
Method Detail

setContainer

public void setContainer(Container con)
Description copied from interface: ContainerPlugin
This callback is set by the container so that the plugin may access it

Specified by:
setContainer in interface ContainerPlugin
Parameters:
con - The container using this plugin. This may be null if the plugin is being disassociated from a container.

setInvokerMetaData

public void setInvokerMetaData(InvokerProxyBindingMetaData metadata)
Description copied from interface: EJBProxyFactory
Set the invoker meta data so that the ProxyFactory can initialize properly

Specified by:
setInvokerMetaData in interface EJBProxyFactory

setInvokerBinding

public void setInvokerBinding(String binding)
Description copied from interface: EJBProxyFactory
Set the invoker jndi binding

Specified by:
setInvokerBinding in interface EJBProxyFactory

create

public void create()
            throws Exception
Specified by:
create in interface org.jboss.system.Service
Throws:
Exception

start

public void start()
           throws Exception
Become fully available. At this point our invokers should be started and we can bind the homes into JNDI.

Specified by:
start in interface org.jboss.system.Service
Throws:
Exception

setupInvokers

protected void setupInvokers()
                      throws Exception
Lookup the invokers in the object registry. This typically cannot be done until our start method as the invokers may need to be started themselves.

Throws:
Exception

initInterceptorClasses

protected void initInterceptorClasses()
                               throws Exception
Load the client interceptor classes

Throws:
Exception

loadInterceptorClasses

protected void loadInterceptorClasses(ArrayList classes,
                                      Element interceptors)
                               throws Exception
The loadInterceptorClasses load an interceptor classes from configuration

Throws:
Exception - if an error occurs

loadInterceptorChain

protected void loadInterceptorChain(ArrayList chain,
                                    ClientContainer client)
                             throws Exception
The loadInterceptorChain create instances of interceptor classes previously loaded in loadInterceptorClasses

Throws:
Exception - if an error occurs

bindProxy

protected void bindProxy()
                  throws Exception
The bindProxy method creates the home proxy and binds the home into jndi. It also creates the InvocationContext and client container and interceptor chain.

Throws:
Exception - if an error occurs

rebindHomeProxy

protected void rebindHomeProxy()
                        throws NamingException
Throws:
NamingException

stop

public void stop()
Specified by:
stop in interface org.jboss.system.Service

destroy

public void destroy()
Specified by:
destroy in interface org.jboss.system.Service

isIdentical

public boolean isIdentical(Container container,
                           Invocation mi)
Description copied from interface: EJBProxyFactory
Protocol specific isIdentical implementation

Specified by:
isIdentical in interface EJBProxyFactory
Parameters:
container - the container
mi - the invocation
Returns:
true when identical, false otherwise

getEJBMetaData

public javax.ejb.EJBMetaData getEJBMetaData()
Description copied from interface: EJBProxyFactory
This method is called whenever the metadata for this container is needed.

Specified by:
getEJBMetaData in interface EJBProxyFactory
Returns:
An implementation of the EJBMetaData interface.

getEJBHome

public Object getEJBHome()
Description copied from interface: EJBProxyFactory
This method is called whenever the EJBHome implementation for this container is needed.

Specified by:
getEJBHome in interface EJBProxyFactory
Returns:
An implementation of the home interface for this container.

getStatelessSessionEJBObject

public Object getStatelessSessionEJBObject()
Return the EJBObject proxy for stateless sessions.

Specified by:
getStatelessSessionEJBObject in interface EJBProxyFactory
Returns:
An implementation of the remote interface for this container.

getStatefulSessionEJBObject

public Object getStatefulSessionEJBObject(Object id)
Create an EJBObject proxy for a stateful session given its session id.

Specified by:
getStatefulSessionEJBObject in interface EJBProxyFactory
Parameters:
id - The id of the session.
Returns:
An implementation of the remote interface for this container.

getEntityEJBObject

public Object getEntityEJBObject(Object id)
Create an EJBObject proxy for an entity given its primary key.

Specified by:
getEntityEJBObject in interface EJBProxyFactory
Specified by:
getEntityEJBObject in interface GenericEntityObjectFactory
Parameters:
id - The primary key of the entity.
Returns:
An implementation of the remote interface for this container.

getEntityCollection

public Collection getEntityCollection(Collection ids)
Create a Collection EJBObject proxies for an entity given its primary keys.

Specified by:
getEntityCollection in interface EJBProxyFactory
Parameters:
ids - Enumeration of primary keys.
Returns:
A collection of EJBObjects implementing the remote interface for this container.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.