| java.lang.Object org.mockejb.TransactionManager
TransactionManager | public class TransactionManager implements Interceptor,Serializable(Code) | | 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.
author: Alexander Ananiev |
Method Summary | |
public boolean | equals(Object obj) Returns true if the given object is of the same type and
it has the same transaction policy. | public TransactionPolicy | getPolicy() Returns the currently set transaction policy. | public static UserTransaction | getUserTransaction() Returns UserTransaction object. | protected boolean | handlePolicy(TransactionPolicy policy, Object targetObj, Method method, Object[] args) Performs the actions necessary to handle the transaction policy
according to the spec. | public int | hashCode() | public void | intercept(InvocationContext invocationContext) Begins, commits and rolls back the transaction according to the currently
set policy and EJB spec. | protected void | log(String message) | public void | setPolicy(TransactionPolicy policy) Sets the transaction policy. | public void | setUserTransaction(UserTransaction userTransaction) Sets the shared instance of UserTransaction that will be used by MockEJB.
This is convenient when the remote JNDI is used and the cost of obtaining
UserTransaction object from JNDI every time is too high. |
POLICY_CONTEXT_KEY | final public static String POLICY_CONTEXT_KEY(Code) | | |
USER_TRANSACTION_JNDI | final public static String USER_TRANSACTION_JNDI(Code) | | |
TransactionManager | public TransactionManager(TransactionPolicy policy)(Code) | | Creates a new instance of the TransactionManager with the
given policy.
Parameters: policy - transaction policy |
TransactionManager | public TransactionManager()(Code) | | Creates a new instance of the TransactionManager with the
default (Supports) policy.
|
equals | public boolean equals(Object obj)(Code) | | Returns true if the given object is of the same type and
it has the same transaction policy.
|
getPolicy | public TransactionPolicy getPolicy()(Code) | | Returns the currently set transaction policy.
transaction policy |
getUserTransaction | public static UserTransaction getUserTransaction()(Code) | | Returns UserTransaction object. If setUserTransaction()
was called, will return the object that was set by this method.
Otherwise, tries to obtain UserTransaction object from JNDI.
UserTransaction object |
handlePolicy | protected boolean handlePolicy(TransactionPolicy policy, Object targetObj, Method method, Object[] args) throws SystemException, NamingException(Code) | | Performs the actions necessary to handle the transaction policy
according to the spec.
Determines whether the new transaction has to begin for the given method.
Parameters: policy - policy of this invoker Parameters: targetObj - bean being called Parameters: method - method being called Parameters: args - parameter values of the method being called true if the new transaction must begin for the given method |
hashCode | public int hashCode()(Code) | | |
intercept | public void intercept(InvocationContext invocationContext) throws Exception(Code) | | Begins, commits and rolls back the transaction according to the currently
set policy and EJB spec.
|
setPolicy | public void setPolicy(TransactionPolicy policy)(Code) | | Sets the transaction policy.
Parameters: policy - policy to set. |
setUserTransaction | public void setUserTransaction(UserTransaction userTransaction)(Code) | | Sets the shared instance of UserTransaction that will be used by MockEJB.
This is convenient when the remote JNDI is used and the cost of obtaining
UserTransaction object from JNDI every time is too high. TransactionManager tries to
get UserTransaction for every EJB method call.
|
|
|