org.objectweb.easybeans.container.session
Class SessionFactory<PoolType extends EasyBeansSB<PoolType>>

java.lang.Object
  extended by org.objectweb.easybeans.container.AbsFactory<PoolType>
      extended by org.objectweb.easybeans.container.session.SessionFactory<PoolType>
Type Parameters:
PoolType - the type of bean instance.
All Implemented Interfaces:
Factory<PoolType,java.lang.Long>
Direct Known Subclasses:
StatefulSessionFactory, StatelessSessionFactory

public abstract class SessionFactory<PoolType extends EasyBeansSB<PoolType>>
extends AbsFactory<PoolType>

This class manages the session bean and its creation/lifecycle.

Author:
Florent Benoit

Field Summary
private static JLog logger
          Logger.
private  SessionBeanInfo sessionBeanInfo
          Session Desc (deployment info).
 
Constructor Summary
SessionFactory(java.lang.String className, EZBContainer container)
          Builds a new factory with a given name and its container.
 
Method Summary
 PoolType create(java.lang.Long clue)
          Creates an instance with the given hint.
protected abstract  PoolType getBean(java.lang.Long beanId)
          Gets a bean for the given id.
 IBeanInfo getBeanInfo()
          Gets the bean information.
protected abstract  java.lang.Long getId(java.lang.Long beanId)
          Gets a new ID or a null value.
 SessionBeanInfo getSessionBeanInfo()
           
abstract  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 setSessionBeanInfo(SessionBeanInfo sessionBeanInfo)
          Sets the information object for a session bean.
 void stop()
          Stops the factory.
 
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.api.Factory
notifyTimeout
 

Field Detail

logger

private static JLog logger
Logger.


sessionBeanInfo

private SessionBeanInfo sessionBeanInfo
Session Desc (deployment info).

Constructor Detail

SessionFactory

public SessionFactory(java.lang.String className,
                      EZBContainer container)
               throws FactoryException
Builds a new 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

stop

public void stop()
Stops the factory.

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

getBeanInfo

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

Returns:
information of the current bean.

getSessionBeanInfo

public SessionBeanInfo getSessionBeanInfo()
Returns:
information of the current bean.

setSessionBeanInfo

public void setSessionBeanInfo(SessionBeanInfo sessionBeanInfo)
Sets the information object for a session bean.

Parameters:
sessionBeanInfo - information on the bean.

getId

protected abstract java.lang.Long getId(java.lang.Long beanId)
Gets a new ID or a null value.

Parameters:
beanId - given id.
Returns:
new id

create

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

Parameters:
clue - a clue given by the Pool. Could be null.
Returns:
the created instance.
Throws:
PoolException - if instance cannot be created.

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<PoolType extends EasyBeansSB<PoolType>,java.lang.Long>
Specified by:
rpcInvoke in class AbsFactory<PoolType extends EasyBeansSB<PoolType>>
Parameters:
request - the EJB request.
Returns:
a response that have been processed by the factory.

getBean

protected abstract PoolType getBean(java.lang.Long beanId)
                                                           throws java.lang.IllegalArgumentException
Gets a bean for the given id.

Parameters:
beanId - id of the expected bean.
Returns:
a Stateless bean.
Throws:
java.lang.IllegalArgumentException - if bean is not found.

localCall

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

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.