|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.jonas.lib.ejb21.JContext
org.ow2.jonas.lib.ejb21.JEntityContext
public class JEntityContext
This class implements javax.ejb.EntityContext interface. An Entitycontext is bound to a bean instance. To be used, it must be associated to a JEntitySwitch, and possibly to a Transaction. In case the Context is used inside a Transaction, we use the Synchronization interface to be aware of transaction demarcations.
| Field Summary |
|---|
| Fields inherited from class org.ow2.jonas.lib.ejb21.JContext |
|---|
bf, CTX_STATE_ACTIVE, CTX_STATE_COMMITTING, CTX_STATE_FINDING, CTX_STATE_INITIAL, CTX_STATE_PASSIVE, myinstance, tm |
| Constructor Summary | |
|---|---|
JEntityContext(JEntityFactory bf,
EntityBean eb)
Constructs an EntityContext the Context has to be initialized after this. |
|
| Method Summary | |
|---|---|
void |
activate(boolean doactivate)
Activate instance. |
void |
afterCompletion(int status)
This method is typically called after the transaction is committed. |
void |
beforeCompletion()
This method is typically called at beforeCompletion |
void |
detachTx()
Detach this Context from tx |
EJBLocalObject |
get2EJBLocalObject()
Obtain a reference to the EJB local object that is currently associated with the instance. |
EJBLocalObject |
getEJBLocalObject()
Obtain a reference to the EJB local object that is currently associated with the instance. |
EJBObject |
getEJBObject()
Obtains a reference to the EJB object that is currently associated with the instance. |
JEntityFactory |
getEntityFactory()
JEntityFactory accessor |
JEntitySwitch |
getEntitySwitch()
JEntitySwitch accessor |
EntityBean |
getInstance()
Returns the bean instance of this context Used in the generated classes to retrieve the instance |
Transaction |
getMyTx()
|
Object |
getPrimaryKey()
Obtains the primary key of the EJB object that is currently associated with this instance. |
TimerService |
getTimerService()
Get access to the EJB Timer Service. |
boolean |
initEntityContext(JEntitySwitch bs)
Reinit Context for reuse |
boolean |
isDirty()
|
boolean |
isInitialized()
|
boolean |
isMarkedRemoved()
Check if context has been marked removed |
boolean |
isNewInstance()
Check if context is a newly created instance |
boolean |
passivate()
passivate this instance |
void |
razEntityContext()
Raz Context before freeing it. |
void |
reuseEntityContext(boolean newtrans)
reuse EntityContext for another transaction. optimization: don't pass it by the pool. |
void |
setDirty(boolean d)
Set the dirty flag: true = instance modified. |
void |
setEntitySwitch(JEntitySwitch bs)
set the EntitySwitch |
void |
setNewInstance()
Set new instance flag |
void |
setRemoved()
Mark this context as removed. |
boolean |
setRunningTx(Transaction tx)
Associate transaction to ths Context |
void |
storeIfModified()
Persistence: write data on storage |
| Methods inherited from class org.ow2.jonas.lib.ejb21.JContext |
|---|
getCallerIdentity, getCallerPrincipal, getEJBHome, getEJBLocalHome, getEnvironment, getRollbackOnly, getState, getUserTransaction, getWorkManager, isCallerInRole, isCallerInRole, lookup, setActive, setCommitting, setFinding, setPassive, setRollbackOnly, setState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.ejb.EJBContext |
|---|
getCallerIdentity, getCallerPrincipal, getEJBHome, getEJBLocalHome, getEnvironment, getRollbackOnly, getUserTransaction, isCallerInRole, isCallerInRole, lookup, setRollbackOnly |
| Constructor Detail |
|---|
public JEntityContext(JEntityFactory bf,
EntityBean eb)
bf - - the JEntityFactoryeb - - the Enterprise Bean instance| Method Detail |
|---|
public Transaction getMyTx()
public TimerService getTimerService()
throws IllegalStateException
getTimerService in interface EJBContextgetTimerService in class JContextIllegalStateException - Thrown if the instance is not allowed to
use this method
public EJBObject getEJBObject()
throws IllegalStateException
getEJBObject in interface EntityContextIllegalStateException - Thrown if the instance invokes this method
while the instance is in a state that does not allow the instance
to invoke this method.
public EJBLocalObject getEJBLocalObject()
throws IllegalStateException
getEJBLocalObject in interface EntityContextIllegalStateException - - if the instance invokes this method while
the instance is in a state that does not allow the instance to
invoke this method, or if the instance does not have a local
interface.
public EJBLocalObject get2EJBLocalObject()
throws IllegalStateException
IllegalStateException - - if the instance invokes this method while
the instance is in a state that does not allow the instance to
invoke this method, or if the instance does not have a local
interface.
public Object getPrimaryKey()
throws IllegalStateException
getPrimaryKey in interface EntityContextIllegalStateException - Thrown if the instance invokes this method
while the instance is in a state that does not allow the instance
to invoke this method.public void beforeCompletion()
beforeCompletion in interface Synchronizationpublic void afterCompletion(int status)
afterCompletion in interface Synchronizationstatus - The status of the transaction completion.public void razEntityContext()
public void detachTx()
public boolean initEntityContext(JEntitySwitch bs)
bs - - The Bean Switch this Context belongs to.public boolean setRunningTx(Transaction tx)
tx -
public void reuseEntityContext(boolean newtrans)
newtrans - true if new transactionpublic void setNewInstance()
public void setRemoved()
throws RemoteException,
RemoveException
RemoteException - ejbRemove failed
RemoveException - ejbRemove failedpublic boolean isMarkedRemoved()
public boolean isNewInstance()
public EntityBean getInstance()
throws RemoteException
RemoteException - if no instance.public JEntityFactory getEntityFactory()
public JEntitySwitch getEntitySwitch()
public boolean isInitialized()
public void setEntitySwitch(JEntitySwitch bs)
bs - - the EntitySwitchpublic boolean isDirty()
public void setDirty(boolean d)
public void storeIfModified()
public boolean passivate()
public void activate(boolean doactivate)
doactivate - True if ejbActivate() is called before ejbLoad()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||