[jboss-svn-commits] JBL Code SVN: r7357 - in labs/jbosstm/trunk/XTS: WS-C/dev/src/com/arjuna/webservices/wscoor WS-C/dev/src/com/arjuna/webservices/wscoor/handlers WS-C/dev/src/com/arjuna/webservices/wscoor/policy WS-T/dev/src/com/arjuna/webservices/wsat WS-T/dev/src/com/arjuna/webservices/wsat/client WS-T/dev/src/com/arjuna/webservices/wsba WS-T/dev/src/com/arjuna/webservices/wsba/client WS-T/dev/src/com/arjuna/wst/messaging WS-T/dev/src/com/arjuna/wst/messaging/engines WSTX/classes/com/arjuna/mwlabs/wst/at WSTX/classes/com/arjuna/mwlabs/wst/at/context WSTX/classes/com/arjuna/mwlabs/wst/at/local WSTX/classes/com/arjuna/mwlabs/wst/at/remote WSTX/classes/com/arjuna/mwlabs/wst/ba WSTX/classes/com/arjuna/mwlabs/wst/ba/context

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 3 01:48:43 EST 2006


Author: kevin.conner at jboss.com
Date: 2006-11-03 01:48:28 -0500 (Fri, 03 Nov 2006)
New Revision: 7357

Added:
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/CoordinationContext.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/handlers/CoordinationContextHandler.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/policy/CoordinationContextPolicy.java
Modified:
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/AtomicTransactionConstants.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/ParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/BusinessActivityConstants.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionCoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionCoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantEngine.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/ContextFactoryImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/RegistrarImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/context/TxContextImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/local/LocalContextFactoryImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/TransactionManagerImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/ContextFactoryImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/context/TxContextImple.java
Log:
Modifications to qualify against interop tests: JBTM-122

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/CoordinationContext.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/CoordinationContext.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/CoordinationContext.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag.  All rights reserved. 
+ * 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 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.webservices.wscoor;
+
+import com.arjuna.webservices.MessageContext;
+
+/**
+ * The coordination context.
+ * @author kevin
+ */
+public class CoordinationContext
+{
+    /**
+     * The key used for the coordination context within a message exchange.
+     */
+    private static final byte[] COORDINATION_CONTEXT_PROPERTY = new byte[0] ;
+    /**
+     * The coordination context associated with the thread.
+     */
+    private static final ThreadLocal THREAD_CONTEXT = new ThreadLocal() ;
+    
+    /**
+     * Get the coordination context from the message context if present.
+     * @param messageContext The message context.
+     * @return The coordination context or null if not present.
+     */
+    public static CoordinationContextType getContext(final MessageContext messageContext)
+    {
+        return (CoordinationContextType)messageContext.getProperty(COORDINATION_CONTEXT_PROPERTY) ;
+    }
+
+    /**
+     * Set the coordination context for the message context.
+     * @param messageContext The message context.
+     * @param coordinationContext The coordination context.
+     */
+    public static void setContext(final MessageContext messageContext, final CoordinationContextType coordinationContext)
+    {
+        messageContext.setProperty(COORDINATION_CONTEXT_PROPERTY, coordinationContext) ;
+    }
+    
+    /**
+     * Get the coordination context from the current thread if present.
+     * @return The coordination context or null if not present.
+     */
+    public static CoordinationContextType getThreadContext()
+    {
+        return (CoordinationContextType)THREAD_CONTEXT.get() ;
+    }
+
+    /**
+     * Set the coordination context for the current thread.
+     * @param coordinationContext The coordination context.
+     */
+    public static void setThreadContext(final CoordinationContextType coordinationContext)
+    {
+        THREAD_CONTEXT.set(coordinationContext) ;
+    }
+}


Property changes on: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/CoordinationContext.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/handlers/CoordinationContextHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/handlers/CoordinationContextHandler.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/handlers/CoordinationContextHandler.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag.  All rights reserved. 
+ * 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 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.webservices.wscoor.handlers;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import com.arjuna.webservices.HeaderHandler;
+import com.arjuna.webservices.MessageContext;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.soap.SoapDetails;
+import com.arjuna.webservices.util.StreamHelper;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
+import com.arjuna.webservices.wscoor.CoordinationContext;
+import com.arjuna.webservices.wscoor.CoordinationContextType;
+
+/**
+ * Header handler for parsing the Coordination Context header.
+ * @author kevin
+ */
+public class CoordinationContextHandler implements HeaderHandler
+{
+    /**
+     * Handle the header element.
+     * @param in The current streamreader.
+     * @param messageContext The current message context.
+     * @throws XMLStreamException for parsing errors.
+     * @throws SoapFault for processing errors.
+     */
+    public void invoke(final XMLStreamReader in, final MessageContext messageContext)
+        throws XMLStreamException, SoapFault
+    {
+        final CoordinationContextType coordinationContext = new CoordinationContextType(in) ;
+        CoordinationContext.setContext(messageContext, coordinationContext) ;
+    }
+    
+    /**
+     * Write the header element in a response.
+     * @param out The output stream.
+     * @param headerElementName The name of the header element.
+     * @param context The current message context.
+     * @param soapDetails The SOAP details.
+     * @throws XMLStreamException 
+     */
+    public void writeContent(final XMLStreamWriter out, final QName headerElementName,
+        final MessageContext context, final SoapDetails soapDetails)
+        throws XMLStreamException
+    {
+        final CoordinationContextType coordinationContext = CoordinationContext.getThreadContext() ;
+        if (coordinationContext != null)
+        {
+            coordinationContext.putAttribute(soapDetails.getMustUnderstandQName(), soapDetails.getMustUnderstandValue()) ;
+            StreamHelper.writeElement(out, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT_QNAME, coordinationContext) ;
+        }
+    }
+    
+    /**
+     * Validate headers after processing.
+     * @param context The current message context.
+     * @throws SoapFault for validation errors.
+     */
+    public void headerValidate(final MessageContext context)
+        throws SoapFault
+    {
+    }
+    
+    /**
+     * Notification of a subsequent header processing fault.
+     * @param context The current message context.
+     */
+    public void headerFaultNotification(final MessageContext context)
+    {
+    }
+}


