Search in sources :

Example 21 with TxContextImple

use of com.arjuna.mwlabs.wst11.ba.context.TxContextImple in project narayana by jbosstm.

the class BusinessActivityManagerImple method enlistForBusinessAgreementWithParticipantCompletion.

public BAParticipantManager enlistForBusinessAgreementWithParticipantCompletion(BusinessAgreementWithParticipantCompletionParticipant bap, String id) throws WrongStateException, UnknownTransactionException, SystemException {
    final QName service = BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_QNAME;
    final QName endpoint = BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_PORT_QNAME;
    try {
        boolean isSecure = ((TxContextImple) currentTransaction()).isSecure();
        final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
        final String address = serviceRegistry.getServiceURI(BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_NAME, isSecure);
        final W3CEndpointReference participant = getParticipant(service, endpoint, address, id);
        W3CEndpointReference baPMEndpoint = registerParticipant(participant, BusinessActivityConstants.WSBA_SUB_PROTOCOL_PARTICIPANT_COMPLETION);
        final ParticipantCompletionParticipantEngine engine = new ParticipantCompletionParticipantEngine(id, baPMEndpoint, bap);
        ParticipantCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id);
        return new BAParticipantCompletionParticipantManagerStub(engine);
    } catch (com.arjuna.wsc.InvalidProtocolException ex) {
        throw new SystemException(ex.toString());
    } catch (com.arjuna.wsc.InvalidStateException ex) {
        throw new WrongStateException();
    } catch (com.arjuna.wsc.CannotRegisterException ex) {
        throw new UnknownTransactionException();
    } catch (Throwable ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    }
}
Also used : ParticipantCompletionParticipantEngine(com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine) QName(javax.xml.namespace.QName) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) BAParticipantCompletionParticipantManagerStub(com.arjuna.wst11.stub.BAParticipantCompletionParticipantManagerStub) CannotRegisterException(com.arjuna.wsc.CannotRegisterException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 22 with TxContextImple

use of com.arjuna.mwlabs.wst11.ba.context.TxContextImple in project narayana by jbosstm.

the class BusinessActivityManagerImple method enlistForBusinessAgreementWithCoordinatorCompletion.

public com.arjuna.wst11.BAParticipantManager enlistForBusinessAgreementWithCoordinatorCompletion(BusinessAgreementWithCoordinatorCompletionParticipant bawcp, String id) throws WrongStateException, UnknownTransactionException, SystemException {
    final QName service = BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_QNAME;
    final QName endpoint = BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_PORT_QNAME;
    boolean isSecure = ((TxContextImple) currentTransaction()).isSecure();
    try {
        final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
        final String address = serviceRegistry.getServiceURI(BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_NAME, isSecure);
        final W3CEndpointReference participant = getParticipant(service, endpoint, address, id);
        W3CEndpointReference baPMEndpoint = registerParticipant(participant, BusinessActivityConstants.WSBA_SUB_PROTOCOL_COORDINATOR_COMPLETION);
        final CoordinatorCompletionParticipantEngine engine = new CoordinatorCompletionParticipantEngine(id, baPMEndpoint, bawcp);
        CoordinatorCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id);
        return new BACoordinatorCompletionParticipantManagerStub(engine);
    } catch (com.arjuna.wsc.InvalidProtocolException ex) {
        throw new SystemException(ex.toString());
    } catch (com.arjuna.wsc.InvalidStateException ex) {
        throw new WrongStateException();
    } catch (com.arjuna.wsc.CannotRegisterException ex) {
        ex.printStackTrace();
        throw new UnknownTransactionException();
    } catch (Throwable ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    }
}
Also used : CoordinatorCompletionParticipantEngine(com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine) QName(javax.xml.namespace.QName) BACoordinatorCompletionParticipantManagerStub(com.arjuna.wst11.stub.BACoordinatorCompletionParticipantManagerStub) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) CannotRegisterException(com.arjuna.wsc.CannotRegisterException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 23 with TxContextImple

use of com.arjuna.mwlabs.wst11.ba.context.TxContextImple in project narayana by jbosstm.

the class BusinessActivityManagerImple method registerParticipant.

private final W3CEndpointReference registerParticipant(final W3CEndpointReference participant, final String protocol) throws com.arjuna.wsc.InvalidProtocolException, com.arjuna.wsc.InvalidStateException, com.arjuna.wsc.CannotRegisterException, SystemException {
    TxContextImple currentTx = null;
    try {
        currentTx = (TxContextImple) _ctxManager.currentTransaction();
        if (currentTx == null)
            throw new com.arjuna.wsc.NoActivityException();
        final CoordinationContextType coordinationContext = currentTx.context().getCoordinationContext();
        final String messageId = MessageId.getMessageId();
        return RegistrationCoordinator.register(coordinationContext, messageId, participant, protocol);
    } catch (final SoapFault sf) {
        throw new SystemException(sf.getMessage());
    } catch (CannotRegisterException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    } finally {
        try {
            if (currentTx != null)
                _ctxManager.resume(currentTx);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CannotRegisterException(com.arjuna.wsc.CannotRegisterException) CannotRegisterException(com.arjuna.wsc.CannotRegisterException)

Example 24 with TxContextImple

use of com.arjuna.mwlabs.wst11.ba.context.TxContextImple in project narayana by jbosstm.

the class UserBusinessActivityImple method beginSubordinate.

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.ba.context.TxContextImple)

Example 25 with TxContextImple

use of com.arjuna.mwlabs.wst11.ba.context.TxContextImple in project narayana by jbosstm.

the class UserBusinessActivityImple method complete.

public void complete() throws UnknownTransactionException, SystemException, WrongStateException {
    try {
        final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction());
        if (ctx == null) {
            throw new WrongStateException();
        }
        final String id = ctx.identifier();
        final W3CEndpointReference terminatorCoordinator = getTerminationCoordinator(ctx);
        BusinessActivityTerminatorStub terminatorStub = new BusinessActivityTerminatorStub(id, terminatorCoordinator);
        terminatorStub.complete();
    } catch (SystemException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) BusinessActivityTerminatorStub(com.arjuna.wst11.stub.BusinessActivityTerminatorStub) 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)

Aggregations

InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)22 SystemException (com.arjuna.wst.SystemException)22 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)22 WrongStateException (com.arjuna.wst.WrongStateException)22 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)17 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)15 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)14 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)14 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)12 TxContext (com.arjuna.mw.wst.TxContext)9 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)9 Context (com.arjuna.mw.wsc11.context.Context)7 CannotRegisterException (com.arjuna.wsc.CannotRegisterException)7 SoapFault (com.arjuna.webservices.SoapFault)6 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)4 InvalidStateException (com.arjuna.wsc.InvalidStateException)4 BusinessActivityTerminatorRPCStub (com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub)3 BusinessActivityTerminatorStub (com.arjuna.wst11.stub.BusinessActivityTerminatorStub)3 ContextImple (com.arjuna.mwlabs.wst11.at.ContextImple)2 ContextImple (com.arjuna.mwlabs.wst11.ba.ContextImple)2