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 boolean commit(final Notification commitfinal MAP map,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
         final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier) ;
 
         {
             try {
             if (participant != null)
             {
                 try
                 {
                     participant.commit() ;
                 }
                 catch (final TransactionRolledBackException trbe)
                 {
                     return false;
                 }
                 catch (final UnknownTransactionException ute)
                 {
                     SOAPFactory factory = SOAPFactory.newInstance();
                     SOAPFault soapFault = factory.createFault(..getValue(), .);
                     throw new SOAPFaultException(soapFault);
                 }
                 catch (final SystemException se)
                 {
                     SOAPFactory factory = SOAPFactory.newInstance();
                     SOAPFault soapFault = factory.createFault(..getValue(), .);
                     throw new SOAPFaultException(soapFault);
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from commit:"th) ;
                    }
                    SOAPFactory factory = SOAPFactory.newInstance();
                    SOAPFault soapFault = factory.createFault(..getValue(), .);
                    throw new SOAPFaultException(soapFault);
                }
                return true;
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Commit called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                SOAPFactory factory = SOAPFactory.newInstance();
                throw new SOAPFaultException(soapFault);
            }
            } catch (SOAPException se) {
                se.printStackTrace(.);
                throw new ProtocolException(se);
            }
        }
    }

    
Rollback.

Parameters:
rollback The rollback notification.
map The addressing context.
arjunaContext The arjuna context.
    public boolean 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() ;
                    return true;
                }
                catch (final UnknownTransactionException ute)
                {
                    SOAPFactory factory = SOAPFactory.newInstance();
                    SOAPFault soapFault = factory.createFault(..getValue(), .);
                    throw new SOAPFaultException(soapFault);
                }
                catch (final SystemException se)
                {
                    SOAPFactory factory = SOAPFactory.newInstance();
                    SOAPFault soapFault = factory.createFault(..getValue(), .);
                    throw new SOAPFaultException(soapFault);
                }
                catch (final Throwable th)
                {
                    if (..isTraceEnabled())
                    {
                        ..tracev("Unexpected exception thrown from commit:"th) ;
                    }
                    SOAPFactory factory = SOAPFactory.newInstance();
                    SOAPFault soapFault = factory.createFault(..getValue(), .);
                    throw new SOAPFaultException(soapFault);
                }
            }
            else
            {
                if (..isTraceEnabled())
                {
                    ..tracev("Rollback called on unknown participant: {0}"new Object[] {instanceIdentifier}) ;
                }
                SOAPFactory factory = SOAPFactory.newInstance();
                throw new SOAPFaultException(soapFault);
            }
        } catch (SOAPException se) {
            se.printStackTrace(.);
            throw new ProtocolException(se);
        }
    }
New to GrepCode? Check out our FAQ X