org.jboss.proxy.ejb
Class ProxyFactory

java.lang.Object
  extended byorg.jboss.proxy.ejb.ProxyFactory
All Implemented Interfaces:
AllowedOperationsFlags (src) , ContainerPlugin (src) , EJBProxyFactory (src) , GenericEntityObjectFactory (src) , Service (src)
Direct Known Subclasses:
ProxyFactoryHA (src)

public class ProxyFactory
extends java.lang.Object
implements EJBProxyFactory (src)

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.


Nested Class Summary
 
Nested classes inherited from class org.jboss.ejb.GenericEntityObjectFactory (src)
GenericEntityObjectFactory.UTIL (src)
 
Field Summary
protected static java.lang.String BEAN_INTERCEPTOR
           
protected  java.util.ArrayList beanInterceptorClasses
          The proxy-config/client-interceptors/bean stack
protected  Invoker (src) beanInvoker
           
protected  Container (src) container
           
 EJBMetaData (src) ejbMetaData
           
protected  EJBHome (src) home
           
protected static java.lang.String HOME_INTERCEPTOR
           
protected  java.util.ArrayList homeInterceptorClasses
          The proxy-config/client-interceptors/home stack
protected  Invoker (src) homeInvoker
           
protected  boolean includeIClientIface
          A flag indicating if the IClientContainer interface should be added
protected  InvokerProxyBindingMetaData (src) invokerMetaData
           
protected  boolean isServiceEndpointOnly
           
protected  ObjectName (src) jmxName
           
protected  int jmxNameHash
           
protected  java.lang.String jndiBinding
           
protected static java.lang.String LIST_ENTITY_INTERCEPTOR
           
protected  java.util.ArrayList listEntityInterceptorClasses
          The proxy-config/client-interceptors/entity-list stack
protected static Logger (src) log
           
protected  java.lang.reflect.Constructor proxyClassConstructor
           
protected  EJBObject (src) statelessObject
           
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
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()
          create the service, do expensive operations etc
 void destroy()
          destroy the service, tear down
 java.lang.Object getEJBHome()
          This method is called whenever the EJBHome implementation for this container is needed.
 EJBMetaData (src) getEJBMetaData()
          This method is called whenever the metadata for this container is needed.
 java.util.Collection getEntityCollection(java.util.Collection ids)
          Create a Collection EJBObject proxies for an entity given its primary keys.
 java.lang.Object getEntityEJBObject(java.lang.Object id)
          Create an EJBObject proxy for an entity given its primary key.
 java.lang.Object getStatefulSessionEJBObject(java.lang.Object id)
          Create an EJBObject proxy for a stateful session given its session id.
 java.lang.Object getStatelessSessionEJBObject()
          Return the EJBObject proxy for stateless sessions.
protected  void initInterceptorClasses()
          Load the client interceptor classes
 boolean isIdentical(Container (src)  container, Invocation (src)  mi)
          Protocol specific isIdentical implementation
protected  void loadInterceptorChain(java.util.ArrayList chain, ClientContainer (src)  client)
          The loadInterceptorChain create instances of interceptor classes previously loaded in loadInterceptorClasses
protected  void loadInterceptorClasses(java.util.ArrayList classes, org.w3c.dom.Element interceptors)
          The loadInterceptorClasses load an interceptor classes from configuration
protected  void rebindHomeProxy()
           
 void setContainer(Container (src)  con)
          This callback is set by the container so that the plugin may access it
 void setInvokerBinding(java.lang.String binding)
          Set the invoker jndi binding
 void setInvokerMetaData(InvokerProxyBindingMetaData (src)  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()
          stop the service
 
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 java.lang.String HOME_INTERCEPTOR
See Also:
Constant Field Values (src)

BEAN_INTERCEPTOR

protected static final java.lang.String BEAN_INTERCEPTOR
See Also:
Constant Field Values (src)

LIST_ENTITY_INTERCEPTOR

protected static final java.lang.String LIST_ENTITY_INTERCEPTOR
See Also:
Constant Field Values (src)

log

protected static Logger (src)  log

ejbMetaData

public EJBMetaData (src)  ejbMetaData

isServiceEndpointOnly

protected boolean isServiceEndpointOnly

home

protected EJBHome (src)  home

statelessObject

protected EJBObject (src)  statelessObject

jndiBinding

protected java.lang.String jndiBinding

jmxName

protected ObjectName (src)  jmxName

jmxNameHash

protected int jmxNameHash

beanInvoker

protected Invoker (src)  beanInvoker

homeInvoker

protected Invoker (src)  homeInvoker

invokerMetaData

protected InvokerProxyBindingMetaData (src)  invokerMetaData

homeInterceptorClasses

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


beanInterceptorClasses

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


listEntityInterceptorClasses

protected java.util.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 (src)  container

proxyClassConstructor

protected java.lang.reflect.Constructor proxyClassConstructor
Constructor Detail

ProxyFactory

public ProxyFactory()
Method Detail

setContainer

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

Specified by:
setContainer in interface ContainerPlugin (src)
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 (src)  metadata)
Description copied from interface: EJBProxyFactory (src)
Set the invoker meta data so that the ProxyFactory can initialize properly

Specified by:
setInvokerMetaData in interface EJBProxyFactory (src)

setInvokerBinding

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

Specified by:
setInvokerBinding in interface EJBProxyFactory (src)

create

public void create()
            throws java.lang.Exception
Description copied from interface: Service (src)
create the service, do expensive operations etc

Specified by:
create in interface Service (src)
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.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 Service (src)
Throws:
java.lang.Exception

setupInvokers

protected void setupInvokers()
                      throws java.lang.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:
java.lang.Exception

initInterceptorClasses

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

Throws:
java.lang.Exception

loadInterceptorClasses

protected void loadInterceptorClasses(java.util.ArrayList classes,
                                      org.w3c.dom.Element interceptors)
                               throws java.lang.Exception
The loadInterceptorClasses load an interceptor classes from configuration

Throws:
java.lang.Exception - if an error occurs

loadInterceptorChain

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

Throws:
java.lang.Exception - if an error occurs

bindProxy

protected void bindProxy()
                  throws java.lang.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:
java.lang.Exception - if an error occurs

rebindHomeProxy

protected void rebindHomeProxy()
                        throws javax.naming.NamingException
Throws:
javax.naming.NamingException

stop

public void stop()
Description copied from interface: Service (src)
stop the service

Specified by:
stop in interface Service (src)

destroy

public void destroy()
Description copied from interface: Service (src)
destroy the service, tear down

Specified by:
destroy in interface Service (src)

isIdentical

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

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

getEJBMetaData

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

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

getEJBHome

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

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

getStatelessSessionEJBObject

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

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

getStatefulSessionEJBObject

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

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

getEntityEJBObject

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

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

getEntityCollection

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

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