|
||||||||||
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 |
inactivityTimeout
|
protected int |
instanceCount
|
protected JEntityLocalHome |
localhome
optional local home |
protected int |
lockPolicy
lock policy |
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, ejbTimeoutSignature, JNDICtx, maxCacheSize, minPoolSize, myTimerService, naming, passivationDir, timerTxAttr, tm, txbeanmanaged, wm |
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 |
createNewContext(javax.ejb.EntityBean bean)
|
protected JEntityContext |
createNewInstance(JEntitySwitch es)
Create a new instance of the bean and its EntityContext In case of CMP, the bean class is derived to manage entity persistence. |
javax.ejb.Timer |
createTimer(java.util.Date arg0,
long arg1,
java.io.Serializable arg2)
|
javax.ejb.Timer |
createTimer(java.util.Date arg0,
java.io.Serializable arg1)
|
javax.ejb.Timer |
createTimer(long arg0,
long arg1,
java.io.Serializable arg2)
|
javax.ejb.Timer |
createTimer(long arg0,
java.io.Serializable arg1)
|
java.io.Serializable |
decodePK(java.io.Serializable strpk)
Decode PK. |
boolean |
dirtyInstances()
|
void |
dummyFinderException(boolean dummy)
Dummy method that defines the FinderException in the throws clause to can catch this exception in any case in the JentityHome.vm |
java.io.Serializable |
encodePK(java.io.Serializable pk)
Encode PK. |
JEntitySwitch |
existEJB(java.lang.Object pk,
JEntitySwitch bs)
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 |
int |
getInactivityTimeout()
|
JEntityContext |
getJContext(JEntitySwitch es)
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 |
getPoolSize()
Get the size of the instance pool for this bean |
java.util.Collection |
getTimers()
|
javax.ejb.TimerService |
getTimerService()
Obtains the TimerService associated for this Bean |
void |
init(EntityDesc dd,
JContainer cont)
Init this object |
void |
initInstancePool()
Init the pool of instances |
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 |
printAllPks()
print the list of PKs for DEBUG only |
boolean |
rebindEJB(javax.transaction.Transaction tx,
JEntityContext bctx,
java.lang.Object pk)
rebind a PK with a JEntitySwitch (called by create methods) |
void |
reduceCache()
Reduce number of instances in memory |
boolean |
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, checkSecurity, checkTransactionContainer, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEjbTimeoutSignature, getEnv, getInitialContext, getMaxCacheSize, getMinPoolSize, getPassivationDir, getTimerTxAttribute, getTransactionManager, getWorkManager, init, isClassAvailable, isTxBeanManaged, myClassLoader, postInvoke, postInvokeRemote, preInvoke, preInvokeRemote, resetComponentContext, restartTimers, 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 instanceCount
protected int inactivityTimeout
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 void initInstancePool()
initInstancePool
in interface BeanFactory
initInstancePool
in class JFactory
public JEntitySwitch getEJB(java.lang.Object pk)
pk
- The Primary Key Object
public JEntitySwitch existEJB(java.lang.Object pk, JEntitySwitch bs)
pk
- The Primary Key Objectbs
- the Entityswitch
public boolean rebindEJB(javax.transaction.Transaction tx, JEntityContext bctx, java.lang.Object pk)
tx
- current Transactionbctx
- The EntityContextpk
- 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 getInactivityTimeout()
public int getPoolSize()
BeanFactory
getPoolSize
in interface BeanFactory
getPoolSize
in class JFactory
public void stop()
stop
in interface BeanFactory
public void sync()
sync
in interface BeanFactory
public void reduceCache()
reduceCache
in interface BeanFactory
public JHome getHome()
BeanFactory
getHome
in interface BeanFactory
public JLocalHome getLocalHome()
BeanFactory
getLocalHome
in interface BeanFactory
public JEntityContext getJContext(JEntitySwitch es)
public void releaseJContext(JContext ctx)
ctx
- - The JContext to release.public javax.ejb.TimerService getTimerService()
getTimerService
in class JFactory
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 boolean registerContext(javax.transaction.Transaction tx, JEntityContext ec) throws java.lang.IllegalStateException
tx
- current Transaction
java.lang.IllegalStateException
public EntityCounters getEntityCounters()
public int calculateAutomaticPk()
public void dummyFinderException(boolean dummy) throws javax.ejb.FinderException
dummy
- if true do nothing, else throw the FinderException
javax.ejb.FinderException
- if dummy is falsepublic void printAllPks()
protected JEntityContext createNewInstance(JEntitySwitch es) throws java.lang.Exception
java.lang.Exception
- cannot instantiate beanprotected JEntityContext createNewContext(javax.ejb.EntityBean bean)
public java.io.Serializable encodePK(java.io.Serializable pk)
public java.io.Serializable decodePK(java.io.Serializable strpk)
public javax.ejb.Timer createTimer(long arg0, java.io.Serializable arg1) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(long arg0, long arg1, java.io.Serializable arg2) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(java.util.Date arg0, java.io.Serializable arg1) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(java.util.Date arg0, long arg1, java.io.Serializable arg2) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
public java.util.Collection getTimers() throws java.lang.IllegalStateException, javax.ejb.EJBException
getTimers
in interface javax.ejb.TimerService
java.lang.IllegalStateException
javax.ejb.EJBException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |