Search in sources :

Example 6 with SystemException

use of com.arjuna.wst.SystemException 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 7 with SystemException

use of com.arjuna.wst.SystemException 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)

Example 8 with SystemException

use of com.arjuna.wst.SystemException in project narayana by jbosstm.

the class UserTransactionImple method commitWithoutAck.

private final void commitWithoutAck() throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    String id = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        id = ctx.identifier();
        /*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
        final W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
        if (completionCoordinator == null)
            throw new WrongStateException();
        CompletionStub completionStub = new CompletionStub(id, completionCoordinator);
        completionStub.commit();
    } catch (SystemException ex) {
        throw ex;
    } catch (TransactionRolledBackException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (SecurityException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    } finally {
        try {
            if (ctx != null)
                _ctxManager.resume(ctx);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if (id != null)
            _completionCoordinators.remove(id);
    }
}
Also used : CompletionStub(com.arjuna.wst11.stub.CompletionStub) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) TxContextImple(com.arjuna.mwlabs.wst11.at.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 9 with SystemException

use of com.arjuna.wst.SystemException in project narayana by jbosstm.

the class UserTransactionImple 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));
        enlistCompletionParticipants();
    } 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) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple)

Example 10 with SystemException

use of com.arjuna.wst.SystemException in project narayana by jbosstm.

the class BusinessActivityTerminatorImple method close.

public void close() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
    try {
        if (_hier == null)
            throw new UnknownTransactionException();
        _coordManager.resume(_hier);
        _coordManager.close();
    } catch (com.arjuna.mw.wsas.exceptions.InvalidActivityException ex) {
        throw new UnknownTransactionException();
    } catch (com.arjuna.mw.wsas.exceptions.ProtocolViolationException ex) {
        throw new SystemException(ex.toString());
    } catch (com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException ex) {
        wstxLogger.i18NLogger.warn_mwlabs_wst11_ba_coordinator_cancelled_activity();
        throw new TransactionRolledBackException();
    } catch (com.arjuna.mw.wscf.exceptions.NoCoordinatorException ex) {
        throw new UnknownTransactionException();
    } catch (com.arjuna.mw.wsas.exceptions.WrongStateException ex) {
        throw new SystemException(ex.toString());
    } catch (com.arjuna.mw.wsas.exceptions.NoPermissionException ex) {
        throw new SystemException(ex.toString());
    } catch (com.arjuna.mw.wsas.exceptions.SystemException ex) {
        throw new SystemException(ex.toString());
    } catch (UnknownTransactionException ex) {
        throw ex;
    } finally {
        TerminationCoordinatorProcessor.getProcessor().deactivateParticipant(this);
    }
}
Also used : UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException)

Aggregations

SystemException (com.arjuna.wst.SystemException)74 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)63 WrongStateException (com.arjuna.wst.WrongStateException)45 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)39 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)20 ArrayList (java.util.ArrayList)19 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)16 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)15 SoapFault (com.arjuna.webservices.SoapFault)15 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)13 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)11 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)11 MAP (org.jboss.ws.api.addressing.MAP)11 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)10 Context (com.arjuna.mw.wsc11.context.Context)6 FaultedException (com.arjuna.wst.FaultedException)6 BusinessActivityTerminator (com.arjuna.wst11.BusinessActivityTerminator)6 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 TxContext (com.arjuna.mw.wst.TxContext)5 BusinessActivityManager (com.arjuna.mw.wst11.BusinessActivityManager)5