use of com.arjuna.mwlabs.wst11.ba.remote.SubordinateBAParticipantManagerImple 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();
}
}
Aggregations