Search in sources :

Example 1 with ATCoordinator

use of com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator in project narayana by jbosstm.

the class ContextFactoryImple method createSubordinate.

public final Object createSubordinate(String subordinateType) throws NoActivityException, InvalidProtocolException, SystemException {
    try {
        CoordinatorServiceImple coordManager = (CoordinatorServiceImple) _coordManager;
        CoordinatorControl theControl = coordManager.coordinatorControl();
        ATCoordinator subordinateTransaction = theControl.createSubordinate(subordinateType);
        /*
			 * Now add the registrar for this specific coordinator to the
			 * mapper.
			 */
        subordinateTransaction.enlistSynchronization(new CleanupSynchronization(subordinateTransaction.get_uid().stringForm(), _theRegistrar));
        _theRegistrar.associate(subordinateTransaction);
        return subordinateTransaction;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : CleanupSynchronization(com.arjuna.mwlabs.wst11.at.participants.CleanupSynchronization) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) SubordinateATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator) ATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator) CoordinatorServiceImple(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.CoordinatorServiceImple) CoordinatorControl(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.CoordinatorControl) InvalidProtocolException(com.arjuna.wsc.InvalidProtocolException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException)

Example 2 with ATCoordinator

use of com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator 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)

Aggregations

SystemException (com.arjuna.mw.wsas.exceptions.SystemException)2 ATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator)2 ActionHierarchy (com.arjuna.ats.arjuna.coordinator.ActionHierarchy)1 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)1 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)1 CoordinatorControl (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.CoordinatorControl)1 CoordinatorServiceImple (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.CoordinatorServiceImple)1 SubordinateATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator)1 CleanupSynchronization (com.arjuna.mwlabs.wst11.at.participants.CleanupSynchronization)1 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)1 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)1