Search in sources :

Example 6 with WSCEnvironmentBean

use of org.jboss.jbossts.xts.environment.WSCEnvironmentBean in project narayana by jbosstm.

the class RegistrationCoordinator method registerOperation.

private static RegisterResponseType registerOperation(String messageID, final RegistrationPortType port, final RegisterType registerType) throws CannotRegisterException, InvalidProtocolException, InvalidStateException, SoapFault {
    final WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
    if (!WSCEnvironmentBean.NO_ASYNC_REQUEST.equals(wscEnvironmentBean.getUseAsynchronousRequest())) {
        // using asynchronous request, we have to wait for the response
        AsynchronousRegistrationMapper.getInstance().addClientMessage(messageID);
    }
    RegisterResponseType response;
    if (System.getSecurityManager() == null) {
        response = port.registerOperation(registerType);
    } else {
        response = AccessController.doPrivileged(new PrivilegedAction<RegisterResponseType>() {

            @Override
            public RegisterResponseType run() {
                return port.registerOperation(registerType);
            }
        });
    }
    if (!WSCEnvironmentBean.NO_ASYNC_REQUEST.equals(wscEnvironmentBean.getUseAsynchronousRequest())) {
        // wait until the response arrives
        FaultOrResponse res = AsynchronousRegistrationMapper.getInstance().waitForResponse(messageID, wscEnvironmentBean.getAsyncRequestWait());
        if (res.isFault()) {
            String detail = res.getFault().getFaultstring();
            if (res.getFault().getDetail() != null && res.getFault().getDetail().getAny() != null && !res.getFault().getDetail().getAny().isEmpty()) {
                detail = res.getFault().getDetail().getAny().get(0).toString();
            }
            throwException(res.getFault().getFaultcode(), detail, null, res.getFault());
        } else if (res.isEmpty()) {
            throw new InvalidStateException("No response assigned to messageID " + messageID);
        }
        response = res.getResponse();
    }
    return response;
}
Also used : RegisterResponseType(org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterResponseType) PrivilegedAction(java.security.PrivilegedAction) WSCEnvironmentBean(org.jboss.jbossts.xts.environment.WSCEnvironmentBean)

Example 7 with WSCEnvironmentBean

use of org.jboss.jbossts.xts.environment.WSCEnvironmentBean in project narayana by jbosstm.

the class ATParticipantInitialisation method contextInitialized.

/**
 * The context has been initialized.
 * @param servletContextEvent The servlet context event.
 */
public void contextInitialized(final ServletContextEvent servletContextEvent) {
    ServletContext context = servletContextEvent.getServletContext();
    WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
    String bindAddress = wscEnvironmentBean.getBindAddress11();
    int bindPort = wscEnvironmentBean.getBindPort11();
    String baseURI = "http://" + bindAddress + ":" + bindPort + "/interop11";
    final String uri = baseURI + "/ATParticipantService";
    final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
    serviceRegistry.registerServiceProvider(ATInteropConstants.SERVICE_PARTICIPANT, uri);
}
Also used : WSCEnvironmentBean(org.jboss.jbossts.xts.environment.WSCEnvironmentBean) ServletContext(javax.servlet.ServletContext) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 8 with WSCEnvironmentBean

use of org.jboss.jbossts.xts.environment.WSCEnvironmentBean in project narayana by jbosstm.

the class ATInitiatorInitialisation method contextInitialized.

/**
 * The context has been initialized.
 * @param servletContextEvent The servlet context event.
 */
public void contextInitialized(final ServletContextEvent servletContextEvent) {
    ServletContext context = servletContextEvent.getServletContext();
    WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
    String bindAddress = wscEnvironmentBean.getBindAddress11();
    int bindPort = wscEnvironmentBean.getBindPort11();
    String baseURI = "http://" + bindAddress + ":" + bindPort + "/interop11";
    final String uri = baseURI + "/ATInitiatorService";
    final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
    serviceRegistry.registerServiceProvider(ATInteropConstants.SERVICE_INITIATOR, uri);
}
Also used : WSCEnvironmentBean(org.jboss.jbossts.xts.environment.WSCEnvironmentBean) ServletContext(javax.servlet.ServletContext) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 9 with WSCEnvironmentBean

