Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.arjuna.webservices11.wsat.client;
  
 import  org.jboss.ws.api.addressing.MAPEndpoint;
 import  org.jboss.ws.api.addressing.MAPBuilder;
 import  org.jboss.ws.api.addressing.MAP;
 import  org.jboss.ws.api.addressing.MAPBuilderFactory;
 
The Client side of the Coordinator.

Author(s):
kevin
 
 public class CoordinatorClient
 {
    
The client singleton.
 
     private static final CoordinatorClient CLIENT = new CoordinatorClient() ;

    
The prepared action.
 
     private String preparedAction = null;
    
The aborted action.
 
     private String abortedAction = null;
    
The read only action.
 
     private String readOnlyAction = null;
    
The committed action.
 
     private String committedAction = null;
    
The fault action.
 
     private String faultAction = null;

    
The participant URI for replies.
 
     private MAPEndpoint participant ;

    
The participant URI for secure replies.
 
     private MAPEndpoint secureParticipant ;

    
Construct the coordinator client.
 
     private CoordinatorClient()
     {
         final MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
 
         final String participantURIString =
             ServiceRegistry.getRegistry().getServiceURI(.false);
         final String secureParticipantURIString =
             ServiceRegistry.getRegistry().getServiceURI(.true);
          = builder.newEndpoint(participantURIString);
          = builder.newEndpoint(secureParticipantURIString);
     }

    
Send a prepared request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any SOAP errors.
java.io.IOException for any transport errors.
 
     public void sendPrepared(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
         throws SoapFaultIOException
     {
         MAPEndpoint participant = getParticipant(endpointmap);
         AddressingHelper.installFromFaultTo(mapparticipantidentifier);
         CoordinatorPortType port = getPort(endpointmap);
         Notification prepared = new Notification();
 
         port.preparedOperation(prepared);
    }

    
Send an aborted request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any SOAP errors.
java.io.IOException for any transport errors.
    public void sendAborted(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint participant = getParticipant(endpointmap);
        AddressingHelper.installFaultTo(mapparticipantidentifier);
        CoordinatorPortType port = getPort(endpointmap);
        Notification aborted = new Notification();
        port.abortedOperation(aborted);
    }

    
Send a read only request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any SOAP errors.
java.io.IOException for any transport errors.
    public void sendReadOnly(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint participant = getParticipant(endpointmap);
        AddressingHelper.installFaultTo(mapparticipantidentifier);
        CoordinatorPortType port = getPort(endpointmap);
        Notification readOnly = new Notification();
        port.readOnlyOperation(readOnly);
    }

    
Send a committed request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any SOAP errors.
java.io.IOException for any transport errors.
    public void sendCommitted(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint participant = getParticipant(endpointmap);
        AddressingHelper.installFaultTo(mapparticipantidentifier);
        CoordinatorPortType port = getPort(endpointmap);
        Notification committed = new Notification();
        port.committedOperation(committed);
    }

    
Send a fault.

Parameters:
map The addressing context.
soapFault The SOAP fault.
identifier The arjuna instance identifier.
Throws:
com.arjuna.webservices.SoapFault For any SOAP errors.
java.io.IOException for any transport errors.
    public void sendSoapFault(final W3CEndpointReference endpointfinal MAP mapfinal SoapFault soapFaultfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        CoordinatorPortType port = getPort(endpointmap);
        // convert fault to the wire format and dispatch it to the initiator
        soapFault.setAction() ;
        Fault fault = ((SoapFault11)soapFault).toFault();
        port.soapFault(fault);
    }

    
return a participant endpoint appropriate to the type of coordinator

Parameters:
endpoint
Returns:
either the secure participant endpoint or the non-secure endpoint
    MAPEndpoint getParticipant(W3CEndpointReference endpoint, MAP map)
    {
        String address;
        if (endpoint != null) {
            NativeEndpointReference nativeRef = EndpointHelper.transform(NativeEndpointReference.classendpoint);
            address = nativeRef.getAddress();
        } else {
            address = map.getTo();
        }
        if (address.startsWith("https")) {
            return ;
        } else {
            return ;
        }
    }

    
Get the Completion Coordinator client singleton.

Returns:
The Completion Coordinator client singleton.
    public static CoordinatorClient getClient()
    {
        return ;
    }

    
obtain a port from the coordinator endpoint configured with the instance identifier handler and the supplied addressing properties supplemented with the given action

Parameters:
endpoint
map
action
Returns:
    private CoordinatorPortType getPort(final W3CEndpointReference endpoint,
                                                final MAP map,
                                                final String action)
    {
        AddressingHelper.installNoneReplyTo(map);
        if (endpoint != null) {
            return WSATClient.getCoordinatorPort(endpointactionmap);
        } else {
            return WSATClient.getCoordinatorPort(actionmap);
        }
    }
New to GrepCode? Check out our FAQ X