Search in sources :

Example 41 with ServiceRegistry

use of com.arjuna.webservices11.ServiceRegistry 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 42 with ServiceRegistry

use of com.arjuna.webservices11.ServiceRegistry 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 43 with ServiceRegistry

use of com.arjuna.webservices11.ServiceRegistry in project narayana by jbosstm.

the class UserBusinessActivityImple method getParticipantProtocolService.

private W3CEndpointReference getParticipantProtocolService(final String id, boolean isSecure) {
    // final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
    // final String serviceURI = soapRegistry.getServiceURI(ArjunaTX11Constants.SERVICE_TERMINATION_PARTICIPANT) ;
    final QName serviceId = ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_QNAME;
    final QName endpointId = ArjunaTX11Constants.TERMINATION_PARTICIPANT_PORT_QNAME;
    final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
    final String address = serviceRegistry.getServiceURI(ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_NAME, isSecure);
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.serviceName(serviceId);
    builder.endpointName(endpointId);
    builder.address(address);
    InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
    return builder.build();
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) QName(javax.xml.namespace.QName) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 44 with ServiceRegistry

use of com.arjuna.webservices11.ServiceRegistry in project narayana by jbosstm.

the class ATInteropUtil method getCompletionParticipant.

/**
 * Get an endpoint reference for the completion initiator service.
 * @param id The completion id.
 * @return The endpoint reference.
 */
private static W3CEndpointReference getCompletionParticipant(final String id) {
    final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
    final String serviceURI = serviceRegistry.getServiceURI(AtomicTransactionConstants.COMPLETION_INITIATOR_SERVICE_NAME);
    final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.serviceName(AtomicTransactionConstants.COMPLETION_INITIATOR_SERVICE_QNAME);
    builder.endpointName(AtomicTransactionConstants.COMPLETION_INITIATOR_PORT_QNAME);
    builder.address(serviceURI);
    InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
    return builder.build();
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 45 with ServiceRegistry

use of com.arjuna.webservices11.ServiceRegistry in project narayana by jbosstm.

the class ATInteropUtil method getParticipant.

/**
 * Get an endpoint reference for the participant service.
 * @param id The participant id.
 * @return The endpoint reference.
 */
private static W3CEndpointReference getParticipant(final String id) {
    final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
    final String serviceURI = serviceRegistry.getServiceURI(AtomicTransactionConstants.PARTICIPANT_SERVICE_NAME);
    final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.serviceName(AtomicTransactionConstants.PARTICIPANT_SERVICE_QNAME);
    builder.endpointName(AtomicTransactionConstants.PARTICIPANT_PORT_QNAME);
    builder.address(serviceURI);
    InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
    return builder.build();
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Aggregations

ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)53 WSCEnvironmentBean (org.jboss.jbossts.xts.environment.WSCEnvironmentBean)22 W3CEndpointReferenceBuilder (javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)16 WSTEnvironmentBean (org.jboss.jbossts.xts.environment.WSTEnvironmentBean)12 QName (javax.xml.namespace.QName)7 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)7 SystemException (com.arjuna.mw.wsas.exceptions.SystemException)6 ServletContext (javax.servlet.ServletContext)6 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)5 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)5 Expires (org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires)5 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)4 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)4 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)4 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)4 SubordinateBACoordinator (com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator)3 Uid (com.arjuna.ats.arjuna.common.Uid)2 DuplicateParticipantException (com.arjuna.mw.wscf.exceptions.DuplicateParticipantException)2 ProtocolNotRegisteredException (com.arjuna.mw.wscf.exceptions.ProtocolNotRegisteredException)2 SubordinateATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator)2