use of org.jboss.jbossts.xts.environment.WSCEnvironmentBean in project narayana by jbosstm.

the class CoordinatorCompletionParticipantInitialisation method startup.

public static void startup() {
    final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
    WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
    String bindAddress = wscEnvironmentBean.getBindAddress11();
    int bindPort = wscEnvironmentBean.getBindPort11();
    int secureBindPort = wscEnvironmentBean.getBindPortSecure11();
    WSTEnvironmentBean wstEnvironmentBean = XTSPropertyManager.getWSTEnvironmentBean();
    String participantServiceURLPath = wstEnvironmentBean.getParticipantServiceURLPath();
    if (participantServiceURLPath == null) {
        participantServiceURLPath = "/ws-t11-participant";
    }
    if (bindAddress == null) {
        bindAddress = "localhost";
    }
    if (bindPort == 0) {
        bindPort = 8080;
    }
    if (secureBindPort == 0) {
        secureBindPort = 8443;
    }
    final String baseUri = "http://" + bindAddress + ":" + bindPort + participantServiceURLPath;
    final String uri = baseUri + "/" + BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_NAME;
    final String secureBaseUri = "https://" + bindAddress + ":" + secureBindPort + participantServiceURLPath;
    final String secureUri = secureBaseUri + "/" + BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_NAME;
    serviceRegistry.registerServiceProvider(BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_NAME, uri);
    serviceRegistry.registerSecureServiceProvider(BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_NAME, secureUri);
}
Also used : WSTEnvironmentBean(org.jboss.jbossts.xts.environment.WSTEnvironmentBean) WSCEnvironmentBean(org.jboss.jbossts.xts.environment.WSCEnvironmentBean) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 10 with WSCEnvironmentBean

use of org.jboss.jbossts.xts.environment.WSCEnvironmentBean in project narayana by jbosstm.

the class ParticipantCompletionParticipantInitialisation method startup.

public static void startup() {
    final ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
    WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
    String bindAddress = wscEnvironmentBean.getBindAddress11();
    int bindPort = wscEnvironmentBean.getBindPort11();
    int secureBindPort = wscEnvironmentBean.getBindPortSecure11();
    WSTEnvironmentBean wstEnvironmentBean = XTSPropertyManager.getWSTEnvironmentBean();
    String participantServiceURLPath = wstEnvironmentBean.getParticipantServiceURLPath();
    if (participantServiceURLPath == null) {
        participantServiceURLPath = "/ws-t11-participant";
    }
    if (bindAddress == null) {
        bindAddress = "localhost";
    }
    if (bindPort == 0) {
        bindPort = 8080;
    }
    if (secureBindPort == 0) {
        secureBindPort = 8443;
    }
    final String baseUri = "http://" + bindAddress + ":" + bindPort + participantServiceURLPath;
    final String uri = baseUri + "/" + BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_NAME;
    final String secureBaseUri = "https://" + bindAddress + ":" + secureBindPort + participantServiceURLPath;
    final String secureUri = secureBaseUri + "/" + BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_NAME;
    serviceRegistry.registerServiceProvider(BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_NAME, uri);
    serviceRegistry.registerSecureServiceProvider(BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_NAME, secureUri);
}
Also used : WSTEnvironmentBean(org.jboss.jbossts.xts.environment.WSTEnvironmentBean) WSCEnvironmentBean(org.jboss.jbossts.xts.environment.WSCEnvironmentBean) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Aggregations

WSCEnvironmentBean (org.jboss.jbossts.xts.environment.WSCEnvironmentBean)27 ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)22 WSTEnvironmentBean (org.jboss.jbossts.xts.environment.WSTEnvironmentBean)12 ServletContext (javax.servlet.ServletContext)6 PrivilegedAction (java.security.PrivilegedAction)1 XTSService (org.jboss.jbossts.XTSService)1 StartException (org.jboss.msc.service.StartException)1 MAP (org.jboss.ws.api.addressing.MAP)1 ServerConfig (org.jboss.wsf.spi.management.ServerConfig)1 RegisterResponseType (org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterResponseType)1