Search in sources :

Example 11 with SystemException

use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.

the class TwoPhaseHLSImple method context.

/**
 * Return the context augmentation for this HLS, if any on the current
 * activity.
 *
 * @return a context object or null if no augmentation is necessary.
 */
public Context context() throws SystemException {
    ensureContextInitialised();
    if (CONTEXT_IMPLE_CLASS != null) {
        try {
            SOAPContext ctx = (SOAPContext) CONTEXT_IMPLE_CLASS.newInstance();
            ctx.initialiseContext(_coordManager.currentCoordinator());
            return ctx;
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new SystemException(ex.toString());
        }
    } else {
        throw new SystemException("Unable to create SOAPContext for Two Phase 1.1 service");
    }
}
Also used : SystemException(com.arjuna.mw.wsas.exceptions.SystemException) SOAPContext(com.arjuna.mw.wsas.context.soap.SOAPContext) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException)

Example 12 with SystemException

use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.

the class CoordinatorControl method begin.

/**
 * An activity has begun and is active on the current thread.
 */
public void begin() throws SystemException {
    try {
        ATCoordinator coord = new ATCoordinator();
        int status = coord.start(parentCoordinator());
        if (status != ActionStatus.RUNNING)
            throw new BegunFailedException(wscfLogger.i18NLogger.get_model_twophase_arjunacore_CoordinatorControl_1() + ActionStatus.stringForm(status));
        else {
            _coordinators.put(currentActivity(), coord);
        }
    } catch (SystemException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new UnexpectedException(ex.toString());
    }
}
Also used : SystemException(com.arjuna.mw.wsas.exceptions.SystemException) SubordinateATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException)

Example 13 with SystemException

use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.

the class CoordinatorControl method createSubordinate.

/**
 * Create a subordinate transaction, i.e., one which can be driven
 * through prepare, commit and rollback. Such a transaction is not
 * interposed with any parent transaction because the parent may
 * be physically remote from the child. Such interposition is the
 * responsibility of the invoker.
 *
 * @return the subordinate transaction. The transaction is not
 * associated with the thread and is not interposed. It is running.
 *
 * @throws SystemException throw if any error occurs.
 */
public final ATCoordinator createSubordinate(String subordinateType) throws SystemException {
    try {
        SubordinateATCoordinator coord = new SubordinateATCoordinator(subordinateType);
        int status = coord.start(null);
        if (status != ActionStatus.RUNNING) {
            throw new BegunFailedException(wscfLogger.i18NLogger.get_model_twophase_arjunacore_CoordinatorControl_1() + ActionStatus.stringForm(status));
        } else {
            return coord;
        }
    } catch (SystemException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new UnexpectedException(ex.toString());
    }
}
Also used : SubordinateATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException)

Example 14 with SystemException

use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.

the class UserCoordinatorFactory method userCoordinator.

/**
 * Obtain a reference to a coordinator that implements the specified
 * protocol.
 *
 * @param protocol The XML definition of the type of
 * coordination protocol required.
 *
 * @exception com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException Thrown if the requested
 * protocol is not available.
 *
 * @return the CoordinatorManager implementation to use.
 */
