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 Participant.

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

    
The complete action.
 
     private String completeAction = null;
    
The close action.
 
     private String closeAction = null;
    
The cancel action.
 
     private String cancelAction = null;

    
The participant URI for replies.
 
     private MAPEndpoint terminationParticipant ;

    
The participant URI for secure replies.
 
     private MAPEndpoint secureTerminationParticipant ;


    
Construct the terminator participant client.
 
     private TerminationCoordinatorClient()
     {
         MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
         final String terminationParticipantURIString =
             ServiceRegistry.getRegistry().getServiceURI(.false);
         final String secureTerminationParticipantURIString =
             ServiceRegistry.getRegistry().getServiceURI(.true);
 
          = builder.newEndpoint(terminationParticipantURIString);
          = builder.newEndpoint(secureTerminationParticipantURIString);
     }

    
Send a 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 sendComplete(final W3CEndpointReference coordinatorfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint participant = getParticipant(coordinator);
        AddressingHelper.installFromFaultTo(mapparticipantidentifier);
        final TerminationCoordinatorPortType port = getPort(coordinatormapidentifier);
        final NotificationType complete = new NotificationType();
        port.completeOperation(complete);
    }

    
Send a close 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 sendClose(final W3CEndpointReference coordinatorfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint participant = getParticipant(coordinator);
        AddressingHelper.installFromFaultTo(mapparticipantidentifier);
        final TerminationCoordinatorPortType port = getPort(coordinatormapidentifier);
        final NotificationType close = new NotificationType();
        port.closeOperation(close);
    }

    
Send a cancel 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 sendCancel(final W3CEndpointReference coordinatorfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint participant = getParticipant(coordinator);
        AddressingHelper.installFromFaultTo(mapparticipantidentifier);
        final TerminationCoordinatorPortType port = getPort(coordinatormapidentifier);
        final NotificationType cancel = new NotificationType();
        port.cancelOperation(cancel);
    }

    
return a participant endpoint appropriate to the type of coordinator

Parameters:
coordinator
Returns:
either the secure terminaton coordinator endpoint or the non-secure endpoint
    MAPEndpoint getParticipant(W3CEndpointReference coordinator)
    {
        NativeEndpointReference nativeRef = EndpointHelper.transform(NativeEndpointReference.classcoordinator);
        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 TerminationCoordinatorClient 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
        AddressingHelper.installNoneReplyTo(map);
        return WSARJTXClient.getTerminationCoordinatorPort(endpointactionmap);
    }
New to GrepCode? Check out our FAQ X