Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.arjuna.wst11.messaging;
  
 import  org.jboss.ws.api.addressing.MAP;
 
The Completion Coordinator 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 CompletionCoordinatorParticipant participantfinal String identifier)
     {
         .activateObject(participantidentifier) ;
     }

    
Deactivate the participant.

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

    
Get the participant with the specified identifier.

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

    
Commit.

Parameters:
commit The commit notification.
map The addressing context.
arjunaContext The arjuna context.
 
     public void commit(final Notification commitfinal MAP map,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
         final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier) ;
 
         try
         {
             if (participant != null)
             {
                 final String messageId = MessageId.getMessageId() ;
                 try
                 {
                     participant.commit() ;
                 }
                 catch (final TransactionRolledBackException trbe)
                 {
                     final MAP responseAddressingContext =
                         AddressingHelper.createResponseContext(mapmessageId) ;
                     CompletionInitiatorClient.getClient().sendAborted(participant.getParticipant(), responseAddressingContextinstanceIdentifier) ;
                     return ;
                 }
                 catch (final UnknownTransactionException ute)
                 {
                     final MAP faultAddressingContext = AddressingHelper.createFaultContext(mapmessageId) ;
                     final SoapFault soapFault = new SoapFault11(..,
                             ..get_wst11_messaging_CompletionCoordinatorProcessorImpl_1()) ;
                     CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContextsoapFaultinstanceIdentifier) ;
                     return ;
                }
                catch (final SystemException se)
                {
                    final MAP faultAddressingContext = AddressingHelper.createFaultContext(mapmessageId) ;
                    final String pattern = ..get_wst11_messaging_CompletionCoordinatorProcessorImpl_2();
                    final String message = MessageFormat.format(patternnew Object[] {se}) ;
                    final SoapFault soapFault = new SoapFault11(..message) ;
                    CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContextsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from commit:"th) ;
                    }
                    final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                    final SoapFault soapFault = new SoapFault11(th) ;
                    CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContextsoapFaultinstanceIdentifier) ;
                    return ;
                }
                final MAP responseAddressingContext = AddressingHelper.createResponseContext(mapmessageId) ;
                CompletionInitiatorClient.getClient().sendCommitted(participant.getParticipant(), responseAddressingContextinstanceIdentifier) ;
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Commit called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                final SoapFault soapFault = new SoapFault11(..,
                        ..get_wst11_messaging_CompletionCoordinatorProcessorImpl_5()) ;
                CompletionInitiatorClient.getClient().sendSoapFault(faultAddressingContextsoapFaultinstanceIdentifier) ;
            }
        }
        catch (Throwable throwable)
        {
            throwable.printStackTrace(.);
        }
    }

    
Rollback.

Parameters:
rollback The rollback notification.
map The addressing context.
arjunaContext The arjuna context.
    public void rollback(final Notification rollbackfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier) ;
        try
        {
            if (participant != null)
            {
                final String messageId = MessageId.getMessageId() ;
                try
                {
                    participant.rollback() ;
                }
                catch (final UnknownTransactionException ute)
                {
                    final MAP faultAddressingContext = AddressingHelper.createFaultContext(mapmessageId) ;
                    final SoapFault soapFault = new SoapFault11(..,
                            ..get_wst11_messaging_CompletionCoordinatorProcessorImpl_6()) ;
                    CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContextsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (SystemException systemException)
                {
                    final MAP faultAddressingContext = AddressingHelper.createFaultContext(mapmessageId) ;
                    final String message = ..get_wst11_messaging_CompletionCoordinatorProcessorImpl_7();
                    final SoapFault soapFault = new SoapFault11(..message) ;
                    CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContextsoapFaultinstanceIdentifier) ;
                    return ;
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from rollback:"th) ;
                    }
                    final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                    final SoapFault soapFault = new SoapFault11(th) ;
                    CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContextsoapFaultinstanceIdentifier) ;
                    return ;
                }
                final MAP responseAddressingContext = AddressingHelper.createResponseContext(mapmessageId) ;
                CompletionInitiatorClient.getClient().sendAborted(participant.getParticipant(), responseAddressingContextinstanceIdentifier) ;
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Rollback called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
                final SoapFault soapFault = new SoapFault11(..,
                        ..get_wst11_messaging_CompletionCoordinatorProcessorImpl_10()) ;
                CompletionInitiatorClient.getClient().sendSoapFault(faultAddressingContextsoapFaultinstanceIdentifier) ;
            }
        }
        catch (Throwable throwable)
        {
            throwable.printStackTrace(.);
        }
    }
New to GrepCode? Check out our FAQ X