Property changes on: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/handlers/CoordinationContextHandler.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/policy/CoordinationContextPolicy.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/policy/CoordinationContextPolicy.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/policy/CoordinationContextPolicy.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag.  All rights reserved. 
+ * 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 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.webservices.wscoor.policy;
+
+import com.arjuna.webservices.HandlerRegistry;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
+import com.arjuna.webservices.wscoor.handlers.CoordinationContextHandler;
+
+/**
+ * Policy responsible for binding the WS-Coordination header handlers for a service.
+ * @author kevin
+ */
+public class CoordinationContextPolicy
+{
+    /**
+     * Add this policy to the registry.
+     * @param registry The registry containing the policy.
+     */
+    public static void register(final HandlerRegistry registry)
+    {
+        registry.registerHeaderHandler(CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT_QNAME, new CoordinationContextHandler()) ;
+    }
+
+    /**
+     * Remove this policy from the registry.
+     * @param registry The registry containing the policy.
+     */
+    public static void remove(final HandlerRegistry registry)
+    {
+        registry.removeHeaderHandler(CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT_QNAME) ;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/policy/CoordinationContextPolicy.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/AtomicTransactionConstants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/AtomicTransactionConstants.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/AtomicTransactionConstants.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -157,21 +157,9 @@
      */
     public String WSAT_ACTION_REPLAY = WSAT_NAMESPACE + "/" + WSAT_ELEMENT_REPLAY ;
     /**
-     * The PrepareResponse element.
-     */
-    public String WSAT_ELEMENT_PREPARE_RESPONSE = "PrepareResponse" ;
-    /**
-     * The PrepareResponse QName.
-     */
-    public QName WSAT_ELEMENT_PREPARE_RESPONSE_QNAME = new QName(WSAT_NAMESPACE, WSAT_ELEMENT_PREPARE_RESPONSE, WSAT_PREFIX) ;
-    /**
      * The Fault Action.
      */
     public String WSAT_ACTION_FAULT = WSAT_NAMESPACE + "/fault" ;
-    /**
-     * The SOAP Fault Action.
-     */
-    public String WSAT_ACTION_SOAP_FAULT = WSAT_NAMESPACE + "/soapFault" ;
     
     /**
      * The vote attribute.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/ParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/ParticipantClient.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/ParticipantClient.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -65,8 +65,8 @@
     /**
      * The SOAP fault action.
      */
-    private final AttributedURIType soapFaultAction =
-        new AttributedURIType(AtomicTransactionConstants.WSAT_ACTION_SOAP_FAULT) ;
+    private final AttributedURIType faultAction =
+        new AttributedURIType(AtomicTransactionConstants.WSAT_ACTION_FAULT) ;
     
     /**
      * The SOAP service representing the client.
@@ -155,7 +155,7 @@
         throws SoapFault, IOException
     {
         final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
-        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
+        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, faultAction) ;
     }
     
     /**

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/BusinessActivityConstants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/BusinessActivityConstants.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/BusinessActivityConstants.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -236,11 +236,6 @@
      * The Status Action.
      */
     public String WSBA_ACTION_STATUS = WSBA_NAMESPACE + "/" + WSBA_ELEMENT_STATUS ;
-
-    /**
-     * The SoapFault Action.
-     */
-    public String WSBA_ACTION_SOAP_FAULT = WSBA_NAMESPACE + "/soapFault" ;
     
     /**
      * The InconsistentInternalState error code.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -90,11 +90,6 @@
      */
     private final AttributedURIType statusAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
-    /**
-     * The soapFault action.
-     */
-    private final AttributedURIType soapFaultAction =
-        new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_SOAP_FAULT) ;
     
     /**
      * The SOAP service representing the client.
@@ -251,20 +246,6 @@
                 endpointReference, BusinessActivityConstants.WSBA_ELEMENT_STATUS_QNAME,
             statusAction) ;
     }
-
-    /**
-     * Send a fault.
-     * @param addressingContext The addressing context.
-     * @param soapFault The SOAP fault.
-     * @throws SoapFault For any errors.
-     * @throws IOException for any transport errors.
-     */
-    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
-        throws SoapFault, IOException
-    {
-        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
-        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
-    }
     
     /**
      * Get the endpoint reference for the specified identifier.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -89,11 +89,6 @@
      */
     private final AttributedURIType statusAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
-    /**
-     * The SOAP fault action.
-     */
-    private final AttributedURIType soapFaultAction =
-        new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_SOAP_FAULT) ;
     
     /**
      * The SOAP service representing the client.
@@ -248,20 +243,6 @@
                 endpointReference, BusinessActivityConstants.WSBA_ELEMENT_STATUS_QNAME,
             statusAction) ;
     }
-
-    /**
-     * Send a fault.
-     * @param addressingContext The addressing context.
-     * @param soapFault The SOAP fault.
-     * @throws SoapFault For any errors.
-     * @throws IOException for any transport errors.
-     */
-    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
-        throws SoapFault, IOException
-    {
-        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
-        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
-    }
     
     /**
      * Get the endpoint reference for the specified identifier.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -90,11 +90,6 @@
      */
     private final AttributedURIType statusAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
-    /**
-     * The soapFault action.
-     */
-    private final AttributedURIType soapFaultAction =
-        new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_SOAP_FAULT) ;
     
     /**
      * The SOAP service representing the client.
@@ -250,20 +245,6 @@
                 endpointReference, BusinessActivityConstants.WSBA_ELEMENT_STATUS_QNAME,
             statusAction) ;
     }
-
-    /**
-     * Send a fault.
-     * @param addressingContext The addressing context.
-     * @param soapFault The SOAP fault.
-     * @throws SoapFault For any errors.
-     * @throws IOException for any transport errors.
-     */
-    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
-        throws SoapFault, IOException
-    {
-        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
-        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
-    }
     
     /**
      * Get the endpoint reference for the specified identifier.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -84,11 +84,6 @@
      */
     private final AttributedURIType statusAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
-    /**
-     * The SOAP fault action.
-     */
-    private final AttributedURIType soapFaultAction =
-        new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_SOAP_FAULT) ;
     
     /**
      * The SOAP service representing the client.
@@ -227,20 +222,6 @@
                 endpointReference, BusinessActivityConstants.WSBA_ELEMENT_STATUS_QNAME,
             statusAction) ;
     }
-
-    /**
-     * Send a fault.
-     * @param addressingContext The addressing context.
-     * @param soapFault The SOAP fault.
-     * @throws SoapFault For any errors.
-     * @throws IOException for any transport errors.
-     */
-    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
-        throws SoapFault, IOException
-    {
-        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
-        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
-    }
     
     /**
      * Get the endpoint reference for the specified identifier.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -30,7 +30,9 @@
 import com.arjuna.webservices.wsba.ExceptionType;
 import com.arjuna.webservices.wsba.NotificationType;
 import com.arjuna.webservices.wsba.StatusType;
+import com.arjuna.webservices.wsba.client.CoordinatorCompletionParticipantClient;
 import com.arjuna.webservices.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
+import com.arjuna.wsc.messaging.MessageId;
 
 
 /**
@@ -239,9 +241,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendExited(addressingContext, arjunaContext) ;
         }
     }
 
@@ -274,9 +280,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendFaulted(addressingContext, arjunaContext) ;
         }
     }
     
@@ -382,4 +392,56 @@
             WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
         }
     }
+    
+    /**
+     * Send an exited message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendExited_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendExited_1] - Unexpected exception while sending Exited
+     */
+    private void sendExited(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendExited(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendExited_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a faulted message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFaulted_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFaulted_1] - Unexpected exception while sending Faulted
+     */
+    private void sendFaulted(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendFaulted(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendExited_1", th) ;
+            }
+        }
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -29,7 +29,9 @@
 import com.arjuna.webservices.wsba.CoordinatorCompletionParticipantInboundEvents;
 import com.arjuna.webservices.wsba.NotificationType;
 import com.arjuna.webservices.wsba.StatusType;
+import com.arjuna.webservices.wsba.client.CoordinatorCompletionCoordinatorClient;
 import com.arjuna.webservices.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.wsc.messaging.MessageId;
 
 
 /**
@@ -101,9 +103,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendCancelled(addressingContext, arjunaContext) ;
         }
     }
     
@@ -135,9 +141,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendClosed(addressingContext, arjunaContext) ;
         }
     }
     
@@ -169,9 +179,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendCompensated(addressingContext, arjunaContext) ;
         }
     }
     
@@ -183,6 +197,7 @@
      * 
      * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_1] - Unexpected exception thrown from complete:
      * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_2] - Complete called on unknown participant: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_3 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_3] - Complete called on unknown participant
      */
     public void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
@@ -203,9 +218,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendFault(addressingContext, arjunaContext, WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_3")) ;
         }
     }
     
@@ -379,4 +398,109 @@
             WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
         }
     }
+    
+    /**
+     * Send a cancelled message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendCancelled_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendCancelled_1] - Unexpected exception while sending Cancelled
+     */
+    private void sendCancelled(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendCancelled_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a closed message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendClosed_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendClosed_1] - Unexpected exception while sending Closed
+     */
+    private void sendClosed(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendClosed(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendClosed_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a compensated message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendCompensated_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendCompensated_1] - Unexpected exception while sending Compensated
+     */
+    private void sendCompensated(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendCompensated_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a fault message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * @param exceptionIdentifier The exception identifier.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFault_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFault_1] - Unexpected exception while sending Fail
+     */
+    private void sendFault(final AddressingContext addressingContext, final ArjunaContext arjunaContext, final String exceptionIdentifier)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendFault(responseAddressingContext, arjunaContext.getInstanceIdentifier(), exceptionIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFault_1", th) ;
+            }
+        }
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorProcessorImpl.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorProcessorImpl.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -21,15 +21,19 @@
 package com.arjuna.wst.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.AttributedURIType;
