org.objectweb.easybeans.container.session.stateful
Class StatefulSessionFactory

java.lang.Object
  extended by org.objectweb.easybeans.container.AbsFactory
      extended by org.objectweb.easybeans.container.session.SessionFactory<EasyBeansSFSB>
          extended by org.objectweb.easybeans.container.session.stateful.StatefulSessionFactory
All Implemented Interfaces:
Factory, PoolFactory<EasyBeansSFSB,java.lang.Long>

public class StatefulSessionFactory
extends SessionFactory<EasyBeansSFSB>
implements PoolFactory<EasyBeansSFSB,java.lang.Long>

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

Author:
Florent Benoit

Field Summary
private  java.lang.Long idCount
          Id generator.
private  java.util.Map<EasyBeansSFSB,java.lang.Long> idMap
          TODO: to be removed.
private static JLog logger
          Logger.
 
Constructor Summary
StatefulSessionFactory(java.lang.String className, EZBContainer container)
          Builds a new factory with a given name and its container.
 
Method Summary
 EasyBeansSFSB create(java.lang.Long clue)
          Creates an instance with the given hint.
 boolean isMatching(EasyBeansSFSB bean, java.lang.Long clue)
          Checks if the given object with the given clue is matching.
 void remove(EasyBeansSFSB instance)
          Callback called when object is gonna be removed.
 EJBResponse rpcInvoke(EJBRequest request)
          A request comes to the bean factory and needs to be handled.
A response is done which contains the answer.
 boolean validate(EasyBeansSFSB object, PoolEntryStatistics stats)
          Validate an instance by giving some statistics.
 
Methods inherited from class org.objectweb.easybeans.container.session.SessionFactory
getBeanClass, getClassName, getContainer, getHashes, getPool, setBeanClass, setHashes, setPool, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static JLog logger
Logger.


idCount

private java.lang.Long idCount
Id generator.


idMap

private java.util.Map<EasyBeansSFSB,java.lang.Long> idMap
TODO: to be removed. Map between bean and its id

Constructor Detail

StatefulSessionFactory

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

create

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

Specified by:
create in interface PoolFactory<EasyBeansSFSB,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(EasyBeansSFSB bean,
                          java.lang.Long clue)
Checks if the given object with the given clue is matching.

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

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

remove

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

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

rpcInvoke

public EJBResponse rpcInvoke(EJBRequest request)
                      throws RPCException
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
Specified by:
rpcInvoke in class AbsFactory
Parameters:
request - the EJB request.
Returns:
a response that have been processed by the factory.
Throws:
RPCException - if the invocation fails.