org.objectweb.easybeans.container.session.stateless
Class StatelessSessionFactory

java.lang.Object
  extended by org.objectweb.easybeans.container.AbsFactory<PoolType>
      extended by org.objectweb.easybeans.container.session.SessionFactory<EasyBeansSLSB>
          extended by org.objectweb.easybeans.container.session.stateless.StatelessSessionFactory
All Implemented Interfaces:
Factory<EasyBeansSLSB,java.lang.Long>, PoolFactory<EasyBeansSLSB,java.lang.Long>

public class StatelessSessionFactory
extends SessionFactory<EasyBeansSLSB>
implements PoolFactory<EasyBeansSLSB,java.lang.Long>

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

Author:
Florent Benoit

Constructor Summary
StatelessSessionFactory(java.lang.String className, EZBContainer container)
          Builds a new factory with a given name and its container.
 
Method Summary
protected  EasyBeansSLSB getBean(java.lang.Long beanId)
          Gets a bean for the given id.
protected  java.lang.Long getId(java.lang.Long beanId)
          Gets a new ID or a null value.
 boolean isMatching(EasyBeansSLSB 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.
 void notifyTimeout(Timer timer)
          Notified when the timer service send a Timer object.
 void remove(EasyBeansSLSB instance)
          Callback called when object is gonna be removed.
 boolean validate(EasyBeansSLSB object, PoolEntryStatistics stats)
          Validate an instance by giving some statistics.
 
Methods inherited from class org.objectweb.easybeans.container.session.SessionFactory
create, getBeanInfo, getSessionBeanInfo, rpcInvoke, setSessionBeanInfo, stop
 
Methods inherited from class org.objectweb.easybeans.container.AbsFactory
getBeanClass, getClassName, getContainer, getHashes, getId, getJavaContext, getNamingManager, getPool, getTimerService, init, injectResources, 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
create
 

Constructor Detail

StatelessSessionFactory

public StatelessSessionFactory(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

isMatching

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

Specified by:
isMatching in interface PoolFactory<EasyBeansSLSB,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(EasyBeansSLSB object,
                        PoolEntryStatistics stats)
Validate an instance by giving some statistics.

Specified by:
validate in interface PoolFactory<EasyBeansSLSB,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.

getId

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

Specified by:
getId in class SessionFactory<EasyBeansSLSB>
Parameters:
beanId - given id.
Returns:
new id

getBean

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

Specified by:
getBean in class SessionFactory<EasyBeansSLSB>
Parameters:
beanId - id of the expected bean.
Returns:
a Stateless bean.
Throws:
java.lang.IllegalArgumentException - if bean is not found.

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<EasyBeansSLSB,java.lang.Long>
Specified by:
localCall in class SessionFactory<EasyBeansSLSB>
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.

remove

public void remove(EasyBeansSLSB instance)
Callback called when object is gonna be removed.

Specified by:
remove in interface PoolFactory<EasyBeansSLSB,java.lang.Long>
Overrides:
remove in class AbsFactory<EasyBeansSLSB>
Parameters:
instance - that is being removed from the pool.

notifyTimeout

public void notifyTimeout(Timer timer)
Notified when the timer service send a Timer object. It has to call the Timed method.

Specified by:
notifyTimeout in interface Factory<EasyBeansSLSB,java.lang.Long>
Parameters:
timer - the given timer object that will be given to the timer method.