org.objectweb.jonas_ejb.container
Class JSessionFactory

java.lang.Object
  |
  +--org.objectweb.jonas_ejb.container.JFactory
        |
        +--org.objectweb.jonas_ejb.container.JSessionFactory
All Implemented Interfaces:
BeanFactory
Direct Known Subclasses:
JStatefulFactory, JStatelessFactory

public abstract class JSessionFactory
extends JFactory

This class is a factory for a Session Bean. It is responsible for - managing Home and LocalHome. - keeping the JNDI context for this component (java:comp/env)

Author:
Philippe Durieux

Field Summary
protected  JSessionHome home
           
protected  boolean isStateful
           
protected  boolean isSynchro
           
protected  JSessionLocalHome localhome
           
protected  java.util.ArrayList sessionList
           
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, cont, dd, ejb10Env, ejbname, JNDICtx, naming, tm, txbeanmanaged
 
Constructor Summary
JSessionFactory(SessionDesc dd, JContainer cont)
          constructor
 
Method Summary
 void checkTransaction(RequestCtx rctx)
          Session beans can be container managed or bean managed transaction Session home don't check transactional context.
 JSessionSwitch createEJB()
          Create a new Session Find one in the pool, or create a new object.
protected abstract  JSessionSwitch createNewSession()
           
 JHome getHome()
          returns the home if exist or null if not
abstract  JSessionContext getJContext()
           
 JLocalHome getLocalHome()
          returns the local home if exist or null if not
 int getTimeout()
           
 boolean isSessionSynchro()
           
 boolean isStateful()
           
 void reduceCache()
          Reduce number of instances in memory
 void removeEJB(JSessionSwitch bs)
          remove a Session.
 void setTimeout(int t)
          set the current timeout value for Jmx
 void stop()
          stop this EJB.
 void sync()
          synchronize bean instances if needed
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkJonasVersion, checkTransactionContainer, getContainer, getCorbaInitialContext, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEnv, getInitialContext, getPoolSize, getTransactionManager, init, isClassAvailable, isTxBeanManaged, myClassLoader, postInvoke, postInvokeRemote, preInvoke, preInvokeRemote, resetComponentContext, setComponentContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

home

protected JSessionHome home

localhome

protected JSessionLocalHome localhome

isSynchro

protected boolean isSynchro

isStateful

protected boolean isStateful

sessionList

protected java.util.ArrayList sessionList
Constructor Detail

JSessionFactory

public JSessionFactory(SessionDesc dd,
                       JContainer cont)
constructor
Parameters:
dd - The Session Deployment Descriptor
cont - The Container where the bean is defined.
Method Detail

stop

public void stop()
stop this EJB. Mainly unregister it in JNDI.

sync

public void sync()
synchronize bean instances if needed

reduceCache

public void reduceCache()
Reduce number of instances in memory

getHome

public JHome getHome()
Description copied from interface: BeanFactory
returns the home if exist or null if not
Returns:
the home if exist

getLocalHome

public JLocalHome getLocalHome()
Description copied from interface: BeanFactory
returns the local home if exist or null if not
Returns:
the local home if exist

createEJB

public JSessionSwitch createEJB()
                         throws java.rmi.RemoteException
Create a new Session Find one in the pool, or create a new object.
Returns:
a SessionSwitch

removeEJB

public void removeEJB(JSessionSwitch bs)
remove a Session. This may be called also on timeout. put it back in the pool for later use.
Parameters:
bs - The Bean Session Switch to put back in the pool.

checkTransaction

public void checkTransaction(RequestCtx rctx)
                      throws javax.transaction.SystemException
Session beans can be container managed or bean managed transaction Session home don't check transactional context.
Parameters:
rctx - The Request Context

isSessionSynchro

public boolean isSessionSynchro()
Returns:
True if this Session implements SessionSynchronization

getTimeout

public int getTimeout()
Returns:
the current timeout value in seconds for Jmx

setTimeout

public void setTimeout(int t)
set the current timeout value for Jmx
Parameters:
timeout - in seconds

isStateful

public boolean isStateful()
Returns:
true if this Session is Stateful. Will be used internally by EJBObject or EJBLocalObject because they are common to both types.

getJContext

public abstract JSessionContext getJContext()
Returns:
a JSessionContext

createNewSession

protected abstract JSessionSwitch createNewSession()
                                            throws java.rmi.RemoteException