Search in sources :

Example 11 with InvalidCreateParametersException

use of com.arjuna.wsc.InvalidCreateParametersException in project narayana by jbosstm.

the class UserTransactionImple method startTransaction.

protected final Context startTransaction(int timeout, TxContextImple current) throws com.arjuna.wsc.InvalidCreateParametersException, SystemException {
    try {
        // TODO: tricks for per app _activationCoordinatorService config, perhaps:
        // InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/foo.properties");
        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, AtomicTransactionConstants.WSAT_PROTOCOL, expires, currentContext);
        if (coordinationContext == null) {
            throw new SystemException(wstxLogger.i18NLogger.get_mwlabs_wst_at_remote_UserTransaction11Imple__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) ContextImple(com.arjuna.mwlabs.wst11.at.ContextImple) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple) 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 12 with InvalidCreateParametersException

use of com.arjuna.wsc.InvalidCreateParametersException in project narayana by jbosstm.

the class SubordinateImporter method importContext.

public static TxContext importContext(CoordinationContextType cc) {
    // get the subordinate transaction manager to install any existing
    // subordinate tx for this one or create and install a new one.
    final String identifier = cc.getIdentifier().getValue();
    TxContext subordinateTxContext = subordinateContextMap.get(identifier);
    if (subordinateTxContext == null) {
        // create a context for a local coordinator
        CoordinationContext context = null;
        try {
            context = baContextFactory.create(BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, 0L, cc, false);
        } catch (InvalidCreateParametersException e) {
        // should not happen
        }
        subordinateTxContext = new TxContextImple(context);
        subordinateContextMap.put(identifier, subordinateTxContext);
        // register a cleanup callback with the subordinate transactionso that the entry gets removed
        // when the transcation commits or rolls back
        // remove "urn:" prefix
        String subordinateId = context.getIdentifier().getValue().substring(4);
        SubordinateBACoordinator.SubordinateCallback callback = new SubordinateBACoordinator.SubordinateCallback() {

            public String parentId = identifier;

            public void run() {
                subordinateContextMap.remove(parentId);
            }
        };
        SubordinateBACoordinator.addCallback(subordinateId, callback);
    }
    return subordinateTxContext;
}
Also used : SubordinateBACoordinator(com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator) TxContext(com.arjuna.mw.wst.TxContext) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 13 with InvalidCreateParametersException

use of com.arjuna.wsc.InvalidCreateParametersException in project narayana by jbosstm.

the class UserBusinessActivityImple 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 14 with InvalidCreateParametersException

use of com.arjuna.wsc.InvalidCreateParametersException in project narayana by jbosstm.

the class UserBusinessActivityImple 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 : TxContext(com.arjuna.mw.wst.TxContext) 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)

Aggregations

InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)14 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)12 SystemException (com.arjuna.wst.SystemException)7 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)7 WrongStateException (com.arjuna.wst.WrongStateException)7 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)5 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)4 SoapFault (com.arjuna.webservices.SoapFault)4 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)4 Expires (org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires)4 Context (com.arjuna.mw.wsc11.context.Context)3 TxContext (com.arjuna.mw.wst.TxContext)3 ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)3 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)3 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)3 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)2 SystemException (com.arjuna.mw.wsas.exceptions.SystemException)2 SubordinateBACoordinator (com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator)2 SubordinateATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator)2