|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mockejb.TransactionManager
Provides the support for the container-managed transactions according to EJB spec (chapter 18).
Note that RequiredNew is not fully supported since TransactionManager
does not know how to suspend transactions.
Transaction policy must be provided in the invocationContext in the "transactionPolicy" field. If it is not provided the Supprts policy is used.
Field Summary | |
static java.lang.String |
POLICY_CONTEXT_KEY
|
static java.lang.String |
USER_TRANSACTION_JNDI
|
Constructor Summary | |
TransactionManager()
Creates a new instance of the TransactionManager with the
default (Supports) policy. |
|
TransactionManager(TransactionPolicy policy)
Creates a new instance of the TransactionManager with the
given policy. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Returns true if the given object is of the same type and it has the same transaction policy. |
TransactionPolicy |
getPolicy()
Returns the currently set transaction policy. |
static javax.transaction.UserTransaction |
getUserTransaction()
Returns UserTransaction object. |
protected boolean |
handlePolicy(TransactionPolicy policy,
java.lang.Object targetObj,
java.lang.reflect.Method method,
java.lang.Object[] args)
Performs the actions necessary to handle the transaction policy according to the spec. |
int |
hashCode()
|
void |
intercept(InvocationContext invocationContext)
Begins, commits and rolls back the transaction according to the currently set policy and EJB spec. |
protected void |
log(java.lang.String message)
|
void |
setPolicy(TransactionPolicy policy)
Sets the transaction policy. |
void |
setUserTransaction(javax.transaction.UserTransaction userTransaction)
Sets the shared instance of UserTransaction that will be used by MockEJB. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String USER_TRANSACTION_JNDI
public static final java.lang.String POLICY_CONTEXT_KEY
Constructor Detail |
public TransactionManager(TransactionPolicy policy)
TransactionManager
with the
given policy.
policy
- transaction policypublic TransactionManager()
TransactionManager
with the
default (Supports) policy.
Method Detail |
public TransactionPolicy getPolicy()
public void setPolicy(TransactionPolicy policy)
policy
- policy to set.public void intercept(InvocationContext invocationContext) throws java.lang.Exception
intercept
in interface Interceptor
invocationContext
- provides the info about this call. Also calls interceptors in
turn according to their order in the chain. invocationContext provides access to the return value
and thrown exceptions of this call.
java.lang.Exception
protected boolean handlePolicy(TransactionPolicy policy, java.lang.Object targetObj, java.lang.reflect.Method method, java.lang.Object[] args) throws javax.transaction.SystemException, javax.naming.NamingException
policy
- policy of this invokertargetObj
- bean being calledmethod
- method being calledargs
- parameter values of the method being called
javax.transaction.SystemException
javax.naming.NamingException
public static javax.transaction.UserTransaction getUserTransaction()
setUserTransaction()
was called, will return the object that was set by this method.
Otherwise, tries to obtain UserTransaction object from JNDI.
public void setUserTransaction(javax.transaction.UserTransaction userTransaction)
protected void log(java.lang.String message)
public boolean equals(java.lang.Object obj)
public int hashCode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |