|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jonas_ejb.container.JFactory
org.objectweb.jonas_ejb.container.JEntityFactory
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
instance pool management (list of available JEntityContext objects) |
protected java.lang.Object |
datasource
|
protected JEntityHome |
home
optional home |
protected int |
instanceCount
|
protected JEntityLocalHome |
localhome
optional local home |
protected int |
lockPolicy
lock policy |
protected int |
maxCacheSize
|
protected int |
minPoolSize
initial value for pool size |
protected java.util.HashMap |
pklist
List of JEntitySwitch objects At each PK is associated a JEntitySwitch object |
protected boolean |
prefetch
enable the prefetch for CMP2 bean |
protected boolean |
reentrant
reentrant if instance can be used concurrently |
protected boolean |
shared
shared if the EJB container is not the only one to modify the bean state on the database, or if a cluster of container access the bean concurrently. |
protected java.util.HashMap |
txlist
List of Transaction Listeners. |
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory |
beanclass, cont, dd, ejb10Env, ejbname, JNDICtx, naming, tm, txbeanmanaged |
Constructor Summary | |
JEntityFactory()
constructor must be without parameters (required by Jorm) |
Method Summary | |
void |
bindEJB(java.lang.Object pk,
JEntitySwitch bs)
Bind a PK with a JEntitySwitch |
int |
calculateAutomaticPk()
Calculate a new uid for automatic pk creation Used by JEntityCmpJdbc.vm |
void |
checkTransaction(RequestCtx rctx)
Check Transaction before calling a method on a bean. |
protected JEntityContext |
createNewInstance()
Create a new instance of the bean and its EntityContext In case of CMP, the bean class is derived to manage entity persistence. |
boolean |
dirtyInstances()
|
JEntitySwitch |
existEJB(java.lang.Object pk)
get EJB by its PK |
int |
getCacheSize()
|
java.lang.Object |
getDataSource()
|
JEntitySwitch |
getEJB(java.lang.Object pk)
get EJB by its PK Creates if not exist yet. |
EntityCounters |
getEntityCounters()
Take a dump of current entity counters and return them |
JHome |
getHome()
returns the home if exist or null if not |
JEntityContext |
getJContext()
Get a Context from the pool, or create a new one if no more available in the pool. |
JEntitySwitch |
getJEntitySwitch()
This method allocates a new JEntitySwitch. |
JLocalHome |
getLocalHome()
returns the local home if exist or null if not |
int |
getMaxCacheSize()
|
int |
getMinPoolSize()
|
int |
getPoolSize()
Get the size of the instance pool for this bean |
void |
init(EntityDesc dd,
JContainer cont)
Init this object |
boolean |
isBlocked(javax.transaction.Transaction tx)
Return True if this Tx is blocked waiting an instance |
boolean |
isBlocking(javax.transaction.Transaction tx)
Return True if this Tx is blocking an instance |
boolean |
isPrefetch()
|
boolean |
isReentrant()
|
boolean |
isShared()
|
int |
lockPolicy()
|
void |
reduceCache()
Reduce number of instances in memory |
void |
registerContext(javax.transaction.Transaction tx,
JEntityContext ec)
Register a Context/Instance in the transaction. |
void |
registerEJB(JEntitySwitch ejb)
Register an EntitySwitch in the dirty list. |
void |
releaseJContext(JContext ctx)
Release a Context |
void |
removeEJB(java.lang.Object pk)
remove an EJB by its PK |
void |
removeTxListener(javax.transaction.Transaction tx)
Remove a Transaction Listener from the list. |
void |
stop()
stop this EJB. |
void |
sync()
Synchronize all dirty instances |
void |
syncForFind(javax.transaction.Transaction tx)
synchronize data modified in this transaction. |
void |
synchronizeEntities()
Ask swapper to synchronize all dirty EntitySwitch |
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory |
checkJonasVersion, checkTransactionContainer, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEnv, getInitialContext, getTimerService, 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 |
protected JEntityHome home
protected JEntityLocalHome localhome
protected boolean reentrant
protected boolean shared
protected int lockPolicy
protected boolean prefetch
protected java.util.List bctxlist
protected int minPoolSize
protected int instanceCount
protected int maxCacheSize
protected java.util.HashMap pklist
protected java.util.HashMap txlist
protected java.lang.Object datasource
Constructor Detail |
public JEntityFactory()
Method Detail |
public void init(EntityDesc dd, JContainer cont)
dd
- the deployment descriptorcont
- the Containerpublic JEntitySwitch getEJB(java.lang.Object pk)
pk
- The Primary Key Object
public JEntitySwitch existEJB(java.lang.Object pk)
pk
- The Primary Key Object
public void bindEJB(java.lang.Object pk, JEntitySwitch bs)
pk
- The Primary Key Objectbs
- The JEntitySwitchpublic JEntitySwitch getJEntitySwitch()
public void removeEJB(java.lang.Object pk)
pk
- The Primary Key Objectpublic void registerEJB(JEntitySwitch ejb)
ejb
- The Entity Switch to be registeredpublic void synchronizeEntities()
public boolean dirtyInstances()
public int getPoolSize()
BeanFactory
getPoolSize
in interface BeanFactory
getPoolSize
in class JFactory
public void stop()
public void sync()
public void reduceCache()
public JHome getHome()
BeanFactory
public JLocalHome getLocalHome()
BeanFactory
public JEntityContext getJContext()
public void releaseJContext(JContext ctx)
ctx
- - The JContext to release.public int getMinPoolSize()
public int getMaxCacheSize()
public int getCacheSize()
public boolean isReentrant()
public boolean isShared()
public int lockPolicy()
public boolean isPrefetch()
public java.lang.Object getDataSource()
public void checkTransaction(RequestCtx rctx)
rctx
- The Request Contextpublic void syncForFind(javax.transaction.Transaction tx)
tx
- the Transactionpublic boolean isBlocking(javax.transaction.Transaction tx)
public boolean isBlocked(javax.transaction.Transaction tx)
public void removeTxListener(javax.transaction.Transaction tx)
tx
- the Transaction to removepublic void registerContext(javax.transaction.Transaction tx, JEntityContext ec) throws java.lang.IllegalStateException
tx
- current Transaction
java.lang.IllegalStateException
public EntityCounters getEntityCounters()
public int calculateAutomaticPk()
protected JEntityContext createNewInstance() throws java.lang.Exception
java.lang.Exception
- cannot instantiate bean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |