Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.arjuna.webservices11.wsat.client;
  
  import  org.jboss.ws.api.addressing.MAPBuilder;
  import  org.jboss.ws.api.addressing.MAP;
  import  org.jboss.ws.api.addressing.MAPBuilderFactory;
  
 import java.util.Map;

Created by IntelliJ IDEA. User: adinn Date: Oct 7, 2007 Time: 3:14:28 PM To change this template use File | Settings | File Templates.
 
 public class WSATClient
 {
     // TODO -- do we really need a thread local here or can we just use one service?
     
thread local which maintains a per thread coordinator service instance
 
     private static ThreadLocal<CoordinatorServicecoordinatorService = new ThreadLocal<CoordinatorService>();

    
thread local which maintains a per thread participant service instance
 
     private static ThreadLocal<ParticipantServiceparticipantService = new ThreadLocal<ParticipantService>();

    
thread local which maintains a per thread completion coordinator service instance
 
thread local which maintains a per thread completion initiator service instance
 
thread local which maintains a per thread completion coordinator service instance
 
builder used to construct addressing info for calls
 
     private static MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();

    
fetch a coordinator service unique to the current thread

Returns:
 
     private static synchronized CoordinatorService getCoordinatorService()
     {
         if (.get() == null) {
             //coordinatorService.set(new CoordinatorService(null, new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "CoordinatorService")));
             .set(new CoordinatorService());
         }
         return .get();
     }

    
fetch a participant service unique to the current thread

Returns:
 
     private static synchronized ParticipantService getParticipantService()
     {
         if (.get() == null) {
             //participantService.set(new ParticipantService(null, new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "ParticipantService")));
             .set(new ParticipantService());
         }
         return .get();
     }

    
fetch a completion coordinator service unique to the current thread

Returns:
 
     private static synchronized CompletionCoordinatorService getCompletionCoordinatorService()
     {
         if (.get() == null) {
             //completionCoordinatorService.set(new CompletionCoordinatorService(null, new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "CompletionCoordinatorService")));
         }
         return .get();
     }

    
fetch a completion initiator service unique to the current thread

Returns:
 
     private static synchronized CompletionInitiatorService getCompletionInitiatorService()
     {
         if (.get() == null) {
            //completionInitiatorService.set(new CompletionInitiatorService(null, new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "CompletionInitiatorService")));
        }
        return .get();
    }

    
fetch an RPC completion coordinator service unique to the current thread

Returns:
    {
        if (.get() == null) {
        }
        return .get();
    }
    // fetch ports when we HAVE an endpoint
    public static CoordinatorPortType getCoordinatorPort(W3CEndpointReference endpointReference,
                                                         String action,
                                                         MAP map)
    {
        CoordinatorService service = getCoordinatorService();
        CoordinatorPortType port = service.getPort(endpointReferenceCoordinatorPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configureEndpointPort(bindingProvideractionmap);
        return port;
    }
    public static ParticipantPortType getParticipantPort(W3CEndpointReference endpointReference,
                                                         String action,
                                                         MAP map)
    {
        ParticipantService service = getParticipantService();
        ParticipantPortType port = service.getPort(endpointReferenceParticipantPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configureEndpointPort(bindingProvideractionmap);
        return port;
    }
                                                                             String action,
                                                                             MAP map)
    {
        CompletionCoordinatorPortType port = service.getPort(endpointReferenceCompletionCoordinatorPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configureEndpointPort(bindingProvideractionmap);
        return port;
    }
                                                                         String action,
                                                                         MAP map)
    {
        CompletionInitiatorPortType port = service.getPort(endpointReferenceCompletionInitiatorPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configureEndpointPort(bindingProvideractionmap);
        return port;
    }
                                                                             String action,
                                                                             MAP map)
    {
        CompletionCoordinatorRPCPortType port = service.getPort(endpointReferenceCompletionCoordinatorRPCPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configureEndpointPort(bindingProvideractionmap);
        return port;
    }
    // fetch ports when we have NO endpoint
    public static CoordinatorPortType getCoordinatorPort(String action,
                                                         MAP map)
    {
        CoordinatorService service = getCoordinatorService();
        CoordinatorPortType port = service.getPort(CoordinatorPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configurePort(bindingProvideractionmap);
        return port;
    }
    public static ParticipantPortType getParticipantPort(String action,
                                                         MAP map)
    {
        ParticipantService service = getParticipantService();
        ParticipantPortType port = service.getPort(ParticipantPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configurePort(bindingProvideractionmap);
        return port;
    }
                                                                             MAP map)
    {
        CompletionCoordinatorPortType port = service.getPort(CompletionCoordinatorPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configurePort(bindingProvideractionmap);
        return port;
    }
                                                                         MAP map)
    {
        CompletionInitiatorPortType port = service.getPort(CompletionInitiatorPortType.classnew AddressingFeature(truetrue));
        BindingProvider bindingProvider = (BindingProvider)port;
        configurePort(bindingProvideractionmap);
        return port;
    }
    private static void configureEndpointPort(BindingProvider bindingProviderString action, MAP map)
    {
        /*
         * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
        List<Handler> customHandlerChain = new ArrayList<Handler>();
        customHandlerChain.add(new WSAddressingClientHandler());
        bindingProvider.getBinding().setHandlerChain(customHandlerChain);
         */
        Map<StringObjectrequestContext = bindingProvider.getRequestContext();
        MAP requestMap = AddressingHelper.outboundMap(requestContext);
        map.setAction(action);
        AddressingHelper.installCallerProperties(maprequestMap);
        AddressingHelper.configureRequestContext(requestContextrequestMap.getTo(), action);
    }
    private static void configurePort(BindingProvider bindingProvider,
                                      String action,
                                      MAP map)
    {
        /*
         * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
        List<Handler> customHandlerChain = new ArrayList<Handler>();
        customHandlerChain.add(new WSAddressingClientHandler());
        bindingProvider.getBinding().setHandlerChain(customHandlerChain);
         */
        Map<StringObjectrequestContext = bindingProvider.getRequestContext();
        map.setAction(action);
        AddressingHelper.configureRequestContext(requestContextmapmap.getTo(), action);
    }
New to GrepCode? Check out our FAQ X