|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xenonsoft.bridgetown.aop.transaction.support.AbstractTransactionServiceManager
com.xenonsoft.bridgetown.aop.transaction.jta.JtaTransactionServiceManager
A platform transaction service manager that specifically delegates to the Java Transaction API (JTA) and an external transaction manager. The transaction manager and the OTS (CORBA Object TransactionService) and the JTS (Java Transaction Service) are core components that are normally utilised by J2EE based application servers. The J2EE specification from version 1.3 onward, in fact, mandates that certain certain JTA API are available as standard in J2EE-compliant application server. This fact makes it possible to built an abstraction around the concept of platform transaction.
In terms of transaction, we mean transaction that follow the ACID principles. ACID stands for Atomicity, Consistency, Isolation and Durability. In general it is very complex to develop manually enterprise applications that strictly adhere to the ACID principles. The general practice is to delegate this responsibility to an external transaction service. The JTA API is an example of exposing such a enterprise component transaction manager to the Java platform.
Transaction services, then, are designed for transaction that are complex to write. Noteably such services are distributed in nature, in other words these transaction can involved multiple data sources, and across different processes and heterogeneous machines. A transaction that spans across such distributed systems is known as a global transaction.
This class is designed to allow Plain Old Java Objects (POJOS) to
participate in global transactions JTA with the help of an
aspect orient assember, of course. Using the AOP side of
Bridgetown with the transaction method interceptor
TransactionMethodInterceptor
makes the process transparent. On the other hand the transaction
management service is available to be programmed directly.
This class works best with the transaction session factory
JtaTransactionSession
and its corresponding context object
JtaTransactionContext.
Still a developer can invent his or her own configuration.
CAUTION: If the Jta transaction service manager is developed inside an Enterprise JavaBean then be sure to disable Container Managed Transactions, because most J2EE transactions service do not support nested transaction. This transaction service manager class, by default does not perform checks on application server transactions.
| Nested Class Summary |
| Nested classes inherited from class com.xenonsoft.bridgetown.aop.transaction.support.AbstractTransactionServiceManager |
AbstractTransactionServiceManager.ConfigStackThreadLocal, AbstractTransactionServiceManager.TxStackThreadLocal |
| Field Summary | |
protected java.lang.String |
contextFactory
JNDI context factory lookup |
static java.lang.String |
DEFAULT_JNDI_USER_TRANSACTION
Default jndi look up for JTA transaction javax.transaction.UserTransaction |
protected java.util.Properties |
environment
JNDI provider environmental properties |
protected java.lang.String |
jndiUserTransaction
Jndi look up for JTA transaction |
protected IObjectFactory |
managerFactory
Object factory to create or retrieve the external JTA transaction manager from the application server or distributed resource. |
protected java.lang.String |
providerUrl
JNDI provider URL |
protected java.lang.String |
securityCredentials
JNDI provider password |
protected java.lang.String |
securityPrincipal
JNDI provider username |
| Fields inherited from class com.xenonsoft.bridgetown.aop.transaction.support.AbstractTransactionServiceManager |
configStackList, participantListeners, txStackList |
| Constructor Summary | |
JtaTransactionServiceManager()
Default constructor |
|
| Method Summary | |
protected void |
commitRollbackTx(TransactionObject tx,
boolean commit)
A refactored method for this implementation that attempts to commit or rollback the supplied transaction object. |
protected void |
executeCommitOrRollback(boolean commit,
boolean debuggable,
java.lang.String identifier,
ITransactionConfig config,
TransactionObject tx)
A refactored method to commit or rollback the transaction object. |
protected TransactionObject |
executeCreate(ITransactionSession session,
ITransactionConfig config,
boolean debuggable,
java.lang.String identifier)
A refactored method to create a transaction context object. |
protected void |
executeResume(boolean debuggable,
java.lang.String identifier,
ITransactionConfig config,
TransactionObject tx)
A refactored method to resume a transaction object Subclasser cannot override this method to perform additional steps. |
protected void |
executeSuspend(ITransactionConfig config,
boolean debuggable,
java.lang.String identifier,
TransactionObject tx)
A refactored method to suspend an existing transaction context object. |
protected void |
forceRollbackTx(TransactionObject tx)
A refactored method for this TM implementation that forces rollback of the transaction object. |
java.lang.String |
getContextFactory()
Gets the contextFactory |
java.util.Properties |
getEnvironment()
Gets the environment for the JNDI provider |
java.lang.String |
getJndiUserTransaction()
Gets the jndiUserTransaction |
java.lang.String |
getProviderUrl()
Gets the providerUrl |
java.lang.String |
getSecurityCredentials()
Gets the securityCredentials |
java.lang.String |
getSecurityPrincipal()
Gets the securityPrincipal |
javax.transaction.TransactionManager |
getTransactionManager()
Retrieves the transaction manager |
protected javax.transaction.UserTransaction |
getUserTransaction()
Retrieves the user transaction associated with the thread from JNDI lookup |
boolean |
isActive()
Implements / overrides isActive. |
boolean |
isTransactionNew(ITransactionContext txRef)
Implements / overrides isTransactionNew This call is not supported |
void |
setContextFactory(java.lang.String contextFactory)
Sets the contextFactory |
void |
setEnvironment(java.util.Properties env)
Sets the environment for the JNDI provider |
void |
setJndiUserTransaction(java.lang.String jndiUserTransaction)
Sets the jndiUserTransaction |
void |
setProviderUrl(java.lang.String providerUrl)
Sets the providerUrl |
void |
setSecurityCredentials(java.lang.String securityCredentials)
Sets the securityCredentials |
void |
setSecurityPrincipal(java.lang.String securityPrincipal)
Sets the securityPrincipal |
void |
start()
Starts this object when loaded by a service object assembler By default this transaction manager is initially set up for Weblogic Server. |
java.lang.String |
toString()
Reurns a human readable string. |
| Methods inherited from class com.xenonsoft.bridgetown.aop.transaction.support.AbstractTransactionServiceManager |
addParticipiant, begin, commit, fireAfterBegin, fireBeforeCommit, fireBeforeRollback, getThreadName, getTransaction, removeParticipiant, resume, rollback, suspend, unallocate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String DEFAULT_JNDI_USER_TRANSACTION
javax.transaction.UserTransaction
protected java.lang.String jndiUserTransaction
protected java.lang.String contextFactory
protected java.lang.String providerUrl
protected java.lang.String securityPrincipal
protected java.lang.String securityCredentials
protected java.util.Properties environment
protected IObjectFactory managerFactory
| Constructor Detail |
public JtaTransactionServiceManager()
| Method Detail |
public java.lang.String toString()
Object.toString()public java.lang.String getContextFactory()
public void setContextFactory(java.lang.String contextFactory)
contextFactory - the new value for contextFactorypublic java.util.Properties getEnvironment()
public void setEnvironment(java.util.Properties env)
public java.lang.String getJndiUserTransaction()
public void setJndiUserTransaction(java.lang.String jndiUserTransaction)
jndiUserTransaction - the new value for jndiUserTransactionpublic java.lang.String getProviderUrl()
public void setProviderUrl(java.lang.String providerUrl)
providerUrl - the new value for providerUrlpublic java.lang.String getSecurityCredentials()
public void setSecurityCredentials(java.lang.String securityCredentials)
securityCredentials - the new value for securityCredentialspublic java.lang.String getSecurityPrincipal()
public void setSecurityPrincipal(java.lang.String securityPrincipal)
securityPrincipal - the new value for securityPrincipalprotected javax.transaction.UserTransaction getUserTransaction()
public void start()
By default this transaction manager is initially set up for Weblogic Server.
start in interface IStartableIStartable.start()
public javax.transaction.TransactionManager getTransactionManager()
throws TransactionException
TransactionExceptionpublic boolean isActive()
This call is not supported
isActive in interface ITransactionServiceManagerisActive in class AbstractTransactionServiceManagerITransactionServiceManager.isActive()
public boolean isTransactionNew(ITransactionContext txRef)
throws TransactionException,
java.lang.IllegalArgumentException
This call is not supported
isTransactionNew in interface ITransactionServiceManagerisTransactionNew in class AbstractTransactionServiceManagertxRef -
TransactionException
java.lang.IllegalArgumentExceptionITransactionServiceManager.isTransactionNew(com.xenonsoft.bridgetown.aop.transaction.ITransactionContext)
protected TransactionObject executeCreate(ITransactionSession session,
ITransactionConfig config,
boolean debuggable,
java.lang.String identifier)
throws TransactionException
executeCreate in class AbstractTransactionServiceManagersession - the transaction session factoryconfig - the transaction configurationdebuggable - if the logging debuggable flag is setidentifier - the transaction service identifier for logging
TransactionException - if there is a transaction operation failure
protected void executeSuspend(ITransactionConfig config,
boolean debuggable,
java.lang.String identifier,
TransactionObject tx)
throws TransactionException
executeSuspend in class AbstractTransactionServiceManagerconfig - the transaction configurationdebuggable - if the logging debuggable flag is setidentifier - the transaction service identifier for loggingtx - the transaction object that represents a transaction
context to suspend
TransactionException - if there is a transaction operation failure
protected void executeCommitOrRollback(boolean commit,
boolean debuggable,
java.lang.String identifier,
ITransactionConfig config,
TransactionObject tx)
throws TransactionException
executeCommitOrRollback in class AbstractTransactionServiceManagercommit - if true then attempt to commit transaction otherwise rollbackdebuggable - the debuggable flag if this method writes to loggeridentifier - the transaction service manager identifierconfig - the transaction configurationtx - the transaction context
TransactionException - if there is a transaction operation failure
protected void executeResume(boolean debuggable,
java.lang.String identifier,
ITransactionConfig config,
TransactionObject tx)
throws TransactionException
executeResume in class AbstractTransactionServiceManagerdebuggable - the debuggable flag if this method writes to loggeridentifier - the transaction service manager identifierconfig - the transaction configurationtx - the transaction context
TransactionException - if there is a transaction operation failure
protected void commitRollbackTx(TransactionObject tx,
boolean commit)
throws TransactionException
commitRollbackTx in class AbstractTransactionServiceManagertx - the transaction objectcommit - if true then attempt to commit transaction otherwise rollback
TransactionException - if there is a transaction operation failure
protected void forceRollbackTx(TransactionObject tx)
throws TransactionException
forceRollbackTx in class AbstractTransactionServiceManagertx - the transaction object
TransactionException - if there is a transaction operation failure
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||