org.objectweb.jonas_ejb.container
Class JStatefulFactory

java.lang.Object
  extended by org.objectweb.jonas_ejb.container.JFactory
      extended by org.objectweb.jonas_ejb.container.JSessionFactory
          extended by org.objectweb.jonas_ejb.container.JStatefulFactory
All Implemented Interfaces:
BeanFactory

public class JStatefulFactory
extends JSessionFactory

This class is a factory for a Session Stateful Bean.

Author:
Philippe Durieux

Field Summary
protected  int cacheSize
          Current Cache Size
protected  java.util.HashMap statefulList
          List of JStatefulSwitch objects (pool of session instances) Key is the sessionId
 
Fields inherited from class org.objectweb.jonas_ejb.container.JSessionFactory
home, isStateful, isSynchro, localhome, sessionList, singleswitch, uniqueSession
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, cont, dd, ejb10Env, ejbname, ejbTimeoutSignature, isClusterReplicated, JNDICtx, maxCacheSize, minPoolSize, myTimerService, naming, passivationDir, stopped, timerTxAttr, tm, txbeanmanaged, wm
 
Constructor Summary
JStatefulFactory(SessionStatefulDesc dd, JContainer cont)
          constructor
 
Method Summary
 JStatefulContext activateStateful(JStatefulSwitch jss)
           
 void checkSecurity(EJBInvocation ejbInv)
          Check if the access to the bean is authorized
 JSessionSwitch createNewSession()
          Creates a new Session Stateful called back from createEJB
 int getCacheSize()
           
 JSessionContext getJContext(JSessionSwitch ss)
          get a new session context must call newInstance (EJB specs) => no pool should be used.
 int getNewSessionId(JStatefulSwitch jss)
           
 int getPoolSize()
          No pool for stateful session beans
 javax.ejb.TimerService getTimerService()
          Obtains the TimerService associated for this Bean
 void initInstancePool()
          No pool of instances for stateful session beans
 boolean passivateStateful(JStatefulSwitch jss)
           
 void postInvoke(RequestCtx rctx)
          postinvoke
 RequestCtx preInvoke(int txa)
          preInvoke for Session beans stateful
 void reduceCache()
          Reduce number of instances in memory
 void removeStateful(int sid)
           
 void storeInstances(javax.transaction.Transaction tx)
          Store intances modified (used before finder ou select methods)
 
Methods inherited from class org.objectweb.jonas_ejb.container.JSessionFactory
checkTransaction, createEJB, getHome, getLocalHome, getTimeout, isSessionSynchro, isStateful, removeEJB, setTimeout, singleSwitchOn, stop, syncDirty
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkJonasVersion, checkTransactionContainer, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEjbTimeoutSignature, getEnv, getInitialContext, getMaxCacheSize, getMinPoolSize, getPassivationDir, getTimerTxAttribute, getTransactionManager, getWorkManager, init, isClassAvailable, isStopped, isTxBeanManaged, myClassLoader, postInvokeRemote, preInvokeRemote, resetComponentContext, restartTimers, setComponentContext, stopContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statefulList

protected java.util.HashMap statefulList
List of JStatefulSwitch objects (pool of session instances) Key is the sessionId


cacheSize

protected int cacheSize
Current Cache Size

Constructor Detail

JStatefulFactory

public JStatefulFactory(SessionStatefulDesc dd,
                        JContainer cont)
constructor

Parameters:
dd - Bean Deployment Descriptor
cont - Container where the bean is defined
Method Detail

getCacheSize

public int getCacheSize()
Overrides:
getCacheSize in class JFactory
Returns:
the Instance cache size for this Ejb

getPoolSize

public int getPoolSize()
No pool for stateful session beans

Specified by:
getPoolSize in interface BeanFactory
Specified by:
getPoolSize in class JFactory
Returns:
0

reduceCache

public void reduceCache()
Reduce number of instances in memory


initInstancePool

public void initInstancePool()
No pool of instances for stateful session beans

Specified by:
initInstancePool in interface BeanFactory
Specified by:
initInstancePool in class JFactory

preInvoke

public RequestCtx preInvoke(int txa)
preInvoke for Session beans stateful

Overrides:
preInvoke in class JFactory
Parameters:
txa - Transaction Attribute (Supports, Required, ...)
Returns:
A RequestCtx object
Throws:
javax.ejb.EJBException

checkSecurity

public void checkSecurity(EJBInvocation ejbInv)
Check if the access to the bean is authorized

Overrides:
checkSecurity in class JFactory
Parameters:
ejbInv - object containing security signature of the method, args of method, etc

postInvoke

public void postInvoke(RequestCtx rctx)
postinvoke

Overrides:
postInvoke in class JFactory
Parameters:
rctx - The RequestCtx that was returned at preInvoke()
Throws:
javax.ejb.EJBException

getTimerService

public javax.ejb.TimerService getTimerService()
Obtains the TimerService associated for this Bean

Specified by:
getTimerService in class JFactory
Returns:
a JTimerService instance.

createNewSession

public JSessionSwitch createNewSession()
                                throws java.rmi.RemoteException
Creates a new Session Stateful called back from createEJB

Specified by:
createNewSession in class JSessionFactory
Returns:
The Session Switch object
Throws:
java.rmi.RemoteException

getNewSessionId

public int getNewSessionId(JStatefulSwitch jss)

passivateStateful

public boolean passivateStateful(JStatefulSwitch jss)

activateStateful

public JStatefulContext activateStateful(JStatefulSwitch jss)

removeStateful

public void removeStateful(int sid)

getJContext

public JSessionContext getJContext(JSessionSwitch ss)
get a new session context must call newInstance (EJB specs) => no pool should be used.

Specified by:
getJContext in class JSessionFactory
Returns:
a new Session Context

storeInstances

public void storeInstances(javax.transaction.Transaction tx)
Description copied from interface: BeanFactory
Store intances modified (used before finder ou select methods)