+import com.arjuna.webservices.wsaddr.RelationshipType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsat.NotificationType;
 import com.arjuna.webservices.wsat.CoordinatorInboundEvents;
 import com.arjuna.webservices.wsat.client.ParticipantClient;
 import com.arjuna.webservices.wsat.processors.CoordinatorProcessor;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.wsc.messaging.MessageId;
 
 /**
@@ -115,7 +119,7 @@
      * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_1] - Unexpected exception thrown from committed:
-     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_2] - Aborted called on unknown coordinator: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_2] - Committed called on unknown coordinator: {0}
      */
     public void committed(final NotificationType committed, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
@@ -150,7 +154,7 @@
      * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_1] - Unexpected exception thrown from prepared:
-     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_2] - Aborted called on unknown coordinator: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_2] - Prepared called on unknown coordinator: {0}
      */
     public void prepared(final NotificationType prepared, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
@@ -178,8 +182,16 @@
             {
                 WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_2", new Object[] {instanceIdentifier}) ; 
             }
-            // Assume participant is durable
-            sendRollback(addressingContext, arjunaContext) ;
+            
+            final String identifierValue = instanceIdentifier.getInstanceIdentifier() ;
+            if ((identifierValue != null) && (identifierValue.length() > 0) && (identifierValue.charAt(0) == 'D'))
+            {
+        	sendRollback(addressingContext, arjunaContext) ;
+            }
+            else
+            {
+                sendInvalidState(addressingContext, arjunaContext) ;
+            }
         }
     }
     
@@ -190,7 +202,7 @@
      * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_1] - Unexpected exception thrown from readOnly:
-     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_2] - Aborted called on unknown coordinator: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_2] - ReadOnly called on unknown coordinator: {0}
      */
     public void readOnly(final NotificationType readOnly, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
@@ -225,7 +237,7 @@
      * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_1] - Unexpected exception thrown from replay:
-     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_2] - Aborted called on unknown coordinator: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_2] - Replay called on unknown coordinator: {0}
      */
     public void replay(final NotificationType replay, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
@@ -253,8 +265,17 @@
             {
                 WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_2", new Object[] {instanceIdentifier}) ; 
             }
-            // Assume participant is durable
-            sendRollback(addressingContext, arjunaContext) ;
+
+            
+            final String identifierValue = instanceIdentifier.getInstanceIdentifier() ;
+            if ((identifierValue != null) && (identifierValue.length() > 0) && (identifierValue.charAt(0) == 'D'))
+            {
+        	sendRollback(addressingContext, arjunaContext) ;
+            }
+            else
+            {
+                sendInvalidState(addressingContext, arjunaContext) ;
+            }
         }
     }
 
@@ -297,6 +318,43 @@
     }
     
     /**
+     * Send an unknown transaction fault.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendInvalidState_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendInvalidState_1] - Unknown Transaction.
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendInvalidState_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendInvalidState_2] - Unexpecting exception while sending InvalidState
+     */
+    private void sendInvalidState(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String responseMessageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), responseMessageId) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        
+        final AttributedURIType requestMessageId = addressingContext.getMessageID() ;
+        if (requestMessageId != null)
+        {
+            responseAddressingContext.addRelatesTo(new RelationshipType(requestMessageId.getValue())) ;
+        }
+        
+        try
+        {
+            final String message = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendInvalidState_1") ;
+            final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+            ParticipantClient.getClient().sendSoapFault(responseAddressingContext, soapFault, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendInvalidState_2", th) ;
+            }
+        }
+    }
+    
+    /**
      * Send a rollback message.
      * 
      * @param addressingContext The addressing context.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -30,7 +30,9 @@
 import com.arjuna.webservices.wsba.NotificationType;
 import com.arjuna.webservices.wsba.ParticipantCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices.wsba.StatusType;
+import com.arjuna.webservices.wsba.client.ParticipantCompletionParticipantClient;
 import com.arjuna.webservices.wsba.processors.ParticipantCompletionCoordinatorProcessor;
+import com.arjuna.wsc.messaging.MessageId;
 
 
 /**
@@ -239,9 +241,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendExited(addressingContext, arjunaContext) ;
         }
     }
     
@@ -274,9 +280,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendFaulted(addressingContext, arjunaContext) ;
         }
     }
     
@@ -382,4 +392,56 @@
             WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
         }
     }
+    
+    /**
+     * Send an exited message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.sendExited_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.sendExited_1] - Unexpected exception while sending Exited
+     */
+    private void sendExited(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendExited(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.sendExited_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a faulted message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.sendFaulted_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.sendFaulted_1] - Unexpected exception while sending Faulted
+     */
+    private void sendFaulted(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendFaulted(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.sendFailed_1", th) ;
+            }
+        }
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -29,7 +29,9 @@
 import com.arjuna.webservices.wsba.NotificationType;
 import com.arjuna.webservices.wsba.ParticipantCompletionParticipantInboundEvents;
 import com.arjuna.webservices.wsba.StatusType;
+import com.arjuna.webservices.wsba.client.ParticipantCompletionCoordinatorClient;
 import com.arjuna.webservices.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.wsc.messaging.MessageId;
 
 
 /**
@@ -101,9 +103,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendCancelled(addressingContext, arjunaContext) ;
         }
     }
 
@@ -135,9 +141,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendClosed(addressingContext, arjunaContext) ;
         }
     }
     
@@ -169,9 +179,13 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendCompensated(addressingContext, arjunaContext) ;
         }
     }
     
@@ -345,4 +359,82 @@
             WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
         }
     }
+    
+    /**
+     * Send a cancelled message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendCancelled_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendCancelled_1] - Unexpected exception while sending Cancelled
+     */
+    private void sendCancelled(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendCancelled(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendCancelled_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a closed message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendClosed_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendClosed_1] - Unexpected exception while sending Closed
+     */
+    private void sendClosed(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendClosed(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendClosed_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a compensated message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendCompensated_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendCompensated_1] - Unexpected exception while sending Compensated
+     */
+    private void sendCompensated(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), messageId) ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendCompensated(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.sendCompensated_1", th) ;
+            }
+        }
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionCoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -22,10 +22,8 @@
 
 import java.io.IOException;
 
-import javax.xml.namespace.QName;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
@@ -133,19 +131,13 @@
             if ((current == State.STATE_CANCELING) || (current == State.STATE_CANCELING_ACTIVE) ||
                 (current == State.STATE_CANCELING_COMPLETING))
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
             else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
             {
                 changeState(State.STATE_FAULTING) ;
             }
         }
-        
-        if ((current == State.STATE_CANCELING) || (current == State.STATE_CANCELING_ACTIVE) ||
-            (current == State.STATE_CANCELING_COMPLETING))
-        {
-            deactivate() ;
-        }
     }
     
     /**
@@ -176,18 +168,13 @@
             current = state ;
             if (current == State.STATE_CLOSING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
             else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
             {
                 changeState(State.STATE_FAULTING) ;
             }
         }
-        
-        if (current == State.STATE_CLOSING)
-        {
-            deactivate() ;
-        }
     }
     
     /**
@@ -218,18 +205,13 @@
             current = state ;
             if (current == State.STATE_COMPENSATING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
             else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
             {
                 changeState(State.STATE_FAULTING) ;
             }
         }
-        
-        if (current == State.STATE_COMPENSATING)
-        {
-            deactivate() ;
-        }
     }
     
     /**
@@ -378,12 +360,17 @@
             }
         }
         
-        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING) ||
-            (current == State.STATE_CANCELING_ACTIVE) || (current == State.STATE_CANCELING_COMPLETING) ||
-            (current == State.STATE_COMPLETING) || (current == State.STATE_COMPENSATING))
+        if (current == State.STATE_ACTIVE)
         {
             executeFault() ;
         }
+        else if ((current == State.STATE_CANCELING) || (current == State.STATE_CANCELING_ACTIVE) ||
+            (current == State.STATE_CANCELING_COMPLETING) || (current == State.STATE_COMPLETING) ||
+            (current == State.STATE_COMPENSATING))
+        {
+            sendFaulted() ;
+            ended() ;
+        }
         else if (current == State.STATE_ENDED)
         {
             sendFaulted() ;
@@ -398,7 +385,12 @@
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+	final State current ;
+	synchronized(this)
+	{
+	    current = state ;
+	}
+	sendStatus(current) ;
     }
     
     /**
@@ -416,10 +408,9 @@
      * Handle the get status event.
      * @return The state.
      */
-    public State getStatus()
+    public synchronized State getStatus()
     {
-        // KEV - implement
-        return null ;
+        return state ;
     }
     
     /**
@@ -536,18 +527,15 @@
      * @param soapFault The soap fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
-     * 
-     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.soapFault_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.soapFault_1] - Unexpected SOAP fault for participant {0}: {1} {2}
      */
     public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-        {
-            final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-            final SoapFaultType soapFaultType = soapFault.getSoapFaultType() ;
-            final QName subCode = soapFault.getSubcode() ;
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
-        }
+	ended() ;
+	try
+	{
+	    coordinator.fault() ;
+	}
+	catch (final Throwable th) {} // ignore
     }
     
     /**
@@ -677,6 +665,28 @@
     }
     
     /**
+     * Send the status message.
+     * @param state The state.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendStatus_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendStatus_1] - Unexpected exception while sending Status
+     */
+    private void sendStatus(final State state)
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendStatus(addressingContext, instanceIdentifier, state) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendStatus_1", th) ;
+            }
+        }
+    }
+    
+    /**
      * Get the coordinator id.
      * @return The coordinator id.
      */
@@ -784,6 +794,7 @@
             return ;
         }
         sendExited() ;
+        ended() ;
     }
     
     /**
@@ -809,13 +820,15 @@
             return ;
         }
         sendFaulted() ;
+        ended() ;
     }
     
     /**
-     * Deactivate the incoming event interface.
+     * End the current coordinator.
      */
-    private void deactivate()
+    private void ended()
     {
+        changeState(State.STATE_ENDED) ;
         CoordinatorCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this) ;
     }
     

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -20,10 +20,10 @@
  */
 package com.arjuna.wst.messaging.engines;
 
-import javax.xml.namespace.QName;
+import java.util.TimerTask;
 
+
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
@@ -35,8 +35,10 @@
 import com.arjuna.webservices.wsba.State;
 import com.arjuna.webservices.wsba.StatusType;
 import com.arjuna.webservices.wsba.client.CoordinatorCompletionCoordinatorClient;
+import com.arjuna.webservices.wsba.processors.CoordinatorCompletionParticipantProcessor;
 import com.arjuna.wsc.messaging.MessageId;
 import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
+import com.arjuna.wst.FaultedException;
 
 /**
  * The coordinator completion participant state engine
@@ -64,6 +66,10 @@
      * The current state.
      */
     private State state ;
+    /**
+     * The associated timer task or null.
+     */
+    private TimerTask timerTask ;
     
     /**
      * Construct the initial engine for the participant.
@@ -186,6 +192,10 @@
         
         if (current == State.STATE_COMPLETED)
         {
+            if (timerTask != null)
+            {
+                timerTask.cancel() ;
+            }
             executeClose() ;
         }
         else if (current == State.STATE_ENDED)
@@ -230,6 +240,10 @@
         
         if (current == State.STATE_COMPLETED)
         {
+            if (timerTask != null)
+            {
+                timerTask.cancel() ;
+            }
             executeCompensate() ;
         }
         else if (current == State.STATE_FAULTING_COMPENSATING)
@@ -324,7 +338,7 @@
             }
             else if (current == State.STATE_EXITING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
         }
     }
@@ -356,7 +370,7 @@
             if ((current == State.STATE_FAULTING) || (current == State.STATE_FAULTING_ACTIVE) ||
                 (current == State.STATE_FAULTING_COMPENSATING))
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
         }
     }
@@ -371,7 +385,12 @@
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+	final State current ;
+	synchronized(this)
+	{
+	    current = state ;
+	}
+	sendStatus(current) ;
     }
     
     /**
@@ -390,18 +409,15 @@
      * @param soapFault The soap fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
-     * 
-     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1] - Unexpected SOAP fault for participant {0}: {1} {2}
      */
     public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-        {
-            final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-            final SoapFaultType soapFaultType = soapFault.getSoapFaultType() ;
-            final QName subCode = soapFault.getSubcode() ;
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
-        }
+	ended() ;
+	try
+	{
+	    participant.error() ;
+	}
+	catch (final Throwable th) {} // ignore
     }
     
     /**
@@ -522,6 +538,25 @@
     }
     
     /**
+     * Handle the comms timeout event.
+     * 
+     * Completed -> Completed (resend Completed)
+     */
+    private void commsTimeout()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+        }
+        
+        if (current == State.STATE_COMPLETED)
+        {
+            sendCompleted() ;
+        }
+    }
+    
+    /**
      * Send the exit message.
      * 
      * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendExit_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendExit_1] - Unexpected exception while sending Exit
@@ -561,6 +596,8 @@
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompleted_1", th) ;
             }
         }
+        
+        initiateTimer() ;
     }
     
     /**
@@ -649,6 +686,28 @@
     }
     
     /**
+     * Send the status message.
+     * @param state The state.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendStatus_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendStatus_1] - Unexpected exception while sending Status
+     */
+    private void sendStatus(final State state)
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendStatus(addressingContext, instanceIdentifier, state) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendStatus_1", th) ;
+            }
+        }
+    }
+    
+    /**
      * Get the coordinator id.
      * @return The coordinator id.
      */
@@ -736,6 +795,7 @@
             return ;
         }
         sendCancelled() ;
+        ended() ;
     }
 
     /**
@@ -758,6 +818,7 @@
             return ;
         }
         sendClosed() ;
+        ended() ;
     }
     
     /**
@@ -771,15 +832,46 @@
         {
             participant.compensate() ;
         }
+        catch (final FaultedException fe)
+        {
+            fault() ;
+        }
         catch (final Throwable th)
         {
+            final State current ;
+            synchronized (this)
+            {
+                current = state ;
+                if (current == State.STATE_COMPENSATING)
+                {
+                    changeState(State.STATE_COMPLETED) ;
+                }
+            }
+            if (current == State.STATE_COMPENSATING)
+            {
+                initiateTimer() ;
+            }
+            
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCompensate_1", th) ;
             }
             return ;
         }
-        sendCompensated() ;
+        
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPENSATING)
+            {
+                ended() ;
+            }
+        }
+        if (current == State.STATE_COMPENSATING)
+        {
+            sendCompensated() ;
+        }
     }
     
     /**
@@ -801,10 +893,57 @@
             }
             return ;
         }
-        sendCompleted() ;
+        
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETING)
+            {
+                changeState(State.STATE_COMPLETED) ;
+            }
+        }
+        if (current == State.STATE_COMPLETING)
+        {
+            sendCompleted() ;
+        }
     }
     
     /**
+     * End the current participant.
+     */
+    private void ended()
+    {
+	changeState(State.STATE_ENDED) ;
+        CoordinatorCompletionParticipantProcessor.getProcessor().deactivateParticipant(this) ;
+    }
+    
+    /**
+     * Initiate the timer.
+     */
+    private synchronized void initiateTimer()
+    {
+        if (timerTask != null)
+        {
+            timerTask.cancel() ;
+        }
+        
+        if (state == State.STATE_COMPLETED)
+        {
+            timerTask = new TimerTask() {
+                public void run() {
+                    commsTimeout() ;
+                }
+            } ;
+            TransportTimer.getTimer().schedule(timerTask, TransportTimer.getTransportPeriod()) ;
+        }
+        else
+        {
+            timerTask = null ;
+        }
+    }
+    
+    /**
      * Create a context for the outgoing message.
      * @return The addressing context.
      */

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorEngine.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorEngine.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -29,7 +29,9 @@
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.AttributedURIType;
 import com.arjuna.webservices.wsaddr.EndpointReferenceType;
