FileDocCategorySizeDatePackage
ATTransactionManagerImpl.javaAPI DocExample6299Tue May 29 16:57:16 BST 2007com.sun.xml.ws.tx.common

ATTransactionManagerImpl

public class ATTransactionManagerImpl extends Object implements TransactionManager
Inject WS-Coordination/WS-AtomicTransaction support into JTA 1.1 TransactionManager and TransactionSynchronizationRegistry.

author
jf39279

Fields Summary
private static final ATTransactionManagerImpl
singleton
private final TransactionManager
javaeeTM
private final TransactionSynchronizationRegistry
javaeeSynchReg
private final Map
coordIdTxnMap
Constructors Summary
private ATTransactionManagerImpl()
Creates a new instance of TransactionManagerImpl

        javaeeTM = TransactionManagerImpl.getInstance();
        javaeeSynchReg = (TransactionSynchronizationRegistry) javaeeTM;
        coordIdTxnMap = new HashMap<String, ATTransaction>();
    
Methods Summary
public voidbegin()

        javaeeTM.begin();
    
public voidcommit()

        javaeeTM.commit();
    
public com.sun.xml.ws.tx.coordinator.CoordinationContextInterfacegetCoordinationContext()
Get the coordination context associated with the current transaction.

Returns null if none set.

        try { 
            return (CoordinationContextInterface) javaeeSynchReg.getResource("WSCOOR-SUN");
        } catch (IllegalStateException ise) {
            return null;  // no current JTA transaction, so return null
        }
    
public static com.sun.xml.ws.tx.common.ATTransactionManagerImplgetInstance()



        
        return singleton;
    
public intgetStatus()

        // TODO return ATCoordinator status mapped to java ee transaction status
        // return javaeeTM.getStatus();
        throw new UnsupportedOperationException("Not yet implemented");
    
public com.sun.xml.ws.api.tx.ATTransactiongetTransaction(java.lang.String coordId)

        return coordIdTxnMap.get(coordId);
    
public javax.transaction.TransactiongetTransaction()

        ATTransaction result = null;
        final Transaction jtaTxn = javaeeTM.getTransaction();
        if (jtaTxn == null) {
            return result;
        } 
        CoordinationContextInterface cc = this.getCoordinationContext();
        if (cc != null) {
            result = getTransaction(cc.getIdentifier());
            if (result == null) {
                result = new ATTransactionImpl(jtaTxn, cc);
                coordIdTxnMap.put(cc.getIdentifier(), result);
            }
        }
        return result;
    
public voidresume(javax.transaction.Transaction transaction)

        javaeeTM.resume(transaction);
    
public voidrollback()

        javaeeTM.rollback();
    
public voidsetCoordinationContext(com.sun.xml.ws.tx.coordinator.CoordinationContextInterface coordinationCtx)
Set the coordination context associated with the current transaction.

        javaeeSynchReg.putResource("WSCOOR-SUN", coordinationCtx);
    
public voidsetRollbackOnly()

        javaeeSynchReg.setRollbackOnly();
    
public voidsetTransactionTimeout(int seconds)

        javaeeTM.setTransactionTimeout(seconds);
    
public javax.transaction.Transactionsuspend()

        return javaeeTM.suspend();