Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. 
   * See the copyright.txt in the distribution for a full listing 
   * of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  * 
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 package com.arjuna.webservices11.wsba.client;
 
 import  org.jboss.ws.api.addressing.MAPEndpoint;
 import  org.jboss.ws.api.addressing.MAP;
 import  org.jboss.ws.api.addressing.MAPBuilder;
 import  org.jboss.ws.api.addressing.MAPBuilderFactory;
 
The Client side of the Participant Completion Coordinator.

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

    
The completed action.
 
     private String completedAction = null;
    
The fault action.
 
     private String failAction = null;
    
The compensated action.
 
     private String compensatedAction = null;
    
The closed action.
 
     private String closedAction = null;
    
The cancelled action.
 
     private String cancelledAction = null;
    
The exit action.
 
     private String exitAction = null;
    
The cannot complete action.
 
     private String cannotCompleteAction = null;
    
The get status action.
 
     private String getStatusAction = null;
    
The status action.
 
     private String statusAction = null;

    
The participant completion participant URI for replies.
 
     private MAPEndpoint participantCompletionParticipant = null;

    
The participant completion participant URI for secure replies.
    private MAPEndpoint secureParticipantCompletionParticipant = null;

    
Construct the participant completion coordinator client.
    {
        final MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
        final String participantCompletionParticipantURIString =
        final String secureParticipantCompletionParticipantURIString =
         = builder.newEndpoint(participantCompletionParticipantURIString);
         = builder.newEndpoint(secureParticipantCompletionParticipantURIString);
    }

    
Send a completed request.

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

    
Send a fault request.

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

    
Send a compensated request.

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

    
Send a closed request.

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

    
Send a cancelled request.

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

    
Send an exit request.

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

    
Send a cannot complete request.

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

    
Send a get status request.

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

    
Send a status request.

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


    
send a soap fault

Parameters:
soapFault the fault to be sent
participant the endpoint to send the fault to
map addressing context to be used to send the fault
faultAction the action to associate with the message
    public void sendSoapFault(SoapFault11 soapFaultW3CEndpointReference participant, MAP mapString faultAction)
            throws SoapFaultIOException
    {
        AddressingHelper.installNoneReplyTo(map);
        map.setAction(faultAction);
        port = getPort(participantmapfaultAction);
        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.
    {
        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:
participant
map
action
Returns:
    getPort(final W3CEndpointReference participantfinal MAP mapfinal String action)
    {
        AddressingHelper.installNoneReplyTo(map);
        if (participant != null) {
            return WSBAClient.getParticipantCompletionCoordinatorPort(participantactionmap);
        } else {
            return WSBAClient.getParticipantCompletionCoordinatorPort(actionmap);
        }
    }
New to GrepCode? Check out our FAQ X