+import com.arjuna.webservices.wsaddr.RelationshipType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsat.CoordinatorInboundEvents;
@@ -37,6 +39,7 @@
 import com.arjuna.webservices.wsat.State;
 import com.arjuna.webservices.wsat.client.ParticipantClient;
 import com.arjuna.webservices.wsat.processors.CoordinatorProcessor;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.wsc.messaging.MessageId;
 
 /**
@@ -186,15 +189,21 @@
         {
             sendCommit() ;
         }
-        else if (current == State.STATE_ABORTING)
+        else if ((current == State.STATE_ABORTING) || ((current == null) && !readOnly))
         {
-            sendRollback() ;
-            forget() ;
+            if (durable)
+            {
+                sendRollback() ;
+            }
+            else
+            {
+        	sendInvalidState(addressingContext, arjunaContext) ;
+            }
+            if (current != null)
+            {
+        	forget() ;
+            }
         }
-        else if ((current == null) && durable && !readOnly)
-        {
-            sendRollback() ;
-        }
     }
     
     /**
@@ -306,7 +315,20 @@
             sendPrepare() ;
         }
         
-        return waitForState(State.STATE_PREPARING, TransportTimer.getTransportTimeout()) ;
+        final State result = waitForState(State.STATE_PREPARING, TransportTimer.getTransportTimeout()) ;
+        if (result != State.STATE_PREPARING)
+        {
+            return result ;
+        }
+        
+        synchronized(this)
+        {
+            if ((state == State.STATE_PREPARING) && (timerTask != null))
+            {
+        	timerTask.cancel() ;
+            }
+            return state ;
+        }
     }
     
     /**
@@ -333,10 +355,23 @@
         
         if ((current == State.STATE_PREPARED_SUCCESS) || (current == State.STATE_COMMITTING))
         {
-            sendPrepare() ;
+            sendCommit() ;
         }
         
-        return waitForState(State.STATE_COMMITTING, TransportTimer.getTransportTimeout()) ;
+        final State result = waitForState(State.STATE_COMMITTING, TransportTimer.getTransportTimeout()) ;
+        if (result != State.STATE_COMMITTING)
+        {
+            return result ;
+        }
+        
+        synchronized(this)
+        {
+            if ((state == State.STATE_COMMITTING) && (timerTask != null))
+            {
+        	timerTask.cancel() ;
+            }
+            return state ;
+        }
     }
     
     /**
@@ -367,6 +402,10 @@
         {
             sendRollback() ;
         }
+        else if (current == State.STATE_ABORTING)
+        {
+            forget() ;
+        }
         
         return waitForState(State.STATE_ABORTING, TransportTimer.getTransportTimeout()) ;
     }
@@ -496,7 +535,7 @@
         {
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
-                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendRollback_1", th) ;
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendPrepare_1", th) ;
             }
         }
         
@@ -546,6 +585,37 @@
     }
     
     /**
+     * Send the InvalidState message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorEngine.sendInvalidState_1 [com.arjuna.wst.messaging.engines.CoordinatorEngine.sendInvalidState_1] - Inconsistent internal state.
+     * @message com.arjuna.wst.messaging.engines.CoordinatorEngine.sendInvalidState_2 [com.arjuna.wst.messaging.engines.CoordinatorEngine.sendInvalidState_2] - Unexpecting exception while sending InvalidState
+     */
+    private void sendInvalidState(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        try
+        {
+            final AddressingContext responseContext = createContext() ;
+            final AttributedURIType messageId = addressingContext.getMessageID() ;
+            final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+            if (messageId != null)
+            {
+                responseContext.addRelatesTo(new RelationshipType(messageId.getValue())) ;
+            }
+            
+            final String message = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendInvalidState_1") ;
+            final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+            ParticipantClient.getClient().sendSoapFault(responseContext, soapFault, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendInvalidState_2", th) ;
+            }
+        }
+    }
+    
+    /**
      * Initiate the timer.
      */
     private synchronized void initiateTimer()

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionCoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -22,10 +22,7 @@
 
 import java.io.IOException;
 
-import javax.xml.namespace.QName;
-
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
@@ -129,18 +126,13 @@
             current = state ;
             if (current == State.STATE_CANCELING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
             else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
             {
                 changeState(State.STATE_FAULTING) ;
             }
         }
-        
-        if (current == State.STATE_CANCELING)
-        {
-            deactivate() ;
-        }
     }
     
     /**
@@ -168,18 +160,13 @@
             current = state ;
             if (current == State.STATE_CLOSING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
             else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
             {
                 changeState(State.STATE_FAULTING) ;
             }
         }
-        
-        if (current == State.STATE_CLOSING)
-        {
-            deactivate() ;
-        }
     }
     
     /**
@@ -207,18 +194,13 @@
             current = state ;
             if (current == State.STATE_COMPENSATING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
             else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
             {
                 changeState(State.STATE_FAULTING) ;
             }
         }
-        
-        if (current == State.STATE_COMPENSATING)
-        {
-            deactivate() ;
-        }
     }
     
     /**
@@ -228,7 +210,7 @@
      * @param arjunaContext The arjuna context.
      * 
      * Active -> Completed
-     * Canceling -> Completed
+     * Canceling -> Compensating
      * Completed -> Completed
      * Closing -> Closing (resend close)
      * Compensating -> Compensating (resend compensate)
@@ -253,6 +235,10 @@
             {
                 changeState(State.STATE_FAULTING) ;
             }
+            else if (current == State.STATE_CANCELING)
+            {
+        	state = State.STATE_COMPENSATING ;
+            }
         }
         
         if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
@@ -263,7 +249,7 @@
         {
             sendClose() ;
         }
-        else if (current == State.STATE_COMPENSATING)
+        else if ((current == State.STATE_CANCELING) || (current == State.STATE_COMPENSATING))
         {
             sendCompensate() ;
         }
@@ -350,11 +336,15 @@
             }
         }
         
-        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING) ||
-            (current == State.STATE_COMPENSATING))
+        if (current == State.STATE_ACTIVE)
         {
             executeFault() ;
         }
+        else if ((current == State.STATE_CANCELING) || (current == State.STATE_COMPENSATING))
+        {
+            sendFaulted() ;
+            ended() ;
+        }
         else if (current == State.STATE_ENDED)
         {
             sendFaulted() ;
@@ -369,7 +359,12 @@
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+	final State current ;
+	synchronized(this)
+	{
+	    current = state ;
+	}
+	sendStatus(current) ;
     }
     
     /**
@@ -387,10 +382,9 @@
      * Handle the get status event.
      * @return The state.
      */
-    public State getStatus()
+    public synchronized State getStatus()
     {
-        // KEV - implement
-        return null ;
+        return state ;
     }
     
     /**
@@ -470,18 +464,15 @@
      * @param soapFault The soap fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
-     * 
-     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.soapFault_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.soapFault_1] - Unexpected SOAP fault for participant {0}: {1} {2}
      */
     public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-        {
-            final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-            final SoapFaultType soapFaultType = soapFault.getSoapFaultType() ;
-            final QName subCode = soapFault.getSubcode() ;
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
-        }
+	ended() ;
+	try
+	{
+	    coordinator.fault() ;
+	}
+	catch (final Throwable th) {} // ignore
     }
     
     /**
@@ -590,6 +581,28 @@
     }
     
     /**
+     * Send the status message.
+     * @param state The state.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendStatus_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendStatus_1] - Unexpected exception while sending Status
+     */
+    private void sendStatus(final State state)
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendStatus(addressingContext, instanceIdentifier, state) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendStatus_1", th) ;
+            }
+        }
+    }
+    
+    /**
      * Get the coordinator id.
      * @return The coordinator id.
      */
@@ -697,6 +710,7 @@
             return ;
         }
         sendExited() ;
+        ended() ;
     }
     
     /**
@@ -722,13 +736,15 @@
             return ;
         }
         sendFaulted() ;
+        ended() ;
     }
     
     /**
-     * Deactivate the incoming event interface.
+     * End the current coordinator.
      */
-    private void deactivate()
+    private void ended()
     {
+        changeState(State.STATE_ENDED) ;
         ParticipantCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this) ;
     }
     

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -20,10 +20,9 @@
  */
 package com.arjuna.wst.messaging.engines;
 
