org.objectweb.jonas_ejb.container
Class JEntityFactory

java.lang.Object
  |
  +--org.objectweb.jonas_ejb.container.JFactory
        |
        +--org.objectweb.jonas_ejb.container.JEntityFactory
All Implemented Interfaces:
BeanFactory

public class JEntityFactory
extends JFactory

This class is a factory for an Entity Bean. It is responsible for - managing Home and LocalHome. - managing a pool of instances/contexts - keeping the list of PKs and the associated JEntitySwitch's - keeping the JNDI context for this component (java:comp/env)


Field Summary
protected  java.util.List bctxlist
           
protected  javax.sql.DataSource datasource
           
protected  JEntityHome home
           
protected  int instanceCount
           
protected  JEntityLocalHome localhome
           
protected  int maxCacheSize
           
protected  int minPoolSize
           
protected  java.util.Hashtable pklist
           
protected  boolean reentrant
           
protected  boolean shared
           
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, bn, cont, dd, ejb10Env, ejbname, JNDICtx, naming, tm, txbeanmanaged
 
Constructor Summary
JEntityFactory()
          constructor must be without parameters (required by Jorm)
 
Method Summary
 void checkTransaction(RequestCtx rctx)
          For Entity beans, the only possible case is "Container Managed Tx"
 int getCacheSize()
          returns current cache size for Jmx
 javax.sql.DataSource getDataSource()
          returns the Datasource used for CMP
 JEntitySwitch getEJB(java.lang.Object pk)
          get EJB by its PK Creates if not exist yet.
 JHome getHome()
          returns the home if exist
 JEntityContext getJContext()
          Get a Context from the pool, or create a new one if no more available in the pool.
 JLocalHome getLocalHome()
          returns the local home if exist
 int getMaxCacheSize()
          returns max cache size for Jmx
 int getMinPoolSize()
          returns min pool size for Jmx
 int getPoolSize()
           
 void init(EntityDesc dd, JContainer cont)
          Init this object
 boolean isReentrant()
          return true if reentrant
 boolean isShared()
          return true if shared
 void reduceCache()
          Reduce number of instances in memory
 void releaseJContext(JContext ctx)
          Release a Context
 void removeEJB(java.lang.Object pk)
          remove an EJB by its PK
 void stop()
          stop this EJB.
 void sync()
          synchronize bean instances if needed
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkTransactionContainer, getContainer, getCorbaInitialContext, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEnv, getInitialContext, getTransactionManager, init, isTxBeanManaged, 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 JEntityHome home

localhome

protected JEntityLocalHome localhome

reentrant

protected boolean reentrant

shared

protected boolean shared

bctxlist

protected java.util.List bctxlist

instanceCount

protected int instanceCount

maxCacheSize

protected int maxCacheSize

minPoolSize

protected int minPoolSize

pklist

protected java.util.Hashtable pklist

datasource

protected javax.sql.DataSource datasource
Constructor Detail

JEntityFactory

public JEntityFactory()
constructor must be without parameters (required by Jorm)
Method Detail

init

public void init(EntityDesc dd,
                 JContainer cont)
Init this object

getEJB

public JEntitySwitch getEJB(java.lang.Object pk)
get EJB by its PK Creates if not exist yet.

removeEJB

public void removeEJB(java.lang.Object pk)
remove an EJB by its PK

getPoolSize

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

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()
returns the home if exist

getLocalHome

public JLocalHome getLocalHome()
returns the local home if exist

getJContext

public JEntityContext getJContext()
Get a Context from the pool, or create a new one if no more available in the pool. This JContext must be initialized then by the caller.

releaseJContext

public void releaseJContext(JContext ctx)
Release a Context

getMinPoolSize

public int getMinPoolSize()
returns min pool size for Jmx

getMaxCacheSize

public int getMaxCacheSize()
returns max cache size for Jmx

getCacheSize

public int getCacheSize()
returns current cache size for Jmx

isReentrant

public boolean isReentrant()
return true if reentrant

isShared

public boolean isShared()
return true if shared

getDataSource

public javax.sql.DataSource getDataSource()
returns the Datasource used for CMP

checkTransaction

public void checkTransaction(RequestCtx rctx)
                      throws javax.transaction.SystemException
For Entity beans, the only possible case is "Container Managed Tx"