Search in sources :

Example 1 with TxContextImple

use of com.arjuna.mwlabs.wst11.at.context.TxContextImple in project narayana by jbosstm.

the class UserBusinessActivityStandaloneImple method complete.

public void complete() throws UnknownTransactionException, SystemException, WrongStateException {
    try {
        final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction());
        if (ctx == null) {
            throw new WrongStateException();
        }
        final String id = ctx.identifier();
        final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx);
        BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
        terminatorRPCStub.complete();
    } catch (SystemException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : BusinessActivityTerminatorRPCStub(com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException)

Example 2 with TxContextImple

use of com.arjuna.mwlabs.wst11.at.context.TxContextImple in project narayana by jbosstm.

the class UserBusinessActivityStandaloneImple method begin.

public void begin(int timeout) throws WrongStateException, SystemException {
    try {
        if (_ctxManager.currentTransaction() != null)
            throw new WrongStateException();
        Context ctx = startTransaction(timeout, null);
        _ctxManager.resume(new TxContextImple(ctx));
    } catch (InvalidCreateParametersException ex) {
        tidyup();
        throw new SystemException(ex.toString());
    } catch (UnknownTransactionException ex) {
        tidyup();
        throw new SystemException(ex.toString());
    } catch (SystemException ex) {
        tidyup();
        throw ex;
    }
}
Also used : Context(com.arjuna.mw.wsc11.context.Context) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException)

Example 3 with TxContextImple

use of com.arjuna.mwlabs.wst11.at.context.TxContextImple in project narayana by jbosstm.

the class UserBusinessActivityStandaloneImple method startTransaction.

private final Context startTransaction(int timeout, TxContextImple current) throws InvalidCreateParametersException, SystemException {
    try {
        final Long expires = (timeout > 0 ? new Long(timeout) : null);
        final String messageId = MessageId.getMessageId();
        final CoordinationContext currentContext = (current != null ? getContext(current) : null);
        final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(_activationCoordinatorService, messageId, BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, expires, currentContext);
        if (coordinationContext == null) {
            throw new SystemException(wstxLogger.i18NLogger.get_mwlabs_wst11_ba_remote_UserBusinessActivityImple_2());
        }
        return new ContextImple(coordinationContext);
    } catch (final InvalidCreateParametersException icpe) {
        throw icpe;
    } catch (final SoapFault sf) {
        throw new SystemException(sf.getMessage());
    } catch (final Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) ContextImple(com.arjuna.mwlabs.wst11.ba.ContextImple) SystemException(com.arjuna.wst.SystemException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 4 with TxContextImple

use of com.arjuna.mwlabs.wst11.at.context.TxContextImple in project narayana by jbosstm.

the class BridgeWrapper method create.

/**
 * create an AT 1.1 subordinate transaction, associate it with the AT 1.1. registry then return a
 * BridgedTransaction wrapper allowing the transaction to be driven through prepare, commit
 * and/or rollback and providing access to the transaction id and a context which can be used to
 * resume the transaction.
 * @param subordinateType a unique string which groups subordinates for the benefit of their parent
 * tx/app and allows them to be identified and retrieved as a group during recovery. this must differ
 * from the string {@link SUBORDINATE_TX_TYPE_AT_AT}
 * @param expires the timeout for the bridged-to transaction or 0 if no timeout is required
 * @param isSecure true if AT 1.1. protocol messages for the bridged-to transaction should employ
 * secure communications, otherwise false
 * @return a wrapper for the bridged-to transaction
 * @throws SystemException
 */
public static BridgeWrapper create(String subordinateType, long expires, boolean isSecure) {
    // the AT 1.1 context factory provides us with a means to create the required data.
    ContextFactoryImple.BridgeTxData bridgeTxData = contextFactory.createBridgedTransaction(subordinateType, expires, isSecure);
    if (bridgeTxData != null) {
        BridgeWrapper bridgeWrapper = new BridgeWrapper();
        bridgeWrapper.context = new TxContextImple(bridgeTxData.context);
        bridgeWrapper.coordinator = bridgeTxData.coordinator;
        bridgeWrapper.id = bridgeTxData.identifier;
        bridgeWrapper.subordinateType = subordinateType;
        return bridgeWrapper;
    } else {
        return null;
    }
}
Also used : TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple) ContextFactoryImple(com.arjuna.mwlabs.wst11.at.ContextFactoryImple)

Example 5 with TxContextImple

use of com.arjuna.mwlabs.wst11.at.context.TxContextImple in project narayana by jbosstm.

the class UserTransactionImple method beginSubordinate.

/**
 * method provided for the benefit of UserSubordinateTransactionImple to allow it
 * to begin a subordinate transaction which requires an existing context to be
 * installed on the thread before it will start and instal la new transaction
 *
 * @param timeout
 * @throws WrongStateException
 * @throws SystemException
 */
public void beginSubordinate(int timeout) throws WrongStateException, SystemException {
    try {
        TxContext current = _ctxManager.currentTransaction();
        if ((current == null) || !(current instanceof TxContextImple))
            throw new WrongStateException();
        TxContextImple currentImple = (TxContextImple) current;
        Context ctx = startTransaction(timeout, currentImple);
        _ctxManager.resume(new TxContextImple(ctx));
    // n.b. we don't enlist the subordinate transaction for completion
    // that ensures that any attempt to commit or rollback will fail
    } catch (com.arjuna.wsc.InvalidCreateParametersException ex) {
        tidyup();
        throw new SystemException(ex.toString());
    } catch (com.arjuna.wst.UnknownTransactionException ex) {
        tidyup();
        throw new SystemException(ex.toString());
    } catch (SystemException ex) {
        tidyup();
        throw ex;
    }
}
Also used : TxContext(com.arjuna.mw.wst.TxContext) Context(com.arjuna.mw.wsc11.context.Context) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) WrongStateException(com.arjuna.wst.WrongStateException) TxContext(com.arjuna.mw.wst.TxContext) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple)

Aggregations

InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)22 SystemException (com.arjuna.wst.SystemException)22 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)22 WrongStateException (com.arjuna.wst.WrongStateException)22 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)17 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)15 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)14 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)14 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)12 TxContext (com.arjuna.mw.wst.TxContext)9 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)9 Context (com.arjuna.mw.wsc11.context.Context)7 CannotRegisterException (com.arjuna.wsc.CannotRegisterException)7 SoapFault (com.arjuna.webservices.SoapFault)6 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)4 InvalidStateException (com.arjuna.wsc.InvalidStateException)4 BusinessActivityTerminatorRPCStub (com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub)3 BusinessActivityTerminatorStub (com.arjuna.wst11.stub.BusinessActivityTerminatorStub)3 ContextImple (com.arjuna.mwlabs.wst11.at.ContextImple)2 ContextImple (com.arjuna.mwlabs.wst11.ba.ContextImple)2