-import javax.xml.namespace.QName;
+import java.util.TimerTask;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
@@ -35,8 +34,10 @@
 import com.arjuna.webservices.wsba.State;
 import com.arjuna.webservices.wsba.StatusType;
 import com.arjuna.webservices.wsba.client.ParticipantCompletionCoordinatorClient;
+import com.arjuna.webservices.wsba.processors.ParticipantCompletionParticipantProcessor;
 import com.arjuna.wsc.messaging.MessageId;
 import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
+import com.arjuna.wst.FaultedException;
 
 /**
  * The participant completion participant state engine
@@ -64,6 +65,10 @@
      * The current state.
      */
     private State state ;
+    /**
+     * The associated timer task or null.
+     */
+    private TimerTask timerTask ;
     
     /**
      * Construct the initial engine for the participant.
@@ -184,6 +189,10 @@
         
         if (current == State.STATE_COMPLETED)
         {
+            if (timerTask != null)
+            {
+                timerTask.cancel() ;
+            }
             executeClose() ;
         }
         else if (current == State.STATE_ENDED)
@@ -227,6 +236,10 @@
         
         if (current == State.STATE_COMPLETED)
         {
+            if (timerTask != null)
+            {
+                timerTask.cancel() ;
+            }
             executeCompensate() ;
         }
         else if (current == State.STATE_FAULTING_COMPENSATING)
@@ -268,7 +281,7 @@
             }
             else if (current == State.STATE_EXITING)
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
         }
     }
@@ -299,7 +312,7 @@
             if ((current == State.STATE_FAULTING) || (current == State.STATE_FAULTING_ACTIVE) ||
                 (current == State.STATE_FAULTING_COMPENSATING))
             {
-                changeState(State.STATE_ENDED) ;
+                ended() ;
             }
         }
     }
@@ -314,7 +327,12 @@
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+	final State current ;
+	synchronized(this)
+	{
+	    current = state ;
+	}
+	sendStatus(current) ;
     }
     
     /**
@@ -333,18 +351,15 @@
      * @param soapFault The soap fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
-     * 
-     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1] - Unexpected SOAP fault for participant {0}: {1} {2}
      */
     public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-        {
-            final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-            final SoapFaultType soapFaultType = soapFault.getSoapFaultType() ;
-            final QName subCode = soapFault.getSubcode() ;
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
-        }
+	ended() ;
+	try
+	{
+	    participant.error() ;
+	}
+	catch (final Throwable th) {} // ignore
     }
     
     /**
@@ -459,6 +474,25 @@
     }
     
     /**
+     * Handle the comms timeout event.
+     * 
+     * Completed -> Completed (resend Completed)
+     */
+    private void commsTimeout()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+        }
+        
+        if (current == State.STATE_COMPLETED)
+        {
+            sendCompleted() ;
+        }
+    }
+    
+    /**
      * Send the exit message.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendExit_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendExit_1] - Unexpected exception while sending Exit
@@ -498,6 +532,8 @@
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompleted_1", th) ;
             }
         }
+        
+        initiateTimer() ;
     }
     
     /**
@@ -586,6 +622,28 @@
     }
     
     /**
+     * Send the status message.
+     * @param state The state.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendStatus_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendStatus_1] - Unexpected exception while sending Status
+     */
+    private void sendStatus(final State state)
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendStatus(addressingContext, instanceIdentifier, state) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendStatus_1", th) ;
+            }
+        }
+    }
+    
+    /**
      * Get the coordinator id.
      * @return The coordinator id.
      */
@@ -673,6 +731,7 @@
             return ;
         }
         sendCancelled() ;
+        ended() ;
     }
 
     /**
@@ -695,6 +754,7 @@
             return ;
         }
         sendClosed() ;
+        ended() ;
     }
     
     /**
@@ -708,18 +768,83 @@
         {
             participant.compensate() ;
         }
+        catch (final FaultedException fe)
+        {
+            fault() ;
+        }
         catch (final Throwable th)
         {
+            final State current ;
+            synchronized (this)
+            {
+                current = state ;
+                if (current == State.STATE_COMPENSATING)
+                {
+                    changeState(State.STATE_COMPLETED) ;
+                }
+            }
+            if (current == State.STATE_COMPENSATING)
+            {
+                initiateTimer() ;
+            }
+            
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeClose_1", th) ;
             }
             return ;
         }
-        sendCompensated() ;
+        
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPENSATING)
+            {
+                ended() ;
+            }
+        }
+        if (current == State.STATE_COMPENSATING)
+        {
+            sendCompensated() ;
+        }
     }
     
     /**
+     * End the current participant.
+     */
+    private void ended()
+    {
+	changeState(State.STATE_ENDED) ;
+        ParticipantCompletionParticipantProcessor.getProcessor().deactivateParticipant(this) ;
+    }
+    
+    /**
+     * Initiate the timer.
+     */
+    private synchronized void initiateTimer()
+    {
+        if (timerTask != null)
+        {
+            timerTask.cancel() ;
+        }
+        
+        if (state == State.STATE_COMPLETED)
+        {
+            timerTask = new TimerTask() {
+                public void run() {
+                    commsTimeout() ;
+                }
+            } ;
+            TransportTimer.getTimer().schedule(timerTask, TransportTimer.getTransportPeriod()) ;
+        }
+        else
+        {
+            timerTask = null ;
+        }
+    }
+    
+    /**
      * Create a context for the outgoing message.
      * @return The addressing context.
      */

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantEngine.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantEngine.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -29,6 +29,7 @@
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.EndpointReferenceType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsat.NotificationType;
@@ -36,11 +37,13 @@
 import com.arjuna.webservices.wsat.State;
 import com.arjuna.webservices.wsat.client.CoordinatorClient;
 import com.arjuna.webservices.wsat.processors.ParticipantProcessor;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.wsc.messaging.MessageId;
 import com.arjuna.wst.Aborted;
 import com.arjuna.wst.Participant;
 import com.arjuna.wst.Prepared;
 import com.arjuna.wst.ReadOnly;
+import com.arjuna.wst.SystemException;
 import com.arjuna.wst.Vote;
 
 /**
@@ -54,6 +57,14 @@
      */
     private final Participant participant ;
     /**
+     * The participant id.
+     */
+    private final String id ;
+    /**
+     * The coordinator endpoint reference.
+     */
+    private final EndpointReferenceType coordinator ;
+    /**
      * The current state.
      */
     private State state ;
@@ -65,21 +76,27 @@
     /**
      * Construct the initial engine for the participant.
      * @param participant The participant.
+     * @param id The participant id.
+     * @param coordinator The coordinator endpoint reference.
      */
-    public ParticipantEngine(final Participant participant)
+    public ParticipantEngine(final Participant participant, final String id, final EndpointReferenceType coordinator)
     {
-        this(participant, State.STATE_ACTIVE) ;
+        this(participant, id, State.STATE_ACTIVE, coordinator) ;
     }
     
     /**
      * Construct the engine for the participant in a specified state.
      * @param participant The participant.
+     * @param id The participant id.
      * @param state The initial state.
+     * @param coordinator The coordinator endpoint reference.
      */
