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.wst11.messaging;
 
 import  org.jboss.ws.api.addressing.MAP;
 
The Terminator Participant processor.

Author(s):
kevin
 
 {
    
The activated object processor.
 
     private final ActivatedObjectProcessor activatedObjectProcessor = new ActivatedObjectProcessor() ;

    
Activate the participant.

Parameters:
participant The participant.
identifier The identifier.
 
     public void activateParticipant(final BusinessActivityTerminator participantfinal String identifier)
     {
         .activateObject(participantidentifier) ;
     }

    
Deactivate the participant.

Parameters:
participant The participant.
 
     public void deactivateParticipant(final BusinessActivityTerminator participant)
     {
         .deactivateObject(participant) ;
     }

   
Get the participant with the specified identifier.

Parameters:
instanceIdentifier The participant identifier.
Returns:
The participant or null if not known.
 
     public BusinessActivityTerminator getParticipant(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
     }

    
Cancel.

Parameters:
cancel The cancel notification.
map The addressing context.
arjunaContext The arjuna context.
 
     public void cancel(final NotificationType cancelfinal MAP map,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
         final BusinessActivityTerminator participant = getParticipant(instanceIdentifier) ;
 
         try
        {
            if (participant != null)
            {
                W3CEndpointReference endpoint = participant.getEndpoint();
                final String messageId = MessageId.getMessageId() ;
                try
                {
                    participant.cancel() ;
                }
                catch (final FaultedException fe)
                {
                    final MAP responseMAP = AddressingHelper.createNotificationContext(messageId) ;
                    TerminationParticipantClient.getClient().sendFaulted(endpointresponseMAPinstanceIdentifier) ;
                }
                catch (final UnknownTransactionException ute)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(..,
                            ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_1()) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final SystemException se)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final String message = ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_2();
                    final SoapFault soapFault = new SoapFault11(..message) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from cancel:"th) ;
                    }
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(th) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                final MAP responseMAP = AddressingHelper.createNotificationContext(messageId) ;
                TerminationParticipantClient.getClient().sendCancelled(endpointresponseMAPinstanceIdentifier) ;
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Cancel called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                final MAP faultMAP =
                        AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                final SoapFault soapFault = new SoapFault11(..,
                        ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_5()) ;
                 TerminationParticipantClient.getClient().sendSoapFault(soapFaultfaultMAPinstanceIdentifier) ;
            }
        }
        catch (Throwable throwable)
        {
            throwable.printStackTrace(.);
        }
    }

    
Close.

Parameters:
close The close notification.
map The addressing context.
arjunaContext The arjuna context.
    public void close(final NotificationType closefinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final BusinessActivityTerminator participant = getParticipant(instanceIdentifier) ;
        try
        {
            if (participant != null)
            {
                W3CEndpointReference endpoint = participant.getEndpoint();
                final String messageId = MessageId.getMessageId() ;
                try
                {
                    participant.close() ;
                }
                catch (final UnknownTransactionException ute)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(..,
                            ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_6()) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final TransactionRolledBackException trbe)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(..,
                            ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_7()) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final SystemException se)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final String message = ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_8();
                    final SoapFault soapFault = new SoapFault11(..message) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from close:"th) ;
                    }
                    final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                    final SoapFault soapFault = new SoapFault11(th) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                final MAP responseMAP = AddressingHelper.createNotificationContext(messageId) ;
                TerminationParticipantClient.getClient().sendClosed(endpointresponseMAPinstanceIdentifier) ;
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Close called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                final MAP faultMAP =
                        AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                final SoapFault soapFault = new SoapFault11(..,
                        ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_11()) ;
                TerminationParticipantClient.getClient().sendSoapFault(soapFaultfaultMAPinstanceIdentifier) ;
            }
        }
        catch (Throwable throwable)
        {
            throwable.printStackTrace(.);
        }
    }

    
Complete.

Parameters:
complete The complete notification.
map The addressing context.
arjunaContext The arjuna context.
    public void complete(final NotificationType completefinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final BusinessActivityTerminator participant = getParticipant(instanceIdentifier) ;
        try
        {
            if (participant != null)
            {
                W3CEndpointReference endpoint = participant.getEndpoint();
                final String messageId = MessageId.getMessageId() ;
                try
                {
                    participant.complete() ;
                }
                catch (final FaultedException fe)
                {
                    final MAP responseMAP = AddressingHelper.createNotificationContext(messageId) ;
                    TerminationParticipantClient.getClient().sendFaulted(endpointresponseMAPinstanceIdentifier) ;
                }
                catch (final UnknownTransactionException ute)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(..,
                            ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_12()) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final SystemException se)
                {
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final String message = ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_13();
                    final SoapFault soapFault = new SoapFault11(..message) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from complete:"th) ;
                    }
                    final MAP faultMAP = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(th) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpointfaultMAPsoapFaultinstanceIdentifier) ;
                    return ;
                }
                final MAP responseMAP = AddressingHelper.createNotificationContext(messageId) ;
                TerminationParticipantClient.getClient().sendCompleted(endpointresponseMAPinstanceIdentifier) ;
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Complete called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                final MAP faultMAP =
                        AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                final SoapFault soapFault =
                                ..get_wst11_messaging_TerminationCoordinatorProcessorImpl_16()) ;
                TerminationParticipantClient.getClient().sendSoapFault(soapFaultfaultMAPinstanceIdentifier) ;
            }
        }
        catch (Throwable throwable)
        {
            throwable.printStackTrace(.);
        }
    }

    
handle a soap fault sent by the participant. kev's code just prints a log message?

Parameters:
soapFault The soap fault
map The addressing context.
arjunaContext The arjuna context.
    public void soapFault(final SoapFault soapFaultfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        // in this case all we do is log a message
        if (..isTraceEnabled())
        {
            ..tracev("Service {0} received unexpected fault: {1}",
                    new Object[] {.soapFault}) ;
        }
    }
New to GrepCode? Check out our FAQ X