public static UserCoordinator userCoordinator(String protocol) throws ProtocolNotRegisteredException, SystemException {
    try {
        SagasHLS coordHLS;
        synchronized (_implementations) {
            coordHLS = (SagasHLS) _implementations.get(protocol);
            if (coordHLS == null) {
                coordHLS = (SagasHLS) _protocolManager.getProtocolImplementation(protocol);
                _implementations.put(protocol, coordHLS);
            }
            return coordHLS.userCoordinator();
        }
    } catch (ProtocolNotRegisteredException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ProtocolNotRegisteredException(com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException) SagasHLS(com.arjuna.mw.wscf.model.sagas.hls.SagasHLS) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ProtocolNotRegisteredException(com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException)

Example 15 with SystemException

use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.

the class UserActivityImple method end.

/**
 * Complete the activity with the completion status provided.
 *
 * @exception InvalidActivityException Thrown if the current activity is
 * invalid in the execution environment.
 * @exception ActiveChildException Thrown if the current activity is a
 * @exception WrongStateException Thrown if the current activity is not in a
 * state that allows it to be completed, or is incompatible with the
 * completion status provided.
 * @exception ProtocolViolationException Thrown if the a violation of the
 * activity service or HLS protocol occurs.
 * @exception NoActivityException Thrown if there is no activity
 * associated with the invoking thread or none with the given type of coordinator.
 * @exception NoPermissionException Thrown if the invoking thread does
 * not have permission to terminate the transaction.
 * @exception SystemException Thrown if some other error occurred.
 *
 * @return the result of completing the activity. Null is valid and must
 * be interpreted within the context of any HLS that may exist.
 *
 * @see com.arjuna.mw.wsas.activity.Outcome
 * @message com.arjuna.mwlabs.wsas.UserActivityImple_2 [com.arjuna.mwlabs.wsas.UserActivityImple_2] - currentActivity.end threw:
 * @message com.arjuna.mwlabs.wsas.UserActivityImple_3 [com.arjuna.mwlabs.wsas.UserActivityImple_3] - Activity.completed caught:
 */
public Outcome end() throws InvalidActivityException, WrongStateException, ProtocolViolationException, SystemException, NoActivityException, SystemException, NoPermissionException, ActiveChildException {
    ActivityImple currentActivity = current();
    if (currentActivity == null) {
        throw new NoActivityException();
    }
    Outcome res = null;
    String serviceType = currentActivity.serviceType();
    try {
        res = currentActivity.end();
    } catch (Exception ex) {
        wsasLogger.i18NLogger.warn_UserActivityImple_1(ex);
    }
    HLS hls = HLSManager.getHighLevelService(serviceType);
    if (hls != null) {
        try {
            hls.completed();
        } catch (SystemException ex) {
            wsasLogger.i18NLogger.warn_UserActivityImple_3(ex);
        }
    }
    pop();
    return res;
}
Also used : SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ActivityImple(com.arjuna.mwlabs.wsas.activity.ActivityImple) Outcome(com.arjuna.mw.wsas.activity.Outcome) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) EmptyStackException(java.util.EmptyStackException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) InvalidTimeoutException(com.arjuna.mw.wsas.exceptions.InvalidTimeoutException) ActiveChildException(com.arjuna.mw.wsas.exceptions.ActiveChildException) NoPermissionException(com.arjuna.mw.wsas.exceptions.NoPermissionException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) InvalidActivityException(com.arjuna.mw.wsas.exceptions.InvalidActivityException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException) HLS(com.arjuna.mw.wsas.activity.HLS)

Aggregations

SystemException (com.arjuna.mw.wsas.exceptions.SystemException)32 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)16 WrongStateException (com.arjuna.mw.wsas.exceptions.WrongStateException)16 ProtocolViolationException (com.arjuna.mw.wsas.exceptions.ProtocolViolationException)15 SubordinateATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator)7 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)6 HLS (com.arjuna.mw.wsas.activity.HLS)6 ProtocolNotRegisteredException (com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException)6 SubordinateBACoordinator (com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator)6 InvalidActivityException (com.arjuna.mw.wsas.exceptions.InvalidActivityException)5 InvalidTimeoutException (com.arjuna.mw.wsas.exceptions.InvalidTimeoutException)5 NoPermissionException (com.arjuna.mw.wsas.exceptions.NoPermissionException)5 ActivityImple (com.arjuna.mwlabs.wsas.activity.ActivityImple)5 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)5 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)5 SOAPContext (com.arjuna.mw.wsas.context.soap.SOAPContext)4 ActiveChildException (com.arjuna.mw.wsas.exceptions.ActiveChildException)4 ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)4 EmptyStackException (java.util.EmptyStackException)4 Outcome (com.arjuna.mw.wsas.activity.Outcome)3