-    public ParticipantEngine(final Participant participant, final State state)
+    public ParticipantEngine(final Participant participant, final String id, final State state, final EndpointReferenceType coordinator)
     {
         this.participant = participant ;
+        this.id = id ;
         this.state = state ;
+        this.coordinator = coordinator ;
     }
     
     /**
@@ -104,6 +121,10 @@
             if (current == State.STATE_PREPARED_SUCCESS)
             {
                 state = State.STATE_COMMITTING ;
+                if (timerTask != null)
+                {
+                    timerTask.cancel() ;
+                }
             }
             else if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING))
             {
@@ -113,11 +134,11 @@
         
         if (current == State.STATE_PREPARED_SUCCESS)
         {
-            executeCommit(addressingContext, arjunaContext) ;
+            executeCommit() ;
         }
         else if (current == null)
         {
-            sendCommitted(addressingContext, arjunaContext) ;
+            sendCommitted() ;
         }
     }
     
@@ -148,15 +169,15 @@
         
         if (current == State.STATE_ACTIVE)
         {
-            executePrepare(addressingContext, arjunaContext) ;
+            executePrepare() ;
         }
         else if (current == State.STATE_PREPARED_SUCCESS)
         {
-            sendPrepared(addressingContext, arjunaContext) ;
+            sendPrepared() ;
         }
         else if ((current == State.STATE_ABORTING) || (current == null))
         {
-            sendAborted(addressingContext, arjunaContext) ;
+            sendAborted() ;
             forget() ;
         }
     }
@@ -192,10 +213,13 @@
             if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
                 (current == State.STATE_PREPARED_SUCCESS))
             {
-                executeRollback(addressingContext, arjunaContext) ;
+                if (!executeRollback())
+                {
+                    return ;
+                }
             }
             
-            sendAborted(addressingContext, arjunaContext) ;
+            sendAborted() ;
             
             if (current != null)
             {
@@ -205,6 +229,58 @@
     }
     
     /**
+     * Handle the early rollback event.
+     * 
+     * None -> None
+     * Active -> Aborting (execute rollback, send aborted and forget)
+     * Preparing -> Aborting (execute rollback, send aborted and forget)
+     * PreparedSuccess -> PreparedSuccess
+     * Committing -> Committing
+     * Aborting -> Aborting
+     */
+    public void earlyRollback()
+    {
+        rollbackDecision() ;
+    }
+    
+    /**
+     * Handle the early readonly event.
+     * 
+     * None -> None
+     * Active -> None (send ReadOnly)
+     * Preparing -> None (send ReadOnly)
+     * PreparedSuccess -> PreparedSuccess
+     * Committing -> Committing
+     * Aborting -> Aborting
+     */
+    public void earlyReadonly()
+    {
+        readOnlyDecision() ;
+    }
+    
+    /**
+     * Handle the recovery event.
+     * 
+     * None -> None
+     * Active -> Active
+     * Preparing -> Preparing
+     * PreparedSuccess -> PreparedSuccess
+     * Committing -> PreparedSuccess (resend Prepared)
+     * Aborting -> Aborting
+     */
+    public void recovery()
+    {
+	synchronized(this)
+	{
+	    if (timerTask != null)
+	    {
+                timerTask.cancel() ;
+	    }
+	}
+        sendReplay() ;
+    }
+    
+    /**
      * Handle the soap fault event.
      * @param soapFault The soap fault.
      * @param addressingContext The addressing context.
@@ -221,17 +297,20 @@
             final QName subCode = soapFault.getSubcode() ;
             WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
         }
+        
+        if (CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME.equals(soapFault.getSubcode()))
+        {
+            forget() ;
+        }
     }
     
     /**
      * Handle the commit decision event.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * Preparing -> PreparedSuccess (send Prepared)
      * Committing -> Committing (send committed and forget)
      */
-    private void commitDecision(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void commitDecision()
     {
         final State current ;
         synchronized(this)
@@ -245,71 +324,71 @@
         
         if (current == State.STATE_PREPARING)
         {
-            sendPrepared(addressingContext, arjunaContext) ;
+            sendPrepared() ;
         }
         else if (current == State.STATE_COMMITTING)
         {
-            sendCommitted(addressingContext, arjunaContext) ;
+            sendCommitted() ;
             forget() ;
         }
     }
     
     /**
      * Handle the readOnly decision event.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
+     * Active -> None (send ReadOnly)
      * Preparing -> None (send ReadOnly)
      */
-    private void readOnlyDecision(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void readOnlyDecision()
     {
         final State current ;
         synchronized(this)
         {
             current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING))
+            {
+        	state = null ;
+            }
         }
         
-        if (current == State.STATE_PREPARING)
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING))
         {
-            sendReadOnly(addressingContext, arjunaContext) ;
+            sendReadOnly() ;
             forget() ;
         }
     }
     
     /**
      * Handle the rollback decision event.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
+     * Active -> Aborting (send aborted)
      * Preparing -> Aborting (send aborted)
      */
