Search in sources :

Example 26 with SystemException

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

the class ArjunaContextImple method initialiseContext.

public void initialiseContext(Object param) {
    try {
        ATCoordinator currentCoordinator = (ATCoordinator) param;
        ActivityHierarchy hier = null;
        try {
            hier = UserActivityFactory.userActivity().currentActivity();
        } catch (SystemException ex) {
            ex.printStackTrace();
        }
        if ((currentCoordinator != null) && (hier != null)) {
            /*
				 * Do the manditory stuff first.
				 */
            ActionHierarchy txHier = currentCoordinator.getHierarchy();
            final int depth = txHier.depth();
            _identifierValues = new String[depth];
            _expiresValues = new int[depth];
            _identifierValues[0] = txHier.getDeepestActionUid().stringForm();
            _expiresValues[0] = hier.activity(hier.size() - 1).getTimeout();
            /*
				 * Now let's do the optional stuff.
				 */
            for (int count = 1, index = 0; count < depth; count++, index++) {
                _identifierValues[count] = txHier.getActionUid(index).stringForm();
                _expiresValues[count] = hier.activity(index).getTimeout();
            }
        }
    } catch (ClassCastException ex) {
        throw new IllegalArgumentException();
    }
}
Also used : SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator) ActionHierarchy(com.arjuna.ats.arjuna.coordinator.ActionHierarchy) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy)

Example 27 with SystemException

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

the class ATCoordinator method changeParticipantStatus.

private final void changeParticipantStatus(String participantId, int status) throws InvalidParticipantException, SystemException {
    /*
		 * Transaction is active, so we can look at the pendingList only.
		 */
    // TODO allow transaction status to be changed during commit - exit
    // could come in late
    boolean found = false;
    if (pendingList != null) {
        RecordListIterator iter = new RecordListIterator(pendingList);
        AbstractRecord absRec = iter.iterate();
        try {
            while ((absRec != null) && !found) {
                if (absRec instanceof ParticipantRecord) {
                    ParticipantRecord pr = (ParticipantRecord) absRec;
                    Participant participant = (Participant) pr.value();
                    if (participantId.equals(participant.id())) {
                        found = true;
                        if (status == READONLY)
                            pr.readonly();
                        else
                            pr.rolledback();
                    }
                }
                absRec = iter.iterate();
            }
        } catch (Exception ex) {
            throw new SystemException(ex.toString());
        }
    }
    if (!found)
        throw new InvalidParticipantException();
}
Also used : SystemException(com.arjuna.mw.wsas.exceptions.SystemException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException)

Example 28 with SystemException

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

the class CoordinatorManagerFactory method coordinatorManager.

/**
 * 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.
 */
/*
     * Have the type specified in XML. More data may be specified, which
     * can be passed to the implementation in the same way ObjectName was.
     */
public static CoordinatorManager coordinatorManager(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.coordinatorManager();
    } 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 29 with SystemException

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

the class CoordinatorManagerFactory method coordinatorManager.

/**
 * 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.
 */
/*
     * Have the type specified in XML. More data may be specified, which
     * can be passed to the implementation in the same way ObjectName was.
     */
public static CoordinatorManager coordinatorManager(String protocol) throws ProtocolNotRegisteredException, SystemException {
    try {
        TwoPhaseHLS coordHLS;
        synchronized (_implementations) {
            coordHLS = (TwoPhaseHLS) _implementations.get(protocol);
            if (coordHLS == null) {
                coordHLS = (TwoPhaseHLS) _protocolManager.getProtocolImplementation(protocol);
                _implementations.put(protocol, coordHLS);
            }
            return coordHLS.coordinatorManager();
        }
    } 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) TwoPhaseHLS(com.arjuna.mw.wscf.model.twophase.hls.TwoPhaseHLS) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ProtocolNotRegisteredException(com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException)

Example 30 with SystemException

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

the class CoordinatorControl method parentCoordinator.

private final BACoordinator parentCoordinator() throws SystemException {
    try {
        ActivityHierarchy hier = UserActivityFactory.userActivity().currentActivity();
        ActivityHandleImple parentActivity = null;
        BACoordinator parentCoordinator = null;
        if (hier.size() > 1) {
            parentActivity = (ActivityHandleImple) hier.activity(hier.size() - 2);
            parentCoordinator = (BACoordinator) _coordinators.get(parentActivity);
        }
        return parentCoordinator;
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}
Also used : ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) ActivityHandleImple(com.arjuna.mwlabs.wsas.activity.ActivityHandleImple) SubordinateBACoordinator(com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator) 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)

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