org.objectweb.easybeans.container.mdb
Class MDBFactory

java.lang.Object
  extended by org.objectweb.easybeans.container.AbsFactory<EasyBeansMDB>
      extended by org.objectweb.easybeans.container.mdb.MDBFactory
All Implemented Interfaces:
Factory<EasyBeansMDB,java.lang.Long>, PoolFactory<EasyBeansMDB,java.lang.Long>
Direct Known Subclasses:
MDBMessageEndPointFactory

public abstract class MDBFactory
extends AbsFactory<EasyBeansMDB>
implements PoolFactory<EasyBeansMDB,java.lang.Long>

This classes is reponsible to manage the MDB objects.
Each MDB object (EasyBeansMDB) has a link to a MessageEndPoint object. The internal message endpoint object is used by the resource adapter with the help of the message end point factory.

Author:
Florent Benoit

Field Summary
private static JLog logger
          Logger.
private  MessageDrivenInfo messageDrivenInfo
          Runtime information about the session bean.
 
Constructor Summary
MDBFactory(java.lang.String className, EZBContainer container)
          Builds a new MDB factory with a given name and its container.
 
Method Summary
 EasyBeansMDB create(java.lang.Long clue)
          Creates an instance with the given hint.
 IBeanInfo getBeanInfo()
          Gets the bean information.
 MessageDrivenInfo getMessageDrivenInfo()
           
 boolean isMatching(EasyBeansMDB object, java.lang.Long clue)
          Checks if the given object with the given clue is matching.
 EJBResponse localCall(long hash, java.lang.Object[] methodArgs, java.lang.Long beanId)
          Do a local call on a method of this factory.
 EJBResponse rpcInvoke(EJBRequest request)
          A request comes to the bean factory and needs to be handled.
A response is done which contains the answer.
 void setMessageDrivenInfo(MessageDrivenInfo messageDrivenInfo)
          Sets the information object for a session bean.
 void stop()
          Stops the factory.
 boolean validate(EasyBeansMDB object, PoolEntryStatistics stats)
          Validate an instance by giving some statistics.
 
Methods inherited from class org.objectweb.easybeans.container.AbsFactory
getBeanClass, getClassName, getContainer, getHashes, getId, getJavaContext, getNamingManager, getPool, getTimerService, init, injectResources, remove, setBeanClass, setHashes, setJavaContext, setPool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.easybeans.pool.PoolFactory
remove
 
Methods inherited from interface org.objectweb.easybeans.api.Factory
notifyTimeout
 

Field Detail

logger

private static JLog logger
Logger.


messageDrivenInfo

private MessageDrivenInfo messageDrivenInfo
Runtime information about the session bean.

Constructor Detail

MDBFactory

public MDBFactory(java.lang.String className,
                  EZBContainer container)
           throws FactoryException
Builds a new MDB factory with a given name and its container.

Parameters:
className - name of this factory (name of class that is managed)
container - the root component of this factory.
Throws:
FactoryException - if class can't be loaded.
Method Detail

rpcInvoke

public EJBResponse rpcInvoke(EJBRequest request)
A request comes to the bean factory and needs to be handled.
A response is done which contains the answer.

Specified by:
rpcInvoke in interface Factory<EasyBeansMDB,java.lang.Long>
Specified by:
rpcInvoke in class AbsFactory<EasyBeansMDB>
Parameters:
request - the EJB request.
Returns:
a response that have been processed by the factory.

localCall

public EJBResponse localCall(long hash,
                             java.lang.Object[] methodArgs,
                             java.lang.Long beanId)
Do a local call on a method of this factory.

Specified by:
localCall in interface Factory<EasyBeansMDB,java.lang.Long>
Parameters:
hash - the hash of the method to execute.
methodArgs - the arguments of the method
beanId - the id of the bean that we want (stateful).
Returns:
response container new id (if any) and value.

stop

public void stop()
Stops the factory.

Specified by:
stop in interface Factory<EasyBeansMDB,java.lang.Long>
Overrides:
stop in class AbsFactory<EasyBeansMDB>

getBeanInfo

public IBeanInfo getBeanInfo()
Description copied from interface: Factory
Gets the bean information.

Specified by:
getBeanInfo in interface Factory<EasyBeansMDB,java.lang.Long>
Returns:
information of the current bean.

getMessageDrivenInfo

public MessageDrivenInfo getMessageDrivenInfo()
Returns:
information of the current bean.

setMessageDrivenInfo

public void setMessageDrivenInfo(MessageDrivenInfo messageDrivenInfo)
Sets the information object for a session bean.

Parameters:
messageDrivenInfo - information on the bean.

create

public EasyBeansMDB create(java.lang.Long clue)
                    throws PoolException
Creates an instance with the given hint.

Specified by:
create in interface PoolFactory<EasyBeansMDB,java.lang.Long>
Parameters:
clue - a clue given by the Pool. Could be null.
Returns:
the created instance.
Throws:
PoolException - if instance cannot be created.

isMatching

public boolean isMatching(EasyBeansMDB object,
                          java.lang.Long clue)
Checks if the given object with the given clue is matching.

Specified by:
isMatching in interface PoolFactory<EasyBeansMDB,java.lang.Long>
Parameters:
object - given object against which the check should be done.
clue - the object used as clue to check the matching.
Returns:
true if it is matching, else false.

validate

public boolean validate(EasyBeansMDB object,
                        PoolEntryStatistics stats)
Validate an instance by giving some statistics.

Specified by:
validate in interface PoolFactory<EasyBeansMDB,java.lang.Long>
Parameters:
object - the instance to validate
stats - some statistics to help in the validating process.
Returns:
true if the element is valid, else false.