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.wsarjtx.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 Terminator Coordinator.

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

    
The completed action.
 
     private String completedAction = null;
    
The closed action.
 
     private String closedAction = null;
    
The cancelled action.
 
     private String cancelledAction = null;
    
The faulted action.
 
     private String faultedAction = null;
    
The SOAP fault action.
 
     private String soapFaultAction = null;

    
The participant URI for replies.
 
     private MAPEndpoint terminationCoordinator ;

    
The participant URI for securereplies.
 
     private MAPEndpoint secureTerminationCoordinator ;

    
Construct the terminator coordinator client.
 
     private TerminationParticipantClient()
     {
         final MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
 
         final String terminationCoordinatorURIString =
            ServiceRegistry.getRegistry().getServiceURI(.false);
        final String secureTerminationCoordinatorURIString =
         = builder.newEndpoint(terminationCoordinatorURIString);
         = builder.newEndpoint(secureTerminationCoordinatorURIString);
    }

    
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(final W3CEndpointReference participantfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint coordinator = getCoordinator(participant);
        AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
        final TerminationParticipantPortType port = getPort(participantmapidentifier);
        final NotificationType completed = new NotificationType();
        port.completedOperation(completed);
    }

    
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(final W3CEndpointReference participantfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint coordinator = getCoordinator(participant);
        AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
        final TerminationParticipantPortType port = getPort(participantmapidentifier);
        final 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(final W3CEndpointReference participant,final MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint coordinator = getCoordinator(participant);
        AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
        final TerminationParticipantPortType port = getPort(participantmapidentifier);
        final NotificationType cancelled = new NotificationType();
        port.cancelledOperation(cancelled);
    }

    
Send a faulted 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 sendFaulted(final W3CEndpointReference participantfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint coordinator = getCoordinator(participant);
        AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
        final TerminationParticipantPortType port = getPort(participantmapidentifier);
        final NotificationType faulted = new NotificationType();
        port.faultedOperation(faulted);
    }

    
Send a fault.

Parameters:
endpoint the endpoint reference to notify
map The addressing context.
soapFault The SOAP fault.
identifier The arjuna instance identifier.
Throws:
com.arjuna.webservices.SoapFault For any errors.
java.io.IOException for any transport errors.
    public void sendSoapFault(final W3CEndpointReference endpointfinal MAP mapfinal SoapFault soapFaultfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        //AddressingHelper.installFrom(map, terminationCoordinator, identifier);
        AddressingHelper.installNoneReplyTo(map);
        final TerminationParticipantPortType port = getPort(endpointmapidentifier);
        SoapFault11 soapFault11 = (SoapFault11)soapFault;
        Fault fault = soapFault11.toFault();
        port.faultOperation(fault);
    }

    
Send a fault.

Parameters:
map The addressing context.
soapFault The SOAP fault.
identifier The arjuna instance identifier.
Throws:
com.arjuna.webservices.SoapFault For any errors.
java.io.IOException for any transport errors.
    public void sendSoapFault(final SoapFault soapFaultfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        final TerminationParticipantPortType port = getPort(mapidentifier);
        SoapFault11 soapFault11 = (SoapFault11)soapFault;
        Fault fault = soapFault11.toFault();
        port.faultOperation(fault);
    }

    
return a coordinator endpoint appropriate to the type of participant

Parameters:
participant
Returns:
either the secure terminaton participant endpoint or the non-secure endpoint
    MAPEndpoint getCoordinator(W3CEndpointReference participant)
    {
        NativeEndpointReference nativeRef = EndpointHelper.transform(NativeEndpointReference.classparticipant);
        String address = nativeRef.getAddress();
        if (address.startsWith("https")) {
            return ;
        } else {
            return ;
        }
    }

    
Get the Terminator Coordinator client singleton.

Returns:
The Terminator Coordinator client singleton.
    public static TerminationParticipantClient getClient()
    {
        return  ;
    }
                                                   final MAP map,
                                                   final InstanceIdentifier identifier,
                                                   final String action)
    {
        // we only need the message id from the addressing properties as the address is already wrapped up
        // in the ednpoint reference. also the identifier should already be installed in the endpoint
        // reference as a reference parameter so we don't need that either
        return WSARJTXClient.getTerminationParticipantPort(endpointactionmap);
    }
    private TerminationParticipantPortType getPort(final MAP map,
                                                   final InstanceIdentifier identifier,
                                                   final String action)
    {
        // create a port specific to the incoming addressing properties
        AddressingHelper.installNoneReplyTo(map);
        return WSARJTXClient.getTerminationParticipantPort(identifieractionmap);
    }
New to GrepCode? Check out our FAQ X