-    private void rollbackDecision(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void rollbackDecision()
     {
         final State current ;
         synchronized(this)
         {
             current = state ;
-            if (current == State.STATE_PREPARING)
+            if ((current == State.STATE_PREPARING) || (current == State.STATE_ACTIVE))
             {
                 state = State.STATE_ABORTING ;
             }
         }
         
-        if (current == State.STATE_PREPARING)
+        if ((current == State.STATE_PREPARING) || (current == State.STATE_ACTIVE))
         {
-            sendAborted(addressingContext, arjunaContext) ;
+            sendAborted() ;
             forget() ;
         }
     }
     
     /**
      * Handle the comms timeout event.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * PreparedSuccess -> PreparedSuccess (resend Prepared)
      */
-    private void commsTimeout(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void commsTimeout()
     {
         final State current ;
         synchronized(this)
@@ -317,28 +396,33 @@
             current = state ;
         }
         
-        if (current == State.STATE_PREPARING)
+        if (current == State.STATE_PREPARED_SUCCESS)
         {
-            sendPrepared(addressingContext, arjunaContext) ;
+            sendPrepared() ;
         }
     }
     
     /**
      * Execute the commit transition.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.executeCommit_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.executeCommit_1] - Unexpected exception from participant commit
      */
-    private void executeCommit(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void executeCommit()
     {
         try
         {
             participant.commit() ;
-            commitDecision(addressingContext, arjunaContext) ;
+            commitDecision() ;
         }
         catch (final Throwable th)
         {
+            synchronized(this)
+            {
+                if (state == State.STATE_COMMITTING)
+                {
+            	    state = State.STATE_PREPARED_SUCCESS ;
+                }
+            }
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executeCommit_1", th) ;
@@ -348,17 +432,19 @@
     
     /**
      * Execute the rollback transition.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.executeRollback_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.executeRollback_1] - Unexpected exception from participant rollback
      */
-    private void executeRollback(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private boolean executeRollback()
     {
         try
         {
             participant.rollback() ;
         }
+        catch (final SystemException se)
+        {
+            return false ;
+        }
         catch (final Throwable th)
         {
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
@@ -366,44 +452,51 @@
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executeRollback_1", th) ;
             }
         }
+        return true ;
     }
     
     /**
      * Execute the prepare transition.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_1] - Unexpected exception from participant prepare
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_2 [com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_2] - Unexpected result from participant prepare: {0}
      */
-    private void executePrepare(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void executePrepare()
     {
         final Vote vote ;
         try
         {
             vote = participant.prepare();
         }
+        catch (final SystemException se)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_1", se) ;
+            }
+            return ;
+        }
         catch (final Throwable th)
         {
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_1", th) ;
             }
-            rollbackDecision(addressingContext, arjunaContext) ;
+            rollbackDecision() ;
             return ;
         }
         
         if (vote instanceof Prepared)
         {
-            commitDecision(addressingContext, arjunaContext) ;
+            commitDecision() ;
         }
         else if (vote instanceof ReadOnly)
         {
-            readOnlyDecision(addressingContext, arjunaContext) ;
+            readOnlyDecision() ;
         }
         else if (vote instanceof Aborted)
         {
-            rollbackDecision(addressingContext, arjunaContext) ;
+            rollbackDecision() ;
         }
         else
         {
@@ -411,7 +504,7 @@
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_2", new Object[] {(vote == null ? "null" : vote.getClass().getName())}) ;
             }
-            rollbackDecision(addressingContext, arjunaContext) ;
+            rollbackDecision() ;
         }
     }
     
@@ -429,15 +522,13 @@
     
     /**
      * Send the committed message.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.sendCommitted_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.sendCommitted_1] - Unexpected exception while sending Committed
      */
-    private void sendCommitted(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void sendCommitted()
     {
-        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
-        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final AddressingContext responseAddressingContext = createContext() ;
+        final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ;
         try
         {
             CoordinatorClient.getClient().sendCommitted(responseAddressingContext, instanceIdentifier) ;
@@ -453,15 +544,13 @@
     
     /**
      * Send the prepared message.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.sendPrepared_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.sendPrepared_1] - Unexpected exception while sending Prepared
      */
-    private void sendPrepared(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void sendPrepared()
     {
-        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
-        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final AddressingContext responseAddressingContext = createContext() ;
+        final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ;
         try
         {
             CoordinatorClient.getClient().sendPrepared(responseAddressingContext, instanceIdentifier) ;
@@ -474,20 +563,18 @@
             }
         }
         
-        initiateTimer(addressingContext, arjunaContext) ;
+        initiateTimer() ;
     }
     
     /**
      * Send the aborted message.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.sendAborted_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.sendAborted_1] - Unexpected exception while sending Aborted
      */
-    private void sendAborted(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void sendAborted()
     {
-        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
-        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final AddressingContext responseAddressingContext = createContext() ;
+        final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ;
         try
         {
             CoordinatorClient.getClient().sendAborted(responseAddressingContext, instanceIdentifier) ;
@@ -503,15 +590,13 @@
     
     /**
      * Send the read only message.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      * 
      * @message com.arjuna.wst.messaging.engines.ParticipantEngine.sendReadOnly_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.sendReadOnly_1] - Unexpected exception while sending ReadOnly
      */
-    private void sendReadOnly(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private void sendReadOnly()
     {
-        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
-        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final AddressingContext responseAddressingContext = createContext() ;
+        final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ;
         try
         {
             CoordinatorClient.getClient().sendReadOnly(responseAddressingContext, instanceIdentifier) ;
@@ -526,21 +611,42 @@
     }
     
     /**
+     * Send the replay message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantEngine.sendReplay_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.sendReplay_1] - Unexpected exception while sending Replay
+     */
+    private void sendReplay()
+    {
+        final AddressingContext responseAddressingContext = createContext() ;
+        final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ;
+        try
+        {
+            CoordinatorClient.getClient().sendReplay(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.sendReplay_1", th) ;
+            }
+        }
+    }
+    
+    /**
      * Initiate the timer.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
      */
-    private synchronized void initiateTimer(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    private synchronized void initiateTimer()
     {
         if (timerTask != null)
         {
             timerTask.cancel() ;
         }
-        if (state == State.STATE_PREPARING)
+        
+        if (state == State.STATE_PREPARED_SUCCESS)
         {
             timerTask = new TimerTask() {
                 public void run() {
-                    commsTimeout(addressingContext, arjunaContext) ;
+                    commsTimeout() ;
                 }
             } ;
             TransportTimer.getTimer().schedule(timerTask, TransportTimer.getTransportPeriod()) ;
@@ -553,12 +659,11 @@
     
     /**
      * Create a response context from the incoming context.
-     * @param addressingContext The incoming addressing context.
-     * @return The response addressing context.
+     * @return The addressing context.
      */
-    private AddressingContext createResponseContext(final AddressingContext addressingContext)
+    private AddressingContext createContext()
     {
         final String messageId = MessageId.getMessageId() ;
-        return AddressingContext.createNotificationContext(addressingContext, messageId) ;
+        return AddressingContext.createRequestContext(coordinator, messageId) ;
     }
 }

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/ContextFactoryImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/ContextFactoryImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/ContextFactoryImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -145,7 +145,7 @@
                 
                 final CoordinationContextType coordinationContext = new CoordinationContextType() ;
                 coordinationContext.setCoordinationType(new URI(coordinationTypeURI)) ;
-                coordinationContext.setIdentifier(new AttributedURIType(arjunaContext.getTransactionIdentifier())) ;
+                coordinationContext.setIdentifier(new AttributedURIType("urn:"+arjunaContext.getTransactionIdentifier())) ;
                 final int transactionExpires = arjunaContext.getTransactionExpires() ;
                 if (transactionExpires > 0)
                 {

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/RegistrarImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/RegistrarImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/RegistrarImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -173,7 +173,7 @@
 		if (AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC.equals(protocolIdentifier))
 		{
 			// enlist participant that wraps the requester URI.
-			final String participantId = new Uid().stringForm();
+			final String participantId = "D" + new Uid().stringForm();
 
 			try
 			{
@@ -192,7 +192,7 @@
 		else if (AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC.equals(protocolIdentifier))
 		{
 			// enlist participant that wraps the requester URI.
-			final String participantId = new Uid().stringForm();
+			final String participantId = "V" + new Uid().stringForm();
 
 			try
 			{
@@ -280,7 +280,7 @@
 		if (AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC.equals(protocolIdentifier))
 		{
 			// enlist participant that wraps the requester URI.
-            final String participantId = new Uid().stringForm();
+            final String participantId = "D" + new Uid().stringForm();
 
             try
             {
@@ -297,7 +297,7 @@
 		else if (AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC.equals(protocolIdentifier))
 		{
 			// enlist participant that wraps the requester URI.
-            final String participantId = new Uid().stringForm();
+            final String participantId = "V" + new Uid().stringForm();
 
             try
             {

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/context/TxContextImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/context/TxContextImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/context/TxContextImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -72,7 +72,12 @@
 
 	public final String identifier ()
 	{
-		return _context.getCoordinationContext().getIdentifier().getValue();
+	    final String value = _context.getCoordinationContext().getIdentifier().getValue();
+	    if ((value != null) && value.startsWith("urn:"))
+	    {
+		return value.substring(4) ;
+	    }
+	    return value ;
 	}
 
 	public final com.arjuna.mw.wsc.context.Context context ()

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/local/LocalContextFactoryImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/local/LocalContextFactoryImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/local/LocalContextFactoryImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -121,7 +121,7 @@
                 
                 final CoordinationContextType coordinationContext = new CoordinationContextType() ;
                 coordinationContext.setCoordinationType(new URI(coordinationTypeURI)) ;
-                coordinationContext.setIdentifier(new AttributedURIType(arjunaContext.getTransactionIdentifier())) ;
+                coordinationContext.setIdentifier(new AttributedURIType("urn:"+arjunaContext.getTransactionIdentifier())) ;
                 final int transactionExpires = arjunaContext.getTransactionExpires() ;
                 if (transactionExpires > 0)
                 {

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/TransactionManagerImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/TransactionManagerImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/TransactionManagerImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -74,9 +74,9 @@
 	{
 		try
 		{
-			registerParticipant(getParticipant(id) , AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC);
+			final EndpointReferenceType coordinator = registerParticipant(getParticipant(id) , AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC);
 
-			ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp), id) ;
+			ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp, id, coordinator), id) ;
 		}
 		catch (com.arjuna.wsc.InvalidProtocolException ex)
 		{
@@ -98,9 +98,9 @@
 	{
 		try
 		{
-			registerParticipant(getParticipant(id), AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC);
+			final EndpointReferenceType coordinator = registerParticipant(getParticipant(id), AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC);
 
-            ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp), id) ;
+			ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp, id, coordinator), id) ;
 		}
 		catch (com.arjuna.wsc.InvalidProtocolException ex)
 		{

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/ContextFactoryImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/ContextFactoryImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/ContextFactoryImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -131,7 +131,7 @@
             
             final CoordinationContextType coordinationContext = new CoordinationContextType() ;
             coordinationContext.setCoordinationType(new URI(coordinationTypeURI)) ;
-            coordinationContext.setIdentifier(new AttributedURIType(arjunaContext.getTransactionIdentifier())) ;
+            coordinationContext.setIdentifier(new AttributedURIType("urn:"+arjunaContext.getTransactionIdentifier())) ;
             final int transactionExpires = arjunaContext.getTransactionExpires() ;
             if (transactionExpires > 0)
             {

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/context/TxContextImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/context/TxContextImple.java	2006-11-03 00:28:27 UTC (rev 7356)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/context/TxContextImple.java	2006-11-03 06:48:28 UTC (rev 7357)
@@ -72,7 +72,12 @@
 
     public final String identifier ()
     {
-        return _context.getCoordinationContext().getIdentifier().getValue();
+        final String value = _context.getCoordinationContext().getIdentifier().getValue();
+        if ((value != null) && value.startsWith("urn:"))
+        {
+            return value.substring(4) ;
+        }
+        return value ;
     }
     
     public final com.arjuna.mw.wsc.context.Context context ()




More information about the jboss-svn-commits mailing list