Search in sources :

Example 1 with DuplicateParticipantException

use of com.arjuna.mw.wscf.exceptions.DuplicateParticipantException in project narayana by jbosstm.

the class RegistrarImple method registerWithSubordinate.

private final W3CEndpointReference registerWithSubordinate(final SubordinateBACoordinator theTx, final W3CEndpointReference participantProtocolService, final String protocolIdentifier, final boolean isSecure) throws AlreadyRegisteredException, InvalidProtocolException, InvalidStateException, NoActivityException {
    if (BusinessActivityConstants.WSBA_SUB_PROTOCOL_PARTICIPANT_COMPLETION.equals(protocolIdentifier)) {
        // enlist participant that wraps the requester URI.
        final String id = "PCP" + new Uid().stringForm();
        try {
            // we use a manager which goes direct to the tx rather than via the activity service
            BAParticipantManager manager = new SubordinateBAParticipantManagerImple(theTx, id);
            final ParticipantCompletionCoordinatorEngine engine = new ParticipantCompletionCoordinatorEngine(id, participantProtocolService);
            BusinessAgreementWithParticipantCompletionImple participant = new BusinessAgreementWithParticipantCompletionImple(manager, new BusinessAgreementWithParticipantCompletionStub(engine), id);
            engine.setCoordinator(participant.participantManager());
            theTx.enlistParticipant(participant);
            final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
            return getParticipantManager(BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_SERVICE_QNAME, BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_PORT_QNAME, serviceRegistry.getServiceURI(BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_SERVICE_NAME, isSecure), id);
        } catch (DuplicateParticipantException dpe) {
            throw new AlreadyRegisteredException();
        } catch (Exception ex) {
            throw new InvalidStateException();
        }
    } else if (BusinessActivityConstants.WSBA_SUB_PROTOCOL_COORDINATOR_COMPLETION.equals(protocolIdentifier)) {
        // enlist participant that wraps the requester URI.
        final String id = "CCP" + new Uid().stringForm();
        try {
            BAParticipantManager manager = new SubordinateBAParticipantManagerImple(theTx, id);
            final CoordinatorCompletionCoordinatorEngine engine = new CoordinatorCompletionCoordinatorEngine(id, participantProtocolService);
            BusinessAgreementWithCoordinatorCompletionImple participant = new BusinessAgreementWithCoordinatorCompletionImple(manager, new BusinessAgreementWithCoordinatorCompletionStub(engine), id);
            engine.setCoordinator(participant.participantManager());
            theTx.enlistParticipant(participant);
            final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
            return getParticipantManager(BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_SERVICE_QNAME, BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_PORT_QNAME, serviceRegistry.getServiceURI(BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_SERVICE_NAME, isSecure), id);
        } catch (Exception ex) {
            throw new InvalidStateException();
        }
    } else if (com.arjuna.webservices.wsarjtx.ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION.equals(protocolIdentifier)) {
        throw new InvalidStateException();
    } else {
        wstxLogger.i18NLogger.warn_mwlabs_wst_ba_Registrar11Imple_1(BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, protocolIdentifier);
        throw new InvalidProtocolException();
    }
}
Also used : CoordinatorCompletionCoordinatorEngine(com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine) BusinessAgreementWithCoordinatorCompletionImple(com.arjuna.mwlabs.wst11.ba.participants.BusinessAgreementWithCoordinatorCompletionImple) BusinessAgreementWithParticipantCompletionStub(com.arjuna.wst11.stub.BusinessAgreementWithParticipantCompletionStub) ProtocolNotRegisteredException(com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException) DuplicateParticipantException(com.arjuna.mw.wscf.exceptions.DuplicateParticipantException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) Uid(com.arjuna.ats.arjuna.common.Uid) SubordinateBAParticipantManagerImple(com.arjuna.mwlabs.wst11.ba.remote.SubordinateBAParticipantManagerImple) DuplicateParticipantException(com.arjuna.mw.wscf.exceptions.DuplicateParticipantException) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry) BusinessAgreementWithCoordinatorCompletionStub(com.arjuna.wst11.stub.BusinessAgreementWithCoordinatorCompletionStub) BAParticipantManager(com.arjuna.wst11.BAParticipantManager) ParticipantCompletionCoordinatorEngine(com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine) BusinessAgreementWithParticipantCompletionImple(com.arjuna.mwlabs.wst11.ba.participants.BusinessAgreementWithParticipantCompletionImple)

Aggregations

Uid (com.arjuna.ats.arjuna.common.Uid)1 SystemException (com.arjuna.mw.wsas.exceptions.SystemException)1 DuplicateParticipantException (com.arjuna.mw.wscf.exceptions.DuplicateParticipantException)1 ProtocolNotRegisteredException (com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException)1 BusinessAgreementWithCoordinatorCompletionImple (com.arjuna.mwlabs.wst11.ba.participants.BusinessAgreementWithCoordinatorCompletionImple)1 BusinessAgreementWithParticipantCompletionImple (com.arjuna.mwlabs.wst11.ba.participants.BusinessAgreementWithParticipantCompletionImple)1 SubordinateBAParticipantManagerImple (com.arjuna.mwlabs.wst11.ba.remote.SubordinateBAParticipantManagerImple)1 ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)1 BAParticipantManager (com.arjuna.wst11.BAParticipantManager)1 CoordinatorCompletionCoordinatorEngine (com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine)1 ParticipantCompletionCoordinatorEngine (com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine)1 BusinessAgreementWithCoordinatorCompletionStub (com.arjuna.wst11.stub.BusinessAgreementWithCoordinatorCompletionStub)1 BusinessAgreementWithParticipantCompletionStub (com.arjuna.wst11.stub.BusinessAgreementWithParticipantCompletionStub)1