[jboss-svn-commits] JBL Code SVN: r5472 - in labs/jbosstm/trunk/XTS: WS-C/dev/src/com/arjuna/webservices/base/processors WS-C/dev/src/com/arjuna/webservices/transport/http WS-C/dev/src/com/arjuna/webservices/util WS-C/dev/src/com/arjuna/webservices/wscoor/processors WS-T/dev/src WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors WS-T/dev/src/com/arjuna/webservices/wsat WS-T/dev/src/com/arjuna/webservices/wsat/client WS-T/dev/src/com/arjuna/webservices/wsat/handlers WS-T/dev/src/com/arjuna/webservices/wsat/processors WS-T/dev/src/com/arjuna/webservices/wsba WS-T/dev/src/com/arjuna/webservices/wsba/handlers WS-T/dev/src/com/arjuna/webservices/wsba/processors WS-T/dev/src/com/arjuna/wst WS-T/dev/src/com/arjuna/wst/messaging WS-T/dev/src/com/arjuna/wst/messaging/deploy WS-T/dev/src/com/arjuna/wst/messaging/engines WS-T/dev/src/com/arjuna/wst/stub WSAS/classes/com/arjuna/mw/wsas/common WSCF/classes/com/arjuna/mw/wscf/model/sagas/part! icipants WSCF/classes/com/arjuna/mw/wscf/model/twophase/participants WSCF/classes/com/arjuna/mwlabs/wsc/model/twophase/participants WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore WSCF/classes/com/arjuna/mwtests/wscf/common WSTX/classes/com/arjuna/mw/wst/common WSTX/classes/com/arjuna/mw/wst/deploy WSTX/classes/com/arjuna/mwlabs/wst WSTX/classes/com/arjuna/mwlabs/wst/at WSTX/classes/com/arjuna/mwlabs/wst/at/participants WSTX/classes/com/arjuna/mwlabs/wst/at/remote WSTX/classes/com/arjuna/mwlabs/wst/ba WSTX/classes/com/arjuna/mwlabs/wst/ba/participants WSTX/classes/com/arjuna/mwlabs/wst/ba/remote WSTX/classes/com/arjuna/mwlabs/wst/util WSTX/config

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 4 10:21:54 EDT 2006


Author: kevin.conner at jboss.com
Date: 2006-08-04 10:20:59 -0400 (Fri, 04 Aug 2006)
New Revision: 5472

Added:
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/base/processors/ActivatedObjectProcessor.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/util/TransportTimer.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/CoordinatorInboundEvents.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/ParticipantInboundEvents.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/State.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionCoordinatorInboundEvents.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionParticipantInboundEvents.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionCoordinatorInboundEvents.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionParticipantInboundEvents.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/PersistableParticipant.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/engines/
   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/util/
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java
Removed:
   labs/jbosstm/trunk/XTS/WS-T/dev/src/META-INF/
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorCallback.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorCallback.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantCallback.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorCallback.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantCallback.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ActivatedObjectProcessor.java
Modified:
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpClient.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpServiceMultiplexorServlet.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpUtils.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/ActivationCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/RegistrationCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCancelHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCloseHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCompleteHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCancelledHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantClosedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCompletedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantFaultedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationParticipantProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/CoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorCommitHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorRollbackHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorAbortedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorCommittedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorAbortedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorCommittedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorPreparedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReadOnlyHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReplayHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantCommitHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantPrepareHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantRollbackHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionInitiatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/ParticipantProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCancelledHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorClosedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompensatedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompletedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorExitHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorGetStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCancelHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCloseHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompensateHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompleteHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantExitedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantFaultedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantGetStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCancelledHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorClosedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompensatedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompletedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorExitHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorGetStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCancelHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCloseHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCompensateHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantExitedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantFaultedHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantGetStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantSoapFaultHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantStatusHandler.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/BusinessAgreementWithParticipantCompletionParticipant.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CompletionCoordinatorProcessorImpl.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/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/ParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/TerminatorParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/deploy/TransactionInitialisation.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BACoordinatorCompletionParticipantManagerStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BAParticipantCompletionParticipantManagerStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessActivityTerminatorStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithCoordinatorCompletionStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithParticipantCompletionStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/CompletionStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Volatile2PCStub.java
   labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/common/Environment.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/sagas/participants/Participant.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/twophase/participants/Participant.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wsc/model/twophase/participants/TwoPhaseParticipant.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ACCoordinator.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ParticipantRecord.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwtests/wscf/common/TwoPhaseParticipant.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/common/Environment.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/deploy/WSTXInitialisation.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/participants/CompletionCoordinatorImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.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/BusinessActivityTerminatorImple.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/RegistrarImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithCoordinatorCompletionImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithParticipantCompletionImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/remote/BusinessActivityManagerImple.java
   labs/jbosstm/trunk/XTS/WSTX/config/wstx.xml
Log:
Updated for 4.2.1GA

Copied: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/base/processors/ActivatedObjectProcessor.java (from rev 4476, labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ActivatedObjectProcessor.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ActivatedObjectProcessor.java	2006-05-30 06:16:32 UTC (rev 4476)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/base/processors/ActivatedObjectProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,82 @@
+/*
+ * 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.base.processors;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This class manages the association between an object and its identifier.
+ */
+public final class ActivatedObjectProcessor
+{
+    /**
+     * The identifier to object map.
+     */
+    private Map objectMap = new HashMap() ;
+    /**
+     * The object to identifier map.
+     */
+    private Map identifierMap = new HashMap() ;
+
+    /**
+     * Activate the object.
+     * @param object The object.
+     * @param identifier The identifier.
+     */
+    public synchronized void activateObject(final Object object, final String identifier)
+    {
+        objectMap.put(identifier, object);
+        identifierMap.put(object, identifier);
+    }
+
+    /**
+     * Deactivate the object.
+     * @param object The object.
+     */
+    public synchronized void deactivateObject(final Object object)
+    {
+        String identifier = (String) identifierMap.remove(object) ;
+        if (identifier != null)
+        {
+            objectMap.remove(identifier) ;
+        }
+    }
+    
+    /**
+     * Get the object with the specified identifier.
+     * @param identifier The identifier.
+     * @return The participant or null if not known.
+     */
+    public synchronized Object getObject(final String identifier)
+    {
+        return objectMap.get(identifier) ;
+    }
+    
+    /**
+     * Get the number of active objects.
+     * @return The number of active objects.
+     */
+    public synchronized int count()
+    {
+        return objectMap.size() ;
+    }
+}

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpClient.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpClient.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -243,7 +243,7 @@
             final Reader reader ;
             if (threadLogEnabled || (contentLength <= 0))
             {
-                final String responseContents = readStream(isr) ;
+                final String responseContents = HttpUtils.readAll(isr) ;
                 
                 if (responseContents.length() == 0)
                 {
@@ -283,31 +283,4 @@
             is.close() ;
         }
     }
-    
-    /**
-     * Get the contents of the stream for logging.
-     * @param isr The input stream reader.
-     * @return The stream contents.
-     * @throws IOException For errors during reading.
-     */
-    private String readStream(final InputStreamReader isr)
-        throws IOException
-    {
-        final StringBuffer stringBuffer = new StringBuffer() ;
-        final char[] charBuffer = new char[256] ;
-        while(true)
-        {
-            final int count = isr.read(charBuffer) ;
-            if (count > 0)
-            {
-                stringBuffer.append(charBuffer, 0, count) ;
-            }
-            else
-            {
-                break ;
-            }
-        }
-        
-        return stringBuffer.toString() ;
-    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpServiceMultiplexorServlet.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpServiceMultiplexorServlet.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpServiceMultiplexorServlet.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -144,7 +144,7 @@
                 final Reader reader ;
                 if (logPackets)
                 {
-                    final String contents = readAll(input) ;
+                    final String contents = HttpUtils.readAll(input) ;
                     SoapMessageLogging.appendThreadLog(contents) ;
                     reader = new StringReader(contents) ;
                 }
@@ -451,30 +451,4 @@
             return null ;
         }
     }
-    
-    /**
-     * Read all the contents of the reader.
-     * @param reader The specified reader.
-     * @return The contents.
-     * @throws IOException For errors during reading.
-     */
-    private static String readAll(final Reader reader)
-        throws IOException
-    {
-        final StringBuffer contents = new StringBuffer() ;
-        final char[] buffer = new char[256] ;
-        while(true)
-        {
-            final int count = reader.read(buffer) ;
-            if (count > 0)
-            {
-                contents.append(buffer, 0, count) ;
-            }
-            else
-            {
-                break ;
-            }
-        }
-        return contents.toString() ;
-    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpUtils.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpUtils.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/transport/http/HttpUtils.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,6 +20,9 @@
  */
 package com.arjuna.webservices.transport.http;
 
+import java.io.IOException;
+import java.io.Reader;
+
 import com.arjuna.webservices.soap.SoapDetails;
 
 /**
@@ -74,6 +77,15 @@
      * The default charset parameter.
      */
     public static final String HTTP_DEFAULT_CHARSET_PARAMETER = "; " + HTTP_CHARSET_PARAMETER + "=utf-8" ;
+
+    /**
+     * The name of the HTTP scheme.
+     */
+    public static final String HTTP_SCHEME = "http" ;
+    /**
+     * The name of the HTTPS scheme.
+     */
+    public static final String HTTPS_SCHEME = "https" ;
     
     /**
      * Get the base content type.
@@ -206,11 +218,58 @@
     }
 
     /**
-     * The name of the HTTP scheme.
+     * Read all the contents of the reader.
+     * @param reader The specified reader.
+     * @return The contents.
+     * @throws IOException For errors during reading.
      */
-    public static final String HTTP_SCHEME = "http" ;
+    static String readAll(final Reader reader)
+        throws IOException
+    {
+        final StringBuffer contents = new StringBuffer() ;
+        final char[] buffer = new char[256] ;
+        while(true)
+        {
+            final int count = reader.read(buffer) ;
+            if (count > 0)
+            {
+                contents.append(buffer, 0, count) ;
+            }
+            else
+            {
+                break ;
+            }
+        }
+        return checkForXMLDecl(contents) ;
+    }
+    
     /**
-     * The name of the HTTPS scheme.
+     * Check for the XML declaration and remove.
+     * This method is only used if we are intending to log the SOAP message so that it is easy to combine the XML without creating invalid documents.
+     * @param contents The current stream contents.
+     * @return The stream contents as a string.
      */
-    public static final String HTTPS_SCHEME = "https" ;
+    private static String checkForXMLDecl(final StringBuffer contents)
+    {
+        int count = 0 ;
+        try
+        {
+            while(Character.isWhitespace(contents.charAt(count))) count++ ;
+            if (contents.charAt(count) == '<')
+            {
+                if (contents.charAt(count+1) == '?')
+                {
+                    count+=2 ;
+                    while(contents.charAt(count++) != '>') ;
+                }
+            }
+            if (count > 0)
+            {
+                contents.delete(0, count) ;
+            }
+        }
+        catch (final StringIndexOutOfBoundsException sioobe) {}
+        
+        return contents.toString() ;
+    }
 }

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/util/TransportTimer.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/util/TransportTimer.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/util/TransportTimer.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,89 @@
+/*
+ * 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.util;
+
+import java.util.Timer;
+
+/**
+ * Utility class providing access to a timer and associated properties.
+ * @author kevin
+ */
+public class TransportTimer
+{
+    /**
+     * Daemon timer.
+     */
+    private static final Timer TIMER = new Timer(true) ;
+    
+    /**
+     * The transport timeout.
+     */
+    private static long TIMEOUT = 30000 ;
+    /**
+     * The transport period.
+     */
+    private static long PERIOD = 5000 ;
+
+    /**
+     * Get the transport timer.
+     * @return The transport timer.
+     */
+    public static Timer getTimer()
+    {
+        return TIMER ;
+    }
+    
+    /**
+     * Set the transport timeout.
+     * @param timeout The transport timeout in milliseconds.
+     */
+    public static void setTransportTimeout(final long timeout)
+    {
+       TIMEOUT = timeout ; 
+    }
+    
+    /**
+     * Get the transport timeout.
+     * @return The transport timeout in milliseconds.
+     */
+    public static long getTransportTimeout()
+    {
+        return TIMEOUT ;
+    }
+    
+    /**
+     * Set the transport period.
+     * @param period The transport period in milliseconds.
+     */
+    public static void setTransportPeriod(final long period)
+    {
+       PERIOD = period ; 
+    }
+    
+    /**
+     * Get the transport period.
+     * @return The transport period in milliseconds.
+     */
+    public static long getTransportPeriod()
+    {
+        return PERIOD ;
+    }
+}

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/ActivationCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/ActivationCoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/ActivationCoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -38,7 +38,7 @@
      * Get the coordinator.
      * @return The coordinator.
      */
-    public static synchronized ActivationCoordinatorProcessor getCoordinator()
+    public static ActivationCoordinatorProcessor getCoordinator()
     {
         return COORDINATOR ;
     }
@@ -48,7 +48,7 @@
      * @param coordinator The coordinator.
      * @return The previous coordinator.
      */
-    public static synchronized ActivationCoordinatorProcessor setCoordinator(final ActivationCoordinatorProcessor coordinator)
+    public static ActivationCoordinatorProcessor setCoordinator(final ActivationCoordinatorProcessor coordinator)
     {
         final ActivationCoordinatorProcessor origCoordinator = COORDINATOR ;
         COORDINATOR = coordinator ;

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/RegistrationCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/RegistrationCoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src/com/arjuna/webservices/wscoor/processors/RegistrationCoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -40,7 +40,7 @@
      * Get the coordinator.
      * @return The coordinator.
      */
-    public static synchronized RegistrationCoordinatorProcessor getCoordinator()
+    public static RegistrationCoordinatorProcessor getCoordinator()
     {
         return COORDINATOR ;
     }
@@ -50,7 +50,7 @@
      * @param coordinator The coordinator.
      * @return The orig coordinator.
      */
-    public static synchronized RegistrationCoordinatorProcessor setCoordinator(final RegistrationCoordinatorProcessor coordinator)
+    public static RegistrationCoordinatorProcessor setCoordinator(final RegistrationCoordinatorProcessor coordinator)
     {
         final RegistrationCoordinatorProcessor origCoordinator = COORDINATOR ;
         COORDINATOR = coordinator ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCancelHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCancelHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCancelHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationCoordinatorProcessor.getParticipant().cancel(cancel, addressingContext, arjunaContext) ;
+                TerminationCoordinatorProcessor.getProcessor().cancel(cancel, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCloseHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCloseHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCloseHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationCoordinatorProcessor.getParticipant().close(close, addressingContext, arjunaContext) ;
+                TerminationCoordinatorProcessor.getProcessor().close(close, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCompleteHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCompleteHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationCoordinatorCompleteHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationCoordinatorProcessor.getParticipant().complete(complete, addressingContext, arjunaContext) ;
+                TerminationCoordinatorProcessor.getProcessor().complete(complete, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCancelledHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCancelledHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCancelledHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationParticipantProcessor.getCoordinator().handleCancelled(cancelled, addressingContext, arjunaContext) ;
+                TerminationParticipantProcessor.getProcessor().handleCancelled(cancelled, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantClosedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantClosedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantClosedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationParticipantProcessor.getCoordinator().handleClosed(complete, addressingContext, arjunaContext) ;
+                TerminationParticipantProcessor.getProcessor().handleClosed(complete, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCompletedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCompletedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantCompletedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationParticipantProcessor.getCoordinator().handleCompleted(completed, addressingContext, arjunaContext) ;
+                TerminationParticipantProcessor.getProcessor().handleCompleted(completed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantFaultedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantFaultedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantFaultedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationParticipantProcessor.getCoordinator().handleFaulted(faulted, addressingContext, arjunaContext) ;
+                TerminationParticipantProcessor.getProcessor().handleFaulted(faulted, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/handlers/TerminationParticipantSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                TerminationParticipantProcessor.getCoordinator().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                TerminationParticipantProcessor.getProcessor().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationCoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationCoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -32,29 +32,29 @@
 public abstract class TerminationCoordinatorProcessor
 {
     /**
-     * The participant.
+     * The participant processor.
      */
-    private static TerminationCoordinatorProcessor PARTICIPANT ;
+    private static TerminationCoordinatorProcessor PROCESSOR ;
     
     /**
-     * Get the participant.
-     * @return The participant.
+     * Get the processor.
+     * @return The processor.
      */
-    public static synchronized TerminationCoordinatorProcessor getParticipant()
+    public static TerminationCoordinatorProcessor getProcessor()
     {
-        return PARTICIPANT ;
+        return PROCESSOR ;
     }
     
     /**
-     * Set the participant.
-     * @param participant The participant.
-     * @return The previous participant.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized TerminationCoordinatorProcessor setParticipant(final TerminationCoordinatorProcessor participant)
+    public static TerminationCoordinatorProcessor setProcessor(final TerminationCoordinatorProcessor processor)
     {
-        final TerminationCoordinatorProcessor origParticipant = PARTICIPANT ;
-        PARTICIPANT = participant ;
-        return origParticipant ;
+        final TerminationCoordinatorProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
 
     /**

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationParticipantProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/processors/TerminationParticipantProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -34,17 +34,17 @@
 public class TerminationParticipantProcessor extends BaseNotificationProcessor
 {
     /**
-     * The coordinator singleton.
+     * The coordinator processor.
      */
-    private static final TerminationParticipantProcessor COORDINATOR = new TerminationParticipantProcessor() ;
+    private static final TerminationParticipantProcessor PROCESSOR = new TerminationParticipantProcessor() ;
     
     /**
-     * Get the coordinator singleton.
+     * Get the processor singleton.
      * @return The singleton.
      */
-    public static TerminationParticipantProcessor getCoordinator()
+    public static TerminationParticipantProcessor getProcessor()
     {
-        return COORDINATOR ;
+        return PROCESSOR ;
     }
 
     /**

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/CoordinatorInboundEvents.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/CoordinatorInboundEvents.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/CoordinatorInboundEvents.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,80 @@
+/*
+ * 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.wsat;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+
+
+/**
+ * The Coordinator events.
+ */
+public interface CoordinatorInboundEvents
+{
+    /**
+     * Handle the aborted event.
+     * @param aborted The aborted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void aborted(final NotificationType aborted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the committed event.
+     * @param committed The committed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void committed(final NotificationType committed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the prepared event.
+     * @param prepared The prepared notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void prepared(final NotificationType prepared, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the readOnly event.
+     * @param readOnly The readOnly notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void readOnly(final NotificationType readOnly, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the replay event.
+     * @param replay The replay notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void replay(final NotificationType aborted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/ParticipantInboundEvents.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/ParticipantInboundEvents.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/ParticipantInboundEvents.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,64 @@
+/*
+ * 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.wsat;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+
+
+/**
+ * The Participant events.
+ */
+public interface ParticipantInboundEvents
+{
+    /**
+     * Handle the commit event.
+     * @param commit The commit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void commit(final NotificationType commit, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the prepare event.
+     * @param prepare The prepare notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void prepare(final NotificationType prepare, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the rollback event.
+     * @param rollback The rollback notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void rollback(final NotificationType rollback, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/State.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/State.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/State.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,118 @@
+/*
+ * 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.wsat;
+
+import java.text.MessageFormat;
+import java.util.Map;
+
+import com.arjuna.webservices.logging.WSTLogger;
+import com.arjuna.webservices.util.Enumerated;
+import com.arjuna.webservices.util.InvalidEnumerationException;
+
+/**
+ * Class representing AT state enumerations.
+ * @author kevin
+ */
+public class State extends Enumerated
+{
+    /**
+     * The Active state.
+     */
+    public static final State STATE_ACTIVE = new State("Active") ;
+    /**
+     * The Preparing state.
+     */
+    public static final State STATE_PREPARING = new State("Preparing") ;
+    /**
+     * The Prepared state.
+     */
+    public static final State STATE_PREPARED = new State("Prepared") ;
+    /**
+     * The PreparedSuccess state.
+     */
+    public static final State STATE_PREPARED_SUCCESS = new State("PreparedSuccess") ;
+    /**
+     * The Committing state.
+     */
+    public static final State STATE_COMMITTING = new State("Committing") ;
+    /**
+     * The Aborting state.
+     */
+    public static final State STATE_ABORTING = new State("Aborting") ;
+    
+    /**
+     * The map of enumerations.
+     */
+    private static final Map ENUM_MAP = generateMap(new Enumerated[] {
+        STATE_ACTIVE, STATE_PREPARING, STATE_PREPARED, STATE_PREPARED_SUCCESS,
+        STATE_COMMITTING, STATE_ABORTING
+    }) ;
+    
+    /**
+     * Construct the state enumeration with the specified value.
+     * @param localName The localName of the state enumeration.
+     */
+    private State(final String value)
+    {
+        super(value) ;
+    }
+    
+    /**
+     * Get the value of this enumeration.
+     * @return the value.
+     */
+    public String getValue()
+    {
+        return (String)getKey() ;
+    }
+    
+    /**
+     * Resolve the enumeration for the specified value.
+     * @param value The value.
+     * @return The enumeration.
+     * @throws InvalidEnumerationException if the value is not valid.
+     */
+    protected Enumerated resolveEnum(final Object value)
+        throws InvalidEnumerationException
+    {
+        return toState((String)value) ;
+    }
+    
+    /**
+     * Return the enumeration for the specified value.
+     * @param value The value.
+     * @return The enumeration.
+     * @throws InvalidEnumerationException if the value is not valid.
+     * @message com.arjuna.webservices.wsat.State_1 [com.arjuna.webservices.wsat.State_1] - Invalid fault type enumeration: {0}
+     */
+    public static State toState(final String value)
+        throws InvalidEnumerationException
+    {
+        final Object state = ENUM_MAP.get(value) ;
+        if (state == null)
+        {
+            final String pattern = WSTLogger.log_mesg.getString("com.arjuna.webservices.wsat.State_1") ;
+            final String message = MessageFormat.format(pattern, new Object[] {value}) ;
+            throw new InvalidEnumerationException(message) ;
+        }
+        return (State)state ;
+    }
+}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/CoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/CoordinatorClient.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/client/CoordinatorClient.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -109,7 +109,7 @@
      * Send a prepared request.
      * @param addressingContext addressing context initialised with to and message ID.
      * @param identifier The identifier of the initiator.
-     * @throws SoapFault For any errors.
+     * @throws SoapFault For any SOAP errors.
      * @throws IOException for any transport errors.
      */
     public void sendPrepared(final AddressingContext addressingContext, final InstanceIdentifier identifier)
@@ -125,7 +125,7 @@
      * Send an aborted request.
      * @param addressingContext addressing context initialised with to and message ID.
      * @param identifier The identifier of the initiator.
-     * @throws SoapFault For any errors.
+     * @throws SoapFault For any SOAP errors.
      * @throws IOException for any transport errors.
      */
     public void sendAborted(final AddressingContext addressingContext, final InstanceIdentifier identifier)
@@ -140,7 +140,7 @@
      * Send a read only request.
      * @param addressingContext addressing context initialised with to and message ID.
      * @param identifier The identifier of the initiator.
-     * @throws SoapFault For any errors.
+     * @throws SoapFault For any SOAP errors.
      * @throws IOException for any transport errors.
      */
     public void sendReadOnly(final AddressingContext addressingContext, final InstanceIdentifier identifier)
@@ -155,7 +155,7 @@
      * Send a committed request.
      * @param addressingContext addressing context initialised with to and message ID.
      * @param identifier The identifier of the initiator.
-     * @throws SoapFault For any errors.
+     * @throws SoapFault For any SOAP errors.
      * @throws IOException for any transport errors.
      */
     public void sendCommitted(final AddressingContext addressingContext, final InstanceIdentifier identifier)
@@ -170,7 +170,7 @@
      * Send a replay request.
      * @param addressingContext addressing context initialised with to and message ID.
      * @param identifier The identifier of the initiator.
-     * @throws SoapFault For any errors.
+     * @throws SoapFault For any SOAP errors.
      * @throws IOException for any transport errors.
      */
     public void sendReplay(final AddressingContext addressingContext, final InstanceIdentifier identifier)
@@ -187,7 +187,7 @@
      * @param addressingContext The addressing context.
      * @param soapFault The SOAP fault.
      * @param identifier The arjuna instance identifier.
-     * @throws SoapFault For any errors.
+     * @throws SoapFault For any SOAP errors.
      * @throws IOException for any transport errors.
      */
     public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorCommitHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorCommitHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorCommitHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CompletionCoordinatorProcessor.getCoordinator().commit(commit, addressingContext, arjunaContext) ;
+                CompletionCoordinatorProcessor.getProcessor().commit(commit, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorRollbackHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorRollbackHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionCoordinatorRollbackHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CompletionCoordinatorProcessor.getCoordinator().rollback(rollback, addressingContext, arjunaContext) ;
+                CompletionCoordinatorProcessor.getProcessor().rollback(rollback, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorAbortedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorAbortedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorAbortedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CompletionInitiatorProcessor.getInitiator().handleAborted(aborted, addressingContext, arjunaContext) ;
+                CompletionInitiatorProcessor.getProcessor().handleAborted(aborted, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorCommittedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorCommittedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorCommittedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CompletionInitiatorProcessor.getInitiator().handleCommitted(committed, addressingContext, arjunaContext) ;
+                CompletionInitiatorProcessor.getProcessor().handleCommitted(committed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CompletionInitiatorSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CompletionInitiatorProcessor.getInitiator().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                CompletionInitiatorProcessor.getProcessor().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorAbortedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorAbortedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorAbortedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorProcessor.getCoordinator().handleAborted(aborted, addressingContext, arjunaContext) ;
+                CoordinatorProcessor.getProcessor().aborted(aborted, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorCommittedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorCommittedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorCommittedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorProcessor.getCoordinator().handleCommitted(committed, addressingContext, arjunaContext) ;
+                CoordinatorProcessor.getProcessor().committed(committed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorPreparedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorPreparedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorPreparedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorProcessor.getCoordinator().handlePrepared(prepared, addressingContext, arjunaContext) ;
+                CoordinatorProcessor.getProcessor().prepared(prepared, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReadOnlyHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReadOnlyHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReadOnlyHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorProcessor.getCoordinator().handleReadOnly(readOnly, addressingContext, arjunaContext) ;
+                CoordinatorProcessor.getProcessor().readOnly(readOnly, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReplayHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReplayHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorReplayHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorProcessor.getCoordinator().handleReplay(replay, addressingContext, arjunaContext) ;
+                CoordinatorProcessor.getProcessor().replay(replay, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/CoordinatorSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorProcessor.getCoordinator().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                CoordinatorProcessor.getProcessor().soapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantCommitHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantCommitHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantCommitHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantProcessor.getParticipant().commit(commit, addressingContext, arjunaContext) ;
+                ParticipantProcessor.getProcessor().commit(commit, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantPrepareHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantPrepareHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantPrepareHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantProcessor.getParticipant().prepare(prepare, addressingContext, arjunaContext) ;
+                ParticipantProcessor.getProcessor().prepare(prepare, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantRollbackHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantRollbackHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantRollbackHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantProcessor.getParticipant().rollback(rollback, addressingContext, arjunaContext) ;
+                ParticipantProcessor.getProcessor().rollback(rollback, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/handlers/ParticipantSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantProcessor.getParticipant().soapFault(soapFault, addressingContext, arjunaContext) ;
+                ParticipantProcessor.getProcessor().soapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionCoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionCoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -32,29 +32,29 @@
 public abstract class CompletionCoordinatorProcessor
 {
     /**
-     * The coordinator.
+     * The coordinator processor.
      */
-    private static CompletionCoordinatorProcessor COORDINATOR ;
+    private static CompletionCoordinatorProcessor PROCESSOR ;
     
     /**
-     * Get the coordinator.
-     * @return The coordinator.
+     * Get the processor.
+     * @return The processor.
      */
-    public static synchronized CompletionCoordinatorProcessor getCoordinator()
+    public static CompletionCoordinatorProcessor getProcessor()
     {
-        return COORDINATOR ;
+        return PROCESSOR ;
     }
 
     /**
-     * Set the coordinator.
-     * @param coordinator The coordinator.
-     * @return The previous coordinator.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized CompletionCoordinatorProcessor setCoordinator(final CompletionCoordinatorProcessor coordinator)
+    public static CompletionCoordinatorProcessor setProcessor(final CompletionCoordinatorProcessor processor)
     {
-        final CompletionCoordinatorProcessor origCoordinator = COORDINATOR ;
-        COORDINATOR = coordinator ;
-        return origCoordinator ;
+        final CompletionCoordinatorProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
 
     /**

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionInitiatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionInitiatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CompletionInitiatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -36,15 +36,15 @@
     /**
      * The initiator singleton.
      */
-    private static final CompletionInitiatorProcessor INITIATOR = new CompletionInitiatorProcessor() ;
+    private static final CompletionInitiatorProcessor PROCESSOR = new CompletionInitiatorProcessor() ;
     
     /**
-     * Get the initiator singleton.
+     * Get the processor singleton.
      * @return The singleton.
      */
-    public static CompletionInitiatorProcessor getInitiator()
+    public static CompletionInitiatorProcessor getProcessor()
     {
-        return INITIATOR ;
+        return PROCESSOR ;
     }
 
     /**

Deleted: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorCallback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorCallback.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorCallback.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -1,88 +0,0 @@
-/*
- * 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.wsat.processors;
-
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
-import com.arjuna.webservices.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsat.NotificationType;
-
-/**
- * The Coordinator callback.
- * @author kevin
- */
-public abstract class CoordinatorCallback extends Callback
-{
-    /**
-     * An aborted response.
-     * @param aborted The aborted notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void aborted(final NotificationType aborted, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A committed response.
-     * @param committed The committed notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void committed(final NotificationType committed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A prepared response.
-     * @param prepared The prepared notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void prepared(final NotificationType prepared, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A read only response.
-     * @param readOnly The read only notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void readOnly(final NotificationType readOnly, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A replay response.
-     * @param replay The replay notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void replay(final NotificationType replay, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A SOAP fault response.
-     * @param soapFault The SOAP fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/CoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -21,135 +21,107 @@
 package com.arjuna.webservices.wsat.processors;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.processor.BaseNotificationProcessor;
+import com.arjuna.webservices.wsat.CoordinatorInboundEvents;
 import com.arjuna.webservices.wsat.NotificationType;
 
 /**
  * The Coordinator processor.
  * @author kevin
  */
-public class CoordinatorProcessor extends BaseNotificationProcessor
+public abstract class CoordinatorProcessor
 {
     /**
-     * The coordinator singleton.
+     * The coordinator processor.
      */
-    private static final CoordinatorProcessor COORDINATOR = new CoordinatorProcessor() ;
+    private static CoordinatorProcessor PROCESSOR ;
     
     /**
-     * Get the coordinator singleton.
+     * Get the processor singleton.
      * @return The singleton.
      */
-    public static CoordinatorProcessor getCoordinator()
+    public static CoordinatorProcessor getProcessor()
     {
-        return COORDINATOR ;
+        return PROCESSOR ;
     }
+    
+    /**
+     * Set the processor singleton.
+     * @param processor The processor.
+     * @return The previous singleton.
+     */
+    public static CoordinatorProcessor setProcessor(final CoordinatorProcessor processor)
+    {
+        final CoordinatorProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
+    }
+    
+    /**
+     * Activate the coordinator.
+     * @param coordinator The coordinator.
+     * @param identifier The identifier.
+     */
+    public abstract void activateCoordinator(final CoordinatorInboundEvents coordinator, final String identifier) ;
 
     /**
-     * Handle an aborted response.
+     * Deactivate the coordinator.
+     * @param coordinator The coordinator.
+     */
+    public abstract void deactivateCoordinator(final CoordinatorInboundEvents coordinator) ;
+    
+    /**
+     * Aborted.
      * @param aborted The aborted notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleAborted(final NotificationType aborted, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCallback)callback).aborted(aborted, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void aborted(final NotificationType aborted, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a committed response.
+     * Committed.
      * @param committed The committed notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleCommitted(final NotificationType committed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCallback)callback).committed(committed, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void committed(final NotificationType committed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a prepared response.
+     * Prepared.
      * @param prepared The prepared notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handlePrepared(final NotificationType prepared, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCallback)callback).prepared(prepared, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void prepared(final NotificationType prepared, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a read only response.
+     * Read only.
      * @param readOnly The read only notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleReadOnly(final NotificationType readOnly, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCallback)callback).readOnly(readOnly, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void readOnly(final NotificationType readOnly, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a replay response.
+     * Replay.
      * @param replay The replay notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleReplay(final NotificationType replay, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCallback)callback).replay(replay, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void replay(final NotificationType replay, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a SOAP fault response.
+     * SOAP fault.
      * @param soapFault The SOAP fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleSoapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCallback)callback).soapFault(soapFault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-
-    /**
-     * Register a callback for the specific instance identifier.
-     * @param instanceIdentifier The instance identifier.
-     * @param callback The callback for the response.
-     */
-    public void registerCallback(final String instanceIdentifier, final CoordinatorCallback callback)
-    {
-        register(instanceIdentifier, callback) ;
-    }
+    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/ParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/ParticipantProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsat/processors/ParticipantProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -24,7 +24,7 @@
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsat.NotificationType;
-import com.arjuna.webservices.wsat.Participant;
+import com.arjuna.webservices.wsat.ParticipantInboundEvents;
 
 /**
  * The Participant processor.
@@ -33,29 +33,29 @@
 public abstract class ParticipantProcessor
 {
     /**
-     * The participant.
+     * The participant processor.
      */
-    private static ParticipantProcessor PARTICIPANT ;
+    private static ParticipantProcessor PROCESSOR ;
     
     /**
-     * Get the participant.
-     * @return The participant.
+     * Get the processor.
+     * @return The processor.
      */
-    public static synchronized ParticipantProcessor getParticipant()
+    public static ParticipantProcessor getProcessor()
     {
-        return PARTICIPANT ;
+        return PROCESSOR ;
     }
 
     /**
-     * Set the participant.
-     * @param participant The participant.
-     * @return The previous participant.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized ParticipantProcessor setParticipant(final ParticipantProcessor participant)
+    public static ParticipantProcessor setProcessor(final ParticipantProcessor processor)
     {
-        final ParticipantProcessor origParticipant = PARTICIPANT ;
-        PARTICIPANT = participant ;
-        return origParticipant ;
+        final ParticipantProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
     
     /**
@@ -63,13 +63,13 @@
      * @param participant The participant.
      * @param identifier The identifier.
      */
-    public abstract void activateParticipant(final Participant participant, final String identifier) ;
+    public abstract void activateParticipant(final ParticipantInboundEvents participant, final String identifier) ;
 
     /**
      * Deactivate the participant.
      * @param participant The participant.
      */
-    public abstract void deactivateParticipant(final Participant participant) ;
+    public abstract void deactivateParticipant(final ParticipantInboundEvents participant) ;
 
     /**
      * Commit.

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionCoordinatorInboundEvents.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionCoordinatorInboundEvents.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionCoordinatorInboundEvents.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,106 @@
+/*
+ * 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.wsba;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+
+
+/**
+ * The Participant events.
+ */
+public interface CoordinatorCompletionCoordinatorInboundEvents
+{
+    /**
+     * Handle the cancelled event.
+     * @param cancelled The cancelled notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the closed event.
+     * @param closed The closed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the compensated event.
+     * @param compensated The compensated notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the completed event.
+     * @param completed The completed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the exit event.
+     * @param exit The exit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the fault event.
+     * @param fault The fault exception.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void fault(final ExceptionType fault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the status event.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionParticipantInboundEvents.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionParticipantInboundEvents.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/CoordinatorCompletionParticipantInboundEvents.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,104 @@
+/*
+ * 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.wsba;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+
+
+/**
+ * The Participant events.
+ */
+public interface CoordinatorCompletionParticipantInboundEvents
+{
+    /**
+     * Handle the cancel event.
+     * @param cancel The cancel notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the close event.
+     * @param close The close notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void close(final NotificationType close, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the compensate event.
+     * @param compensate The compensate notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the complete event.
+     * @param complete The complete notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the exited event.
+     * @param exited The exited notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the faulted event.
+     * @param faulted The faulted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the status event.
+     * @param status The status type.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionCoordinatorInboundEvents.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionCoordinatorInboundEvents.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionCoordinatorInboundEvents.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,106 @@
+/*
+ * 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.wsba;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+
+
+/**
+ * The Participant events.
+ */
+public interface ParticipantCompletionCoordinatorInboundEvents
+{
+    /**
+     * Handle the cancelled event.
+     * @param cancelled The cancelled notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the closed event.
+     * @param closed The closed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the compensated event.
+     * @param compensated The compensated notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the completed event.
+     * @param completed The completed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the exit event.
+     * @param exit The exit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the fault event.
+     * @param fault The fault exception.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void fault(final ExceptionType fault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the status event.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionParticipantInboundEvents.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionParticipantInboundEvents.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/ParticipantCompletionParticipantInboundEvents.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,96 @@
+/*
+ * 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.wsba;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+
+
+/**
+ * The Participant events.
+ */
+public interface ParticipantCompletionParticipantInboundEvents
+{
+    /**
+     * Handle the cancel event.
+     * @param cancel The cancel notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the close event.
+     * @param close The close notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void close(final NotificationType close, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the compensate event.
+     * @param compensate The compensate notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the exited event.
+     * @param exited The exited notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the faulted event.
+     * @param faulted The faulted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the status event.
+     * @param status The status type.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCancelledHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCancelledHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCancelledHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleCancelled(cancelled, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().cancelled(cancelled, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorClosedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorClosedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorClosedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleClosed(closed, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().closed(closed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompensatedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompensatedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompensatedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleCompensated(compensated, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().compensated(compensated, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompletedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompletedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorCompletedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleCompleted(completed, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().completed(completed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorExitHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorExitHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorExitHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().exit(exit, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().exit(exit, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleFault(fault, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().fault(fault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorGetStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorGetStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorGetStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().getStatus(getStatus, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().getStatus(getStatus, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().soapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionCoordinatorStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().handleStatus(status, addressingContext, arjunaContext) ;
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().status(status, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCancelHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCancelHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCancelHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().cancel(cancel, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().cancel(cancel, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCloseHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCloseHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCloseHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().close(close, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().close(close, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompensateHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompensateHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompensateHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().compensate(compensate, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().compensate(compensate, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompleteHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompleteHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantCompleteHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().complete(complete, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().complete(complete, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantExitedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantExitedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantExitedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().handleExited(exited, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().exited(exited, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantFaultedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantFaultedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantFaultedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().handleFaulted(faulted, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().faulted(faulted, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantGetStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantGetStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantGetStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().getStatus(getStatus, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().getStatus(getStatus, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().soapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/CoordinatorCompletionParticipantStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                CoordinatorCompletionParticipantProcessor.getParticipant().handleStatus(status, addressingContext, arjunaContext) ;
+                CoordinatorCompletionParticipantProcessor.getProcessor().status(status, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCancelledHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCancelledHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCancelledHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleCancelled(cancelled, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().cancelled(cancelled, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorClosedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorClosedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorClosedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleClosed(closed, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().closed(closed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompensatedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompensatedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompensatedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleCompensated(compensated, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().compensated(compensated, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompletedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompletedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorCompletedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleCompleted(completed, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().completed(completed, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorExitHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorExitHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorExitHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().exit(exit, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().exit(exit, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleFault(fault, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().fault(fault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorGetStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorGetStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorGetStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().getStatus(getStatus, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().getStatus(getStatus, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().soapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionCoordinatorStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().handleStatus(status, addressingContext, arjunaContext) ;
+                ParticipantCompletionCoordinatorProcessor.getProcessor().status(status, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCancelHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCancelHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCancelHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().cancel(cancel, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().cancel(cancel, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCloseHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCloseHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCloseHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().close(close, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().close(close, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCompensateHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCompensateHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantCompensateHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().compensate(compensate, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().compensate(compensate, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantExitedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantExitedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantExitedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().handleExited(exited, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().exited(exited, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantFaultedHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantFaultedHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantFaultedHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().handleFaulted(faulted, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().faulted(faulted, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantGetStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantGetStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantGetStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().getStatus(getStatus, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().getStatus(getStatus, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantSoapFaultHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantSoapFaultHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantSoapFaultHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().handleSoapFault(soapFault, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().soapFault(soapFault, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantStatusHandler.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantStatusHandler.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/handlers/ParticipantCompletionParticipantStatusHandler.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -61,7 +61,7 @@
         final ArjunaContext arjunaContext = ArjunaContext.getContext(context) ;
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
-                ParticipantCompletionParticipantProcessor.getParticipant().handleStatus(status, addressingContext, arjunaContext) ;
+                ParticipantCompletionParticipantProcessor.getProcessor().status(status, addressingContext, arjunaContext) ;
             }
         }) ;
         return null ;

Deleted: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorCallback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorCallback.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorCallback.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -1,95 +0,0 @@
-/*
- * 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.wsba.processors;
-
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
-import com.arjuna.webservices.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsba.ExceptionType;
-import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.StatusType;
-
-
-/**
- * The Coordinator Completion Coordinator callback.
- * @author kevin
- */
-public abstract class CoordinatorCompletionCoordinatorCallback extends Callback
-{
-    /**
-     * A cancelled response.
-     * @param cancelled The cancelled notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A closed response.
-     * @param closed The closed notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A compensated response.
-     * @param compensated The compensated notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
-    /**
-     * A completed response.
-     * @param completed The completed notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void completed(final NotificationType completed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A Status.
-     * @param status The status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A fault response.
-     * @param fault The fault notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void fault(final ExceptionType fault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A SOAP fault response.
-     * @param soapFault The SOAP fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionCoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -21,202 +21,132 @@
 package com.arjuna.webservices.wsba.processors;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.processor.BaseNotificationProcessor;
+import com.arjuna.webservices.wsba.CoordinatorCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices.wsba.ExceptionType;
 import com.arjuna.webservices.wsba.NotificationType;
 import com.arjuna.webservices.wsba.StatusType;
-import com.arjuna.wst.BAParticipantManager;
 
 
+
 /**
  * The Coordinator Completion Coordinator processor.
  * @author kevin
  */
-public abstract class CoordinatorCompletionCoordinatorProcessor extends BaseNotificationProcessor
+public abstract class CoordinatorCompletionCoordinatorProcessor
 {
     /**
-     * The coordinator.
+     * The coordinator processor.
      */
-    private static CoordinatorCompletionCoordinatorProcessor COORDINATOR ;
+    private static CoordinatorCompletionCoordinatorProcessor PROCESSOR ;
     
     /**
-     * Get the coordinator.
+     * Get the processor.
      * @return The singleton.
      */
-    public static synchronized CoordinatorCompletionCoordinatorProcessor getCoordinator()
+    public static CoordinatorCompletionCoordinatorProcessor getProcessor()
     {
-        return COORDINATOR ;
+        return PROCESSOR ;
     }
     
     /**
-     * Set the coordinator.
-     * @param coordinator The coordinator.
-     * @return The previous coordinator.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized CoordinatorCompletionCoordinatorProcessor setCoordinator(final CoordinatorCompletionCoordinatorProcessor coordinator)
+    public static CoordinatorCompletionCoordinatorProcessor setProcessor(final CoordinatorCompletionCoordinatorProcessor processor)
     {
-        final CoordinatorCompletionCoordinatorProcessor origCoordinator = COORDINATOR ;
-        COORDINATOR = coordinator ;
-        return origCoordinator ;
+        final CoordinatorCompletionCoordinatorProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
     
     /**
-     * Activate the participant.
-     * @param participant The participant.
+     * Activate the coordinator.
+     * @param coordinatorState The coordinator.
      * @param identifier The identifier.
      */
-    public abstract void activateParticipant(final BAParticipantManager participant, final String identifier) ;
+    public abstract void activateCoordinator(final CoordinatorCompletionCoordinatorInboundEvents coordinator, final String identifier) ;
 
     /**
-     * Deactivate the participant.
-     * @param participant The participant.
+     * Deactivate the coordinator.
+     * @param coordinator The coordinator.
      */
-    public abstract void deactivateParticipant(final BAParticipantManager participant) ;
+    public abstract void deactivateCoordinator(final CoordinatorCompletionCoordinatorInboundEvents coordinator) ;
     
     /**
-     * Handle a cancelled response.
+     * Cancelled.
      * @param cancelled The cancelled notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleCancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).cancelled(cancelled, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a closed response.
+     * Closed.
      * @param closed The closed notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleClosed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).closed(closed, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a compensated response.
+     * Compensated.
      * @param compensated The compensated notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleCompensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).compensated(compensated, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
 
     /**
-     * Handle a completed response.
+     * Completed.
      * @param completed The completed notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleCompleted(final NotificationType completed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).completed(completed, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a Status.
-     * @param status The status notification.
+     * Exit.
+     * @param exit The exit notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleStatus(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).status(status, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a fault response.
-     * @param fault The fault notification.
+     * Fault.
+     * @param fault The fault exception.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleFault(final ExceptionType fault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).fault(fault, addressingContext, arjunaContext) ;
-            }
-            public void executeUnknownIds(final String[] ids) {
-                fault(fault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void fault(final ExceptionType fault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a SOAP fault response.
-     * @param soapFault The SOAP fault.
+     * Get Status.
+     * @param getStatus The get status notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleSoapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionCoordinatorCallback)callback).soapFault(soapFault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Exit.
-     * @param exit The exit notification.
+     * Status.
+     * @param status The status.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public abstract void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
+    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
     /**
-     * Fault.
-     * @param fault The fault notification.
+     * SOAP fault.
+     * @param soapFault The SOAP fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public abstract void fault(final ExceptionType fault, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
-    /**
-     * Get Status.
-     * @param getStatus The get status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
-    /**
-     * Register a callback for the specific instance identifier.
-     * @param instanceIdentifier The instance identifier.
-     * @param callback The callback for the response.
-     */
-    public void registerCallback(final String instanceIdentifier, final CoordinatorCompletionCoordinatorCallback callback)
-    {
-        register(instanceIdentifier, callback) ;
-    }
+    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
 }

Deleted: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantCallback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantCallback.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantCallback.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -1,77 +0,0 @@
-/*
- * 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.wsba.processors;
-
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
-import com.arjuna.webservices.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.StatusType;
-
-
-/**
- * The Coordinator Completion Participant callback.
- * @author kevin
- */
-public abstract class CoordinatorCompletionParticipantCallback extends Callback
-{
-    /**
-     * Complete.
-     * @param complete The complete notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * An exited response.
-     * @param exited The exited notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A faulted response.
-     * @param faulted The faulted notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A status response.
-     * @param status The status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A SOAP fault response.
-     * @param soapFault The SOAP fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/CoordinatorCompletionParticipantProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -21,59 +21,57 @@
 package com.arjuna.webservices.wsba.processors;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.processor.BaseNotificationProcessor;
+import com.arjuna.webservices.wsba.CoordinatorCompletionParticipantInboundEvents;
 import com.arjuna.webservices.wsba.NotificationType;
 import com.arjuna.webservices.wsba.StatusType;
-import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
 
 
 /**
  * The Coordinator Completion Participant processor.
  * @author kevin
  */
-public abstract class CoordinatorCompletionParticipantProcessor extends BaseNotificationProcessor
+public abstract class CoordinatorCompletionParticipantProcessor
 {
     /**
-     * The participant.
+     * The participant processor.
      */
-    private static CoordinatorCompletionParticipantProcessor PARTICIPANT ;
+    private static CoordinatorCompletionParticipantProcessor PROCESSOR ;
     
     /**
-     * Get the participant.
-     * @return The participant.
+     * Get the processor.
+     * @return The processor.
      */
-    public static synchronized CoordinatorCompletionParticipantProcessor getParticipant()
+    public static CoordinatorCompletionParticipantProcessor getProcessor()
     {
-        return PARTICIPANT ;
+        return PROCESSOR ;
     }
-
+    
     /**
-     * Set the participant.
-     * @param participant The participant.
-     * @return The previous participant.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized CoordinatorCompletionParticipantProcessor setParticipant(final CoordinatorCompletionParticipantProcessor participant)
+    public static CoordinatorCompletionParticipantProcessor setProcessor(final CoordinatorCompletionParticipantProcessor processor)
     {
-        final CoordinatorCompletionParticipantProcessor origParticipant = PARTICIPANT ;
-        PARTICIPANT = participant ;
-        return origParticipant ;
+        final CoordinatorCompletionParticipantProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
-
+    
     /**
      * Activate the participant.
      * @param participant The participant.
      * @param identifier The identifier.
      */
-    public abstract void activateParticipant(final BusinessAgreementWithCoordinatorCompletionParticipant participant, final String identifier) ;
+    public abstract void activateParticipant(final CoordinatorCompletionParticipantInboundEvents participant, final String identifier) ;
 
     /**
      * Deactivate the participant.
      * @param participant The participant.
      */
-    public abstract void deactivateParticipant(final BusinessAgreementWithCoordinatorCompletionParticipant participant) ;
+    public abstract void deactivateParticipant(final CoordinatorCompletionParticipantInboundEvents participant) ;
     
     /**
      * Cancel.
@@ -108,81 +106,43 @@
     public abstract void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Get Status.
-     * @param getStatus The get status notification.
+     * Exited.
+     * @param exited The exited notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    public abstract void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle an exited response.
-     * @param exited The exited notification.
+     * Faulted.
+     * @param faulted The faulted notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleExited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionParticipantCallback)callback).exited(exited, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a faulted response.
-     * @param faulted The faulted notification.
+     * Get Status.
+     * @param getStatus The get status notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleFaulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionParticipantCallback)callback).faulted(faulted, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a status response.
-     * @param status The status notification.
+     * Status.
+     * @param status The status.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleStatus(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionParticipantCallback)callback).status(status, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a SOAP fault response.
+     * SOAP fault.
      * @param soapFault The SOAP fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleSoapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((CoordinatorCompletionParticipantCallback)callback).soapFault(soapFault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-
-    /**
-     * Register a callback for the specific instance identifier.
-     * @param instanceIdentifier The instance identifier.
-     * @param callback The callback for the response.
-     */
-    public void registerCallback(final String instanceIdentifier, final CoordinatorCompletionParticipantCallback callback)
-    {
-        register(instanceIdentifier, callback) ;
-    }
+    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
 }

Deleted: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorCallback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorCallback.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorCallback.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -1,96 +0,0 @@
-/*
- * 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.wsba.processors;
-
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
-import com.arjuna.webservices.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsba.ExceptionType;
-import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.StatusType;
-
-
-/**
- * The Participant Completion Coordinator callback.
- * @author kevin
- */
-public abstract class ParticipantCompletionCoordinatorCallback extends Callback
-{
-    /**
-     * A cancelled response.
-     * @param cancelled The cancelled notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A closed response.
-     * @param closed The closed notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A compensated response.
-     * @param compensated The compensated notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
-    /**
-     * A completed response.
-     * @param completed The completed notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void completed(final NotificationType completed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A Status.
-     * @param status The status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A fault response.
-     * @param fault The fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void fault(final ExceptionType fault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A SOAP fault response.
-     * @param soapFault The SOAP fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionCoordinatorProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -21,177 +21,84 @@
 package com.arjuna.webservices.wsba.processors;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.processor.BaseNotificationProcessor;
 import com.arjuna.webservices.wsba.ExceptionType;
 import com.arjuna.webservices.wsba.NotificationType;
+import com.arjuna.webservices.wsba.ParticipantCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices.wsba.StatusType;
-import com.arjuna.wst.BAParticipantManager;
 
 
 /**
  * The Participant Completion Coordinator processor.
  * @author kevin
  */
-public abstract class ParticipantCompletionCoordinatorProcessor extends BaseNotificationProcessor
+public abstract class ParticipantCompletionCoordinatorProcessor
 {
     /**
-     * The coordinator.
+     * The coordinator processor.
      */
-    private static ParticipantCompletionCoordinatorProcessor COORDINATOR ;
+    private static ParticipantCompletionCoordinatorProcessor PROCESSOR ;
     
     /**
-     * Get the coordinator.
-     * @return The coordinator.
+     * Get the processor.
+     * @return The processor.
      */
-    public static synchronized ParticipantCompletionCoordinatorProcessor getCoordinator()
+    public static ParticipantCompletionCoordinatorProcessor getProcessor()
     {
-        return COORDINATOR ;
+        return PROCESSOR ;
     }
     
     /**
-     * Set the coordinator.
-     * @param coordinator The coordinator.
-     * @return The previous coordinator.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized ParticipantCompletionCoordinatorProcessor setCoordinator(final ParticipantCompletionCoordinatorProcessor coordinator)
+    public static ParticipantCompletionCoordinatorProcessor setProcessor(final ParticipantCompletionCoordinatorProcessor processor)
     {
-        final ParticipantCompletionCoordinatorProcessor origCoordinator = COORDINATOR ;
-        COORDINATOR = coordinator ;
-        return origCoordinator ;
+        final ParticipantCompletionCoordinatorProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
     
     /**
-     * Activate the participant.
-     * @param participant The participant.
+     * Activate the coordinator.
+     * @param coordinatorState The coordinator.
      * @param identifier The identifier.
      */
-    public abstract void activateParticipant(final BAParticipantManager participant, final String identifier) ;
+    public abstract void activateCoordinator(final ParticipantCompletionCoordinatorInboundEvents coordinator, final String identifier) ;
 
     /**
-     * Deactivate the participant.
-     * @param participant The participant.
+     * Deactivate the coordinator.
+     * @param coordinator The coordinator.
      */
-    public abstract void deactivateParticipant(final BAParticipantManager participant) ;
+    public abstract void deactivateCoordinator(final ParticipantCompletionCoordinatorInboundEvents coordinator) ;
     
     /**
-     * Handle a cancelled response.
+     * Cancelled.
      * @param cancelled The cancelled notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleCancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).cancelled(cancelled, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a closed response.
+     * Closed.
      * @param closed The closed notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleClosed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).closed(closed, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a compensated response.
+     * Compensated.
      * @param compensated The compensated notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleCompensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).compensated(compensated, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
 
     /**
-     * Handle a completed response.
-     * @param completed The completed notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public void handleCompleted(final NotificationType completed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutor() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).completed(completed, addressingContext, arjunaContext) ;
-            }
-            public void executeUnknownIds(final String[] ids) {
-                completed(completed, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-    
-    /**
-     * Handle a Status.
-     * @param status The status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public void handleStatus(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).status(status, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-    
-    /**
-     * Handle a fault response.
-     * @param fault The fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public void handleFault(final ExceptionType fault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutor() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).fault(fault, addressingContext, arjunaContext) ;
-            }
-            public void executeUnknownIds(final String[] ids) {
-                fault(fault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-    
-    /**
-     * Handle a SOAP fault response.
-     * @param soapFault The SOAP fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public void handleSoapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionCoordinatorCallback)callback).soapFault(soapFault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-    
-
-    /**
      * Completed.
      * @param completed The completed notification.
      * @param addressingContext The addressing context.
@@ -209,8 +116,8 @@
     public abstract void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a fault response.
-     * @param fault The fault.
+     * Fault.
+     * @param fault The fault exception.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
@@ -224,14 +131,21 @@
      * @param arjunaContext The arjuna context.
      */
     public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
+    
     /**
-     * Register a callback for the specific instance identifier.
-     * @param instanceIdentifier The instance identifier.
-     * @param callback The callback for the response.
+     * Status.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
      */
-    public void registerCallback(final String instanceIdentifier, final ParticipantCompletionCoordinatorCallback callback)
-    {
-        register(instanceIdentifier, callback) ;
-    }
+    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    
+    /**
+     * SOAP fault.
+     * @param soapFault The SOAP fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
 }

Deleted: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantCallback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantCallback.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantCallback.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -1,77 +0,0 @@
-/*
- * 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.wsba.processors;
-
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
-import com.arjuna.webservices.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.StatusType;
-
-
-/**
- * The Participant Completion Participant callback.
- * @author kevin
- */
-public abstract class ParticipantCompletionParticipantCallback extends Callback
-{
-    /**
-     * A complete response.
-     * @param complete The complete notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * An exited response.
-     * @param exited The exited notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A faulted response.
-     * @param faulted The faulted notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A status response.
-     * @param status The status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-    
-    /**
-     * A SOAP fault response.
-     * @param soapFault The SOAP fault.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext) ;
-}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsba/processors/ParticipantCompletionParticipantProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -21,45 +21,43 @@
 package com.arjuna.webservices.wsba.processors;
 
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.base.processors.Callback;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.processor.BaseNotificationProcessor;
 import com.arjuna.webservices.wsba.NotificationType;
+import com.arjuna.webservices.wsba.ParticipantCompletionParticipantInboundEvents;
 import com.arjuna.webservices.wsba.StatusType;
-import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
 
 
 /**
  * The Participant Completion Participant processor.
  * @author kevin
  */
-public abstract class ParticipantCompletionParticipantProcessor extends BaseNotificationProcessor
+public abstract class ParticipantCompletionParticipantProcessor
 {
     /**
-     * The participant.
+     * The participant processor.
      */
-    private static ParticipantCompletionParticipantProcessor PARTICIPANT ;
+    private static ParticipantCompletionParticipantProcessor PROCESSOR ;
     
     /**
-     * Get the participant.
-     * @return The participant.
+     * Get the processor.
+     * @return The processor.
      */
-    public static synchronized ParticipantCompletionParticipantProcessor getParticipant()
+    public static ParticipantCompletionParticipantProcessor getProcessor()
     {
-        return PARTICIPANT ;
+        return PROCESSOR ;
     }
     
     /**
-     * Set the participant.
-     * @param participant The participant.
-     * @return The previous participant.
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
      */
-    public static synchronized ParticipantCompletionParticipantProcessor setParticipant(final ParticipantCompletionParticipantProcessor participant)
+    public static ParticipantCompletionParticipantProcessor setProcessor(final ParticipantCompletionParticipantProcessor processor)
     {
-        final ParticipantCompletionParticipantProcessor origParticipant = PARTICIPANT ;
-        PARTICIPANT = participant ;
-        return origParticipant ;
+        final ParticipantCompletionParticipantProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
     }
     
     /**
@@ -67,13 +65,13 @@
      * @param participant The participant.
      * @param identifier The identifier.
      */
-    public abstract void activateParticipant(final BusinessAgreementWithParticipantCompletionParticipant participant, final String identifier) ;
+    public abstract void activateParticipant(final ParticipantCompletionParticipantInboundEvents participant, final String identifier) ;
 
     /**
      * Deactivate the participant.
      * @param participant The participant.
      */
-    public abstract void deactivateParticipant(final BusinessAgreementWithParticipantCompletionParticipant participant) ;
+    public abstract void deactivateParticipant(final ParticipantCompletionParticipantInboundEvents participant) ;
     
     /**
      * Cancel.
@@ -82,7 +80,7 @@
      * @param arjunaContext The arjuna context.
      */
     public abstract void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
-
+    
     /**
      * Close.
      * @param close The close notification.
@@ -100,97 +98,43 @@
     public abstract void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Get Status.
-     * @param getStatus The get status notification.
+     * Exited.
+     * @param exited The exited notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
+    public abstract void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
-    
     /**
-     * Handle a complete response.
-     * @param complete The complete notification.
+     * Faulted.
+     * @param faulted The faulted notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleComplete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionParticipantCallback)callback).complete(complete, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle an exited response.
-     * @param exited The exited notification.
+     * Get Status.
+     * @param getStatus The get status notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleExited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionParticipantCallback)callback).exited(exited, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a faulted response.
-     * @param faulted The faulted notification.
+     * Status.
+     * @param status The status.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleFaulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionParticipantCallback)callback).faulted(faulted, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
+    public abstract void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext) ;
     
     /**
-     * Handle a status response.
-     * @param status The status notification.
-     * @param addressingContext The addressing context.
-     * @param arjunaContext The arjuna context.
-     */
-    public void handleStatus(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionParticipantCallback)callback).status(status, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-    
-    /**
-     * Handle a SOAP fault response.
+     * SOAP fault.
      * @param soapFault The SOAP fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      */
-    public void handleSoapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
-    {
-        handleCallbacks(new CallbackExecutorAdapter() {
-            public void execute(final Callback callback) {
-                ((ParticipantCompletionParticipantCallback)callback).soapFault(soapFault, addressingContext, arjunaContext) ;
-            }
-        }, getIDs(addressingContext, arjunaContext)) ;
-    }
-
-    /**
-     * Register a callback for the specific instance identifier.
-     * @param instanceIdentifier The instance identifier.
-     * @param callback The callback for the response.
-     */
-    public void registerCallback(final String instanceIdentifier, final ParticipantCompletionParticipantCallback callback)
-    {
-        register(instanceIdentifier, callback) ;
-    }
+    public abstract void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext) ;
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/BusinessAgreementWithParticipantCompletionParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/BusinessAgreementWithParticipantCompletionParticipant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/BusinessAgreementWithParticipantCompletionParticipant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -78,5 +78,4 @@
      */
 
     public void error () throws SystemException;
-    
 }

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/PersistableParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/PersistableParticipant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/PersistableParticipant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,44 @@
+package com.arjuna.wst;
+
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+
+/*
+ * 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.
+ */
+/**
+ * The interface for a persistable resource.
+ */
+public interface PersistableParticipant
+{
+    /**
+     * Save the state of the particpant to the specified input object stream.
+     * @param oos The output output stream.
+     * @return true if persisted, false otherwise.
+     */
+    public boolean saveState(final OutputObjectState oos) ;
+    
+    /**
+     * Restore the state of the particpant from the specified input object stream.
+     * @param ios The Input object stream.
+     * @return true if restored, false otherwise.
+     */
+    public boolean restoreState(final InputObjectState ios);
+}

Deleted: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ActivatedObjectProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ActivatedObjectProcessor.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ActivatedObjectProcessor.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -1,87 +0,0 @@
-/*
- * 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.wst.messaging;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The base class for processors acting on registered objects.
- */
-class ActivatedObjectProcessor
-{
-    /**
-     * Lock for guarding the maps.
-     */
-    private final byte[] lock = new byte[0] ;
-    
-    /**
-     * The identifier to object map.
-     */
-    private Map objectMap = new HashMap() ;
-    /**
-     * The object to identifier map.
-     */
-    private Map identifierMap = new HashMap() ;
-
-    /**
-     * Activate the object.
-     * @param object The object.
-     * @param identifier The identifier.
-     */
-    void activateObject(final Object object, final String identifier)
-    {
-        synchronized(lock)
-        {
-            objectMap.put(identifier, object);
-            identifierMap.put(object, identifier);
-        }
-    }
-
-    /**
-     * Deactivate the object.
-     * @param object The object.
-     */
-    void deactivateObject(final Object object)
-    {
-        synchronized(lock)
-        {
-            String identifier = (String) identifierMap.remove(object) ;
-            if (identifier != null)
-            {
-                objectMap.remove(identifier) ;
-            }
-        }
-    }
-    
-    /**
-     * Get the object with the specified identifier.
-     * @param identifier The identifier.
-     * @return The participant or null if not known.
-     */
-    Object getObject(final String identifier)
-    {
-        synchronized(lock)
-        {
-            return objectMap.get(identifier) ;
-        }
-    }
-}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CompletionCoordinatorProcessorImpl.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CompletionCoordinatorProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -24,6 +24,7 @@
 
 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.wsarj.ArjunaContext;

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,40 +20,22 @@
  */
 package com.arjuna.wst.messaging;
 
-import java.text.MessageFormat;
-
 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.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices.wsba.CoordinatorCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices.wsba.ExceptionType;
 import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.client.CoordinatorCompletionParticipantClient;
+import com.arjuna.webservices.wsba.StatusType;
 import com.arjuna.webservices.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
-import com.arjuna.wsc.messaging.MessageId;
-import com.arjuna.wst.BAParticipantManager;
-import com.arjuna.wst.SystemException;
-import com.arjuna.wst.UnknownTransactionException;
-import com.arjuna.wst.WrongStateException;
 
 
 /**
  * The Coordinator Completion Coordinator processor.
  * @author kevin
- * 
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_6 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_6] - Wrong state
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_7 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_7] - Unknown Transaction
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_8 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_8] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_9 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_9] - Unexpected exception thrown from exit:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_10 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_10] - Exit called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_11 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_11] - Unknown participant
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_12 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_12] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_13 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_13] - Unexpected exception thrown from fault:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_14 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_14] - Fault called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_15 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_15] - Unknown participant
  */
 public class CoordinatorCompletionCoordinatorProcessorImpl extends CoordinatorCompletionCoordinatorProcessor
 {
@@ -63,185 +45,341 @@
     private final ActivatedObjectProcessor activatedObjectProcessor = new ActivatedObjectProcessor() ;
     
     /**
-     * Activate the participant.
-     * @param participant The participant.
+     * Activate the coordinator.
+     * @param coordinator The coordinator.
      * @param identifier The identifier.
      */
-    public void activateParticipant(final BAParticipantManager participant, final String identifier)
+    public void activateCoordinator(final CoordinatorCompletionCoordinatorInboundEvents coordinator, final String identifier)
     {
-        activatedObjectProcessor.activateObject(participant, identifier) ;
+        activatedObjectProcessor.activateObject(coordinator, identifier) ;
     }
 
     /**
-     * Deactivate the participant.
-     * @param participant The participant.
+     * Deactivate the coordinator.
+     * @param coordinator The coordinator.
      */
-    public void deactivateParticipant(final BAParticipantManager participant)
+    public void deactivateCoordinator(final CoordinatorCompletionCoordinatorInboundEvents coordinator)
     {
-        activatedObjectProcessor.deactivateObject(participant) ;
+        activatedObjectProcessor.deactivateObject(coordinator) ;
     }
     
     /**
-     * Get the participant with the specified identifier.
-     * @param instanceIdentifier The participant identifier.
-     * @return The participant or null if not known.
+     * Get the coordinator associated with the specified identifier.
+     * @param instanceIdentifier The coordinator identifier.
+     * @return The coordinator or null if not known.
      */
-    private BAParticipantManager getParticipant(final InstanceIdentifier instanceIdentifier)
+    private CoordinatorCompletionCoordinatorInboundEvents getCoordinator(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
-        return (BAParticipantManager)activatedObjectProcessor.getObject(identifier) ;
+        return (CoordinatorCompletionCoordinatorInboundEvents)activatedObjectProcessor.getObject(identifier) ;
     }
     
     /**
-     * Exit.
-     * @param exit The exit notification.
+     * Cancelled.
+     * @param cancelled The cancelled notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.cancelled_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.cancelled_1] - Unexpected exception thrown from cancelled:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.cancelled_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.cancelled_2] - Cancelled called on unknown coordinator: {0}
      */
-    public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BAParticipantManager participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
 
-        try
+        if (coordinator != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
+                coordinator.cancelled(cancelled, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    participant.exit() ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.cancelled_1", th) ;
                 }
-                catch (final WrongStateException wse)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.cancelled_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Closed.
+     * @param closed The closed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.closed_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.closed_1] - Unexpected exception thrown from closed:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.closed_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.closed_2] - Closed called on unknown coordinator: {0}
+     */
+    public void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.closed(closed, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_6")) ;
-                    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.closed_1", th) ;
                 }
-                catch (final UnknownTransactionException ute)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.closed_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Compensated.
+     * @param compensated The compensated notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.compensated_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.compensated_1] - Unexpected exception thrown from compensated:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.compensated_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.compensated_2] - Compensated called on unknown coordinator: {0}
+     */
+    public void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.compensated(compensated, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_7")) ;
-                    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.compensated_1", th) ;
                 }
-                catch (final SystemException se)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.compensated_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+
+    /**
+     * Completed.
+     * @param completed The completed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.completed_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.completed_1] - Unexpected exception thrown from completed:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.completed_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.completed_2] - Completed called on unknown coordinator: {0}
+     */
+    public void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.completed(completed, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_8") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.completed_1", th) ;
                 }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_9", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionParticipantClient.getClient().sendExited(responseAddressingContext, instanceIdentifier) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.completed_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Exit.
+     * @param exit The exit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_1] - Unexpected exception thrown from exit:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_2] - Exit called on unknown coordinator: {0}
+     */
+    public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
             {
+                coordinator.exit(exit, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_10", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_11")) ;
-                CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.exit_2", new Object[] {instanceIdentifier}) ;
         }
     }
 
-
     /**
      * Fault.
      * @param fault The fault notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_1] - Unexpected exception thrown from fault:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_2] - Fault called on unknown coordinator: {0}
      */
     public void fault(final ExceptionType fault, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BAParticipantManager participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
 
-        try
+        if (coordinator != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
+                coordinator.fault(fault, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    participant.fault() ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_1", th) ;
                 }
-                catch (final SystemException se)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.fault_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Get Status.
+     * @param getStatus The get status notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2] - GetStatus called on unknown coordinator: {0}
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.getStatus(getStatus, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_12") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1", th) ;
                 }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_13", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionParticipantClient.getClient().sendFaulted(responseAddressingContext, instanceIdentifier) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Status.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.status_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.status_1] - Unexpected exception thrown from status:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.status_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.status_2] - Status called on unknown coordinator: {0}
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
             {
+                coordinator.status(status, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_14", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.status_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl_15")) ;
-                CoordinatorCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.status_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
     /**
-     * Get Status.
-     * @param getStatus The get status notification.
+     * SOAP fault.
+     * @param soapFault The SOAP fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_1] - Unexpected exception thrown from soapFault:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_2] - SoapFault called on unknown coordinator: {0}
      */
-    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
     {
-        // Not implemented yet
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.soapFault(soapFault, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_1", th) ;
+                }
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
+        }
     }
 }

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,56 +20,21 @@
  */
 package com.arjuna.wst.messaging;
 
-import java.text.MessageFormat;
-
 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.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices.wsba.CoordinatorCompletionParticipantInboundEvents;
 import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.State;
-import com.arjuna.webservices.wsba.client.CoordinatorCompletionCoordinatorClient;
+import com.arjuna.webservices.wsba.StatusType;
 import com.arjuna.webservices.wsba.processors.CoordinatorCompletionParticipantProcessor;
-import com.arjuna.wsc.messaging.MessageId;
-import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
-import com.arjuna.wst.FaultedException;
-import com.arjuna.wst.SystemException;
-import com.arjuna.wst.WrongStateException;
 
 
 /**
  * The Coordinator Completion Participant processor.
  * @author kevin
- * 
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_1] - Wrong state
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_2] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_3 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_3] - Unexpected exception thrown from cancel:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_4 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_4] - Cancel called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_5 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_5] - Unknown participant
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_6 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_6] - Wrong state
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_7 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_7] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_8 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_8] - Unexpected exception thrown from close:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_9 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_9] - Close called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_10 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_10] - Unknown participant
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_11 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_11] - Wrong state
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_12 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_12] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_13 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_13] - Unexpected exception thrown from compensate:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_14 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_14] - Compensate called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_15 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_15] - Unknown participant
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_16 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_16] - Wrong state
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_17 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_17] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_18 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_18] - Unexpected exception thrown from complete:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_19 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_19] - Complete called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_20 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_20] - Unknown participant
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_21 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_21] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_22 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_22] - Unexpected exception thrown from getStatus:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_23 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_23] - Complete called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_24 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_24] - Unknown participant
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_25 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_25] - Unexpected exception thrown from soapFault:
- * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_26 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_26] - SoapFault called on unknown participant: {0}
  */
 public class CoordinatorCompletionParticipantProcessorImpl extends CoordinatorCompletionParticipantProcessor
 {
@@ -83,7 +48,7 @@
      * @param participant The participant.
      * @param identifier The identifier.
      */
-    public void activateParticipant(final BusinessAgreementWithCoordinatorCompletionParticipant participant, final String identifier)
+    public void activateParticipant(final CoordinatorCompletionParticipantInboundEvents participant, final String identifier)
     {
         activatedObjectProcessor.activateObject(participant, identifier) ;
     }
@@ -92,7 +57,7 @@
      * Deactivate the participant.
      * @param participant The participant.
      */
-    public void deactivateParticipant(final BusinessAgreementWithCoordinatorCompletionParticipant participant)
+    public void deactivateParticipant(final CoordinatorCompletionParticipantInboundEvents participant)
     {
         activatedObjectProcessor.deactivateObject(participant) ;
     }
@@ -102,10 +67,10 @@
      * @param instanceIdentifier The participant identifier.
      * @return The participant or null if not known.
      */
-    private BusinessAgreementWithCoordinatorCompletionParticipant getParticipant(final InstanceIdentifier instanceIdentifier)
+    private CoordinatorCompletionParticipantInboundEvents getParticipant(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
-        return (BusinessAgreementWithCoordinatorCompletionParticipant)activatedObjectProcessor.getObject(identifier) ;
+        return (CoordinatorCompletionParticipantInboundEvents)activatedObjectProcessor.getObject(identifier) ;
     }
 
     /**
@@ -113,68 +78,32 @@
      * @param cancel The cancel notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_1] - Unexpected exception thrown from cancel:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_2] - Cancel called on unknown participant: {0}
      */
     public void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithCoordinatorCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.cancel() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_1")) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_2") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_3", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(responseAddressingContext, instanceIdentifier) ;
+                participant.cancel(cancel, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_4", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_5")) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -183,68 +112,32 @@
      * @param close The close notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_1] - Unexpected exception thrown from close:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_2] - Close called on unknown participant: {0}
      */
     public void close(final NotificationType close, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithCoordinatorCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.close() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_6")) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_7") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_8", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendClosed(responseAddressingContext, instanceIdentifier) ;
+                participant.close(close, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_9", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_10")) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -253,75 +146,32 @@
      * @param compensate The compensate notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_1] - Unexpected exception thrown from compensate:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_2] - Compensate called on unknown participant: {0}
      */
     public void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithCoordinatorCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.compensate() ;
-                }
-                catch (final FaultedException fe)
-                {
-                    final AddressingContext responseAddressingContext =
-                        AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendFault(responseAddressingContext, instanceIdentifier, null) ;
-                    return ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_11")) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_12") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_13", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(responseAddressingContext, instanceIdentifier) ;
+                participant.compensate(compensate, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_14", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_15")) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -330,68 +180,100 @@
      * @param complete The complete notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @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}
      */
     public void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithCoordinatorCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
+                participant.complete(complete, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    participant.complete() ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_1", th) ;
                 }
-                catch (final WrongStateException wse)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Exited.
+     * @param exited The exited notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.exited_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.exited_1] - Unexpected exception thrown from exited:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.exited_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.exited_2] - Exited called on unknown participant: {0}
+     */
+    public void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+
+        if (participant != null)
+        {
+            try
+            {
+                participant.exited(exited, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_16")) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.exited_1", th) ;
                 }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_17") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_18", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(responseAddressingContext, instanceIdentifier) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.exited_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Faulted.
+     * @param faulted The faulted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.faulted_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.faulted_1] - Unexpected exception thrown from faulted:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.faulted_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.faulted_2] - Faulted called on unknown participant: {0}
+     */
+    public void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+
+        if (participant != null)
+        {
+            try
             {
+                participant.faulted(faulted, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_19", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.faulted_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_20")) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.faulted_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -400,61 +282,66 @@
      * @param getStatus The get status notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2] - GetStatus called on unknown participant: {0}
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithCoordinatorCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                final State state ;
-                try
+                participant.getStatus(getStatus, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    state = State.toState(participant.status()) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1", th) ;
                 }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_21") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_22", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendStatus(responseAddressingContext, instanceIdentifier, state) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Status.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.status_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.status_1] - Unexpected exception thrown from status:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.status_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.status_2] - Status called on unknown participant: {0}
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+
+        if (participant != null)
+        {
+            try
             {
+                participant.status(status, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_23", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.status_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_24")) ;
-                CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.status_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -463,33 +350,33 @@
      * @param soapFault The SOAP fault notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_1] - Unexpected exception thrown from soapFault:
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_2] - SoapFault called on unknown participant: {0}
      */
     public void soapFault(final SoapFault fault, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithCoordinatorCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
         if (participant != null)
         {
             try
             {
-                participant.error() ;
+                participant.soapFault(fault, addressingContext, arjunaContext) ;
             }
             catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_25", th) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_1", th) ;
                 }
             }
         }
-        else
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-            {
-                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl_25", new Object[] {instanceIdentifier}) ;
-            }
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
         }
     }
 }

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/CoordinatorProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,325 @@
+/*
+ * 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.wst.messaging;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
+import com.arjuna.webservices.logging.WSTLogger;
+import com.arjuna.webservices.wsaddr.AddressingContext;
+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.wsc.messaging.MessageId;
+
+/**
+ * The Coordinator processor.
+ * @author kevin
+ */
+public class CoordinatorProcessorImpl extends CoordinatorProcessor
+{
+    /**
+     * The activated object processor.
+     */
+    private final ActivatedObjectProcessor activatedObjectProcessor = new ActivatedObjectProcessor() ;
+
+    /**
+     * Activate the coordinator.
+     * @param coordinator The coordinator.
+     * @param identifier The identifier.
+     */
+    public void activateCoordinator(final CoordinatorInboundEvents coordinator, final String identifier)
+    {
+        activatedObjectProcessor.activateObject(coordinator, identifier) ;
+    }
+
+    /**
+     * Deactivate the coordinator.
+     * @param coordinator The coordinator.
+     */
+    public void deactivateCoordinator(final CoordinatorInboundEvents coordinator)
+    {
+        activatedObjectProcessor.deactivateObject(coordinator) ;
+    }
+    
+    /**
+     * Get the coordinator with the specified identifier.
+     * @param instanceIdentifier The coordinator identifier.
+     * @return The coordinator or null if not known.
+     */
+    private CoordinatorInboundEvents getCoordinator(final InstanceIdentifier instanceIdentifier)
+    {
+        final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
+        return (CoordinatorInboundEvents)activatedObjectProcessor.getObject(identifier) ;
+    }
+    
+    /**
+     * Aborted.
+     * @param aborted The aborted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.aborted_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.aborted_1] - Unexpected exception thrown from aborted:
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.aborted_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.aborted_2] - Aborted called on unknown coordinator: {0}
+     */
+    public void aborted(final NotificationType aborted, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+        
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.aborted(aborted, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.aborted_1", th) ; 
+                }
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+        {
+            WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.aborted_2", new Object[] {instanceIdentifier}) ; 
+        }
+    }
+    
+    /**
+     * Committed.
+     * @param committed The committed notification.
+     * @param addressingContext The addressing context.
+     * @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}
+     */
+    public void committed(final NotificationType committed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+        
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.committed(committed, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_1", th) ; 
+                }
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+        {
+            WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.committed_2", new Object[] {instanceIdentifier}) ; 
+        }
+    }
+    
+    /**
+     * Prepared.
+     * @param prepared The prepared notification.
+     * @param addressingContext The addressing context.
+     * @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}
+     */
+    public void prepared(final NotificationType prepared, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+        
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.prepared(prepared, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_1", th) ; 
+                }
+            }
+        }
+        else
+        {
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.prepared_2", new Object[] {instanceIdentifier}) ; 
+            }
+            // Assume participant is durable
+            sendRollback(addressingContext, arjunaContext) ;
+        }
+    }
+    
+    /**
+     * Read only.
+     * @param readOnly The read only notification.
+     * @param addressingContext The addressing context.
+     * @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}
+     */
+    public void readOnly(final NotificationType readOnly, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+        
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.readOnly(readOnly, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_1", th) ; 
+                }
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+        {
+            WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.readOnly_2", new Object[] {instanceIdentifier}) ; 
+        }
+    }
+    
+    /**
+     * Replay.
+     * @param replay The replay notification.
+     * @param addressingContext The addressing context.
+     * @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}
+     */
+    public void replay(final NotificationType replay, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+        
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.replay(replay, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_1", th) ; 
+                }
+            }
+        }
+        else
+        {
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.replay_2", new Object[] {instanceIdentifier}) ; 
+            }
+            // Assume participant is durable
+            sendRollback(addressingContext, arjunaContext) ;
+        }
+    }
+
+    /**
+     * SOAP Fault.
+     * @param soapFault The SOAP fault notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.soapFault_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.soapFault_1] - Unexpected exception thrown from soapFault: 
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.soapFault_2 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.soapFault_2] - SoapFault called on unknown coordinator: {0}
+     */
+    public void soapFault(final SoapFault fault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.soapFault(fault, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.soapFault_1", th) ;
+                }
+            }
+        }
+        else
+        {
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.CoordinatorProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a rollback message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendRollback_1 [com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendRollback_1] - Unexpected exception while sending Rollback
+     */
+    private void sendRollback(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createNotificationContext(addressingContext, messageId) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            ParticipantClient.getClient().sendRollback(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorProcessorImpl.sendRollback_1", th) ;
+            }
+        }
+    }
+}

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,45 +20,22 @@
  */
 package com.arjuna.wst.messaging;
 
-import java.text.MessageFormat;
-
 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.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices.wsba.ExceptionType;
 import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.client.ParticipantCompletionParticipantClient;
+import com.arjuna.webservices.wsba.ParticipantCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices.wsba.StatusType;
 import com.arjuna.webservices.wsba.processors.ParticipantCompletionCoordinatorProcessor;
-import com.arjuna.wsc.messaging.MessageId;
-import com.arjuna.wst.BAParticipantManager;
-import com.arjuna.wst.SystemException;
-import com.arjuna.wst.UnknownTransactionException;
-import com.arjuna.wst.WrongStateException;
 
 
 /**
  * The Participant Completion Coordinator processor.
  * @author kevin
- * 
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_1] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_2] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_3 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_3] - Unexpected exception thrown from completed:
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_4 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_4] - Completed called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_5 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_5] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_6 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_6] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_7 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_7] - Unknown Transaction
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_8 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_8] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_9 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_9] - Unexpected exception thrown from exit:
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_10 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_10] - Exit called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_11 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_11] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_12 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_12] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_13 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_13] - Unexpected exception thrown from fault:
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_14 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_14] - Fault called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_15 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_15] - Unknown participant
  */
 public class ParticipantCompletionCoordinatorProcessorImpl extends ParticipantCompletionCoordinatorProcessor
 {
@@ -68,100 +45,169 @@
     private final ActivatedObjectProcessor activatedObjectProcessor = new ActivatedObjectProcessor() ;
     
     /**
-     * Activate the participant.
-     * @param participant The participant.
+     * Activate the coordinator.
+     * @param coordinator The coordinator.
      * @param identifier The identifier.
      */
-    public void activateParticipant(final BAParticipantManager participant, final String identifier)
+    public void activateCoordinator(final ParticipantCompletionCoordinatorInboundEvents coordinator, final String identifier)
     {
-        activatedObjectProcessor.activateObject(participant, identifier) ;
+        activatedObjectProcessor.activateObject(coordinator, identifier) ;
     }
 
     /**
-     * Deactivate the participant.
-     * @param participant The participant.
+     * Deactivate the coordinator.
+     * @param coordinator The coordinator.
      */
-    public void deactivateParticipant(final BAParticipantManager participant)
+    public void deactivateCoordinator(final ParticipantCompletionCoordinatorInboundEvents coordinator)
     {
-        activatedObjectProcessor.deactivateObject(participant) ;
+        activatedObjectProcessor.deactivateObject(coordinator) ;
     }
     
     /**
-     * Get the participant with the specified identifier.
-     * @param instanceIdentifier The participant identifier.
-     * @return The participant or null if not known.
+     * Get the coordinator with the specified identifier.
+     * @param instanceIdentifier The coordinator identifier.
+     * @return The coordinator or null if not known.
      */
-    private BAParticipantManager getParticipant(final InstanceIdentifier instanceIdentifier)
+    private ParticipantCompletionCoordinatorInboundEvents getCoordinator(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
-        return (BAParticipantManager)activatedObjectProcessor.getObject(identifier) ;
+        return (ParticipantCompletionCoordinatorInboundEvents)activatedObjectProcessor.getObject(identifier) ;
     }
     
     /**
-     * Completed.
-     * @param completed The completed notification.
+     * Cancelled.
+     * @param cancelled The cancelled notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.cancelled_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.cancelled_1] - Unexpected exception thrown from cancelled:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.cancelled_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.cancelled_2] - Cancelled called on unknown coordinator: {0}
      */
-    public void completed(final NotificationType completed, final AddressingContext addressingContext,
-        final ArjunaContext arjunaContext)
+    public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BAParticipantManager participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
 
-        try
+        if (coordinator != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
+                coordinator.cancelled(cancelled, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    participant.completed() ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.cancelled_1", th) ;
                 }
-                catch (final WrongStateException wse)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.cancelled_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Closed.
+     * @param closed The closed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.closed_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.closed_1] - Unexpected exception thrown from closed:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.closed_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.closed_2] - Closed called on unknown coordinator: {0}
+     */
+    public void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.closed(closed, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                         WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_1")) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.closed_1", th) ;
                 }
-                catch (final SystemException se)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.closed_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Compensated.
+     * @param compensated The compensated notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.compensated_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.compensated_1] - Unexpected exception thrown from compensated:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.compensated_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.compensated_2] - Compensated called on unknown coordinator: {0}
+     */
+    public void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.compensated(compensated, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_2") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.compensated_1", th) ;
                 }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_3", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.compensated_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Completed.
+     * @param completed The completed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.completed_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.completed_1] - Unexpected exception thrown from completed:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.completed_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.completed_2] - Completed called on unknown coordinator: {0}
+     */
+    public void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
             {
+                coordinator.completed(completed, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_4", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.completed_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_5")) ;
-                ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.completed_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -170,76 +216,32 @@
      * @param exit The exit notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_1] - Unexpected exception thrown from exit:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_2] - Exit called on unknown coordinator: {0}
      */
     public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BAParticipantManager participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
 
-        try
+        if (coordinator != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.exit() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_6")) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final UnknownTransactionException ute)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_7")) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_8") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_9", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                ParticipantCompletionParticipantClient.getClient().sendExited(responseAddressingContext, instanceIdentifier) ;
+                coordinator.exit(exit, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_10", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_11")) ;
-                ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.exit_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -248,72 +250,136 @@
      * @param fault The fault notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_1] - Unexpected exception thrown from fault:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_2] - Fault called on unknown coordinator: {0}
      */
     public void fault(final ExceptionType fault, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BAParticipantManager participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
 
-        try
+        if (coordinator != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
+                coordinator.fault(fault, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    participant.fault() ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_1", th) ;
                 }
-                catch (final SystemException se)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.fault_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Get Status.
+     * @param getStatus The get status notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2] - GetStatus called on unknown coordinator: {0}
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.getStatus(getStatus, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_12") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1", th) ;
                 }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_13", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                ParticipantCompletionParticipantClient.getClient().sendFaulted(responseAddressingContext, instanceIdentifier) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Status.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.status_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.status_1] - Unexpected exception thrown from status:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.status_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.status_2] - Status called on unknown coordinator: {0}
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
             {
+                coordinator.status(status, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_14", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.status_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl_15")) ;
-                ParticipantCompletionParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.status_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
     /**
-     * Get Status.
-     * @param getStatus The get status notification.
+     * SOAP fault.
+     * @param soapFault The SOAP fault.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_1] - Unexpected exception thrown from soapFault:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_2] - SoapFault called on unknown coordinator: {0}
      */
-    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
     {
-        // Not implemented yet
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
+
+        if (coordinator != null)
+        {
+            try
+            {
+                coordinator.soapFault(soapFault, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_1", th) ;
+                }
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
+        }
     }
 }

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,50 +20,21 @@
  */
 package com.arjuna.wst.messaging;
 
-import java.text.MessageFormat;
-
 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.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.State;
-import com.arjuna.webservices.wsba.client.ParticipantCompletionCoordinatorClient;
+import com.arjuna.webservices.wsba.ParticipantCompletionParticipantInboundEvents;
+import com.arjuna.webservices.wsba.StatusType;
 import com.arjuna.webservices.wsba.processors.ParticipantCompletionParticipantProcessor;
-import com.arjuna.wsc.messaging.MessageId;
-import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
-import com.arjuna.wst.FaultedException;
-import com.arjuna.wst.SystemException;
-import com.arjuna.wst.WrongStateException;
 
 
 /**
  * The Participant Completion Participant processor.
  * @author kevin
- * 
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_1] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_2] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_3 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_3] - Unexpected exception thrown from cancel:
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_4 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_4] - Cancel called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_5 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_5] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_6 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_6] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_7 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_7] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_8 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_8] - Unexpected exception thrown from close:
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_9 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_9] - Close called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_10 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_10] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_11 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_11] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_12 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_12] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_13 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_13] - Unexpected exception thrown from compensate:
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_14 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_14] - Compensate called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_15 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_15] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_16 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_16] - Unexpected exception thrown from getStatus:
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_17 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_17] - Complete called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_18 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_18] - Unexpected exception thrown from soapFault:
- * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_19 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_19] - SoapFault called on unknown participant: {0}
- *  
  */
 public class ParticipantCompletionParticipantProcessorImpl extends ParticipantCompletionParticipantProcessor
 {
@@ -77,7 +48,7 @@
      * @param participant The participant.
      * @param identifier The identifier.
      */
-    public void activateParticipant(final BusinessAgreementWithParticipantCompletionParticipant participant, final String identifier)
+    public void activateParticipant(final ParticipantCompletionParticipantInboundEvents participant, final String identifier)
     {
         activatedObjectProcessor.activateObject(participant, identifier) ;
     }
@@ -86,7 +57,7 @@
      * Deactivate the participant.
      * @param participant The participant.
      */
-    public void deactivateParticipant(final BusinessAgreementWithParticipantCompletionParticipant participant)
+    public void deactivateParticipant(final ParticipantCompletionParticipantInboundEvents participant)
     {
         activatedObjectProcessor.deactivateObject(participant) ;
     }
@@ -96,10 +67,10 @@
      * @param instanceIdentifier The participant identifier.
      * @return The participant or null if not known.
      */
-    private BusinessAgreementWithParticipantCompletionParticipant getParticipant(final InstanceIdentifier instanceIdentifier)
+    private ParticipantCompletionParticipantInboundEvents getParticipant(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
-        return (BusinessAgreementWithParticipantCompletionParticipant)activatedObjectProcessor.getObject(identifier) ;
+        return (ParticipantCompletionParticipantInboundEvents)activatedObjectProcessor.getObject(identifier) ;
     }
 
     /**
@@ -107,68 +78,32 @@
      * @param cancel The cancel notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_1] - Unexpected exception thrown from cancel:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_2] - Cancel called on unknown participant: {0}
      */
     public void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithParticipantCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.cancel() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_1")) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_2") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_3", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                ParticipantCompletionCoordinatorClient.getClient().sendCancelled(responseAddressingContext, instanceIdentifier) ;
+                participant.cancel(cancel, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_4", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_5")) ;
-                ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
         }
     }
 
@@ -177,68 +112,32 @@
      * @param close The close notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_1] - Unexpected exception thrown from close:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_2] - Close called on unknown participant: {0}
      */
     public void close(final NotificationType close, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithParticipantCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.close() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_6")) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_7") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_8", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                ParticipantCompletionCoordinatorClient.getClient().sendClosed(responseAddressingContext, instanceIdentifier) ;
+                participant.close(close, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_9", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                     WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_10")) ;
-                ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -247,75 +146,100 @@
      * @param compensate The compensate notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_1] - Unexpected exception thrown from compensate:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_2] - Compensate called on unknown participant: {0}
      */
     public void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithParticipantCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
+                participant.compensate(compensate, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    participant.compensate() ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_1", th) ;
                 }
-                catch (final FaultedException fe)
+            }
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Exited.
+     * @param exited The exited notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.exited_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.exited_1] - Unexpected exception thrown from exited:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.exited_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.exited_2] - Exited called on unknown participant: {0}
+     */
+    public void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+
+        if (participant != null)
+        {
+            try
+            {
+                participant.exited(exited, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    final AddressingContext responseAddressingContext =
-                        AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendFault(responseAddressingContext, instanceIdentifier, null) ;
-                    return ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.exited_1", th) ;
                 }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_11")) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_12") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_13", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                ParticipantCompletionCoordinatorClient.getClient().sendCompensated(responseAddressingContext, instanceIdentifier) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.exited_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Faulted.
+     * @param faulted The faulted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.faulted_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.faulted_1] - Unexpected exception thrown from faulted:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.faulted_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.faulted_2] - Faulted called on unknown participant: {0}
+     */
+    public void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+
+        if (participant != null)
+        {
+            try
             {
+                participant.faulted(faulted, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_14", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.faulted_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    "Unknown participant") ;
-                ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.faulted_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -324,61 +248,66 @@
      * @param getStatus The get status notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2] - Complete called on unknown participant: {0}
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithParticipantCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                final State state ;
-                try
+                participant.getStatus(getStatus, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    state = State.toState(participant.status()) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1", th) ;
                 }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_15") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_16", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                ParticipantCompletionCoordinatorClient.getClient().sendStatus(responseAddressingContext, instanceIdentifier, state) ;
             }
-            else
+        }
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+        }
+    }
+    
+    /**
+     * Status.
+     * @param status The status type.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.status_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.status_1] - Unexpected exception thrown from status:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.status_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.status_2] - Status called on unknown participant: {0}
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+
+        if (participant != null)
+        {
+            try
             {
+                participant.status(status, addressingContext, arjunaContext) ;
+            }
+            catch (final Throwable th)
+            {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_17", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.status_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    "Unknown participant") ;
-                ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            throwable.printStackTrace(System.err);
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.status_2", new Object[] {instanceIdentifier}) ;
         }
     }
     
@@ -387,33 +316,33 @@
      * @param soapFault The SOAP fault notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_1] - Unexpected exception thrown from soapFault:
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_2] - SoapFault called on unknown participant: {0}
      */
     public void soapFault(final SoapFault fault, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final BusinessAgreementWithParticipantCompletionParticipant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
         if (participant != null)
         {
             try
             {
-                participant.error() ;
+                participant.soapFault(fault, addressingContext, arjunaContext) ;
             }
             catch (final Throwable th)
             {
                 if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_18", th) ;
+                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_1", th) ;
                 }
             }
         }
-        else
+        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
         {
-            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-            {
-                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl_19", new Object[] {instanceIdentifier}) ;
-            }
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
         }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantProcessorImpl.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/ParticipantProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,49 +20,21 @@
  */
 package com.arjuna.wst.messaging;
 
-import java.text.MessageFormat;
-
 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.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices.wsat.NotificationType;
-import com.arjuna.webservices.wsat.Participant;
+import com.arjuna.webservices.wsat.ParticipantInboundEvents;
 import com.arjuna.webservices.wsat.client.CoordinatorClient;
 import com.arjuna.webservices.wsat.processors.ParticipantProcessor;
 import com.arjuna.wsc.messaging.MessageId;
-import com.arjuna.wst.Aborted;
-import com.arjuna.wst.Prepared;
-import com.arjuna.wst.ReadOnly;
-import com.arjuna.wst.SystemException;
-import com.arjuna.wst.Vote;
-import com.arjuna.wst.WrongStateException;
 
 /**
  * The Participant processor.
  * @author kevin
- * 
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl_1] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_2 [com.arjuna.wst.messaging.ParticipantProcessorImpl_2] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_3 [com.arjuna.wst.messaging.ParticipantProcessorImpl_3] - Unexpected exception thrown from commit:
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_4 [com.arjuna.wst.messaging.ParticipantProcessorImpl_4] - Commit called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_5 [com.arjuna.wst.messaging.ParticipantProcessorImpl_5] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_6 [com.arjuna.wst.messaging.ParticipantProcessorImpl_6] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_7 [com.arjuna.wst.messaging.ParticipantProcessorImpl_7] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_8 [com.arjuna.wst.messaging.ParticipantProcessorImpl_8] - Unexpected exception thrown from prepare: 
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_9 [com.arjuna.wst.messaging.ParticipantProcessorImpl_9] - Unknown error
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_10 [com.arjuna.wst.messaging.ParticipantProcessorImpl_10] - Prepare called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_11 [com.arjuna.wst.messaging.ParticipantProcessorImpl_11] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_12 [com.arjuna.wst.messaging.ParticipantProcessorImpl_12] - Wrong state
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_13 [com.arjuna.wst.messaging.ParticipantProcessorImpl_13] - Unknown error: {0}
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_14 [com.arjuna.wst.messaging.ParticipantProcessorImpl_14] - Unexpected exception thrown from rollback: 
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_15 [com.arjuna.wst.messaging.ParticipantProcessorImpl_15] - Rollback called on unknown participant: {0}
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_16 [com.arjuna.wst.messaging.ParticipantProcessorImpl_16] - Unknown participant
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_17 [com.arjuna.wst.messaging.ParticipantProcessorImpl_17] - Unexpected exception thrown from soapFault: 
- * @message com.arjuna.wst.messaging.ParticipantProcessorImpl_18 [com.arjuna.wst.messaging.ParticipantProcessorImpl_18] - SoapFault called on unknown participant: {0}
  */
 public class ParticipantProcessorImpl extends ParticipantProcessor
 {
@@ -76,7 +48,7 @@
      * @param participant The participant.
      * @param identifier The identifier.
      */
-    public void activateParticipant(final Participant participant, final String identifier)
+    public void activateParticipant(final ParticipantInboundEvents participant, final String identifier)
     {
         activatedObjectProcessor.activateObject(participant, identifier) ;
     }
@@ -85,7 +57,7 @@
      * Deactivate the participant.
      * @param participant The participant.
      */
-    public void deactivateParticipant(final Participant participant)
+    public void deactivateParticipant(final ParticipantInboundEvents participant)
     {
         activatedObjectProcessor.deactivateObject(participant) ;
     }
@@ -95,10 +67,10 @@
      * @param instanceIdentifier The participant identifier.
      * @return The participant or null if not known.
      */
-    private Participant getParticipant(final InstanceIdentifier instanceIdentifier)
+    private ParticipantInboundEvents getParticipant(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
-        return (Participant)activatedObjectProcessor.getObject(identifier) ;
+        return (ParticipantInboundEvents)activatedObjectProcessor.getObject(identifier) ;
     }
 
     /**
@@ -106,69 +78,37 @@
      * @param commit The commit notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.commit_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl.commit_1] - Unexpected exception thrown from commit:
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.commit_2 [com.arjuna.wst.messaging.ParticipantProcessorImpl.commit_2] - Commit called on unknown participant: {0}
      */
     public void commit(final NotificationType commit, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final Participant participant = getParticipant(instanceIdentifier) ;
-
-        try
+        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
+        
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.commit() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_1")) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_2") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_3", th) ; 
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorClient.getClient().sendCommitted(responseAddressingContext, instanceIdentifier) ;
+                participant.commit(commit, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
-                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_4", new Object[] {instanceIdentifier}) ; 
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.commit_1", th) ; 
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_5")) ;
-                CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else
         {
-            throwable.printStackTrace(System.err);
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.commit_2", new Object[] {instanceIdentifier}) ; 
+            }
+            sendCommitted(addressingContext, arjunaContext) ;
         }
     }
     
@@ -177,88 +117,37 @@
      * @param prepare The prepare notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.prepare_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl.prepare_1] - Unexpected exception thrown from prepare: 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.prepare_2 [com.arjuna.wst.messaging.ParticipantProcessorImpl.prepare_2] - Prepare called on unknown participant: {0}
      */
     public void prepare(final NotificationType prepare, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final Participant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                final Vote vote ;
-                try
-                {
-                    vote = participant.prepare();
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_6")) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_7") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_8", th) ; 
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                if (vote instanceof Prepared)
-                {
-                    CoordinatorClient.getClient().sendPrepared(responseAddressingContext, instanceIdentifier) ;
-                }
-                else if (vote instanceof ReadOnly)
-                {
-                    CoordinatorClient.getClient().sendReadOnly(responseAddressingContext, instanceIdentifier) ;
-                }
-                else if (vote instanceof Aborted)
-                {
-                    CoordinatorClient.getClient().sendAborted(responseAddressingContext, instanceIdentifier) ;
-                }
-                else
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_9")) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                }
+                participant.prepare(prepare, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
-                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_10", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.prepare_1", th) ; 
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_11")) ;
-                CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else
         {
-            throwable.printStackTrace(System.err);
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.prepare_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendAborted(addressingContext, arjunaContext) ;
         }
     }
     
@@ -267,69 +156,37 @@
      * @param rollback The rollback notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.rollback_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl.rollback_1] - Unexpected exception thrown from rollback: 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.rollback_2 [com.arjuna.wst.messaging.ParticipantProcessorImpl.rollback_2] - Rollback called on unknown participant: {0}
      */
     public void rollback(final NotificationType rollback, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final Participant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
-        try
+        if (participant != null)
         {
-            if (participant != null)
+            try
             {
-                final String messageId = MessageId.getMessageId() ;
-                try
-                {
-                    participant.rollback() ;
-                }
-                catch (final WrongStateException wse)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME,
-                        WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_12")) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final SystemException se)
-                {
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
-                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_13") ;
-                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
-                    final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                catch (final Throwable th)
-                {
-                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
-                    {
-                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_14", th) ;
-                    }
-                    final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                    final SoapFault soapFault = new SoapFault(th) ;
-                    CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
-                    return ;
-                }
-                final AddressingContext responseAddressingContext =
-                    AddressingContext.createNotificationContext(addressingContext, messageId) ;
-                CoordinatorClient.getClient().sendAborted(responseAddressingContext, instanceIdentifier) ;
+                participant.rollback(rollback, addressingContext, arjunaContext) ;
             }
-            else
+            catch (final Throwable th)
             {
-                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_15", new Object[] {instanceIdentifier}) ;
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.rollback_1", th) ;
                 }
-                final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, MessageId.getMessageId()) ;
-                final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                    WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantProcessorImpl_16")) ;
-                CoordinatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
             }
         }
-        catch (Throwable throwable)
+        else
         {
-            throwable.printStackTrace(System.err);
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.rollback_2", new Object[] {instanceIdentifier}) ;
+            }
+            sendAborted(addressingContext, arjunaContext) ;
         }
     }
 
@@ -338,33 +195,90 @@
      * @param soapFault The SOAP fault notification.
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.soapFault_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl.soapFault_1] - Unexpected exception thrown from soapFault: 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.soapFault_2 [com.arjuna.wst.messaging.ParticipantProcessorImpl.soapFault_2] - SoapFault called on unknown participant: {0}
      */
     public void soapFault(final SoapFault fault, final AddressingContext addressingContext,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        final Participant participant = getParticipant(instanceIdentifier) ;
+        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
         if (participant != null)
         {
             try
             {
-                participant.error() ;
+                participant.soapFault(fault, addressingContext, arjunaContext) ;
             }
             catch (final Throwable th)
             {
-                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
                 {
-                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_17", th) ;
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.soapFault_1", th) ;
                 }
             }
         }
         else
         {
+            if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+            {
+                WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.ParticipantProcessorImpl.soapFault_2", new Object[] {instanceIdentifier}) ;
+            }
+        }
+    }
+    
+    /**
+     * Send a committed message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.sendCommitted_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl.sendCommitted_1] - Unexpected exception while sending Committed
+     */
+    private void sendCommitted(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createNotificationContext(addressingContext, messageId) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            CoordinatorClient.getClient().sendCommitted(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
-                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl_18", new Object[] {instanceIdentifier}) ;
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl.sendCommitted_1", th) ;
             }
         }
     }
+    
+    /**
+     * Send an aborted message.
+     * 
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.ParticipantProcessorImpl.sendAborted_1 [com.arjuna.wst.messaging.ParticipantProcessorImpl.sendAborted_1] - Unexpected exception while sending Aborted
+     */
+    private void sendAborted(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV add check for recovery
+        final String messageId = MessageId.getMessageId() ;
+        final AddressingContext responseAddressingContext = AddressingContext.createNotificationContext(addressingContext, messageId) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            CoordinatorClient.getClient().sendAborted(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantProcessorImpl.sendAborted_1", th) ;
+            }
+        }
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/TerminatorParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/TerminatorParticipantProcessorImpl.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/TerminatorParticipantProcessorImpl.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -24,6 +24,7 @@
 
 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.wsarj.ArjunaContext;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/deploy/TransactionInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/deploy/TransactionInitialisation.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/deploy/TransactionInitialisation.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -23,8 +23,10 @@
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
+import com.arjuna.common.util.SharedTimer;
 import com.arjuna.webservices.wsarjtx.processors.TerminationCoordinatorProcessor;
 import com.arjuna.webservices.wsat.processors.CompletionCoordinatorProcessor;
+import com.arjuna.webservices.wsat.processors.CoordinatorProcessor;
 import com.arjuna.webservices.wsat.processors.ParticipantProcessor;
 import com.arjuna.webservices.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
 import com.arjuna.webservices.wsba.processors.CoordinatorCompletionParticipantProcessor;
@@ -33,6 +35,7 @@
 import com.arjuna.wst.messaging.CompletionCoordinatorProcessorImpl;
 import com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl;
 import com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl;
+import com.arjuna.wst.messaging.CoordinatorProcessorImpl;
 import com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl;
 import com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl;
 import com.arjuna.wst.messaging.ParticipantProcessorImpl;
@@ -50,13 +53,14 @@
      */
     public void contextInitialized(final ServletContextEvent servletContextEvent)
     {
-        CompletionCoordinatorProcessor.setCoordinator(new CompletionCoordinatorProcessorImpl()) ;
-        ParticipantProcessor.setParticipant(new ParticipantProcessorImpl()) ;
-        TerminationCoordinatorProcessor.setParticipant(new TerminatorParticipantProcessorImpl()) ;
-        CoordinatorCompletionParticipantProcessor.setParticipant(new CoordinatorCompletionParticipantProcessorImpl()) ;
-        ParticipantCompletionParticipantProcessor.setParticipant(new ParticipantCompletionParticipantProcessorImpl()) ;
-        CoordinatorCompletionCoordinatorProcessor.setCoordinator(new CoordinatorCompletionCoordinatorProcessorImpl()) ;
-        ParticipantCompletionCoordinatorProcessor.setCoordinator(new ParticipantCompletionCoordinatorProcessorImpl()) ;
+        CompletionCoordinatorProcessor.setProcessor(new CompletionCoordinatorProcessorImpl()) ;
+        ParticipantProcessor.setProcessor(new ParticipantProcessorImpl()) ;
+        CoordinatorProcessor.setProcessor(new CoordinatorProcessorImpl()) ;
+        TerminationCoordinatorProcessor.setProcessor(new TerminatorParticipantProcessorImpl()) ;
+        CoordinatorCompletionParticipantProcessor.setProcessor(new CoordinatorCompletionParticipantProcessorImpl()) ;
+        ParticipantCompletionParticipantProcessor.setProcessor(new ParticipantCompletionParticipantProcessorImpl()) ;
+        CoordinatorCompletionCoordinatorProcessor.setProcessor(new CoordinatorCompletionCoordinatorProcessorImpl()) ;
+        ParticipantCompletionCoordinatorProcessor.setProcessor(new ParticipantCompletionCoordinatorProcessorImpl()) ;
     }
 
     /**
@@ -65,5 +69,6 @@
      */
     public void contextDestroyed(final ServletContextEvent servletContextEvent)
     {
+        SharedTimer.getTimer().cancel() ;
     }
 }

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,834 @@
+/*
+ * 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.wst.messaging.engines;
+
+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;
+import com.arjuna.webservices.wsaddr.EndpointReferenceType;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+import com.arjuna.webservices.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsba.CoordinatorCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices.wsba.ExceptionType;
+import com.arjuna.webservices.wsba.NotificationType;
+import com.arjuna.webservices.wsba.State;
+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;
+import com.arjuna.wst.BAParticipantManager;
+
+/**
+ * The coordinator completion coordinator state engine
+ * @author kevin
+ */
+public class CoordinatorCompletionCoordinatorEngine implements CoordinatorCompletionCoordinatorInboundEvents
+{
+    /**
+     * The coordinator id.
+     */
+    private final String id ;
+    /**
+     * The instance identifier.
+     */
+    private final InstanceIdentifier instanceIdentifier ;
+    /**
+     * The participant endpoint reference.
+     */
+    private final EndpointReferenceType participant ;
+    /**
+     * The associated coordinator
+     */
+    private BAParticipantManager coordinator ;
+    /**
+     * The current state.
+     */
+    private State state ;
+    
+    /**
+     * Construct the initial engine for the coordinator.
+     * @param id The coordinator id.
+     * @param participant The participant endpoint reference.
+     */
+    public CoordinatorCompletionCoordinatorEngine(final String id, final EndpointReferenceType participant)
+    {
+        this(id, participant, State.STATE_ACTIVE) ;
+    }
+    
+    /**
+     * Construct the engine for the coordinator in a specified state.
+     * @param id The coordinator id.
+     * @param participant The participant endpoint reference.
+     * @param state The initial state.
+     */
+    public CoordinatorCompletionCoordinatorEngine(final String id, final EndpointReferenceType participant,
+        final State state)
+    {
+        this.id = id ;
+        this.instanceIdentifier = new InstanceIdentifier(id) ;
+        this.participant = participant ;
+        this.state = state ;
+    }
+    
+    /**
+     * Set the coordinator and register
+     * @param coordinator
+     */
+    public void setCoordinator(final BAParticipantManager coordinator)
+    {
+        this.coordinator = coordinator ;
+        CoordinatorCompletionCoordinatorProcessor.getProcessor().activateCoordinator(this, id) ;
+    }
+    
+    /**
+     * Handle the cancelled event.
+     * @param cancelled The cancelled notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Ended
+     * Canceling-Active -> 
+     * Canceling-Completing -> 
+     * Completing -> 
+     * Canceling-Active -> Ended
+     * Canceling-Completing -> Ended
+     * Completing -> Completing (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating ->Faulting (invalid state) 
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_CANCELING) || (current == State.STATE_CANCELING_ACTIVE) ||
+                (current == State.STATE_CANCELING_COMPLETING))
+            {
+                changeState(State.STATE_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() ;
+        }
+    }
+    
+    /**
+     * Handle the closed event.
+     * @param closed The closed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Canceling-Active -> Canceling (invalid state)
+     * Canceling-Completing -> Canceling (invalid state)
+     * Completing -> Completing (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Ended
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_CLOSING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_CLOSING)
+        {
+            deactivate() ;
+        }
+    }
+    
+    /**
+     * Handle the compensated event.
+     * @param compensated The compensated notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Canceling-Active -> Canceling (invalid state)
+     * Canceling-Completing -> Canceling (invalid state)
+     * Completing -> Completing (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Ended
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPENSATING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_COMPENSATING)
+        {
+            deactivate() ;
+        }
+    }
+    
+    /**
+     * Handle the completed event.
+     * @param completed The completed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Completed
+     * Canceling -> Canceling (invalid state)
+     * Canceling-Active -> Canceling (invalid state)
+     * Canceling-Completing -> Completed
+     * Completing -> Completed
+     * Completed -> Completed
+     * Closing -> Closing (resend close)
+     * Compensating -> Compensating (resend compensate)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING_COMPLETING) ||
+                (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_COMPLETED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING_COMPLETING) ||
+            (current == State.STATE_COMPLETING))
+        {
+            executeCompleted() ;
+        }
+        else if (current == State.STATE_CLOSING)
+        {
+            sendClose() ;
+        }
+        else if (current == State.STATE_COMPENSATING)
+        {
+            sendCompensate() ;
+        }
+    }
+    
+    /**
+     * Handle the exit event.
+     * @param exit The exit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Exiting
+     * Canceling -> Exiting
+     * Canceling-Active -> Exiting
+     * Canceling-Completing -> Exiting
+     * Completing -> Exiting
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting
+     * Ended -> Ended (resend Exited)
+     */
+    public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING) ||
+                (current == State.STATE_CANCELING_ACTIVE) || (current == State.STATE_CANCELING_COMPLETING) ||
+                (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_EXITING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING) ||
+            (current == State.STATE_CANCELING_ACTIVE) || (current == State.STATE_CANCELING_COMPLETING) ||
+            (current == State.STATE_COMPLETING))
+        {
+            executeExit() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendExited() ;
+        }
+    }
+    
+    /**
+     * Handle the fault event.
+     * @param fault The fault exception.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Faulting-Active
+     * Canceling -> Faulting-Active
+     * Canceling-Active -> Faulting-Active
+     * Canceling-Completing -> Faulting-Active
+     * Completing -> Faulting-Active
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Faulting-Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (resend Faulted)
+     */
+    public void fault(final ExceptionType fault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING) ||
+                (current == State.STATE_CANCELING_ACTIVE) || (current == State.STATE_CANCELING_COMPLETING) ||
+                (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_FAULTING_ACTIVE) ;
+            }
+            else if (current == State.STATE_COMPENSATING)
+            {
+                changeState(State.STATE_FAULTING_COMPENSATING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        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))
+        {
+            executeFault() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendFaulted() ;
+        }
+    }
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the status event.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the get status event.
+     * @return The state.
+     */
+    public State getStatus()
+    {
+        // KEV - implement
+        return null ;
+    }
+    
+    /**
+     * Handle the cancel event.
+     * @return The state.
+     */
+    public State cancel()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_CANCELING_ACTIVE) ;
+            }
+            else if (current == State.STATE_COMPLETING)
+            {
+                changeState(State.STATE_CANCELING_COMPLETING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING) ||
+            (current == State.STATE_CANCELING))
+        {
+            sendCancel() ;
+        }
+        
+        if (current == State.STATE_ACTIVE)
+        {
+            return waitForState(State.STATE_CANCELING_ACTIVE, TransportTimer.getTransportTimeout()) ;
+        }
+        else if (current == State.STATE_COMPLETING)
+        {
+            return waitForState(State.STATE_CANCELING_COMPLETING, TransportTimer.getTransportTimeout()) ;
+        }
+        return waitForState(State.STATE_CANCELING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the compensate event.
+     * @return The state.
+     */
+    public State compensate()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_COMPENSATING) ;
+            }
+        }
+        
+        if ((current == State.STATE_COMPLETED) || (current == State.STATE_COMPENSATING))
+        {
+            sendCompensate() ;
+        }
+        
+        return waitForState(State.STATE_COMPENSATING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the complete event.
+     * @return The state.
+     */
+    public State complete()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_COMPLETING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING))
+        {
+            sendComplete() ;
+        }
+        
+        return waitForState(State.STATE_COMPLETING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the close event.
+     * @return The state.
+     */
+    public State close()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_CLOSING) ;
+            }
+        }
+        
+        if ((current == State.STATE_COMPLETED) || (current == State.STATE_CLOSING))
+        {
+            sendClose() ;
+        }
+        
+        return waitForState(State.STATE_CLOSING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the soap fault event.
+     * @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}) ;
+        }
+    }
+    
+    /**
+     * Send the close message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendClose_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendClose_1] - Unexpected exception while sending Close
+     */
+    private void sendClose()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendClose(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendClose_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the compensate message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendCompensate_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendCompensate_1] - Unexpected exception while sending Compensate
+     */
+    private void sendCompensate()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendCompensate(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendCompensate_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the complete message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendComplete_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendComplete_1] - Unexpected exception while sending Complete
+     */
+    private void sendComplete()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendComplete(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendComplete_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the cancel message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendCancel_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendCancel_1] - Unexpected exception while sending Cancel
+     */
+    private void sendCancel()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendCancel(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendCancel_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the exited message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendExited_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendExited_1] - Unexpected exception while sending Exited
+     */
+    private void sendExited()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendExited(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendExited_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the faulted message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendFaulted_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendFaulted_1] - Unexpected exception while sending Faulted
+     */
+    private void sendFaulted()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionParticipantClient.getClient().sendFaulted(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendFaulted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Get the coordinator id.
+     * @return The coordinator id.
+     */
+    public String getId()
+    {
+        return id ;
+    }
+    
+    /**
+     * Get the participant endpoint reference
+     * @return The participant endpoint reference
+     */
+    public EndpointReferenceType getParticipant()
+    {
+        return participant ;
+    }
+    
+    /**
+     * Get the associated coordinator.
+     * @return The associated coordinator.
+     */
+    public BAParticipantManager getCoordinator()
+    {
+        return coordinator ;
+    }
+    
+    /**
+     * Change the state and notify any listeners.
+     * @param state The new state.
+     */
+    private synchronized void changeState(final State state)
+    {
+        if (this.state != state)
+        {
+            this.state = state ;
+            notifyAll() ;
+        }
+    }
+    
+    /**
+     * Wait for the state to change from the specified state.
+     * @param origState The original state.
+     * @param delay The maximum time to wait for (in milliseconds).
+     * @return The current state.
+     */
+    private State waitForState(final State origState, final long delay)
+    {
+        final long end = System.currentTimeMillis() + delay ;
+        synchronized(this)
+        {
+            while(state == origState)
+            {
+                final long remaining = end - System.currentTimeMillis() ;
+                if (remaining <= 0)
+                {
+                    break ;
+                }
+                try
+                {
+                    wait(remaining) ;
+                }
+                catch (final InterruptedException ie) {} // ignore
+            }
+            return state ;
+        }
+    }
+    
+    /**
+     * Execute the completed transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeCompleted_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeCompleted_1] - Unexpected exception from coordinator completed
+     */
+    private void executeCompleted()
+    {
+        try
+        {
+            coordinator.completed() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeCompleted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Execute the exit transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeExit_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeExit_1] - Unexpected exception from coordinator exit
+     */
+    private void executeExit()
+    {
+        try
+        {
+            coordinator.exit() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeExit_1", th) ;
+            }
+            return ;
+        }
+        sendExited() ;
+    }
+    
+    /**
+     * Executing the fault transition.
+     * 
+     * @throws SoapFault for SOAP errors.
+     * @throws IOException for transport errors.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeFault_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeFault_1] - Unexpected exception from coordinator fault
+     */
+    private void executeFault()
+    {
+        try
+        {
+            coordinator.fault() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine.executeFault_1", th) ;
+            }
+            return ;
+        }
+        sendFaulted() ;
+    }
+    
+    /**
+     * Deactivate the incoming event interface.
+     */
+    private void deactivate()
+    {
+        CoordinatorCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this) ;
+    }
+    
+    /**
+     * Create a context for the outgoing message.
+     * @return The addressing context.
+     */
+    private AddressingContext createContext()
+    {
+        final String messageId = MessageId.getMessageId() ;
+        return AddressingContext.createRequestContext(participant, messageId) ;
+    }
+}

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,816 @@
+/*
+ * 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.wst.messaging.engines;
+
+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;
+import com.arjuna.webservices.wsaddr.EndpointReferenceType;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+import com.arjuna.webservices.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsba.CoordinatorCompletionParticipantInboundEvents;
+import com.arjuna.webservices.wsba.NotificationType;
+import com.arjuna.webservices.wsba.State;
+import com.arjuna.webservices.wsba.StatusType;
+import com.arjuna.webservices.wsba.client.CoordinatorCompletionCoordinatorClient;
+import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
+
+/**
+ * The coordinator completion participant state engine
+ * @author kevin
+ */
+public class CoordinatorCompletionParticipantEngine implements CoordinatorCompletionParticipantInboundEvents
+{
+    /**
+     * The participant id.
+     */
+    private final String id ;
+    /**
+     * The instance identifier.
+     */
+    private final InstanceIdentifier instanceIdentifier ;
+    /**
+     * The coordinator endpoint reference.
+     */
+    private final EndpointReferenceType coordinator ;
+    /**
+     * The associated participant
+     */
+    private final BusinessAgreementWithCoordinatorCompletionParticipant participant ;
+    /**
+     * The current state.
+     */
+    private State state ;
+    
+    /**
+     * Construct the initial engine for the participant.
+     * @param id The participant id.
+     * @param coordinator The coordinator endpoint reference.
+     * @param participant The participant.
+     */
+    public CoordinatorCompletionParticipantEngine(final String id, final EndpointReferenceType coordinator,
+        final BusinessAgreementWithCoordinatorCompletionParticipant participant)
+    {
+        this(id, coordinator, participant, State.STATE_ACTIVE) ;
+    }
+    
+    /**
+     * Construct the engine for the participant in a specified state.
+     * @param id The participant id.
+     * @param coordinator The coordinator endpoint reference.
+     * @param participant The participant.
+     * @param state The initial state.
+     */
+    public CoordinatorCompletionParticipantEngine(final String id, final EndpointReferenceType coordinator,
+        final BusinessAgreementWithCoordinatorCompletionParticipant participant, final State state)
+    {
+        this.id = id ;
+        this.instanceIdentifier = new InstanceIdentifier(id) ;
+        this.coordinator = coordinator ;
+        this.participant = participant ;
+        this.state = state ;
+    }
+    
+    /**
+     * Handle the cancel event.
+     * @param cancel The cancel notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Canceling
+     * Canceling -> Canceling
+     * Completing -> Canceling
+     * Completed -> Completed (resend Completed)
+     * Closing -> Closing
+     * Compensating -> Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting (resend Fault)
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (resend Exit)
+     * Ended -> Ended (resend Cancelled)
+     */
+    public void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_CANCELING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING))
+        {
+            executeCancel() ;
+        }
+        else if (current == State.STATE_COMPLETED)
+        {
+            sendCompleted() ;
+        }
+        else if (current == State.STATE_FAULTING_ACTIVE)
+        {
+            sendFault("Cancel called when State faulting active") ;
+        }
+        else if (current == State.STATE_EXITING)
+        {
+            sendExit() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendCancelled() ;
+        }
+    }
+    
+    /**
+     * Handle the close event.
+     * @param close The close notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Completing (invalid state)
+     * Completed -> Closing
+     * Closing -> Closing
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (send Closed)
+     */
+    public void close(final NotificationType close, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_CLOSING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_COMPLETED)
+        {
+            executeClose() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendClosed() ;
+        }
+    }
+    
+    /**
+     * Handle the compensate event.
+     * @param compensate The compensate notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Completing (invalid state)
+     * Completed -> Compensating
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (resend fault)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (send compensated)
+     */
+    public void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_COMPENSATING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_COMPLETED)
+        {
+            executeCompensate() ;
+        }
+        else if (current == State.STATE_FAULTING_COMPENSATING)
+        {
+            sendFault("Compensate called when state faulting compensating") ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendCompensated() ;
+        }
+    }
+    
+    /**
+     * Handle the complete event.
+     * @param complete The complete notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Completing
+     * Canceling -> Canceling
+     * Completing -> Completing
+     * Completed -> Completed (resend Completed)
+     * Closing -> Closing
+     * Compensating -> Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting (resend Fault)
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (resend Exit)
+     * Ended -> Ended
+     */
+    public void complete(final NotificationType complete, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_COMPLETING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_ACTIVE)
+        {
+            executeComplete() ;
+        }
+        else if (current == State.STATE_COMPLETED)
+        {
+            sendCompleted() ;
+        }
+        else if (current == State.STATE_FAULTING_ACTIVE)
+        {
+            sendFault("Complete called when state faulting active") ;
+        }
+        else if (current == State.STATE_EXITING)
+        {
+            sendExit() ;
+        }
+    }
+    
+    /**
+     * Handle the exited event.
+     * @param exited The exited notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Completing (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Ended
+     * Ended -> Ended
+     */
+    public void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+            else if (current == State.STATE_EXITING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+        }
+    }
+    
+    /**
+     * Handle the faulted event.
+     * @param faulted The faulted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Completing (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Ended
+     * Faulting-Active -> Ended
+     * Faulting-Compensating -> Ended
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_FAULTING) || (current == State.STATE_FAULTING_ACTIVE) ||
+                (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+        }
+    }
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.getStatus_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.getStatus_1] - Unknown error: {0}
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the status event.
+     * @param status The status type.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the soap fault event.
+     * @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}) ;
+        }
+    }
+    
+    /**
+     * Handle the completed event.
+     * 
+     * Active -> Completed
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Completed
+     * Completed -> Completed
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting-Active (invalid state)
+     * Faulting-Compensating -> Faulting-Compensating (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (invalid state)
+     */
+    public State completed()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_COMPLETED) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING) ||
+            (current == State.STATE_COMPLETED))
+        {
+            sendCompleted() ;
+        }
+        
+        return current ;
+    }
+    
+    /**
+     * Handle the exit event.
+     * 
+     * Active -> Exiting
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Exiting
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting-Active (invalid state)
+     * Faulting-Compensating -> Faulting-Compensating (invalid state)
+     * Exiting -> Exiting
+     * Ended -> Ended (invalid state)
+     */
+    public State exit()
+    {
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_EXITING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING) ||
+            (current == State.STATE_EXITING))
+        {
+            sendExit() ;
+        }
+        
+        return waitForState(State.STATE_EXITING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the fault event.
+     * 
+     * Active -> Faulting-Active
+     * Canceling -> Canceling (invalid state)
+     * Completing -> Faulting-Active
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Faulting-Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting-Active
+     * Faulting-Compensating -> Faulting-Compensating
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (invalid state)
+     */
+    public State fault()
+    {
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING))
+            {
+                changeState(State.STATE_FAULTING_ACTIVE) ;
+            }
+            else if (current == State.STATE_COMPENSATING)
+            {
+                changeState(State.STATE_FAULTING_COMPENSATING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING) ||
+            (current == State.STATE_FAULTING_ACTIVE))
+        {
+            sendFault("Fault called when state active/faulting active") ;
+            return waitForState(State.STATE_FAULTING_ACTIVE, TransportTimer.getTransportTimeout()) ;
+        }
+        else if ((current == State.STATE_COMPENSATING) || (current == State.STATE_FAULTING_COMPENSATING))
+        {
+            sendFault("Fault called when state compensating/faulting compensating") ;
+        }
+        
+        return waitForState(State.STATE_FAULTING_COMPENSATING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * 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
+     */
+    private void sendExit()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendExit(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendExit_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the completed message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompleted_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompleted_1] - Unexpected exception while sending Completed
+     */
+    private void sendCompleted()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompleted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the fault message.
+     * @param message The fault message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendFault_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendFault_1] - Unexpected exception while sending Fault
+     */
+    private void sendFault(final String message)
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendFault(addressingContext, instanceIdentifier, message) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendFault_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the cancelled message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCancelled_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCancelled_1] - Unexpected exception while sending Cancelled
+     */
+    private void sendCancelled()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCancelled_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the closed message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendClosed_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendClosed_1] - Unexpected exception while sending Closed
+     */
+    private void sendClosed()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendClosed(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendClosed_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the compensated message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompensated_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompensated_1] - Unexpected exception while sending Compensated
+     */
+    private void sendCompensated()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.sendCompensated_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Get the coordinator id.
+     * @return The coordinator id.
+     */
+    public String getId()
+    {
+        return id ;
+    }
+    
+    /**
+     * Get the coordinator endpoint reference
+     * @return The coordinator endpoint reference
+     */
+    public EndpointReferenceType getCoordinator()
+    {
+        return coordinator ;
+    }
+    
+    /**
+     * Get the associated participant.
+     * @return The associated participant.
+     */
+    public BusinessAgreementWithCoordinatorCompletionParticipant getParticipant()
+    {
+        return participant ;
+    }
+    
+    /**
+     * Change the state and notify any listeners.
+     * @param state The new state.
+     */
+    private synchronized void changeState(final State state)
+    {
+        if (this.state != state)
+        {
+            this.state = state ;
+            notifyAll() ;
+        }
+    }
+    
+    /**
+     * Wait for the state to change from the specified state.
+     * @param origState The original state.
+     * @param delay The maximum time to wait for (in milliseconds).
+     * @return The current state.
+     */
+    private State waitForState(final State origState, final long delay)
+    {
+        final long end = System.currentTimeMillis() + delay ;
+        synchronized(this)
+        {
+            while(state == origState)
+            {
+                final long remaining = end - System.currentTimeMillis() ;
+                if (remaining <= 0)
+                {
+                    break ;
+                }
+                try
+                {
+                    wait(remaining) ;
+                }
+                catch (final InterruptedException ie) {} // ignore
+            }
+            return state ;
+        }
+    }
+
+    /**
+     * Execute the cancel transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCancel_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCancel_1] - Unexpected exception from participant cancel
+     */
+    private void executeCancel()
+    {
+        try
+        {
+            participant.cancel() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCancel_1", th) ;
+            }
+            return ;
+        }
+        sendCancelled() ;
+    }
+
+    /**
+     * Execute the close transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeClose_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeClose_1] - Unexpected exception from participant close
+     */
+    private void executeClose()
+    {
+        try
+        {
+            participant.close() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeClose_1", th) ;
+            }
+            return ;
+        }
+        sendClosed() ;
+    }
+    
+    /**
+     * Execute the compensate transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCompensate_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCompensate_1] - Unexpected exception from participant compensate
+     */
+    private void executeCompensate()
+    {
+        try
+        {
+            participant.compensate() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeCompensate_1", th) ;
+            }
+            return ;
+        }
+        sendCompensated() ;
+    }
+    
+    /**
+     * Execute the complete transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeComplete_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeComplete_1] - Unexpected exception from participant compensate
+     */
+    private void executeComplete()
+    {
+        try
+        {
+            participant.complete() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.executeComplete_1", th) ;
+            }
+            return ;
+        }
+        sendCompleted() ;
+    }
+    
+    /**
+     * Create a context for the outgoing message.
+     * @return The addressing context.
+     */
+    private AddressingContext createContext()
+    {
+        final String messageId = MessageId.getMessageId() ;
+        return AddressingContext.createRequestContext(coordinator, messageId) ;
+    }
+}

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/CoordinatorEngine.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,581 @@
+/*
+ * 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.wst.messaging.engines;
+
+import java.util.TimerTask;
+
+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;
+import com.arjuna.webservices.wsaddr.EndpointReferenceType;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+import com.arjuna.webservices.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsat.CoordinatorInboundEvents;
+import com.arjuna.webservices.wsat.NotificationType;
+import com.arjuna.webservices.wsat.State;
+import com.arjuna.webservices.wsat.client.ParticipantClient;
+import com.arjuna.webservices.wsat.processors.CoordinatorProcessor;
+import com.arjuna.wsc.messaging.MessageId;
+
+/**
+ * The coordinator state engine
+ * @author kevin
+ */
+public class CoordinatorEngine implements CoordinatorInboundEvents
+{
+    /**
+     * Flag indicating this is a coordinator for a durable participant.
+     */
+    private final boolean durable ;
+    /**
+     * The coordinator id.
+     */
+    private final String id ;
+    /**
+     * The instance identifier.
+     */
+    private final InstanceIdentifier instanceIdentifier ;
+    /**
+     * The participant endpoint reference.
+     */
+    private final EndpointReferenceType participant ;
+    /**
+     * The current state.
+     */
+    private State state ;
+    /**
+     * The flag indicating a read only response.
+     */
+    private boolean readOnly ;
+    /**
+     * The associated timer task or null.
+     */
+    private TimerTask timerTask ;
+    
+    /**
+     * Construct the initial engine for the coordinator.
+     * @param id The coordinator id.
+     * @param durable true if the participant is durable, false if volatile. 
+     * @param participant The participant endpoint reference.
+     */
+    public CoordinatorEngine(final String id, final boolean durable, final EndpointReferenceType participant)
+    {
+        this(id, durable, participant, State.STATE_ACTIVE) ;
+    }
+    
+    /**
+     * Construct the engine for the coordinator in a specified state.
+     * @param id The coordinator id.
+     * @param durable true if the participant is durable, false if volatile. 
+     * @param participant The participant endpoint reference.
+     * @param state The initial state.
+     */
+    public CoordinatorEngine(final String id, final boolean durable, final EndpointReferenceType participant, final State state)
+    {
+        this.id = id ;
+        this.instanceIdentifier = new InstanceIdentifier(id) ;
+        this.durable = durable ;
+        this.participant = participant ;
+        this.state = state ;
+        CoordinatorProcessor.getProcessor().activateCoordinator(this, id) ;
+    }
+    
+    /**
+     * Handle the aborted event.
+     * @param aborted The aborted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> None (ignore)
+     * Active -> Aborting (forget)
+     * Preparing -> Aborting (forget)
+     * PreparedSuccess -> PreparedSuccess (invalid state)
+     * Committing -> Committing (invalid state)
+     * Aborting -> Aborting (forget)
+     */
+    public synchronized void aborted(final NotificationType aborted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current = state ;
+        if (current == State.STATE_ACTIVE)
+        {
+            changeState(State.STATE_ABORTING) ;
+        }
+        else if ((current == State.STATE_PREPARING) || (current == State.STATE_ABORTING))
+        {
+            forget() ;
+        }
+    }
+    
+    /**
+     * Handle the committed event.
+     * @param committed The committed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> None (ignore)
+     * Active -> Aborting (invalid state)
+     * Preparing -> Aborting (invalid state)
+     * PreparedSuccess -> PreparedSuccess (invalid state)
+     * Committing -> Committing (forget)
+     * Aborting -> Aborting (invalid state)
+     */
+    public synchronized void committed(final NotificationType committed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current = state ;
+        if (current == State.STATE_ACTIVE)
+        {
+            changeState(State.STATE_ABORTING) ;
+        }
+        else if ((current == State.STATE_PREPARING) || (current == State.STATE_COMMITTING))
+        {
+            forget() ;
+        }
+    }
+    
+    /**
+     * Handle the prepared event.
+     * @param prepared The prepared notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> Durable: (send rollback), Volatile: Invalid state: none
+     * Active -> Aborting (invalid state)
+     * Preparing -> PreparedSuccess (Record Vote)
+     * PreparedSuccess -> PreparedSuccess (ignore)
+     * Committing -> Committing (resend Commit)
+     * Aborting -> Aborting (resend Rollback and forget)
+     */
+    public void prepared(final NotificationType prepared, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_ABORTING) ;
+            }
+            else if (current == State.STATE_PREPARING)
+            {
+                changeState(State.STATE_PREPARED_SUCCESS) ;
+            }
+        }
+        if (current == State.STATE_COMMITTING)
+        {
+            sendCommit() ;
+        }
+        else if (current == State.STATE_ABORTING)
+        {
+            sendRollback() ;
+            forget() ;
+        }
+        else if ((current == null) && durable && !readOnly)
+        {
+            sendRollback() ;
+        }
+    }
+    
+    /**
+     * Handle the readOnly event.
+     * @param readOnly The readOnly notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> None (ignore)
+     * Active -> Active (forget)
+     * Preparing -> Preparing (forget)
+     * PreparedSuccess -> PreparedSuccess (invalid state)
+     * Committing -> Committing (invalid state)
+     * Aborting -> Aborting (forget)
+     */
+    public synchronized void readOnly(final NotificationType readOnly, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current = state ;
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
+            (current == State.STATE_ABORTING))
+        {
+            if (current != State.STATE_ABORTING)
+            {
+                this.readOnly = true ;
+            }
+            forget() ;
+        }
+    }
+    
+    /**
+     * Handle the replay event.
+     * @param replay The replay notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> Durable: (send rollback), Volatile: Invalid state: none
+     * Active -> Aborting (send rollback)
+     * Preparing -> Aborting (send rollback)
+     * PreparedSuccess -> PreparedSuccess (ignore)
+     * Committing -> Committing (send commit)
+     * Aborting -> Aborting (send rollback)
+     */
+    public void replay(final NotificationType aborted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING))
+            {
+                changeState(State.STATE_ABORTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
+            (current == State.STATE_ABORTING) || ((current == null) && durable))
+        {
+            sendRollback() ;
+        }
+        else if (current == State.STATE_COMMITTING)
+        {
+            sendCommit() ;
+        }
+    }
+
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorEngine.soapFault_1 [com.arjuna.wst.messaging.engines.CoordinatorEngine.soapFault_1] - Unexpected SOAP fault for coordinator {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.CoordinatorEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
+        }
+    }
+    
+    /**
+     * Handle the prepare event.
+     * 
+     * None -> None (invalid state)
+     * Active -> Preparing (send prepare)
+     * Preparing -> Preparing (resend prepare)
+     * PreparedSuccess -> PreparedSuccess (do nothing)
+     * Committing -> Committing (invalid state)
+     * Aborting -> Aborting (invalid state)
+     */
+    public State prepare()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_PREPARING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING))
+        {
+            sendPrepare() ;
+        }
+        
+        return waitForState(State.STATE_PREPARING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the commit event.
+     * 
+     * None -> None (invalid state)
+     * Active -> Active (invalid state)
+     * Preparing -> Preparing (invalid state)
+     * PreparedSuccess -> Committing (send commit)
+     * Committing -> Committing (resend commit)
+     * Aborting -> Aborting (invalid state)
+     */
+    public State commit()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_PREPARED_SUCCESS)
+            {
+                changeState(State.STATE_COMMITTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_PREPARED_SUCCESS) || (current == State.STATE_COMMITTING))
+        {
+            sendPrepare() ;
+        }
+        
+        return waitForState(State.STATE_COMMITTING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the rollback event.
+     * 
+     * None -> None (invalid state)
+     * Active -> Aborting (send rollback)
+     * Preparing -> Aborting (send rollback)
+     * PreparedSuccess -> Aborting (send rollback)
+     * Committing -> Committing (invalid state)
+     * Aborting -> Aborting (do nothing)
+     */
+    public State rollback()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
+                (current == State.STATE_PREPARED_SUCCESS))
+            {
+                changeState(State.STATE_ABORTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
+            (current == State.STATE_PREPARED_SUCCESS))
+        {
+            sendRollback() ;
+        }
+        
+        return waitForState(State.STATE_ABORTING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the comms timeout event.
+     *
+     * Preparing -> Preparing (resend Prepare)
+     * Committing -> Committing (resend Commit)
+     */
+    private void commsTimeout()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+        }
+        
+        if (current == State.STATE_PREPARING)
+        {
+            sendPrepare() ;
+        }
+        else if (current == State.STATE_COMMITTING)
+        {
+            sendCommit() ;
+        }
+    }
+    
+    /**
+     * Get the coordinator id.
+     * @return The coordinator id.
+     */
+    public String getId()
+    {
+        return id ;
+    }
+    
+    /**
+     * Get the participant endpoint reference
+     * @return The participant endpoint reference
+     */
+    public EndpointReferenceType getParticipant()
+    {
+        return participant ;
+    }
+    
+    /**
+     * Is the participant durable?
+     * @return true if durable, false otherwise.
+     */
+    public boolean isDurable()
+    {
+        return durable ;
+    }
+    
+    /**
+     * Was this a read only response?
+     * @return true if a read only response, false otherwise.
+     */
+    public synchronized boolean isReadOnly()
+    {
+        return readOnly ;
+    }
+    
+    /**
+     * Change the state and notify any listeners.
+     * @param state The new state.
+     */
+    private synchronized void changeState(final State state)
+    {
+        if (this.state != state)
+        {
+            this.state = state ;
+            notifyAll() ;
+        }
+    }
+    
+    /**
+     * Wait for the state to change from the specified state.
+     * @param origState The original state.
+     * @param delay The maximum time to wait for (in milliseconds).
+     * @return The current state.
+     */
+    private State waitForState(final State origState, final long delay)
+    {
+        final long end = System.currentTimeMillis() + delay ;
+        synchronized(this)
+        {
+            while(state == origState)
+            {
+                final long remaining = end - System.currentTimeMillis() ;
+                if (remaining <= 0)
+                {
+                    break ;
+                }
+                try
+                {
+                    wait(remaining) ;
+                }
+                catch (final InterruptedException ie) {} // ignore
+            }
+            return state ;
+        }
+    }
+    
+    /**
+     * Forget the current coordinator.
+     */
+    private void forget()
+    {
+        changeState(null) ;
+        CoordinatorProcessor.getProcessor().deactivateCoordinator(this) ;
+    }
+    
+    /**
+     * Send the prepare message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorEngine.sendPrepare_1 [com.arjuna.wst.messaging.engines.CoordinatorEngine.sendPrepare_1] - Unexpecting exception while sending Prepare
+     */
+    private void sendPrepare()
+    {
+        try
+        {
+            ParticipantClient.getClient().sendPrepare(createContext(), instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendRollback_1", th) ;
+            }
+        }
+        
+        initiateTimer() ;
+    }
+    
+    /**
+     * Send the commit message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorEngine.sendCommit_1 [com.arjuna.wst.messaging.engines.CoordinatorEngine.sendCommit_1] - Unexpecting exception while sending Commit
+     */
+    private void sendCommit()
+    {
+        try
+        {
+            ParticipantClient.getClient().sendCommit(createContext(), instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendCommit_1", th) ;
+            }
+        }
+        
+        initiateTimer() ;
+    }
+    
+    /**
+     * Send the rollback message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.CoordinatorEngine.sendRollback_1 [com.arjuna.wst.messaging.engines.CoordinatorEngine.sendRollback_1] - Unexpecting exception while sending Rollback
+     */
+    private void sendRollback()
+    {
+        try
+        {
+            ParticipantClient.getClient().sendRollback(createContext(), instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.CoordinatorEngine.sendRollback_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Initiate the timer.
+     */
+    private synchronized void initiateTimer()
+    {
+        if (timerTask != null)
+        {
+            timerTask.cancel() ;
+        }
+        if ((state == State.STATE_PREPARING) || (state == State.STATE_COMMITTING))
+        {
+            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.
+     */
+    private AddressingContext createContext()
+    {
+        final String messageId = MessageId.getMessageId() ;
+        return AddressingContext.createRequestContext(participant, messageId) ;
+    }
+}

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,744 @@
+/*
+ * 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.wst.messaging.engines;
+
+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;
+import com.arjuna.webservices.wsaddr.EndpointReferenceType;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+import com.arjuna.webservices.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsba.ExceptionType;
+import com.arjuna.webservices.wsba.NotificationType;
+import com.arjuna.webservices.wsba.ParticipantCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices.wsba.State;
+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;
+import com.arjuna.wst.BAParticipantManager;
+
+/**
+ * The participant completion coordinator state engine
+ * @author kevin
+ */
+public class ParticipantCompletionCoordinatorEngine implements ParticipantCompletionCoordinatorInboundEvents
+{
+    /**
+     * The coordinator id.
+     */
+    private final String id ;
+    /**
+     * The instance identifier.
+     */
+    private final InstanceIdentifier instanceIdentifier ;
+    /**
+     * The participant endpoint reference.
+     */
+    private final EndpointReferenceType participant ;
+    /**
+     * The associated coordinator
+     */
+    private BAParticipantManager coordinator ;
+    /**
+     * The current state.
+     */
+    private State state ;
+    
+    /**
+     * Construct the initial engine for the coordinator.
+     * @param id The coordinator id.
+     * @param participant The participant endpoint reference.
+     */
+    public ParticipantCompletionCoordinatorEngine(final String id, final EndpointReferenceType participant)
+    {
+        this(id, participant, State.STATE_ACTIVE) ;
+    }
+    
+    /**
+     * Construct the engine for the coordinator in a specified state.
+     * @param id The coordinator id.
+     * @param participant The participant endpoint reference.
+     * @param state The initial state.
+     */
+    public ParticipantCompletionCoordinatorEngine(final String id, final EndpointReferenceType participant,
+        final State state)
+    {
+        this.id = id ;
+        this.instanceIdentifier = new InstanceIdentifier(id) ;
+        this.participant = participant ;
+        this.state = state ;
+    }
+    
+    /**
+     * Set the coordinator and register
+     * @param coordinator
+     */
+    public void setCoordinator(final BAParticipantManager coordinator)
+    {
+        this.coordinator = coordinator ;
+        ParticipantCompletionCoordinatorProcessor.getProcessor().activateCoordinator(this, id) ;
+    }
+    
+    /**
+     * Handle the cancelled event.
+     * @param cancelled The cancelled notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Ended
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating ->Faulting (invalid state) 
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_CANCELING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_CANCELING)
+        {
+            deactivate() ;
+        }
+    }
+    
+    /**
+     * Handle the closed event.
+     * @param closed The closed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Ended
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void closed(final NotificationType closed, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_CLOSING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_CLOSING)
+        {
+            deactivate() ;
+        }
+    }
+    
+    /**
+     * Handle the compensated event.
+     * @param compensated The compensated notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Ended
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void compensated(final NotificationType compensated, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPENSATING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_COMPENSATING)
+        {
+            deactivate() ;
+        }
+    }
+    
+    /**
+     * Handle the completed event.
+     * @param completed The completed notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Completed
+     * Canceling -> Completed
+     * Completed -> Completed
+     * Closing -> Closing (resend close)
+     * Compensating -> Compensating (resend compensate)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void completed(final NotificationType completed, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
+            {
+                changeState(State.STATE_COMPLETED) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
+        {
+            executeCompleted() ;
+        }
+        else if (current == State.STATE_CLOSING)
+        {
+            sendClose() ;
+        }
+        else if (current == State.STATE_COMPENSATING)
+        {
+            sendCompensate() ;
+        }
+    }
+    
+    /**
+     * Handle the exit event.
+     * @param exit The exit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Exiting
+     * Canceling -> Exiting
+     * Completed -> Completed
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting
+     * Ended -> Ended (resend Exited)
+     */
+    public void exit(final NotificationType exit, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
+            {
+                changeState(State.STATE_EXITING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
+        {
+            executeExit() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendExited() ;
+        }
+    }
+    
+    /**
+     * Handle the fault event.
+     * @param fault The fault exception.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Faulting-Active
+     * Canceling -> Faulting-Active
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Faulting-Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (resend Faulted)
+     */
+    public void fault(final ExceptionType fault, final AddressingContext addressingContext,
+        final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
+            {
+                changeState(State.STATE_FAULTING_ACTIVE) ;
+            }
+            else if (current == State.STATE_COMPENSATING)
+            {
+                changeState(State.STATE_FAULTING_COMPENSATING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING) ||
+            (current == State.STATE_COMPENSATING))
+        {
+            executeFault() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendFaulted() ;
+        }
+    }
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the status event.
+     * @param status The status.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the get status event.
+     * @return The state.
+     */
+    public State getStatus()
+    {
+        // KEV - implement
+        return null ;
+    }
+    
+    /**
+     * Handle the cancel event.
+     * @return The state.
+     */
+    public State cancel()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_CANCELING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_CANCELING))
+        {
+            sendCancel() ;
+        }
+        
+        return waitForState(State.STATE_CANCELING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the compensate event.
+     * @return The state.
+     */
+    public State compensate()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_COMPENSATING) ;
+            }
+        }
+        
+        if ((current == State.STATE_COMPLETED) || (current == State.STATE_COMPENSATING))
+        {
+            sendCompensate() ;
+        }
+        
+        return waitForState(State.STATE_COMPENSATING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the close event.
+     * @return The state.
+     */
+    public State close()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_CLOSING) ;
+            }
+        }
+        
+        if ((current == State.STATE_COMPLETED) || (current == State.STATE_CLOSING))
+        {
+            sendClose() ;
+        }
+        
+        return waitForState(State.STATE_CLOSING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the soap fault event.
+     * @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}) ;
+        }
+    }
+    
+    /**
+     * Send the close message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendClose_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendClose_1] - Unexpected exception while sending Close
+     */
+    private void sendClose()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendClose(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendClose_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the compensate message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendCompensate_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendCompensate_1] - Unexpected exception while sending Compensate
+     */
+    private void sendCompensate()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendCompensate(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendCompensate_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the cancel message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendCancel_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendCancel_1] - Unexpected exception while sending Cancel
+     */
+    private void sendCancel()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendCancel(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendCancel_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the exited message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendExited_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendExited_1] - Unexpected exception while sending Exited
+     */
+    private void sendExited()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendExited(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendExited_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the faulted message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendFaulted_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendFaulted_1] - Unexpected exception while sending Faulted
+     */
+    private void sendFaulted()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionParticipantClient.getClient().sendFaulted(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.sendFaulted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Get the coordinator id.
+     * @return The coordinator id.
+     */
+    public String getId()
+    {
+        return id ;
+    }
+    
+    /**
+     * Get the participant endpoint reference
+     * @return The participant endpoint reference
+     */
+    public EndpointReferenceType getParticipant()
+    {
+        return participant ;
+    }
+    
+    /**
+     * Get the associated coordinator.
+     * @return The associated coordinator.
+     */
+    public BAParticipantManager getCoordinator()
+    {
+        return coordinator ;
+    }
+    
+    /**
+     * Change the state and notify any listeners.
+     * @param state The new state.
+     */
+    private synchronized void changeState(final State state)
+    {
+        if (this.state != state)
+        {
+            this.state = state ;
+            notifyAll() ;
+        }
+    }
+    
+    /**
+     * Wait for the state to change from the specified state.
+     * @param origState The original state.
+     * @param delay The maximum time to wait for (in milliseconds).
+     * @return The current state.
+     */
+    private State waitForState(final State origState, final long delay)
+    {
+        final long end = System.currentTimeMillis() + delay ;
+        synchronized(this)
+        {
+            while(state == origState)
+            {
+                final long remaining = end - System.currentTimeMillis() ;
+                if (remaining <= 0)
+                {
+                    break ;
+                }
+                try
+                {
+                    wait(remaining) ;
+                }
+                catch (final InterruptedException ie) {} // ignore
+            }
+            return state ;
+        }
+    }
+    
+    /**
+     * Execute the completed transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeCompleted_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeCompleted_1] - Unexpected exception from coordinator completed
+     */
+    private void executeCompleted()
+    {
+        try
+        {
+            coordinator.completed() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeCompleted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Execute the exit transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeExit_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeExit_1] - Unexpected exception from coordinator exit
+     */
+    private void executeExit()
+    {
+        try
+        {
+            coordinator.exit() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeExit_1", th) ;
+            }
+            return ;
+        }
+        sendExited() ;
+    }
+    
+    /**
+     * Executing the fault transition.
+     * 
+     * @throws SoapFault for SOAP errors.
+     * @throws IOException for transport errors.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeFault_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeFault_1] - Unexpected exception from coordinator fault
+     */
+    private void executeFault()
+    {
+        try
+        {
+            coordinator.fault() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine.executeFault_1", th) ;
+            }
+            return ;
+        }
+        sendFaulted() ;
+    }
+    
+    /**
+     * Deactivate the incoming event interface.
+     */
+    private void deactivate()
+    {
+        ParticipantCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this) ;
+    }
+    
+    /**
+     * Create a context for the outgoing message.
+     * @return The addressing context.
+     */
+    private AddressingContext createContext()
+    {
+        final String messageId = MessageId.getMessageId() ;
+        return AddressingContext.createRequestContext(participant, messageId) ;
+    }
+}

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,731 @@
+/*
+ * 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.wst.messaging.engines;
+
+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;
+import com.arjuna.webservices.wsaddr.EndpointReferenceType;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+import com.arjuna.webservices.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsba.NotificationType;
+import com.arjuna.webservices.wsba.ParticipantCompletionParticipantInboundEvents;
+import com.arjuna.webservices.wsba.State;
+import com.arjuna.webservices.wsba.StatusType;
+import com.arjuna.webservices.wsba.client.ParticipantCompletionCoordinatorClient;
+import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
+
+/**
+ * The participant completion participant state engine
+ * @author kevin
+ */
+public class ParticipantCompletionParticipantEngine implements ParticipantCompletionParticipantInboundEvents
+{
+    /**
+     * The participant id.
+     */
+    private final String id ;
+    /**
+     * The instance identifier.
+     */
+    private final InstanceIdentifier instanceIdentifier ;
+    /**
+     * The coordinator endpoint reference.
+     */
+    private final EndpointReferenceType coordinator ;
+    /**
+     * The associated participant
+     */
+    private final BusinessAgreementWithParticipantCompletionParticipant participant ;
+    /**
+     * The current state.
+     */
+    private State state ;
+    
+    /**
+     * Construct the initial engine for the participant.
+     * @param id The participant id.
+     * @param coordinator The coordinator endpoint reference.
+     * @param participant The participant.
+     */
+    public ParticipantCompletionParticipantEngine(final String id, final EndpointReferenceType coordinator,
+        final BusinessAgreementWithParticipantCompletionParticipant participant)
+    {
+        this(id, coordinator, participant, State.STATE_ACTIVE) ;
+    }
+    
+    /**
+     * Construct the engine for the participant in a specified state.
+     * @param id The participant id.
+     * @param coordinator The coordinator endpoint reference.
+     * @param participant The participant.
+     * @param state The initial state.
+     */
+    public ParticipantCompletionParticipantEngine(final String id, final EndpointReferenceType coordinator,
+        final BusinessAgreementWithParticipantCompletionParticipant participant, final State state)
+    {
+        this.id = id ;
+        this.instanceIdentifier = new InstanceIdentifier(id) ;
+        this.coordinator = coordinator ;
+        this.participant = participant ;
+        this.state = state ;
+    }
+    
+    /**
+     * Handle the cancel event.
+     * @param cancel The cancel notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Canceling
+     * Canceling -> Canceling
+     * Completed -> Completed (resend Completed)
+     * Closing -> Closing
+     * Compensating -> Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting (resend Fault)
+     * Faulting-Compensating -> Faulting
+     * Exiting -> Exiting (resend Exit)
+     * Ended -> Ended (resend Cancelled)
+     */
+    public void cancel(final NotificationType cancel, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_CANCELING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_ACTIVE)
+        {
+            executeCancel() ;
+        }
+        else if (current == State.STATE_COMPLETED)
+        {
+            sendCompleted() ;
+        }
+        else if (current == State.STATE_FAULTING_ACTIVE)
+        {
+            sendFault("Cancel called when State faulting active") ;
+        }
+        else if (current == State.STATE_EXITING)
+        {
+            sendExit() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendCancelled() ;
+        }
+    }
+    
+    /**
+     * Handle the close event.
+     * @param close The close notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Closing
+     * Closing -> Closing
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (send Closed)
+     */
+    public void close(final NotificationType close, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_CLOSING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_COMPLETED)
+        {
+            executeClose() ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendClosed() ;
+        }
+    }
+    
+    /**
+     * Handle the compensate event.
+     * @param compensate The compensate notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Compensating
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (resend fault)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (send compensated)
+     */
+    public void compensate(final NotificationType compensate, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_COMPLETED)
+            {
+                changeState(State.STATE_COMPENSATING) ;
+            }
+            else if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+        }
+        
+        if (current == State.STATE_COMPLETED)
+        {
+            executeCompensate() ;
+        }
+        else if (current == State.STATE_FAULTING_COMPENSATING)
+        {
+            sendFault("Compensate called when state faulting compensating") ;
+        }
+        else if (current == State.STATE_ENDED)
+        {
+            sendCompensated() ;
+        }
+    }
+    
+    /**
+     * Handle the exited event.
+     * @param exited The exited notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting (invalid state)
+     * Faulting-Compensating -> Faulting (invalid state)
+     * Exiting -> Ended
+     * Ended -> Ended
+     */
+    public void exited(final NotificationType exited, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_FAULTING_ACTIVE) || (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_FAULTING) ;
+            }
+            else if (current == State.STATE_EXITING)
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+        }
+    }
+    
+    /**
+     * Handle the faulted event.
+     * @param faulted The faulted notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Active -> Active (invalid state)
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Ended
+     * Faulting-Active -> Ended
+     * Faulting-Compensating -> Ended
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended
+     */
+    public void faulted(final NotificationType faulted, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_FAULTING) || (current == State.STATE_FAULTING_ACTIVE) ||
+                (current == State.STATE_FAULTING_COMPENSATING))
+            {
+                changeState(State.STATE_ENDED) ;
+            }
+        }
+    }
+    
+    /**
+     * Handle the getStatus event.
+     * @param getStatus The getStatus notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.getStatus_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.getStatus_1] - Unknown error: {0}
+     */
+    public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the status event.
+     * @param status The status type.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        // KEV - implement
+    }
+    
+    /**
+     * Handle the soap fault event.
+     * @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}) ;
+        }
+    }
+    
+    /**
+     * Handle the completed event.
+     * 
+     * Active -> Completed
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting-Active (invalid state)
+     * Faulting-Compensating -> Faulting-Compensating (invalid state)
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (invalid state)
+     */
+    public State completed()
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_COMPLETED) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETED))
+        {
+            sendCompleted() ;
+        }
+        
+        return current ;
+    }
+    
+    /**
+     * Handle the exit event.
+     * 
+     * Active -> Exiting
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Compensating (invalid state)
+     * Faulting -> Faulting (invalid state)
+     * Faulting-Active -> Faulting-Active (invalid state)
+     * Faulting-Compensating -> Faulting-Compensating (invalid state)
+     * Exiting -> Exiting
+     * Ended -> Ended (invalid state)
+     */
+    public State exit()
+    {
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_EXITING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_EXITING))
+        {
+            sendExit() ;
+        }
+        
+        return waitForState(State.STATE_EXITING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * Handle the fault event.
+     * 
+     * Active -> Faulting-Active
+     * Canceling -> Canceling (invalid state)
+     * Completed -> Completed (invalid state)
+     * Closing -> Closing (invalid state)
+     * Compensating -> Faulting-Compensating
+     * Faulting -> Faulting
+     * Faulting-Active -> Faulting-Active
+     * Faulting-Compensating -> Faulting-Compensating
+     * Exiting -> Exiting (invalid state)
+     * Ended -> Ended (invalid state)
+     */
+    public State fault()
+    {
+        final State current ;
+        synchronized (this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                changeState(State.STATE_FAULTING_ACTIVE) ;
+            }
+            else if (current == State.STATE_COMPENSATING)
+            {
+                changeState(State.STATE_FAULTING_COMPENSATING) ;
+            }
+        }
+        
+        if ((current == State.STATE_ACTIVE) || (current == State.STATE_FAULTING_ACTIVE))
+        {
+            sendFault("Fault called when state active/faulting active") ;
+            return waitForState(State.STATE_FAULTING_ACTIVE, TransportTimer.getTransportTimeout()) ;
+        }
+        else if ((current == State.STATE_COMPENSATING) || (current == State.STATE_FAULTING_COMPENSATING))
+        {
+            sendFault("Fault called when state compensating/faulting compensating") ;
+        }
+        
+        return waitForState(State.STATE_FAULTING_COMPENSATING, TransportTimer.getTransportTimeout()) ;
+    }
+    
+    /**
+     * 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
+     */
+    private void sendExit()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendExit(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendExit_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the completed message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompleted_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompleted_1] - Unexpected exception while sending Completed
+     */
+    private void sendCompleted()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendCompleted(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompleted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the fault message.
+     * @param message The fault message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendFault_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendFault_1] - Unexpected exception while sending Fault
+     */
+    private void sendFault(final String message)
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendFault(addressingContext, instanceIdentifier, message) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendFault_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the cancelled message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCancelled_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCancelled_1] - Unexpected exception while sending Cancelled
+     */
+    private void sendCancelled()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendCancelled(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCancelled_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the closed message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendClosed_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendClosed_1] - Unexpected exception while sending Closed
+     */
+    private void sendClosed()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendClosed(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendClosed_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Send the compensated message.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompensated_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompensated_1] - Unexpected exception while sending Compensated
+     */
+    private void sendCompensated()
+    {
+        final AddressingContext addressingContext = createContext() ;
+        try
+        {
+            ParticipantCompletionCoordinatorClient.getClient().sendCompensated(addressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.sendCompensated_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * Get the coordinator id.
+     * @return The coordinator id.
+     */
+    public String getId()
+    {
+        return id ;
+    }
+    
+    /**
+     * Get the coordinator endpoint reference
+     * @return The coordinator endpoint reference
+     */
+    public EndpointReferenceType getCoordinator()
+    {
+        return coordinator ;
+    }
+    
+    /**
+     * Get the associated participant.
+     * @return The associated participant.
+     */
+    public BusinessAgreementWithParticipantCompletionParticipant getParticipant()
+    {
+        return participant ;
+    }
+    
+    /**
+     * Change the state and notify any listeners.
+     * @param state The new state.
+     */
+    private synchronized void changeState(final State state)
+    {
+        if (this.state != state)
+        {
+            this.state = state ;
+            notifyAll() ;
+        }
+    }
+    
+    /**
+     * Wait for the state to change from the specified state.
+     * @param origState The original state.
+     * @param delay The maximum time to wait for (in milliseconds).
+     * @return The current state.
+     */
+    private State waitForState(final State origState, final long delay)
+    {
+        final long end = System.currentTimeMillis() + delay ;
+        synchronized(this)
+        {
+            while(state == origState)
+            {
+                final long remaining = end - System.currentTimeMillis() ;
+                if (remaining <= 0)
+                {
+                    break ;
+                }
+                try
+                {
+                    wait(remaining) ;
+                }
+                catch (final InterruptedException ie) {} // ignore
+            }
+            return state ;
+        }
+    }
+
+    /**
+     * Execute the cancel transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeCancel_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeCancel_1] - Unexpected exception from participant cancel
+     */
+    private void executeCancel()
+    {
+        try
+        {
+            participant.cancel() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeCancel_1", th) ;
+            }
+            return ;
+        }
+        sendCancelled() ;
+    }
+
+    /**
+     * Execute the close transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeClose_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeClose_1] - Unexpected exception from participant close
+     */
+    private void executeClose()
+    {
+        try
+        {
+            participant.close() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeClose_1", th) ;
+            }
+            return ;
+        }
+        sendClosed() ;
+    }
+    
+    /**
+     * Execute the compensate transition.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeCompensate_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeCompensate_1] - Unexpected exception from participant compensate
+     */
+    private void executeCompensate()
+    {
+        try
+        {
+            participant.compensate() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.executeClose_1", th) ;
+            }
+            return ;
+        }
+        sendCompensated() ;
+    }
+    
+    /**
+     * Create a context for the outgoing message.
+     * @return The addressing context.
+     */
+    private AddressingContext createContext()
+    {
+        final String messageId = MessageId.getMessageId() ;
+        return AddressingContext.createRequestContext(coordinator, messageId) ;
+    }
+}

Added: 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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/messaging/engines/ParticipantEngine.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,564 @@
+/*
+ * 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.wst.messaging.engines;
+
+import java.util.TimerTask;
+
+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;
+import com.arjuna.webservices.wsarj.ArjunaContext;
+import com.arjuna.webservices.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsat.NotificationType;
+import com.arjuna.webservices.wsat.Participant;
+import com.arjuna.webservices.wsat.ParticipantInboundEvents;
+import com.arjuna.webservices.wsat.State;
+import com.arjuna.webservices.wsat.client.CoordinatorClient;
+import com.arjuna.webservices.wsat.processors.ParticipantProcessor;
+import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.wst.Aborted;
+import com.arjuna.wst.Prepared;
+import com.arjuna.wst.ReadOnly;
+import com.arjuna.wst.Vote;
+
+/**
+ * The participant state engine
+ * @author kevin
+ */
+public class ParticipantEngine implements ParticipantInboundEvents
+{
+    /**
+     * The associated participant
+     */
+    private final Participant participant ;
+    /**
+     * The current state.
+     */
+    private State state ;
+    /**
+     * The associated timer task or null.
+     */
+    private TimerTask timerTask ;
+    
+    /**
+     * Construct the initial engine for the participant.
+     * @param participant The participant.
+     */
+    public ParticipantEngine(final Participant participant)
+    {
+        this(participant, State.STATE_ACTIVE) ;
+    }
+    
+    /**
+     * Construct the engine for the participant in a specified state.
+     * @param participant The participant.
+     * @param state The initial state.
+     */
+    public ParticipantEngine(final Participant participant, final State state)
+    {
+        this.participant = participant ;
+        this.state = state ;
+    }
+    
+    /**
+     * Handle the commit event.
+     * @param commit The commit notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> None (send committed)
+     * Active -> Aborting (do nothing)
+     * Preparing -> Aborting (do nothing)
+     * PreparedSuccess -> Committing (initiate commit)
+     * Committing -> Committing (do nothing)
+     * Aborting -> Aborting (do nothing)
+     */
+    public void commit(final NotificationType commit, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_PREPARED_SUCCESS)
+            {
+                state = State.STATE_COMMITTING ;
+            }
+            else if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING))
+            {
+                state = State.STATE_ABORTING ;
+            }
+        }
+        
+        if (current == State.STATE_PREPARED_SUCCESS)
+        {
+            executeCommit(addressingContext, arjunaContext) ;
+        }
+        else if (current == null)
+        {
+            sendCommitted(addressingContext, arjunaContext) ;
+        }
+    }
+    
+    /**
+     * Handle the prepare event.
+     * @param prepare The prepare notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> None (send aborted)
+     * Active -> Preparing (execute prepare)
+     * Preparing -> Preparing (do nothing)
+     * PreparedSuccess -> PreparedSuccess (resend prepared)
+     * Committing -> Committing (ignore)
+     * Aborting -> Aborting (send aborted and forget)
+     */
+    public void prepare(final NotificationType prepare, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_ACTIVE)
+            {
+                state = State.STATE_PREPARING ;
+            }
+        }
+        
+        if (current == State.STATE_ACTIVE)
+        {
+            executePrepare(addressingContext, arjunaContext) ;
+        }
+        else if (current == State.STATE_PREPARED_SUCCESS)
+        {
+            sendPrepared(addressingContext, arjunaContext) ;
+        }
+        else if ((current == State.STATE_ABORTING) || (current == null))
+        {
+            sendAborted(addressingContext, arjunaContext) ;
+            forget() ;
+        }
+    }
+    
+    /**
+     * Handle the rollback event.
+     * @param rollback The rollback notification.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * None -> None (send aborted)
+     * Active -> Aborting (execute rollback, send aborted and forget)
+     * Preparing -> Aborting (execute rollback, send aborted and forget)
+     * PreparedSuccess -> Aborting (execute rollback, send aborted and forget)
+     * Committing -> Committing (ignore)
+     * Aborting -> Aborting (send aborted and forget)
+     */
+    public void rollback(final NotificationType rollback, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
+                (current == State.STATE_PREPARED_SUCCESS))
+            {
+                state = State.STATE_ABORTING ;
+            }
+        }
+        
+        if (current != State.STATE_COMMITTING)
+        {
+            if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING) ||
+                (current == State.STATE_PREPARED_SUCCESS))
+            {
+                executeRollback(addressingContext, arjunaContext) ;
+            }
+            
+            sendAborted(addressingContext, arjunaContext) ;
+            
+            if (current != null)
+            {
+                forget() ;
+            }
+        }
+    }
+    
+    /**
+     * Handle the soap fault event.
+     * @param soapFault The soap fault.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * @message com.arjuna.wst.messaging.engines.ParticipantEngine.soapFault_1 [com.arjuna.wst.messaging.engines.ParticipantEngine.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.ParticipantEngine.soapFault_1", new Object[] {instanceIdentifier, soapFaultType, subCode}) ;
+        }
+    }
+    
+    /**
+     * 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)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_PREPARING)
+            {
+                state = State.STATE_PREPARED_SUCCESS ;
+            }
+        }
+        
+        if (current == State.STATE_PREPARING)
+        {
+            sendPrepared(addressingContext, arjunaContext) ;
+        }
+        else if (current == State.STATE_COMMITTING)
+        {
+            sendCommitted(addressingContext, arjunaContext) ;
+            forget() ;
+        }
+    }
+    
+    /**
+     * Handle the readOnly decision event.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Preparing -> None (send ReadOnly)
+     */
+    private void readOnlyDecision(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+        }
+        
+        if (current == State.STATE_PREPARING)
+        {
+            sendReadOnly(addressingContext, arjunaContext) ;
+            forget() ;
+        }
+    }
+    
+    /**
+     * Handle the rollback decision event.
+     * @param addressingContext The addressing context.
+     * @param arjunaContext The arjuna context.
+     * 
+     * Preparing -> Aborting (send aborted)
+     */
+    private void rollbackDecision(final AddressingContext addressingContext, final ArjunaContext arjunaContext)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+            if (current == State.STATE_PREPARING)
+            {
+                state = State.STATE_ABORTING ;
+            }
+        }
+        
+        if (current == State.STATE_PREPARING)
+        {
+            sendAborted(addressingContext, arjunaContext) ;
+            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)
+    {
+        final State current ;
+        synchronized(this)
+        {
+            current = state ;
+        }
+        
+        if (current == State.STATE_PREPARING)
+        {
+            sendPrepared(addressingContext, arjunaContext) ;
+        }
+    }
+    
+    /**
+     * 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)
+    {
+        try
+        {
+            participant.commit() ;
+            commitDecision(addressingContext, arjunaContext) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executeCommit_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * 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)
+    {
+        try
+        {
+            participant.rollback() ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executeRollback_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * 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)
+    {
+        final Vote vote ;
+        try
+        {
+            vote = participant.prepare();
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_1", th) ;
+            }
+            rollbackDecision(addressingContext, arjunaContext) ;
+            return ;
+        }
+        
+        if (vote instanceof Prepared)
+        {
+            commitDecision(addressingContext, arjunaContext) ;
+        }
+        else if (vote instanceof ReadOnly)
+        {
+            readOnlyDecision(addressingContext, arjunaContext) ;
+        }
+        else if (vote instanceof Aborted)
+        {
+            rollbackDecision(addressingContext, arjunaContext) ;
+        }
+        else
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.executePrepare_2", new Object[] {(vote == null ? "null" : vote.getClass().getName())}) ;
+            }
+            rollbackDecision(addressingContext, arjunaContext) ;
+        }
+    }
+    
+    /**
+     * Forget the current participant.
+     */
+    private void forget()
+    {
+        synchronized(this)
+        {
+            state = null ;
+        }
+        ParticipantProcessor.getProcessor().deactivateParticipant(this) ;
+    }
+    
+    /**
+     * 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)
+    {
+        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            CoordinatorClient.getClient().sendCommitted(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.sendCommitted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * 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)
+    {
+        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            CoordinatorClient.getClient().sendPrepared(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.sendPrepared_1", th) ;
+            }
+        }
+        
+        initiateTimer(addressingContext, arjunaContext) ;
+    }
+    
+    /**
+     * 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)
+    {
+        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            CoordinatorClient.getClient().sendAborted(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.sendAborted_1", th) ;
+            }
+        }
+    }
+    
+    /**
+     * 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)
+    {
+        final AddressingContext responseAddressingContext = createResponseContext(addressingContext) ;
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        try
+        {
+            CoordinatorClient.getClient().sendReadOnly(responseAddressingContext, instanceIdentifier) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.engines.ParticipantEngine.sendReadOnly_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)
+    {
+        if (timerTask != null)
+        {
+            timerTask.cancel() ;
+        }
+        if (state == State.STATE_PREPARING)
+        {
+            timerTask = new TimerTask() {
+                public void run() {
+                    commsTimeout(addressingContext, arjunaContext) ;
+                }
+            } ;
+            TransportTimer.getTimer().schedule(timerTask, TransportTimer.getTransportPeriod()) ;
+        }
+        else
+        {
+            timerTask = null ;
+        }
+    }
+    
+    /**
+     * Create a response context from the incoming context.
+     * @param addressingContext The incoming addressing context.
+     * @return The response addressing context.
+     */
+    private AddressingContext createResponseContext(final AddressingContext addressingContext)
+    {
+        final String messageId = MessageId.getMessageId() ;
+        return AddressingContext.createNotificationContext(addressingContext, messageId) ;
+    }
+}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BACoordinatorCompletionParticipantManagerStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BACoordinatorCompletionParticipantManagerStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BACoordinatorCompletionParticipantManagerStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,161 +20,79 @@
  */
 package com.arjuna.wst.stub;
 
-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.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsaddr.EndpointReferenceType;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
-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.CoordinatorCompletionParticipantCallback;
-import com.arjuna.webservices.wsba.processors.CoordinatorCompletionParticipantProcessor;
-import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.webservices.wsba.State;
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.UnknownTransactionException;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine;
 
 public class BACoordinatorCompletionParticipantManagerStub implements com.arjuna.wst.BAParticipantManager
 {
-    private final EndpointReferenceType _baParticipantManagerParticipant ;
-    private final String _id ;
+    private final CoordinatorCompletionParticipantEngine coordinator ;
     
-    public BACoordinatorCompletionParticipantManagerStub (final String id, final EndpointReferenceType baParticipantManagerParticipant)
+    public BACoordinatorCompletionParticipantManagerStub (final CoordinatorCompletionParticipantEngine coordinator)
         throws Exception
     {
-        _baParticipantManagerParticipant         = baParticipantManagerParticipant;
-        _id = id ;
+        this.coordinator = coordinator ;
     }
 
     public void exit ()
         throws WrongStateException, UnknownTransactionException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionParticipantProcessor participantProcessor = CoordinatorCompletionParticipantProcessor.getParticipant() ;
-        participantProcessor.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> illegal state 
+         * Exiting -> no response
+         * Ended -> ended
+         */
+        final State state = coordinator.exit() ;
+        if (state == State.STATE_EXITING)
         {
-            CoordinatorCompletionCoordinatorClient.getClient().sendExit(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state != State.STATE_ENDED)
         {
-            participantProcessor.removeCallback(_id) ;
+            throw new WrongStateException() ;
         }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedExited())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if (soapFault != null)
-            {
-                final QName subcode = soapFault.getSubcode() ;
-                if (ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-                {
-                    throw new WrongStateException();
-                }
-                else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode))
-                {
-                    throw new UnknownTransactionException() ;
-                }
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
     public void completed ()
         throws WrongStateException, UnknownTransactionException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionParticipantProcessor participantProcessor = CoordinatorCompletionParticipantProcessor.getParticipant() ;
-        participantProcessor.registerCallback(_id, callback) ;
-        try
+        // returns original state
+        final State state = coordinator.completed() ;
+        if ((state != State.STATE_ACTIVE) && (state != State.STATE_COMPLETED))
         {
-            CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
+            throw new WrongStateException() ;
         }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
-        finally
-        {
-            participantProcessor.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedComplete())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if (soapFault != null)
-            {
-                final QName subcode = soapFault.getSubcode() ;
-                if (ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-                {
-                    throw new WrongStateException();
-                }
-                else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode))
-                {
-                    throw new UnknownTransactionException() ;
-                }
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
     public void fault ()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionParticipantProcessor participantProcessor = CoordinatorCompletionParticipantProcessor.getParticipant() ;
-        participantProcessor.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> no response
+         * Faulting-Compensating -> no response 
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = coordinator.fault() ;
+        if (state != State.STATE_ENDED)
         {
-            CoordinatorCompletionCoordinatorClient.getClient().sendFault(addressingContext, new InstanceIdentifier(_id), null) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
-        {
-            participantProcessor.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered() && callback.receivedFaulted())
-        {
-            return ;
-        }
-        
-        throw new SystemException() ;
     }
 
     public void unknown()
@@ -183,187 +101,9 @@
         error() ;
     }
 
-    /**
-     * @message com.arjuna.wst.stub.BACoordinatorCompletionParticipantManagerStub_1 [com.arjuna.wst.stub.BACoordinatorCompletionParticipantManagerStub_1] - Unknown error
-     */
     public void error()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
-                WSTLogger.log_mesg.getString("com.arjuna.wst.stub.BACoordinatorCompletionParticipantManagerStub_1")) ;
-        try
-        {
-            CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(addressingContext, soapFault, new InstanceIdentifier(_id)) ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
+        fault() ;
     }
-
-    private static class RequestCallback extends CoordinatorCompletionParticipantCallback
-    {
-        /**
-         * The addressing context.
-         */
-        private AddressingContext addressingContext ;
-        /**
-         * The arjuna context.
-         */
-        private ArjunaContext arjunaContext ;
-        /**
-         * The SOAP fault.
-         */
-        private SoapFault soapFault ;
-        /**
-         * The complete notification flag.
-         */
-        private boolean complete ;
-        /**
-         * The exited notification flag.
-         */
-        private boolean exited ;
-        /**
-         * The faulted notification flag.
-         */
-        private boolean faulted ;
-        /**
-         * The status response.
-         */
-        private StatusType status ;
-        
-        /**
-         * Get the addressing context.
-         * @return The addressing context.
-         */
-        AddressingContext getAddressingContext()
-        {
-            return addressingContext ;
-        }
-        
-        /**
-         * Get the arjuna context.
-         * @return The arjuna context.
-         */
-        ArjunaContext getArjunaContext()
-        {
-            return arjunaContext ;
-        }
-        
-        /**
-         * Get the SOAP fault.
-         * @return The SOAP fault.
-         */
-        SoapFault getSoapFault()
-        {
-            return soapFault ;
-        }
-        
-        /**
-         * Did we receive a complete notification?
-         * @return True if complete, false otherwise.
-         */
-        boolean receivedComplete()
-        {
-            return complete ;
-        }
-        
-        /**
-         * Did we receive a exited notification?
-         * @return True if exited, false otherwise.
-         */
-        boolean receivedExited()
-        {
-            return exited ;
-        }
-        
-        /**
-         * Did we receive a faulted notification?
-         * @return True if faulted, false otherwise.
-         */
-        boolean receivedFaulted()
-        {
-            return faulted ;
-        }
-        
-        /**
-         * Get the status.
-         * @return The status.
-         */
-        StatusType getStatus()
-        {
-            return status ;
-        }
-        
-        /**
-         * A complete response.
-         * @param complete The complete notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void complete(final NotificationType complete, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.complete = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * An exited response.
-         * @param exited The exited notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void exited(final NotificationType exited, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.exited  = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A faulted response.
-         * @param faulted The faulted notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void faulted(final NotificationType faulted, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.faulted = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A status response.
-         * @param status The status notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-        {
-            this.status = status ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A SOAP fault response.
-         * @param soapFault The SOAP fault.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.soapFault = soapFault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BAParticipantCompletionParticipantManagerStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BAParticipantCompletionParticipantManagerStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BAParticipantCompletionParticipantManagerStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -20,130 +20,79 @@
  */
 package com.arjuna.wst.stub;
 
-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.wsaddr.AddressingContext;
-import com.arjuna.webservices.wsaddr.EndpointReferenceType;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
-import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.StatusType;
-import com.arjuna.webservices.wsba.client.ParticipantCompletionCoordinatorClient;
-import com.arjuna.webservices.wsba.processors.ParticipantCompletionParticipantCallback;
-import com.arjuna.webservices.wsba.processors.ParticipantCompletionParticipantProcessor;
-import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.webservices.wsba.State;
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.UnknownTransactionException;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine;
 
 public class BAParticipantCompletionParticipantManagerStub implements com.arjuna.wst.BAParticipantManager
 {
-    private final EndpointReferenceType _baParticipantManagerParticipant ;
-    private final String _id ;
+    private final ParticipantCompletionParticipantEngine coordinator ;
     
-    public BAParticipantCompletionParticipantManagerStub (final String id, final EndpointReferenceType baParticipantManagerParticipant)
+    public BAParticipantCompletionParticipantManagerStub (final ParticipantCompletionParticipantEngine coordinator)
         throws Exception
     {
-        _baParticipantManagerParticipant         = baParticipantManagerParticipant;
-        _id = id ;
+        this.coordinator = coordinator ;
     }
 
-    public void exit ()
+    public synchronized void exit ()
         throws WrongStateException, UnknownTransactionException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final ParticipantCompletionParticipantProcessor participantProcessor = ParticipantCompletionParticipantProcessor.getParticipant() ;
-        participantProcessor.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> illegal state 
+         * Exiting -> no response
+         * Ended -> ended
+         */
+        final State state = coordinator.exit() ;
+        if (state == State.STATE_EXITING)
         {
-            ParticipantCompletionCoordinatorClient.getClient().sendExit(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state != State.STATE_ENDED)
         {
-            participantProcessor.removeCallback(_id) ;
+            throw new WrongStateException() ;
         }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedExited())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if (soapFault != null)
-            {
-                final QName subcode = soapFault.getSubcode() ;
-                if (ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-                {
-                    throw new WrongStateException();
-                }
-                else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode))
-                {
-                    throw new UnknownTransactionException() ;
-                }
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
-    public void completed ()
+    public synchronized void completed ()
         throws WrongStateException, UnknownTransactionException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        
-        try
+        // returns original state
+        final State state = coordinator.completed() ;
+        if ((state != State.STATE_ACTIVE) && (state != State.STATE_COMPLETED))
         {
-            ParticipantCompletionCoordinatorClient.getClient().sendCompleted(addressingContext, new InstanceIdentifier(_id)) ;
+            throw new WrongStateException() ;
         }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
     }
 
-    public void fault ()
+    public synchronized void fault ()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final ParticipantCompletionParticipantProcessor participantProcessor = ParticipantCompletionParticipantProcessor.getParticipant() ;
-        participantProcessor.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> no response
+         * Faulting-Compensating -> no response 
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = coordinator.fault() ;
+        if (state != State.STATE_ENDED)
         {
-            ParticipantCompletionCoordinatorClient.getClient().sendFault(addressingContext, new InstanceIdentifier(_id), null) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
-        {
-            participantProcessor.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered() && callback.receivedFaulted())
-        {
-            return ;
-        }
-        
-        throw new SystemException() ;
     }
 
     public void unknown()
@@ -152,187 +101,9 @@
         error() ;
     }
 
-    /**
-     * @message com.arjuna.wst.stub.BAParticipantCompletionParticipantManagerStub_1 [com.arjuna.wst.stub.BAParticipantCompletionParticipantManagerStub_1] - Unknown error
-     */
     public void error()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_baParticipantManagerParticipant, MessageId.getMessageId()) ;
-        final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
-                WSTLogger.log_mesg.getString("com.arjuna.wst.stub.BAParticipantCompletionParticipantManagerStub_1")) ;
-        try
-        {
-            ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(addressingContext, soapFault, new InstanceIdentifier(_id)) ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
+        fault() ;
     }
-
-    private static class RequestCallback extends ParticipantCompletionParticipantCallback
-    {
-        /**
-         * The addressing context.
-         */
-        private AddressingContext addressingContext ;
-        /**
-         * The arjuna context.
-         */
-        private ArjunaContext arjunaContext ;
-        /**
-         * The SOAP fault.
-         */
-        private SoapFault soapFault ;
-        /**
-         * The complete notification flag.
-         */
-        private boolean complete ;
-        /**
-         * The exited notification flag.
-         */
-        private boolean exited ;
-        /**
-         * The faulted notification flag.
-         */
-        private boolean faulted ;
-        /**
-         * The status.
-         */
-        private StatusType status ;
-        
-        /**
-         * Get the addressing context.
-         * @return The addressing context.
-         */
-        AddressingContext getAddressingContext()
-        {
-            return addressingContext ;
-        }
-        
-        /**
-         * Get the arjuna context.
-         * @return The arjuna context.
-         */
-        ArjunaContext getArjunaContext()
-        {
-            return arjunaContext ;
-        }
-        
-        /**
-         * Get the SOAP fault.
-         * @return The SOAP fault.
-         */
-        SoapFault getSoapFault()
-        {
-            return soapFault ;
-        }
-        
-        /**
-         * Did we receive a complete notification?
-         * @return True if complete, false otherwise.
-         */
-        boolean receivedComplete()
-        {
-            return complete ;
-        }
-        
-        /**
-         * Did we receive a exited notification?
-         * @return True if exited, false otherwise.
-         */
-        boolean receivedExited()
-        {
-            return exited ;
-        }
-        
-        /**
-         * Did we receive a faulted notification?
-         * @return True if faulted, false otherwise.
-         */
-        boolean receivedFaulted()
-        {
-            return faulted ;
-        }
-        
-        /**
-         * Get the status response.
-         * @return the status response.
-         */
-        StatusType getStatus()
-        {
-            return status ;
-        }
-        
-        /**
-         * A complete response.
-         * @param complete The complete notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void complete(final NotificationType complete, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.complete = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * An exited response.
-         * @param exited The exited notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void exited(final NotificationType exited, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.exited  = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A faulted response.
-         * @param faulted The faulted notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void faulted(final NotificationType faulted, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.faulted = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A status response.
-         * @param status The status notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
-        {
-            this.status = status ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A SOAP fault response.
-         * @param soapFault The SOAP fault.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.soapFault = soapFault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessActivityTerminatorStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessActivityTerminatorStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessActivityTerminatorStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -64,7 +64,7 @@
         final AddressingContext addressingContext = AddressingContext.createRequestContext(_terminationParticipant, MessageId.getMessageId()) ;
         
         final RequestCallback callback = new RequestCallback() ;
-        final TerminationParticipantProcessor terminatorCoordinatorProcessor = TerminationParticipantProcessor.getCoordinator() ;
+        final TerminationParticipantProcessor terminatorCoordinatorProcessor = TerminationParticipantProcessor.getProcessor() ;
         terminatorCoordinatorProcessor.registerCallback(_id, callback) ;
         try
         {
@@ -109,7 +109,7 @@
         final AddressingContext addressingContext = AddressingContext.createRequestContext(_terminationParticipant, MessageId.getMessageId()) ;
         
         final RequestCallback callback = new RequestCallback() ;
-        final TerminationParticipantProcessor terminatorCoordinatorProcessor = TerminationParticipantProcessor.getCoordinator() ;
+        final TerminationParticipantProcessor terminatorCoordinatorProcessor = TerminationParticipantProcessor.getProcessor() ;
         terminatorCoordinatorProcessor.registerCallback(_id, callback) ;
         try
         {
@@ -154,7 +154,7 @@
         final AddressingContext addressingContext = AddressingContext.createRequestContext(_terminationParticipant, MessageId.getMessageId()) ;
         
         final RequestCallback callback = new RequestCallback() ;
-        final TerminationParticipantProcessor terminatorCoordinatorProcessor = TerminationParticipantProcessor.getCoordinator() ;
+        final TerminationParticipantProcessor terminatorCoordinatorProcessor = TerminationParticipantProcessor.getProcessor() ;
         terminatorCoordinatorProcessor.registerCallback(_id, callback) ;
         try
         {

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithCoordinatorCompletionStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithCoordinatorCompletionStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithCoordinatorCompletionStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -26,238 +26,165 @@
 
 package com.arjuna.wst.stub;
 
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamWriter;
+
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.webservices.logging.WSTLogger;
-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.wsarjtx.ArjunaTXConstants;
-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.CoordinatorCompletionCoordinatorCallback;
-import com.arjuna.webservices.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
-import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.webservices.soap.SoapUtils;
+import com.arjuna.webservices.util.StreamHelper;
+import com.arjuna.webservices.wsba.State;
+import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
 import com.arjuna.wst.FaultedException;
+import com.arjuna.wst.PersistableParticipant;
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine;
 
-public class BusinessAgreementWithCoordinatorCompletionStub implements com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant
+public class BusinessAgreementWithCoordinatorCompletionStub implements BusinessAgreementWithCoordinatorCompletionParticipant, PersistableParticipant
 {
-    private EndpointReferenceType _businessAgreementWithCoordinatorCompletionParticipant = null;
-    private final String _id ;
+    private static final QName QNAME_BACC_PARTICIPANT = new QName("baccParticipant") ;
+    private CoordinatorCompletionCoordinatorEngine participant ;
 
-    public BusinessAgreementWithCoordinatorCompletionStub (final String id, final EndpointReferenceType businessAgreementWithCoordinatorCompletionParticipant)
+    public BusinessAgreementWithCoordinatorCompletionStub (final CoordinatorCompletionCoordinatorEngine participant)
         throws Exception
     {
-        _businessAgreementWithCoordinatorCompletionParticipant         = businessAgreementWithCoordinatorCompletionParticipant;
-        _id = id ;
+        this.participant = participant ;
     }
 
-    public void close ()
+    public synchronized void close ()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithCoordinatorCompletionParticipant, MessageId.getMessageId()) ;
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Canceling-Active -> illegal state
+         * Canceling-Completing -> illegal state
+         * Completing -> illegal state
+         * Completed -> illegal state
+         * Closing -> no response
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> illegal state
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = participant.close() ;
         
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionCoordinatorProcessor coordinatorCompletionCoordinator = CoordinatorCompletionCoordinatorProcessor.getCoordinator() ;
-        coordinatorCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        if (state == State.STATE_CLOSING)
         {
-            CoordinatorCompletionParticipantClient.getClient().sendClose(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state != State.STATE_ENDED)
         {
-            coordinatorCompletionCoordinator.removeCallback(_id) ;
+            throw new WrongStateException() ;
         }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedClosed())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
-    public void cancel ()
+    public synchronized void cancel ()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithCoordinatorCompletionParticipant, MessageId.getMessageId()) ;
+        /*
+         * Active -> illegal state
+         * Canceling -> no response
+         * Canceling-Active -> no response
+         * Canceling-Completing -> no response
+         * Completing -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> illegal state
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = participant.cancel() ;
         
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionCoordinatorProcessor coordinatorCompletionCoordinator = CoordinatorCompletionCoordinatorProcessor.getCoordinator() ;
-        coordinatorCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        if ((state == State.STATE_CANCELING) || (state == State.STATE_CANCELING_ACTIVE) ||
+            (state == State.STATE_CANCELING_COMPLETING))
         {
-            CoordinatorCompletionParticipantClient.getClient().sendCancel(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state != State.STATE_ENDED)
         {
-            coordinatorCompletionCoordinator.removeCallback(_id) ;
+            throw new WrongStateException() ;
         }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedCancelled())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
-    public void compensate ()
+    public synchronized void compensate ()
         throws FaultedException, WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithCoordinatorCompletionParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionCoordinatorProcessor coordinatorCompletionCoordinator = CoordinatorCompletionCoordinatorProcessor.getCoordinator() ;
-        coordinatorCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Canceling-Active -> illegal state
+         * Canceling-Completing -> illegal state
+         * Completing -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> no response
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> fault
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = participant.compensate() ;
+        if (state == State.STATE_COMPENSATING)
         {
-            CoordinatorCompletionParticipantClient.getClient().sendCompensate(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state == State.STATE_FAULTING_COMPENSATING)
         {
-            coordinatorCompletionCoordinator.removeCallback(_id) ;
+            throw new FaultedException() ;
         }
-        
-        if (callback.hasTriggered())
+        else if (state != State.STATE_ENDED)
         {
-            if (callback.receivedCompensated())
-            {
-                return ;
-            }
-            final ExceptionType fault = callback.getFault() ;
-            if (fault != null)
-            {
-                final AddressingContext responseContext = AddressingContext.createNotificationContext(callback.getAddressingContext(),
-                    MessageId.getMessageId()) ;
-                try
-                {
-                    CoordinatorCompletionParticipantClient.getClient().sendFaulted(responseContext, new InstanceIdentifier(_id)) ;
-                }
-                catch (final Throwable th) {} // ignore this as we are faulting
-                throw new FaultedException() ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
+            throw new WrongStateException() ;
         }
-        
-        throw new SystemException() ;
     }
 
-    public void complete ()
+    public synchronized void complete ()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithCoordinatorCompletionParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionCoordinatorProcessor coordinatorCompletionCoordinator = CoordinatorCompletionCoordinatorProcessor.getCoordinator() ;
-        coordinatorCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Canceling-Active -> illegal state
+         * Canceling-Completing -> canceling
+         * Completing -> no response
+         * Completed -> completed
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> fault
+         * Exiting -> exiting
+         * Ended -> illegal state
+         */
+        final State state = participant.complete() ;
+        if (state == State.STATE_COMPLETED)
         {
-            CoordinatorCompletionParticipantClient.getClient().sendComplete(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
+            return ;
         }
-        catch (final Throwable th)
+        else if ((state == State.STATE_FAULTING_COMPENSATING) || (state == State.STATE_CANCELING_COMPLETING) ||
+            (state == State.STATE_EXITING))
         {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
-        {
-            coordinatorCompletionCoordinator.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedCompleted())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
-        }
-        
-        throw new SystemException() ;
+        throw new WrongStateException() ;
     }
 
     public String status ()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithCoordinatorCompletionParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorCompletionCoordinatorProcessor coordinatorCompletionCoordinator = CoordinatorCompletionCoordinatorProcessor.getCoordinator() ;
-        coordinatorCompletionCoordinator.registerCallback(_id, callback) ;
-        try
-        {
-            CoordinatorCompletionParticipantClient.getClient().sendGetStatus(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
-        finally
-        {
-            coordinatorCompletionCoordinator.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered())
-        {
-            final StatusType status = callback.getStatus() ;
-            if (status != null)
-            {
-                return status.getState().toString() ;
-            }
-        }
-        
-        throw new SystemException() ;
+        final State state = participant.getStatus() ;
+        return (state == null ? null : state.getValue().getLocalPart()) ;
     }
 
     public void unknown ()
@@ -266,242 +193,63 @@
         error() ;
     }
 
+    public synchronized void error ()
+        throws SystemException
+    {
+        participant.cancel() ;
+    }
+    
     /**
-     * @message com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_1 [com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_1] - Unknown error
+     * @message com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_2 [com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_2] - Error persisting participant state
      */
-    public void error ()
-        throws SystemException
+    public boolean saveState(final OutputObjectState oos)
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithCoordinatorCompletionParticipant, MessageId.getMessageId()) ;
-        final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
-                WSTLogger.log_mesg.getString("com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_1")) ;
         try
         {
-            CoordinatorCompletionParticipantClient.getClient().sendSoapFault(addressingContext, soapFault, new InstanceIdentifier(_id)) ;
+            oos.packString(participant.getId()) ;
+            
+            final StringWriter sw = new StringWriter() ;
+            final XMLStreamWriter writer = SoapUtils.getXMLStreamWriter(sw) ;
+            StreamHelper.writeStartElement(writer, QNAME_BACC_PARTICIPANT) ;
+            participant.getParticipant().writeContent(writer) ;
+            StreamHelper.writeEndElement(writer, null, null) ;
+            writer.close() ;
+            
+            oos.packString(writer.toString()) ;
+            
+            return true ;
         }
         catch (final Throwable th)
         {
-            th.printStackTrace() ;
-            throw new SystemException() ;
+            WSTLogger.arjLoggerI18N.error("com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_2", th) ;
+            return false ;
         }
     }
-
-    private static class RequestCallback extends CoordinatorCompletionCoordinatorCallback
+    
+    /**
+     * @message com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_3 [com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_3] - Error restoring participant state
+     */
+    public boolean restoreState(final InputObjectState ios)
     {
-        /**
-         * The addressing context.
-         */
-        private AddressingContext addressingContext ;
-        /**
-         * The arjuna context.
-         */
-        private ArjunaContext arjunaContext ;
-        /**
-         * The SOAP fault.
-         */
-        private SoapFault soapFault ;
-        /**
-         * The fault.
-         */
-        private ExceptionType fault ;
-        /**
-         * The status.
-         */
-        private StatusType status ;
-        /**
-         * The completed notification flag.
-         */
-        private boolean completed ;
-        /**
-         * The cancelled notification flag.
-         */
-        private boolean cancelled ;
-        /**
-         * The closed notification flag.
-         */
-        private boolean closed ;
-        /**
-         * The compensated notification flag.
-         */
-        private boolean compensated ;
-        
-        /**
-         * Get the addressing context.
-         * @return The addressing context.
-         */
-        AddressingContext getAddressingContext()
-        {
-            return addressingContext ;
-        }
-        
-        /**
-         * Get the arjuna context.
-         * @return The arjuna context.
-         */
-        ArjunaContext getArjunaContext()
-        {
-            return arjunaContext ;
-        }
-        
-        /**
-         * Get the SOAP fault.
-         * @return The SOAP fault.
-         */
-        SoapFault getSoapFault()
-        {
-            return soapFault ;
-        }
-        
-        /**
-         * Get the fault.
-         * @return The fault.
-         */
-        ExceptionType getFault()
-        {
-            return fault ;
-        }
-        
-        /**
-         * Get the status.
-         * @return The status.
-         */
-        StatusType getStatus()
-        {
-            return status ;
-        }
-        
-        /**
-         * Did we receive a completed notification?
-         * @return True if completed, false otherwise.
-         */
-        boolean receivedCompleted()
-        {
-            return completed ;
-        }
-        
-        /**
-         * Did we receive a cancelled notification?
-         * @return True if cancelled, false otherwise.
-         */
-        boolean receivedCancelled()
-        {
-            return cancelled ;
-        }
-        
-        /**
-         * Did we receive a closed notification?
-         * @return True if closed, false otherwise.
-         */
-        boolean receivedClosed()
-        {
-            return closed ;
-        }
-        
-        /**
-         * Did we receive a compensated notification?
-         * @return True if compensated, false otherwise.
-         */
-        boolean receivedCompensated()
-        {
-            return compensated ;
-        }
-        
-        /**
-         * A completed response.
-         * @param completed The completed notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void completed(final NotificationType completed, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.completed = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A cancelled response.
-         * @param cancelled The cancelled notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.cancelled  = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A closed response.
-         * @param closed The closed notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void closed(final NotificationType closed, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.closed = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A compensated response.
-         * @param compensated The compensated notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void compensated(final NotificationType compensated, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.compensated = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A fault response.
-         * @param fault The fault notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void fault(final ExceptionType fault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.fault = fault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A status response.
-         * @param status The status notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void status(final StatusType status, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.status = status ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A SOAP fault response.
-         * @param soapFault The SOAP fault.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.soapFault = soapFault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
+        // KEV - rework
+        return false ;
+//        try
+//        {
+//            final String id = ios.unpackString() ;
+//            final String eprValue = ios.unpackString() ;
+//            
+//            final XMLStreamReader reader = SoapUtils.getXMLStreamReader(new StringReader(eprValue)) ;
+//            StreamHelper.checkNextStartTag(reader, QNAME_BACC_PARTICIPANT) ;
+//            final EndpointReferenceType endpointReferenceType = new EndpointReferenceType(reader) ;
+//            
+//            _id = id ;
+//            _businessAgreementWithCoordinatorCompletionParticipant = endpointReferenceType ;
+//            return true ;
+//        }
+//        catch (final Throwable th)
+//        {
+//            WSTLogger.arjLoggerI18N.error("com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub_3", th) ;
+//            return false ;
+//        }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithParticipantCompletionStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithParticipantCompletionStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/BusinessAgreementWithParticipantCompletionStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -26,189 +26,125 @@
 
 package com.arjuna.wst.stub;
 
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamWriter;
+
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.webservices.logging.WSTLogger;
-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.wsarjtx.ArjunaTXConstants;
-import com.arjuna.webservices.wsba.ExceptionType;
-import com.arjuna.webservices.wsba.NotificationType;
-import com.arjuna.webservices.wsba.StatusType;
-import com.arjuna.webservices.wsba.client.ParticipantCompletionParticipantClient;
-import com.arjuna.webservices.wsba.processors.ParticipantCompletionCoordinatorCallback;
-import com.arjuna.webservices.wsba.processors.ParticipantCompletionCoordinatorProcessor;
-import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.webservices.soap.SoapUtils;
+import com.arjuna.webservices.util.StreamHelper;
+import com.arjuna.webservices.wsba.State;
+import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
 import com.arjuna.wst.FaultedException;
+import com.arjuna.wst.PersistableParticipant;
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine;
 
-public class BusinessAgreementWithParticipantCompletionStub implements com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant
+public class BusinessAgreementWithParticipantCompletionStub implements BusinessAgreementWithParticipantCompletionParticipant, PersistableParticipant
 {
-    private final EndpointReferenceType _businessAgreementWithParticipantCompletionParticipant ;
-    private final String _id ;
+    private static final QName QNAME_BAPC_PARTICIPANT = new QName("bapcParticipant") ;
     
-    public BusinessAgreementWithParticipantCompletionStub (final String id, final EndpointReferenceType businessAgreementWithParticipantCompletionParticipant)
+    private ParticipantCompletionCoordinatorEngine participant ;
+    
+    public BusinessAgreementWithParticipantCompletionStub (final ParticipantCompletionCoordinatorEngine participant)
         throws Exception
     {
-        _businessAgreementWithParticipantCompletionParticipant         = businessAgreementWithParticipantCompletionParticipant;
-        _id = id ;
+        this.participant = participant ;
     }
 
-    public void close ()
+    public synchronized void close ()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithParticipantCompletionParticipant, MessageId.getMessageId()) ;
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Completed -> illegal state
+         * Closing -> no response
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> illegal state
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = participant.close() ;
         
-        final RequestCallback callback = new RequestCallback() ;
-        final ParticipantCompletionCoordinatorProcessor participantCompletionCoordinator = ParticipantCompletionCoordinatorProcessor.getCoordinator() ;
-        participantCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        if (state == State.STATE_CLOSING)
         {
-            ParticipantCompletionParticipantClient.getClient().sendClose(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state != State.STATE_ENDED)
         {
-            participantCompletionCoordinator.removeCallback(_id) ;
+            throw new WrongStateException() ;
         }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedClosed())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
-    public void cancel ()
+    public synchronized void cancel ()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithParticipantCompletionParticipant, MessageId.getMessageId()) ;
+        /*
+         * Active -> illegal state
+         * Canceling -> no response
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> illegal state
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> illegal state
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = participant.cancel() ;
         
-        final RequestCallback callback = new RequestCallback() ;
-        final ParticipantCompletionCoordinatorProcessor participantCompletionCoordinator = ParticipantCompletionCoordinatorProcessor.getCoordinator() ;
-        participantCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        if (state == State.STATE_CANCELING)
         {
-            ParticipantCompletionParticipantClient.getClient().sendCancel(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state != State.STATE_ENDED)
         {
-            participantCompletionCoordinator.removeCallback(_id) ;
+            throw new WrongStateException() ;
         }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedCancelled())
-            {
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
-        }
-        
-        throw new SystemException() ;
     }
 
-    public void compensate ()
+    public synchronized void compensate ()
         throws FaultedException, WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithParticipantCompletionParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final ParticipantCompletionCoordinatorProcessor participantCompletionCoordinator = ParticipantCompletionCoordinatorProcessor.getCoordinator() ;
-        participantCompletionCoordinator.registerCallback(_id, callback) ;
-        try
+        /*
+         * Active -> illegal state
+         * Canceling -> illegal state
+         * Completed -> illegal state
+         * Closing -> illegal state
+         * Compensating -> no answer
+         * Faulting -> illegal state
+         * Faulting-Active -> illegal state
+         * Faulting-Compensating -> fault
+         * Exiting -> illegal state
+         * Ended -> ended
+         */
+        final State state = participant.compensate() ;
+        if (state == State.STATE_COMPENSATING)
         {
-            ParticipantCompletionParticipantClient.getClient().sendCompensate(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
             throw new SystemException() ;
         }
-        finally
+        else if (state == State.STATE_FAULTING_COMPENSATING)
         {
-            participantCompletionCoordinator.removeCallback(_id) ;
+            throw new FaultedException() ;
         }
-        
-        if (callback.hasTriggered())
+        else if (state != State.STATE_ENDED)
         {
-            if (callback.receivedCompensated())
-            {
-                return ;
-            }
-            final ExceptionType fault = callback.getFault() ;
-            if (fault != null)
-            {
-                throw new FaultedException() ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException();
-            }
+            throw new WrongStateException() ;
         }
-        
-        throw new SystemException() ;
     }
 
     public String status ()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithParticipantCompletionParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final ParticipantCompletionCoordinatorProcessor participantCompletionCoordinator = ParticipantCompletionCoordinatorProcessor.getCoordinator() ;
-        participantCompletionCoordinator.registerCallback(_id, callback) ;
-        try
-        {
-            ParticipantCompletionParticipantClient.getClient().sendGetStatus(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
-        finally
-        {
-            participantCompletionCoordinator.removeCallback(_id) ;
-        }
-        
-        final StatusType status = callback.getStatus() ;
-        if (status != null)
-        {
-            return status.getState().toString() ;
-        }
-        
-        throw new SystemException() ;
+        final State state = participant.getStatus() ;
+        return (state == null ? null : state.getValue().getLocalPart()) ;
     }
 
     public void unknown ()
@@ -217,242 +153,63 @@
         error() ;
     }
 
+    public synchronized void error ()
+        throws SystemException
+    {
+        participant.cancel() ;
+    }
+    
     /**
-     * @message com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_1 [com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_1] - Unknown error
+     * @message com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_2 [com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_2] - Error persisting participant state
      */
-    public void error ()
-        throws SystemException
+    public boolean saveState(final OutputObjectState oos)
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_businessAgreementWithParticipantCompletionParticipant, MessageId.getMessageId()) ;
-        final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
-                WSTLogger.log_mesg.getString("com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_1")) ;
         try
         {
-            ParticipantCompletionParticipantClient.getClient().sendSoapFault(addressingContext, soapFault, new InstanceIdentifier(_id)) ;
+            oos.packString(participant.getId()) ;
+            
+            final StringWriter sw = new StringWriter() ;
+            final XMLStreamWriter writer = SoapUtils.getXMLStreamWriter(sw) ;
+            StreamHelper.writeStartElement(writer, QNAME_BAPC_PARTICIPANT) ;
+            participant.getParticipant().writeContent(writer) ;
+            StreamHelper.writeEndElement(writer, null, null) ;
+            writer.close() ;
+            
+            oos.packString(writer.toString()) ;
+            
+            return true ;
         }
         catch (final Throwable th)
         {
-            th.printStackTrace() ;
-            throw new SystemException() ;
+            WSTLogger.arjLoggerI18N.error("com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_2", th) ;
+            return false ;
         }
     }
     
-    private static class RequestCallback extends ParticipantCompletionCoordinatorCallback
+    /**
+     * @message com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_3 [com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_3] - Error restoring participant state
+     */
+    public boolean restoreState(final InputObjectState ios)
     {
-        /**
-         * The addressing context.
-         */
-        private AddressingContext addressingContext ;
-        /**
-         * The arjuna context.
-         */
-        private ArjunaContext arjunaContext ;
-        /**
-         * The SOAP fault.
-         */
-        private SoapFault soapFault ;
-        /**
-         * The fault.
-         */
-        private ExceptionType fault ;
-        /**
-         * The status.
-         */
-        private StatusType status ;
-        /**
-         * The completed notification flag.
-         */
-        private boolean completed ;
-        /**
-         * The cancelled notification flag.
-         */
-        private boolean cancelled ;
-        /**
-         * The closed notification flag.
-         */
-        private boolean closed ;
-        /**
-         * The compensated notification flag.
-         */
-        private boolean compensated ;
-        
-        /**
-         * Get the addressing context.
-         * @return The addressing context.
-         */
-        AddressingContext getAddressingContext()
-        {
-            return addressingContext ;
-        }
-        
-        /**
-         * Get the arjuna context.
-         * @return The arjuna context.
-         */
-        ArjunaContext getArjunaContext()
-        {
-            return arjunaContext ;
-        }
-        
-        /**
-         * Get the SOAP fault.
-         * @return The SOAP fault.
-         */
-        SoapFault getSoapFault()
-        {
-            return soapFault ;
-        }
-        
-        /**
-         * Get the fault.
-         * @return The fault.
-         */
-        ExceptionType getFault()
-        {
-            return fault ;
-        }
-        
-        /**
-         * Get the status.
-         * @return The status.
-         */
-        StatusType getStatus()
-        {
-            return status ;
-        }
-        
-        /**
-         * Did we receive a completed notification?
-         * @return True if completed, false otherwise.
-         */
-        boolean receivedCompleted()
-        {
-            return completed ;
-        }
-        
-        /**
-         * Did we receive a cancelled notification?
-         * @return True if cancelled, false otherwise.
-         */
-        boolean receivedCancelled()
-        {
-            return cancelled ;
-        }
-        
-        /**
-         * Did we receive a closed notification?
-         * @return True if closed, false otherwise.
-         */
-        boolean receivedClosed()
-        {
-            return closed ;
-        }
-        
-        /**
-         * Did we receive a compensated notification?
-         * @return True if compensated, false otherwise.
-         */
-        boolean receivedCompensated()
-        {
-            return compensated ;
-        }
-        
-        /**
-         * A completed response.
-         * @param completed The completed notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void completed(final NotificationType completed, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.completed = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A cancelled response.
-         * @param cancelled The cancelled notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void cancelled(final NotificationType cancelled, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.cancelled  = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A closed response.
-         * @param closed The closed notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void closed(final NotificationType closed, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.closed = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A compensated response.
-         * @param compensated The compensated notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void compensated(final NotificationType compensated, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.compensated = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A fault response.
-         * @param fault The fault notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void fault(final ExceptionType fault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.fault = fault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-
-        /**
-         * A status response.
-         * @param status The status notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void status(final StatusType status, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.status = status ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A SOAP fault response.
-         * @param soapFault The SOAP fault.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.soapFault = soapFault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
+        // KEV - rework
+        return false ;
+//        try
+//        {
+//            final String id = ios.unpackString() ;
+//            final String eprValue = ios.unpackString() ;
+//            
+//            final XMLStreamReader reader = SoapUtils.getXMLStreamReader(new StringReader(eprValue)) ;
+//            StreamHelper.checkNextStartTag(reader, QNAME_BAPC_PARTICIPANT) ;
+//            final EndpointReferenceType endpointReferenceType = new EndpointReferenceType(reader) ;
+//            
+//            _id = id ;
+//            _businessAgreementWithParticipantCompletionParticipant = endpointReferenceType ;
+//            return true ;
+//        }
+//        catch (final Throwable th)
+//        {
+//            WSTLogger.arjLoggerI18N.error("com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub_3", th) ;
+//            return false ;
+//        }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/CompletionStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/CompletionStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/CompletionStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -60,7 +60,7 @@
         final AddressingContext addressingContext = AddressingContext.createRequestContext(_completionCoordinator, MessageId.getMessageId()) ;
         
         final RequestCallback callback = new RequestCallback() ;
-        final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getInitiator() ;
+        final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor() ;
         completionInitiator.registerCallback(_id, callback) ;
         try
         {
@@ -102,7 +102,7 @@
         final AddressingContext addressingContext = AddressingContext.createRequestContext(_completionCoordinator, MessageId.getMessageId()) ;
         
         final RequestCallback callback = new RequestCallback() ;
-        final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getInitiator() ;
+        final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor() ;
         completionInitiator.registerCallback(_id, callback) ;
         try
         {

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -36,6 +36,6 @@
     public Durable2PCStub(final String id, final EndpointReferenceType twoPCParticipant)
         throws Exception
     {
-        super(id, twoPCParticipant) ;
+        super(id, true, twoPCParticipant) ;
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -28,176 +28,133 @@
 
 package com.arjuna.wst.stub;
 
-import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.webservices.logging.WSTLogger;
-import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.soap.SoapUtils;
+import com.arjuna.webservices.util.StreamHelper;
 import com.arjuna.webservices.wsaddr.EndpointReferenceType;
-import com.arjuna.webservices.wsarj.ArjunaContext;
-import com.arjuna.webservices.wsarj.InstanceIdentifier;
-import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
-import com.arjuna.webservices.wsat.NotificationType;
 import com.arjuna.webservices.wsat.Participant;
-import com.arjuna.webservices.wsat.client.ParticipantClient;
-import com.arjuna.webservices.wsat.processors.CoordinatorCallback;
-import com.arjuna.webservices.wsat.processors.CoordinatorProcessor;
-import com.arjuna.wsc.messaging.MessageId;
+import com.arjuna.webservices.wsat.State;
 import com.arjuna.wst.Aborted;
+import com.arjuna.wst.PersistableParticipant;
 import com.arjuna.wst.Prepared;
 import com.arjuna.wst.ReadOnly;
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.Vote;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.CoordinatorEngine;
 
-public class ParticipantStub implements Participant
+public class ParticipantStub implements Participant, PersistableParticipant
 {
-    private final EndpointReferenceType _twoPCParticipant ;
-    private final String _id ;
+    private static final QName QNAME_TWO_PC_PARTICIPANT = new QName("twoPCParticipant") ;
+    private CoordinatorEngine coordinator ;
     
-    public ParticipantStub(final String id, final EndpointReferenceType twoPCParticipant)
+    public ParticipantStub(final String id, final boolean durable, final EndpointReferenceType twoPCParticipant)
         throws Exception
     {
-        _twoPCParticipant = twoPCParticipant;
-        _id = id ;
+        coordinator = new CoordinatorEngine(id, durable, twoPCParticipant) ;
     }
 
     public Vote prepare()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_twoPCParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorProcessor coordinator = CoordinatorProcessor.getCoordinator() ;
-        coordinator.registerCallback(_id, callback) ;
-        try
+        /*
+         * null - aborted or read only
+         * Active - illegal state
+         * Preparing - no answer
+         * Prepared - illegal state
+         * PreparedSuccess - prepared
+         * Committing - illegal state
+         * Aborting - aborting
+         */
+        final State state = coordinator.prepare() ;
+        if (state == State.STATE_PREPARED_SUCCESS)
         {
-            ParticipantClient.getClient().sendPrepare(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
+            return new Prepared() ;
         }
-        catch (final Throwable th)
+        else if (state == State.STATE_ABORTING)
         {
-            th.printStackTrace() ;
-            throw new SystemException() ;
+            return new Aborted() ;
         }
-        finally
+        else if (state == null)
         {
-            coordinator.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedPrepared())
+            if (coordinator.isReadOnly())
             {
-                return new Prepared() ;
-            }
-            else if (callback.receivedReadOnly())
-            {
                 return new ReadOnly() ;
             }
-            else if (callback.receivedAborted())
+            else
             {
                 return new Aborted() ;
             }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
-                throw new WrongStateException() ;
-            }
         }
-        
-        throw new SystemException() ;
+        else if (state == State.STATE_PREPARING)
+        {
+            throw new SystemException() ;
+        }
+        else
+        {
+            throw new WrongStateException() ;
+        }
     }
 
     public void commit()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_twoPCParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorProcessor coordinator = CoordinatorProcessor.getCoordinator() ;
-        coordinator.registerCallback(_id, callback) ;
-        try
+        /*
+         * null - committed
+         * Active - illegal state
+         * Preparing - illegal state
+         * Prepared - illegal state
+         * PreparedSuccess - illegal state
+         * Committing - no response
+         * Aborting - illegal state
+         */
+        final State state = coordinator.commit() ;
+        if (state != null)
         {
-            ParticipantClient.getClient().sendCommit(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
-        finally
-        {
-            coordinator.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedCommitted())
+            if (state == State.STATE_COMMITTING)
             {
-                return ;
+                throw new SystemException() ;
             }
-            else if (callback.receivedReplay())
+            else
             {
-                commit() ;
-                return ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
                 throw new WrongStateException() ;
             }
         }
-        
-        throw new SystemException() ;
     }
 
     public void rollback()
         throws WrongStateException, SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_twoPCParticipant, MessageId.getMessageId()) ;
-        
-        final RequestCallback callback = new RequestCallback() ;
-        final CoordinatorProcessor coordinator = CoordinatorProcessor.getCoordinator() ;
-        coordinator.registerCallback(_id, callback) ;
-        try
+        /*
+         * null - aborted
+         * Active - illegal state
+         * Preparing - illegal state
+         * Prepared - illegal state
+         * PreparedSuccess - illegal state
+         * Committing - illegal state
+         * Aborting - no response
+         */
+        final State state = coordinator.rollback() ;
+        if (state != null)
         {
-            ParticipantClient.getClient().sendRollback(addressingContext, new InstanceIdentifier(_id)) ;
-            callback.waitUntilTriggered() ;
-        }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
-        finally
-        {
-            coordinator.removeCallback(_id) ;
-        }
-        
-        if (callback.hasTriggered())
-        {
-            if (callback.receivedAborted())
+            if (state == State.STATE_ABORTING)
             {
-                return ;
+                throw new SystemException() ;
             }
-            else if (callback.receivedPrepared() || callback.receivedReplay())
+            else
             {
-                rollback() ;
-                return ;
-            }
-            else if (callback.receivedReplay())
-            {
-                commit() ;
-            }
-            final SoapFault soapFault = callback.getSoapFault() ;
-            if ((soapFault != null) && ArjunaTXConstants.WRONGSTATE_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
-            {
                 throw new WrongStateException() ;
             }
         }
-        
-        throw new SystemException() ;
     }
 
     public void unknown()
@@ -206,215 +163,66 @@
         error() ;
     }
 
-    /**
-     * @message com.arjuna.wst.stub.ParticipantStub_1 [com.arjuna.wst.stub.ParticipantStub_1] - Unknown error
-     */
     public void error()
         throws SystemException
     {
-        final AddressingContext addressingContext = AddressingContext.createRequestContext(_twoPCParticipant, MessageId.getMessageId()) ;
-        final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
-                WSTLogger.log_mesg.getString("com.arjuna.wst.stub.ParticipantStub_1")) ;
         try
         {
-            ParticipantClient.getClient().sendSoapFault(addressingContext, soapFault, new InstanceIdentifier(_id)) ;
+            rollback() ;
         }
-        catch (final Throwable th)
-        {
-            th.printStackTrace() ;
-            throw new SystemException() ;
-        }
+        catch (final WrongStateException wse) {} // ignore
     }
-
-    private static final class RequestCallback extends CoordinatorCallback
+    
+    /**
+     * @message com.arjuna.wst.stub.ParticipantStub_1 [com.arjuna.wst.stub.ParticipantStub_1] - Error persisting participant state
+     */
+    public boolean saveState(final OutputObjectState oos)
     {
-        /**
-         * The addressing context.
-         */
-        private AddressingContext addressingContext ;
-        /**
-         * The arjuna context.
-         */
-        private ArjunaContext arjunaContext ;
-        /**
-         * The SOAP fault.
-         */
-        private SoapFault soapFault ;
-        /**
-         * The aborted notification flag.
-         */
-        private boolean aborted ;
-        /**
-         * The committed notification flag.
-         */
-        private boolean committed ;
-        /**
-         * The prepared notification flag.
-         */
-        private boolean prepared ;
-        /**
-         * The read only notification flag.
-         */
-        private boolean readOnly ;
-        /**
-         * The replay notification flag.
-         */
-        private boolean replay ;
-        
-        /**
-         * Get the addressing context.
-         * @return The addressing context.
-         */
-        AddressingContext getAddressingContext()
+        try
         {
-            return addressingContext ;
+            oos.packString(coordinator.getId()) ;
+            oos.packBoolean(coordinator.isDurable()) ;
+            
+            final StringWriter sw = new StringWriter() ;
+            final XMLStreamWriter writer = SoapUtils.getXMLStreamWriter(sw) ;
+            StreamHelper.writeStartElement(writer, QNAME_TWO_PC_PARTICIPANT) ;
+            coordinator.getParticipant().writeContent(writer) ;
+            StreamHelper.writeEndElement(writer, null, null) ;
+            writer.close() ;
+            
+            oos.packString(writer.toString()) ;
+            
+            return true ;
         }
-        
-        /**
-         * Get the arjuna context.
-         * @return The arjuna context.
-         */
-        ArjunaContext getArjunaContext()
+        catch (final Throwable th)
         {
-            return arjunaContext ;
+            WSTLogger.arjLoggerI18N.error("com.arjuna.wst.stub.ParticipantStub_1", th) ;
+            return false ;
         }
-        
-        /**
-         * Get the SOAP fault.
-         * @return The SOAP fault.
-         */
-        SoapFault getSoapFault()
+    }
+    
+    /**
+     * @message com.arjuna.wst.stub.ParticipantStub_2 [com.arjuna.wst.stub.ParticipantStub_2] - Error restoring participant state
+     */
+    public boolean restoreState(final InputObjectState ios)
+    {
+        try
         {
-            return soapFault ;
+            final String id = ios.unpackString() ;
+            final boolean durable = ios.unpackBoolean() ;
+            final String eprValue = ios.unpackString() ;
+            
+            final XMLStreamReader reader = SoapUtils.getXMLStreamReader(new StringReader(eprValue)) ;
+            StreamHelper.checkNextStartTag(reader, QNAME_TWO_PC_PARTICIPANT) ;
+            final EndpointReferenceType endpointReferenceType = new EndpointReferenceType(reader) ;
+            
+            coordinator = new CoordinatorEngine(id, durable, endpointReferenceType, State.STATE_PREPARED_SUCCESS) ;
+            return true ;
         }
-        
-        /**
-         * Did we receive a aborted notification?
-         * @return True if aborted, false otherwise.
-         */
-        boolean receivedAborted()
+        catch (final Throwable th)
         {
-            return aborted ;
+            WSTLogger.arjLoggerI18N.error("com.arjuna.wst.stub.ParticipantStub_2", th) ;
+            return false ;
         }
-        
-        /**
-         * Did we receive a committed notification?
-         * @return True if committed, false otherwise.
-         */
-        boolean receivedCommitted()
-        {
-            return committed ;
-        }
-        
-        /**
-         * Did we receive a prepared notification?
-         * @return True if prepared, false otherwise.
-         */
-        boolean receivedPrepared()
-        {
-            return prepared ;
-        }
-        
-        /**
-         * Did we receive a read only notification?
-         * @return True if read only, false otherwise.
-         */
-        boolean receivedReadOnly()
-        {
-            return readOnly ;
-        }
-        
-        /**
-         * Did we receive a replay notification?
-         * @return True if replay, false otherwise.
-         */
-        boolean receivedReplay()
-        {
-            return replay ;
-        }
-        
-        /**
-         * An aborted response.
-         * @param aborted The aborted notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void aborted(final NotificationType aborted, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.aborted = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A committed response.
-         * @param committed The committed notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void committed(final NotificationType committed, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.committed = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A prepared response.
-         * @param prepared The prepared notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void prepared(final NotificationType prepared, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.prepared = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A read only response.
-         * @param readOnly The read only notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void readOnly(final NotificationType readOnly, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.readOnly = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A replay response.
-         * @param replay The replay notification.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void replay(final NotificationType replay, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.replay = true ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
-        
-        /**
-         * A SOAP fault response.
-         * @param soapFault The SOAP fault.
-         * @param addressingContext The addressing context.
-         * @param arjunaContext The arjuna context.
-         */
-        public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext,
-            final ArjunaContext arjunaContext)
-        {
-            this.soapFault = soapFault ;
-            this.addressingContext = addressingContext ;
-            this.arjunaContext = arjunaContext ;
-        }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Volatile2PCStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Volatile2PCStub.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Volatile2PCStub.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -36,6 +36,6 @@
     public Volatile2PCStub(final String id, final EndpointReferenceType twoPCParticipant)
         throws Exception
     {
-        super(id, twoPCParticipant) ;
+        super(id, false, twoPCParticipant) ;
     }
 }

Modified: labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/common/Environment.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/common/Environment.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/common/Environment.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -45,4 +45,7 @@
 
     public static final String DEPLOYMENT_CONTEXT = "com.arjuna.mw.wsas.deploymentContext";
     
+    public static final String REPLAY_TIMEOUT = "com.arjuna.mw.wsas.replayTimeout" ;
+    
+    public static final String REPLAY_COUNT = "com.arjuna.mw.wsas.replayCount" ;
 }

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/sagas/participants/Participant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/sagas/participants/Participant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/sagas/participants/Participant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -31,6 +31,8 @@
 
 package com.arjuna.mw.wscf.model.sagas.participants;
 
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.mw.wscf.model.sagas.exceptions.*;
 
 import com.arjuna.mw.wscf.exceptions.*;
@@ -97,5 +99,8 @@
 
     public String id () throws SystemException;
     
+    public boolean save_state (OutputObjectState os);
+    public boolean restore_state (InputObjectState os);
+    
 }
 

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/twophase/participants/Participant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/twophase/participants/Participant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mw/wscf/model/twophase/participants/Participant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -31,6 +31,8 @@
 
 package com.arjuna.mw.wscf.model.twophase.participants;
 
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.mw.wscf.model.twophase.vote.Vote;
 import com.arjuna.mw.wscf.model.twophase.exceptions.*;
 
@@ -147,6 +149,11 @@
     public void forget () throws InvalidParticipantException, WrongStateException, SystemException;
 
     public String id () throws SystemException;
+    
+    // recovery information
+    
+    public boolean save_state (OutputObjectState os);
+    public boolean restore_state (InputObjectState os);
 
 }
 

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wsc/model/twophase/participants/TwoPhaseParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wsc/model/twophase/participants/TwoPhaseParticipant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wsc/model/twophase/participants/TwoPhaseParticipant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -31,6 +31,8 @@
 
 package com.arjuna.mwlabs.wsc.model.twophase.participants;
 
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.mw.wscf.logging.wscfLogger;
 
 import com.arjuna.mw.wsas.exceptions.SystemException;
@@ -68,8 +70,11 @@
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, SystemException
 	{
-		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
-		{ "TwoPhaseParticipant.prepare" });
+        if (wscfLogger.arjLoggerI18N.isInfoEnabled())
+        {
+    		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
+    		{ "TwoPhaseParticipant.prepare" });
+        }
 
 		return new VoteConfirm();
 	}
@@ -78,31 +83,43 @@
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, HeuristicCancelException, SystemException
 	{
-		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
-		{ "TwoPhaseParticipant.confirm" });
+        if (wscfLogger.arjLoggerI18N.isInfoEnabled())
+        {
+    		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
+    		{ "TwoPhaseParticipant.confirm" });
+        }
 	}
 
 	public void cancel () throws InvalidParticipantException,
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, HeuristicConfirmException, SystemException
 	{
-		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
-		{ "TwoPhaseParticipant.cancel" });
+        if (wscfLogger.arjLoggerI18N.isInfoEnabled())
+        {
+    		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
+    		{ "TwoPhaseParticipant.cancel" });
+        }
 	}
 
 	public void confirmOnePhase () throws InvalidParticipantException,
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, HeuristicCancelException, SystemException
 	{
-		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
-		{ "TwoPhaseParticipant.confirmOnePhase" });
+        if (wscfLogger.arjLoggerI18N.isInfoEnabled())
+        {
+    		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
+    		{ "TwoPhaseParticipant.confirmOnePhase" });
+        }
 	}
 
 	public void forget () throws InvalidParticipantException,
 			WrongStateException, SystemException
 	{
-		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
-		{ "TwoPhaseParticipant.forget" });
+        if (wscfLogger.arjLoggerI18N.isInfoEnabled())
+        {
+    		wscfLogger.arjLoggerI18N.info("com.arjuna.mwlabs.wsc.model.twophase.participants.TwoPhaseParticipant_1", new Object[]
+    		{ "TwoPhaseParticipant.forget" });
+        }
 	}
 
 	public String id () throws SystemException
@@ -110,6 +127,16 @@
 		return _id;
 	}
 
+    public boolean save_state(OutputObjectState os)
+    {
+        return false ;
+    }
+    
+    public boolean restore_state(InputObjectState os)
+    {
+        return false ;
+    }
+    
 	private EndpointReferenceType _address;
 
 	private String _id;

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ACCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ACCoordinator.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ACCoordinator.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -52,270 +52,305 @@
 import com.arjuna.mw.wscf.exceptions.*;
 
 /**
- * This class represents a specific coordination instance. It is essentially
- * an ArjunaCore TwoPhaseCoordinator, which gives us access to two-phase with
+ * This class represents a specific coordination instance. It is essentially an
+ * ArjunaCore TwoPhaseCoordinator, which gives us access to two-phase with
  * synchronization support but without thread management.
- *
+ * 
  * @author Mark Little (mark.little at arjuna.com)
  * @version $Id: ACCoordinator.java,v 1.5 2005/05/19 12:13:37 nmcl Exp $
  * @since 1.0.
- *
- * @message com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_1 [com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_1] - Complete call failed!
- * @message com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2 [com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2] - Null is an invalid parameter.
- * @message com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_3 [com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_3] - Wrong state for operation!
+ * 
+ * @message com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_1
+ *          [com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_1] -
+ *          Complete call failed!
+ * @message com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2
+ *          [com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2] -
+ *          Null is an invalid parameter.
+ * @message com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_3
+ *          [com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_3] -
+ *          Wrong state for operation!
  */
 
 public class ACCoordinator extends TwoPhaseCoordinator
 {
 
-    private final static int DELISTED = 0;
-    private final static int COMPLETED = 1;
-    
-    public ACCoordinator ()
-    {
-	super();
+	private final static int DELISTED = 0;
 
-	_theId = new CoordinatorIdImple(get_uid());
-    }
+	private final static int COMPLETED = 1;
 
-    public ACCoordinator (Uid recovery)
-    {
-	super(recovery);
+	public ACCoordinator ()
+	{
+		super();
 
-	_theId = new CoordinatorIdImple(get_uid());
-    }
-    
-    /**
-     * If the application requires and if the coordination protocol supports
-     * it, then this method can be used to execute a coordination protocol on
-     * the currently enlisted participants at any time prior to the termination
-     * of the coordination scope.
-     *
-     * This implementation only supports coordination at the end of the
-     * activity.
-     *
-     * @param CompletionStatus cs The completion status to use when determining
-     * how to execute the protocol.
-     *
-     * @exception WrongStateException Thrown if the coordinator is in a state
-     * the does not allow coordination to occur.
-     * @exception ProtocolViolationException Thrown if the protocol is violated
-     * in some manner during execution.
-     * @exception SystemException Thrown if any other error occurs.
-     *
-     * @return The result of executing the protocol, or null.
-     */
+		_theId = new CoordinatorIdImple(get_uid());
+	}
 
-    public Outcome coordinate (CompletionStatus cs) throws WrongStateException, ProtocolViolationException, SystemException
-    {
-	return null;
-    }
+	public ACCoordinator (Uid recovery)
+	{
+		super(recovery);
 
-    /**
-     */
+		_theId = new CoordinatorIdImple(get_uid());
+	}
 
-    public synchronized void complete () throws WrongStateException, SystemException
-    {
-	if (status() == ActionStatus.RUNNING)
+	/**
+	 * If the application requires and if the coordination protocol supports it,
+	 * then this method can be used to execute a coordination protocol on the
+	 * currently enlisted participants at any time prior to the termination of
+	 * the coordination scope.
+	 * 
+	 * This implementation only supports coordination at the end of the
+	 * activity.
+	 * 
+	 * @param CompletionStatus
+	 *            cs The completion status to use when determining how to
+	 *            execute the protocol.
+	 * 
+	 * @exception WrongStateException
+	 *                Thrown if the coordinator is in a state the does not allow
+	 *                coordination to occur.
+	 * @exception ProtocolViolationException
+	 *                Thrown if the protocol is violated in some manner during
+	 *                execution.
+	 * @exception SystemException
+	 *                Thrown if any other error occurs.
+	 * 
+	 * @return The result of executing the protocol, or null.
+	 */
+
+	public Outcome coordinate (CompletionStatus cs) throws WrongStateException,
+			ProtocolViolationException, SystemException
 	{
-	    /*
-	     * Transaction is active, so we can look at the
-	     * pendingList only.
-	     */
+		return null;
+	}
 
-	    if (pendingList != null)
-	    {
-		RecordListIterator iter = new RecordListIterator(pendingList);
-		AbstractRecord absRec = iter.iterate();
-	    
-		try
+	/**
+	 */
+
+	public synchronized void complete () throws WrongStateException,
+			SystemException
+	{
+		if (status() == ActionStatus.RUNNING)
 		{
-		    while (absRec != null)
-		    {
-			if (absRec instanceof ParticipantRecord)
+			/*
+			 * Transaction is active, so we can look at the pendingList only.
+			 */
+
+			if (pendingList != null)
 			{
-			    ParticipantRecord pr = (ParticipantRecord) absRec;
+				RecordListIterator iter = new RecordListIterator(pendingList);
+				AbstractRecord absRec = iter.iterate();
 
-			    if (!pr.complete())
-			    {
-				preventCommit();
+				try
+				{
+					while (absRec != null)
+					{
+						if (absRec instanceof ParticipantRecord)
+						{
+							ParticipantRecord pr = (ParticipantRecord) absRec;
 
-				throw new SystemException(wscfLogger.log_mesg.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_1"));
-			    }
+							if (!pr.complete())
+							{
+								preventCommit();
+
+								throw new SystemException(
+										wscfLogger.log_mesg
+												.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_1"));
+							}
+						}
+
+						absRec = iter.iterate();
+					}
+				}
+				catch (SystemException ex)
+				{
+					throw ex;
+				}
+				catch (Exception ex)
+				{
+					preventCommit();
+
+					throw new SystemException(ex.toString());
+				}
 			}
-		    
-			absRec = iter.iterate();
-		    }
 		}
-		catch (SystemException ex)
+		else
+			throw new WrongStateException();
+	}
+
+	/**
+	 * Enrol the specified participant with the coordinator associated with the
+	 * current thread.
+	 * 
+	 * @param Participant
+	 *            act The participant.
+	 * 
+	 * @exception WrongStateException
+	 *                Thrown if the coordinator is not in a state that allows
+	 *                participants to be enrolled.
+	 * @exception DuplicateParticipantException
+	 *                Thrown if the participant has already been enrolled and
+	 *                the coordination protocol does not support multiple
+	 *                entries.
+	 * @exception InvalidParticipantException
+	 *                Thrown if the participant is invalid.
+	 * @exception SystemException
+	 *                Thrown if any other error occurs.
+	 */
+
+	public void enlistParticipant (Participant act) throws WrongStateException,
+			DuplicateParticipantException, InvalidParticipantException,
+			SystemException
+	{
+		if (act == null) throw new InvalidParticipantException();
+
+		AbstractRecord rec = new ParticipantRecord(act, new Uid());
+
+		if (add(rec) != AddOutcome.AR_ADDED) throw new WrongStateException();
+		else
 		{
-		    throw ex;
+			/*
+			 * Presume nothing protocol, so we need to write the intentions list
+			 * every time a participant is added.
+			 */
 		}
-		catch (Exception ex)
-		{
-		    preventCommit();
-		
-		    throw new SystemException(ex.toString());
-		}
-	    }
 	}
-	else
-	    throw new WrongStateException();
-    }
-    
-    /**
-     * Enrol the specified participant with the coordinator associated with
-     * the current thread.
-     *
-     * @param Participant act The participant.
-     *
-     * @exception WrongStateException Thrown if the coordinator is not in a
-     * state that allows participants to be enrolled.
-     * @exception DuplicateParticipantException Thrown if the participant has
-     * already been enrolled and the coordination protocol does not support
-     * multiple entries.
-     * @exception InvalidParticipantException Thrown if the participant is invalid.
-     * @exception SystemException Thrown if any other error occurs.
-     */
 
-    public void enlistParticipant (Participant act) throws WrongStateException, DuplicateParticipantException, InvalidParticipantException, SystemException
-    {
-	if (act == null)
-	    throw new InvalidParticipantException();
+	/**
+	 * Remove the specified participant from the coordinator's list.
+	 * 
+	 * @exception InvalidParticipantException
+	 *                Thrown if the participant is not known of by the
+	 *                coordinator.
+	 * @exception WrongStateException
+	 *                Thrown if the state of the coordinator does not allow the
+	 *                participant to be removed (e.g., in a two-phase protocol
+	 *                the coordinator is committing.)
+	 * @exception SystemException
+	 *                Thrown if any other error occurs.
+	 */
 
-	AbstractRecord rec = new ParticipantRecord(act, new Uid());
+	public synchronized void delistParticipant (String participantId)
+			throws InvalidParticipantException, WrongStateException,
+			SystemException
+	{
+		if (participantId == null)
+			throw new SystemException(
+					wscfLogger.log_mesg
+							.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2"));
 
-	if (add(rec) != AddOutcome.AR_ADDED)
-	    throw new WrongStateException();
-	else
+		if (status() == ActionStatus.RUNNING) changeParticipantStatus(
+				participantId, DELISTED);
+		else
+			throw new WrongStateException();
+	}
+
+	public synchronized void participantCompleted (String participantId)
+			throws InvalidParticipantException, WrongStateException,
+			SystemException
 	{
-	    /*
-	     * Presume nothing protocol, so we need to write the intentions
-	     * list every time a participant is added.
-	     */
+		if (participantId == null)
+			throw new SystemException(
+					wscfLogger.log_mesg
+							.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2"));
+
+		if (status() == ActionStatus.RUNNING) changeParticipantStatus(
+				participantId, COMPLETED);
+		else
+			throw new WrongStateException();
 	}
-    }
 
-    /**
-     * Remove the specified participant from the coordinator's list.
-     *
-     * @exception InvalidParticipantException Thrown if the participant is not known
-     * of by the coordinator.
-     * @exception WrongStateException Thrown if the state of the coordinator
-     * does not allow the participant to be removed (e.g., in a two-phase
-     * protocol the coordinator is committing.)
-     * @exception SystemException Thrown if any other error occurs.
-     */
-    
-    public synchronized void delistParticipant (String participantId) throws InvalidParticipantException, WrongStateException, SystemException
-    {
-	if (participantId == null)
-	    throw new SystemException(wscfLogger.log_mesg.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2"));
-	
-	if (status() == ActionStatus.RUNNING)
-	    changeParticipantStatus(participantId, DELISTED);
-	else
-	    throw new WrongStateException();
-    }
+	public synchronized void participantFaulted (String participantId)
+			throws InvalidParticipantException, SystemException
+	{
+		if (participantId == null)
+			throw new SystemException(
+					wscfLogger.log_mesg
+							.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2"));
 
-    public synchronized void participantCompleted (String participantId) throws InvalidParticipantException, WrongStateException, SystemException
-    {
-	if (participantId == null)
-	    throw new SystemException(wscfLogger.log_mesg.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2"));
+		if (status() == ActionStatus.RUNNING)
+		{
+			// participant faulted means it has compensated and gone away
 
-	if (status() == ActionStatus.RUNNING)
-	    changeParticipantStatus(participantId, COMPLETED);
-	else
-	    throw new WrongStateException();
-    }
+			changeParticipantStatus(participantId, DELISTED);
+		}
+		else
+			throw new SystemException(
+					wscfLogger.log_mesg
+							.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_3"));
+	}
 
-    public synchronized void participantFaulted (String participantId) throws InvalidParticipantException, SystemException
-    {
-	if (participantId == null)
-	    throw new SystemException(wscfLogger.log_mesg.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_2"));
+	/**
+	 * @exception SystemException
+	 *                Thrown if any error occurs.
+	 * 
+	 * @return the complete list of qualifiers that have been registered with
+	 *         the current coordinator.
+	 */
 
-	if (status() == ActionStatus.RUNNING)
+	public Qualifier[] qualifiers () throws SystemException
 	{
-	    // participant faulted means it has compensated and gone away
+		return null;
+	}
 
-	    changeParticipantStatus(participantId, DELISTED);
+	/**
+	 * @exception SystemException
+	 *                Thrown if any error occurs.
+	 * 
+	 * @return The unique identity of the current coordinator.
+	 */
+
+	public CoordinatorId identifier () throws SystemException
+	{
+		return _theId;
 	}
-	else
-	    throw new SystemException(wscfLogger.log_mesg.getString("com.arjuna.mwlabs.wscf.model.sagas.arjunacore.ACCoordinator_3"));
-    }
-    
-    /**
-     * @exception SystemException Thrown if any error occurs.
-     *
-     * @return the complete list of qualifiers that have been registered with
-     * the current coordinator.
-     */
 
-    public Qualifier[] qualifiers () throws SystemException
-    {
-	return null;
-    }
+	private final void changeParticipantStatus (String participantId, int status)
+			throws InvalidParticipantException, SystemException
+	{
+		/*
+		 * Transaction is active, so we can look at the pendingList only.
+		 */
 
-    /**
-     * @exception SystemException Thrown if any error occurs.
-     *
-     * @return The unique identity of the current coordinator.
-     */
+		// TODO allow transaction status to be changed during commit - exit
+		// could come in late
+		boolean found = false;
 
-    public CoordinatorId identifier () throws SystemException
-    {
-	return _theId;
-    }
+		if (pendingList != null)
+		{
+			RecordListIterator iter = new RecordListIterator(pendingList);
+			AbstractRecord absRec = iter.iterate();
 
-    private final void changeParticipantStatus (String participantId, int status) throws InvalidParticipantException, SystemException
-    {
-	/*
-	 * Transaction is active, so we can look at the
-	 * pendingList only.
-	 */
+			try
+			{
+				while ((absRec != null) && !found)
+				{
+					if (absRec instanceof ParticipantRecord)
+					{
+						ParticipantRecord pr = (ParticipantRecord) absRec;
+						Participant participant = (Participant) pr.value();
 
-	// TODO allow transaction status to be changed during commit - exit could come in late
+						if (participantId.equals(participant.id()))
+						{
+							found = true;
 
-	boolean found = false;
+							if (status == DELISTED) pr.delist();
+							else
+								pr.completed();
+						}
+					}
 
-	if (pendingList != null)
-	{
-	    RecordListIterator iter = new RecordListIterator(pendingList);
-	    AbstractRecord absRec = iter.iterate();
-	    
-	    try
-	    {
-		while ((absRec != null) && !found)
-		{
-		    if (absRec instanceof ParticipantRecord)
-		    {
-			ParticipantRecord pr = (ParticipantRecord) absRec;
-			Participant participant = (Participant) pr.value();
-	
-			if (participantId.equals(participant.id()))
+					absRec = iter.iterate();
+				}
+			}
+			catch (Exception ex)
 			{
-			    found = true;
-			    
-			    if (status == DELISTED)
-				pr.delist();
-			    else
-				pr.completed();
+				throw new SystemException(ex.toString());
 			}
-		    }
-		    
-		    absRec = iter.iterate();
 		}
-	    }
-	    catch (Exception ex)
-	    {
-		throw new SystemException(ex.toString());
-	    }
+
+		if (!found) throw new InvalidParticipantException();
 	}
-	
-	if (!found)
-	    throw new InvalidParticipantException();
-    }
 
-    private CoordinatorIdImple _theId;
-    
+	private CoordinatorIdImple _theId;
+
 }

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ParticipantRecord.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ParticipantRecord.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/sagas/arjunacore/ParticipantRecord.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -50,634 +50,697 @@
 
 /**
  * Arjuna abstract record to handle two-phase participants.
- *
+ * 
  * @author Mark Little (mark.little at arjuna.com)
  * @version $Id: ParticipantRecord.java,v 1.6 2005/05/19 12:13:37 nmcl Exp $
  */
 
-public class ParticipantRecord extends com.arjuna.ats.arjuna.coordinator.AbstractRecord
+public class ParticipantRecord extends
+		com.arjuna.ats.arjuna.coordinator.AbstractRecord
 {
 
-    /**
-     * Constructor.
-     *
-     * @param theResource is the proxy that allows us to call out to the
-     * object.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_1 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_1] - ParticipantRecord {0} - null participant provided!
-     */
+	/**
+	 * Constructor.
+	 * 
+	 * @param theResource
+	 *            is the proxy that allows us to call out to the object.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_1
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_1] -
+	 *          ParticipantRecord {0} - null participant provided!
+	 */
 
-    public ParticipantRecord (Participant theResource, Uid id)
-    {
-        super(id, null, ObjectType.ANDPERSISTENT);
+	public ParticipantRecord (Participant theResource, Uid id)
+	{
+		super(id, null, ObjectType.ANDPERSISTENT);
 
-	_resourceHandle = theResource;
-	_timeout = 0;
-	_coordId = new CoordinatorIdImple(id);
+		_resourceHandle = theResource;
+		_timeout = 0;
+		_coordId = new CoordinatorIdImple(id);
 
-	if (theResource == null)
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_1",
-					  new Object[]{order()});
-    }
+		if (theResource == null)
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_1",
+							new Object[] { order() });
+	}
 
-    public void finalize () throws Throwable
-    {
-        _resourceHandle = null;
+	public void finalize () throws Throwable
+	{
+		_resourceHandle = null;
 
-        super.finalize();
-    }
+		super.finalize();
+	}
 
-    /**
-     * Override AbstractRecord.propagateOnCommit
-     */
+	/**
+	 * Override AbstractRecord.propagateOnCommit
+	 */
 
-    public boolean propagateOnCommit ()
-    {
-        return true;
-    }
+	public boolean propagateOnCommit ()
+	{
+		return true;
+	}
 
-    /**
-     * The type of this abstract record.
-     */
+	/**
+	 * The type of this abstract record.
+	 */
 
-    public int typeIs ()
-    {
-	return RecordType.USER_DEF_FIRST0;
-    }
+	public int typeIs ()
+	{
+		// TODO add to record list
+		
+		return RecordType.USER_DEF_FIRST1;
+	}
 
-    /**
-     * The class name for this record.
-     */
+	/**
+	 * The class name for this record.
+	 */
 
-    public ClassName className ()
-    {
-	return new ClassName(toString());
-    }
+	public ClassName className ()
+	{
+		return new ClassName("WSBAParticipantRecord");
+	}
 
-    /**
-     * The internal value.
-     */
+	/**
+	 * The internal value.
+	 */
 
-    public Object value ()
-    {
-        return _resourceHandle;
-    }
+	public Object value ()
+	{
+		return _resourceHandle;
+	}
 
-    /**
-     * Set the internal value. Not allowed for this class.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_2 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_2] - ParticipantRecord.setValue() called illegally.
-     */
+	/**
+	 * Set the internal value. Not allowed for this class.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_2
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_2] -
+	 *          ParticipantRecord.setValue() called illegally.
+	 */
 
-    public void setValue (Object o)
-    {
-	wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_2");
-    }
+	public void setValue (Object o)
+	{
+		wscfLogger.arjLoggerI18N
+				.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_2");
+	}
 
-    /**
-     * The record is being driven through nested rollback.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_3 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_3] - ParticipantRecord.nestedAbort {0} caught: {1}
-     */
+	/**
+	 * The record is being driven through nested rollback.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_3
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_3] -
+	 *          ParticipantRecord.nestedAbort {0} caught: {1}
+	 */
 
-    // TODO
+	// TODO
+	public int nestedAbort ()
+	{
+		try
+		{
+			if (_resourceHandle != null)
+			{
+				return TwoPhaseOutcome.FINISH_ERROR;
+			}
+			else
+				return TwoPhaseOutcome.FINISH_ERROR;
+		}
+		catch (Exception ex6)
+		{
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_3",
+							new Object[] { order(), ex6 });
 
-    public int nestedAbort ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
-		return TwoPhaseOutcome.FINISH_ERROR;
-            }
-            else
-                return TwoPhaseOutcome.FINISH_ERROR;
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_3",
-					  new Object[]{order(), ex6});
+			ex6.printStackTrace();
 
-	    ex6.printStackTrace();
+			return TwoPhaseOutcome.FINISH_ERROR;
+		}
+	}
 
-            return TwoPhaseOutcome.FINISH_ERROR;
-        }
-    }
+	/**
+	 * The record is being driven through nested commit.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_4
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_4] -
+	 *          ParticipantRecord.nestedCommit {0} caught: {1}
+	 */
 
-    /**
-     * The record is being driven through nested commit.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_4 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_4] - ParticipantRecord.nestedCommit {0} caught: {1}
-     */
+	public int nestedCommit ()
+	{
+		try
+		{
+			if (_resourceHandle != null)
+			{
+				return TwoPhaseOutcome.FINISH_ERROR;
+			}
+			else
+				return TwoPhaseOutcome.FINISH_ERROR;
+		}
+		catch (Exception ex6)
+		{
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_4",
+							new Object[] { order(), ex6 });
 
-    public int nestedCommit ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
-		return TwoPhaseOutcome.FINISH_ERROR;
-            }
-            else
-                return TwoPhaseOutcome.FINISH_ERROR;
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_4",
-					  new Object[]{order(), ex6});
+			ex6.printStackTrace();
 
-	    ex6.printStackTrace();
+			return TwoPhaseOutcome.FINISH_ERROR;
+		}
+	}
 
-            return TwoPhaseOutcome.FINISH_ERROR;
-        }
-    }
+	/**
+	 * The record is being driven through nested prepare.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_5
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_5] -
+	 *          ParticipantRecord.nestedPrepare {0} caught: {1}
+	 */
 
-    /**
-     * The record is being driven through nested prepare.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_5 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_5] - ParticipantRecord.nestedPrepare {0} caught: {1}
-     */
+	public int nestedPrepare ()
+	{
+		try
+		{
+			if (_resourceHandle != null)
+			{
+				return TwoPhaseOutcome.FINISH_ERROR;
+			}
+			else
+				return TwoPhaseOutcome.PREPARE_NOTOK;
+		}
+		catch (Exception e6)
+		{
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_5",
+							new Object[] { order(), e6 });
 
-    public int nestedPrepare ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
-		return TwoPhaseOutcome.FINISH_ERROR;
-            }
-            else
-                return TwoPhaseOutcome.PREPARE_NOTOK;
-        }
-        catch (Exception e6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_5",
-					  new Object[]{order(), e6});
+			e6.printStackTrace();
 
-	    e6.printStackTrace();
+			return TwoPhaseOutcome.HEURISTIC_HAZARD;
+		}
+	}
 
-            return TwoPhaseOutcome.HEURISTIC_HAZARD;
-        }
-    }
+	/**
+	 * The record is being driven through top-level rollback.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_6
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_6] -
+	 *          ParticipantRecord.topLevelAbort {0} caught: {1}
+	 */
 
-    /**
-     * The record is being driven through top-level rollback.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_6 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_6] - ParticipantRecord.topLevelAbort {0} caught: {1}
-     */
-
-    public int topLevelAbort ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
+	public int topLevelAbort ()
+	{
 		try
 		{
-		    if (!_exited)
-		    {
-			if (_completed)
-			    _resourceHandle.compensate();
+			if (_resourceHandle != null)
+			{
+				try
+				{
+					if (!_exited)
+					{
+						if (_completed) _resourceHandle.compensate();
+						else
+							_resourceHandle.cancel();
+					}
+				}
+				catch (InvalidParticipantException ex)
+				{
+					return TwoPhaseOutcome.FINISH_ERROR;
+				}
+				catch (WrongStateException ex)
+				{
+					return TwoPhaseOutcome.FINISH_ERROR;
+				}
+				catch (SystemException ex)
+				{
+					return TwoPhaseOutcome.HEURISTIC_HAZARD;
+				}
+
+				return TwoPhaseOutcome.FINISH_OK;
+			}
 			else
-			    _resourceHandle.cancel();
-		    }
+				return TwoPhaseOutcome.FINISH_ERROR;
 		}
-		catch (InvalidParticipantException ex)
+		catch (Exception ex6)
 		{
-		    return TwoPhaseOutcome.FINISH_ERROR;
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_6",
+							new Object[] { order(), ex6 });
+
+			ex6.printStackTrace();
+
+			return TwoPhaseOutcome.FINISH_ERROR;
 		}
-		catch (WrongStateException ex)
+	}
+
+	/**
+	 * The record is being driven through top-level commit.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_7
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_7] -
+	 *          ParticipantRecord.topLevelCommit {0} caught: {1}
+	 */
+
+	public int topLevelCommit ()
+	{
+		try
 		{
-		    return TwoPhaseOutcome.FINISH_ERROR;
+			if (_resourceHandle != null)
+			{
+				try
+				{
+					if (!_exited) _resourceHandle.close();
+				}
+				catch (InvalidParticipantException ex)
+				{
+					return TwoPhaseOutcome.FINISH_ERROR;
+				}
+				catch (WrongStateException ex)
+				{
+					return TwoPhaseOutcome.NOT_PREPARED;
+				}
+				catch (SystemException ex)
+				{
+					return TwoPhaseOutcome.HEURISTIC_HAZARD;
+				}
+
+				return TwoPhaseOutcome.FINISH_OK;
+			}
+			else
+				return TwoPhaseOutcome.FINISH_ERROR;
 		}
-		catch (SystemException ex)
+		catch (Exception ex6)
 		{
-		    return TwoPhaseOutcome.HEURISTIC_HAZARD;
-		}
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_7",
+							new Object[] { order(), ex6 });
 
-		return TwoPhaseOutcome.FINISH_OK;
-            }
-            else
-                return TwoPhaseOutcome.FINISH_ERROR;
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_6",
-					  new Object[]{order(), ex6});
+			ex6.printStackTrace();
 
-	    ex6.printStackTrace();
+			return TwoPhaseOutcome.FINISH_ERROR;
+		}
+	}
 
-            return TwoPhaseOutcome.FINISH_ERROR;
-        }
-    }
+	/**
+	 * The record is being driven through top-level prepare.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_8
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_8] -
+	 *          ParticipantRecord.topLevelPrepare {0} caught: {1}
+	 */
 
-    /**
-     * The record is being driven through top-level commit.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_7 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_7] - ParticipantRecord.topLevelCommit {0} caught: {1}
-     */
-
-    public int topLevelCommit ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
+	public int topLevelPrepare ()
+	{
 		try
 		{
-		    if (!_exited)
-			_resourceHandle.close();
+			if (_resourceHandle != null)
+			{
+				return TwoPhaseOutcome.PREPARE_OK;
+			}
+			else
+				return TwoPhaseOutcome.PREPARE_NOTOK;
 		}
-		catch (InvalidParticipantException ex)
+		catch (Exception e6)
 		{
-		    return TwoPhaseOutcome.FINISH_ERROR;
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_8",
+							new Object[] { order(), e6 });
+
+			e6.printStackTrace();
+
+			return TwoPhaseOutcome.PREPARE_OK;
 		}
-		catch (WrongStateException ex)
+	}
+
+	/**
+	 * The record is being driven through nested commit and is the only
+	 * resource.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_9
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_9] -
+	 *          ParticipantRecord.nestedOnePhaseCommit {0} caught: {1}
+	 */
+
+	public int nestedOnePhaseCommit ()
+	{
+		try
 		{
-		    return TwoPhaseOutcome.NOT_PREPARED;
+			if (_resourceHandle != null)
+			{
+				return TwoPhaseOutcome.FINISH_ERROR;
+			}
+			else
+				return TwoPhaseOutcome.FINISH_ERROR;
 		}
-		catch (SystemException ex)
+		catch (Exception ex6)
 		{
-		    return TwoPhaseOutcome.HEURISTIC_HAZARD;
-		}
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_9",
+							new Object[] { order(), ex6 });
 
-		return TwoPhaseOutcome.FINISH_OK;
-            }
-            else
-                return TwoPhaseOutcome.FINISH_ERROR;
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_7",
-					  new Object[]{order(), ex6});
+			ex6.printStackTrace();
 
-	    ex6.printStackTrace();
+			return TwoPhaseOutcome.FINISH_ERROR;
+		}
+	}
 
-            return TwoPhaseOutcome.FINISH_ERROR;
-        }
-    }
+	/**
+	 * The record is being driven through top-level commit and is the only
+	 * resource.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_10
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_10] -
+	 *          ParticipantRecord.topLevelOnePhaseCommit {0} caught: {1}
+	 */
 
-    /**
-     * The record is being driven through top-level prepare.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_8 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_8] - ParticipantRecord.topLevelPrepare {0} caught: {1}
-     */
+	public int topLevelOnePhaseCommit ()
+	{
+		try
+		{
+			if (_resourceHandle != null)
+			{
+				try
+				{
+					if (!_exited) _resourceHandle.close();
+				}
+				catch (InvalidParticipantException ex)
+				{
+					return TwoPhaseOutcome.FINISH_ERROR;
+				}
+				catch (WrongStateException ex)
+				{
+					return TwoPhaseOutcome.FINISH_ERROR;
+				}
+				catch (SystemException ex)
+				{
+					return TwoPhaseOutcome.HEURISTIC_HAZARD;
+				}
 
-    public int topLevelPrepare ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
-		return TwoPhaseOutcome.PREPARE_OK;
-            }
-            else
-                return TwoPhaseOutcome.PREPARE_NOTOK;
-        }
-        catch (Exception e6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_8",
-					  new Object[]{order(), e6});
+				return TwoPhaseOutcome.FINISH_OK;
+			}
+			else
+				return TwoPhaseOutcome.FINISH_ERROR;
+		}
+		catch (Exception ex6)
+		{
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_10",
+							new Object[] { order(), ex6 });
 
-	    e6.printStackTrace();
+			ex6.printStackTrace();
 
-            return TwoPhaseOutcome.PREPARE_OK;
-        }
-    }
+			return TwoPhaseOutcome.FINISH_ERROR;
+		}
+	}
 
-    /**
-     * The record is being driven through nested commit and is the only
-     * resource.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_9 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_9] - ParticipantRecord.nestedOnePhaseCommit {0} caught: {1}
-     */
+	/**
+	 * The record generated a heuristic and can now forget about it.
+	 * 
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_11
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_11] -
+	 *          ParticipantRecord.forgetHeuristic for {0} called without a
+	 *          resource!
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_12
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_12] -
+	 *          ParticipantRecord.forgetHeuristic {0} caught exception: {1}
+	 */
 
-    public int nestedOnePhaseCommit ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
-		return TwoPhaseOutcome.FINISH_ERROR;
-            }
-            else
-                return TwoPhaseOutcome.FINISH_ERROR;
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_9",
-					  new Object[]{order(), ex6});
-
-	    ex6.printStackTrace();
-
-            return TwoPhaseOutcome.FINISH_ERROR;
-        }
-    }
-
-    /**
-     * The record is being driven through top-level commit and is the only
-     * resource.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_10 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_10] - ParticipantRecord.topLevelOnePhaseCommit {0} caught: {1}
-     */
-
-    public int topLevelOnePhaseCommit ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
+	public boolean forgetHeuristic ()
+	{
 		try
 		{
-		    if (!_exited)
-			_resourceHandle.close();
+			if (_resourceHandle != null)
+			{
+				try
+				{
+					if (!_exited) _resourceHandle.forget();
+				}
+				catch (InvalidParticipantException ex)
+				{
+					return false;
+				}
+				catch (WrongStateException ex)
+				{
+					return false;
+				}
+				catch (SystemException ex)
+				{
+					return false;
+				}
+
+				return true;
+			}
+			else
+			{
+				wscfLogger.arjLoggerI18N
+						.warn(
+								"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_11",
+								new Object[] { order() });
+			}
 		}
-		catch (InvalidParticipantException ex)
+		catch (Exception e)
 		{
-		    return TwoPhaseOutcome.FINISH_ERROR;
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_12",
+							new Object[] { order(), e });
+
+			e.printStackTrace();
 		}
-		catch (WrongStateException ex)
-		{
-		    return TwoPhaseOutcome.FINISH_ERROR;
-		}
-		catch (SystemException ex)
-		{
-		    return TwoPhaseOutcome.HEURISTIC_HAZARD;
-		}
 
-		return TwoPhaseOutcome.FINISH_OK;
-            }
-            else
-                return TwoPhaseOutcome.FINISH_ERROR;
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_10",
-					  new Object[]{order(), ex6});
+		return false;
+	}
 
-	    ex6.printStackTrace();
+	/**
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_13
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_13] -
+	 *          ParticipantRecord.complete {0} caught: {1}
+	 */
 
-            return TwoPhaseOutcome.FINISH_ERROR;
-        }
-    }
+	public boolean complete ()
+	{
+		boolean result = false;
 
-    /**
-     * The record generated a heuristic and can now forget about it.
-     *
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_11 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_11] - ParticipantRecord.forgetHeuristic for {0} called without a resource!
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_12 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_12] - ParticipantRecord.forgetHeuristic {0} caught exception: {1}
-     */
-
-    public boolean forgetHeuristic ()
-    {
-        try
-        {
-            if (_resourceHandle != null)
-            {
 		try
 		{
-		    if (!_exited)
-			_resourceHandle.forget();
+			if (_resourceHandle != null)
+			{
+				try
+				{
+					if (!_completed)
+					{
+						if (_resourceHandle instanceof ParticipantWithComplete)
+						{
+							((ParticipantWithComplete) _resourceHandle)
+									.complete();
+							// _completed = true;
+						}
+
+						result = true;
+					}
+					else
+					{
+						// already completed, so this is a null op. just rtn
+						// true.
+						result = true;
+					}
+				}
+				catch (InvalidParticipantException ex)
+				{
+				}
+				catch (WrongStateException ex)
+				{
+				}
+				catch (SystemException ex)
+				{
+				}
+			}
 		}
-		catch (InvalidParticipantException ex)
+		catch (Exception ex6)
 		{
-		    return false;
+			wscfLogger.arjLoggerI18N
+					.warn(
+							"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_13",
+							new Object[] { order(), ex6 });
+
+			ex6.printStackTrace();
 		}
-		catch (WrongStateException ex)
-		{
-		    return false;
-		}
-		catch (SystemException ex)
-		{
-		    return false;
-		}
 
-		return true;
-            }
-            else
-	    {
-		wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_11",
-					      new Object[]{order()});
-	    }
-        }
-        catch (Exception e)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_12",
-					  new Object[]{order(), e});
+		return result;
+	}
 
-	    e.printStackTrace();
-        }
+	public static AbstractRecord create ()
+	{
+		return new ParticipantRecord();
+	}
 
-        return false;
-    }
+	public void remove (AbstractRecord toDelete)
+	{
+		toDelete = null;
+	}
 
-    /**
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_13 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_13] - ParticipantRecord.complete {0} caught: {1}
-     */
+	public void print (PrintWriter strm)
+	{
+		super.print(strm);
 
-    public boolean complete ()
-    {
-        boolean result = false;
+		strm.print("ParticipantRecord");
+		strm.print(_resourceHandle);
+	}
 
-        try
-        {
-            if (_resourceHandle != null)
-            {
-		        try
-		        {
-		            if (!_completed)
-		            {
-			            if (_resourceHandle instanceof ParticipantWithComplete)
-			            {
-			                ((ParticipantWithComplete) _resourceHandle).complete();
-            			    //			    _completed = true;
-			            }
+	/**
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_14
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_14] -
+	 *          ParticipantRecord.restore_state: {1}
+	 */
 
-        			    result = true;
-		            }
-                    else
-                    {
-                        // already completed, so this is a null op. just rtn true.
-                        result = true;
-                    }
-		        }
-		        catch (InvalidParticipantException ex)
-		        {
-		        }
-		        catch (WrongStateException ex)
-		        {
-		        }
-		        catch (SystemException ex)
-		        {
-		        }
-            }
-        }
-        catch (Exception ex6)
-        {
-	    wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_13",
-					  new Object[]{order(), ex6});
+	public boolean restore_state (InputObjectState os, int t)
+	{
+		boolean result = super.restore_state(os, t);
 
-    	    ex6.printStackTrace();
-        }
+		if (result)
+		{
+			try
+			{
+				// TODO
 
-	    return result;
-    }
+				if (_resourceHandle.restore_state(os))
+					_timeout = os.unpackLong();
 
-    public static AbstractRecord create ()
-    {
-        return new ParticipantRecord();
-    }
+				/*
+				 * TODO: unpack qualifiers and coord id.
+				 */
+			}
+			catch (Exception ex)
+			{
+				wscfLogger.arjLoggerI18N
+						.warn(
+								"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_14",
+								new Object[] { ex });
 
-    public void remove (AbstractRecord toDelete)
-    {
-        toDelete = null;
-    }
+				result = false;
+			}
+		}
 
-    public void print (PrintWriter strm)
-    {
-        super.print(strm);
+		return result;
+	}
 
-        strm.print("ParticipantRecord");
-        strm.print(_resourceHandle);
-    }
+	/**
+	 * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_15
+	 *          [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_15] -
+	 *          ParticipantRecord.save_state: {1}
+	 */
 
-    /**
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_14 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_14] - ParticipantRecord.restore_state: {1}
-     */
+	public boolean save_state (OutputObjectState os, int t)
+	{
+		boolean result = super.save_state(os, t);
 
-    public boolean restore_state (InputObjectState os, int t)
-    {
-        boolean result = super.restore_state(os, t);
+		if (result)
+		{
+			try
+			{
+				// TODO
+				
+				if (_resourceHandle.save_state(os))
+					os.packLong(_timeout);
 
-        if (result)
-        {
-            try
-            {
-		//TODO
+				/*
+				 * TODO: pack qualifiers and coord id.
+				 */
+			}
+			catch (Exception ex)
+			{
+				wscfLogger.arjLoggerI18N
+						.warn(
+								"com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_15",
+								new Object[] { ex });
 
-		//                result = _resourceHandle.unpackState(os);
+				result = false;
+			}
+		}
 
-		_timeout = os.unpackLong();
+		return result;
+	}
 
+	public String type ()
+	{
+		return "/StateManager/AbstractRecord/WSCF/ArjunaCore/ParticipantRecord";
+	}
+
+	public boolean doSave ()
+	{
 		/*
-		 * TODO: unpack qualifiers and coord id.
+		 * If the participant has exited, then we don't need to save anything
+		 * about it in the transaction log.
 		 */
-            }
-            catch (Exception ex)
-            {
-		wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_14",
-					      new Object[]{ex});
 
-                result = false;
-            }
-        }
+		return !_exited;
+	}
 
-        return result;
-    }
+	public void merge (AbstractRecord a)
+	{
+	}
 
-    /**
-     * @message com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_15 [com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_15] - ParticipantRecord.save_state: {1}
-     */
+	public void alter (AbstractRecord a)
+	{
+	}
 
-    public boolean save_state (OutputObjectState os, int t)
-    {
-        boolean result = super.save_state(os, t);
+	public boolean shouldAdd (AbstractRecord a)
+	{
+		return false;
+	}
 
-        if (result)
-        {
-            try
-            {
-		// TODO
-		//                result = _resourceHandle.packState(os);
+	public boolean shouldAlter (AbstractRecord a)
+	{
+		return false;
+	}
 
-		os.packLong(_timeout);
+	public boolean shouldMerge (AbstractRecord a)
+	{
+		return false;
+	}
 
-		/*
-		 * TODO: pack qualifiers and coord id.
-		 */
-            }
-            catch (Exception ex)
-            {
-		wscfLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wscf.model.sagas.coordinator.arjunacore.ParticipantRecord_15",
-					      new Object[]{ex});
+	public boolean shouldReplace (AbstractRecord rec)
+	{
+		return false;
+	}
 
-                result = false;
-            }
-        }
+	public final void delist ()
+	{
+		_exited = true;
+	}
 
-        return result;
-    }
+	public final void completed ()
+	{
+		_completed = true;
+	}
 
-    public String type ()
-    {
-        return "/StateManager/AbstractRecord/WSCF/ArjunaCore/ParticipantRecord";
-    }
-
-    public boolean doSave ()
-    {
 	/*
-	 * If the participant has exited, then we don't need to save
-	 * anything about it in the transaction log.
+	 * Protected constructor used by crash recovery.
 	 */
 
-        return ! _exited;
-    }
+	protected ParticipantRecord ()
+	{
+		super();
 
-    public void merge (AbstractRecord a)
-    {
-    }
+		_resourceHandle = null;
+		_timeout = 0;
+		_coordId = null;
+	}
 
-    public void alter (AbstractRecord a)
-    {
-    }
+	private Participant _resourceHandle;
 
-    public boolean shouldAdd (AbstractRecord a)
-    {
-        return false;
-    }
+	private long _timeout;
 
-    public boolean shouldAlter (AbstractRecord a)
-    {
-        return false;
-    }
+	private CoordinatorIdImple _coordId;
 
-    public boolean shouldMerge (AbstractRecord a)
-    {
-        return false;
-    }
+	private boolean _exited = false;
 
-    public boolean shouldReplace (AbstractRecord rec)
-    {
-        return false;
-    }
+	private boolean _completed = false;
 
-    public final void delist ()
-    {
-	_exited = true;
-    }
-
-    public final void completed ()
-    {
-	_completed = true;
-    }
-
-    /*
-    * Protected constructor used by crash recovery.
-    */
-
-    protected ParticipantRecord ()
-    {
-        super();
-
-        _resourceHandle = null;
-        _timeout = 0;
-	_coordId = null;
-    }
-
-    private Participant        _resourceHandle;
-    private long               _timeout;
-    private CoordinatorIdImple _coordId;
-    private boolean            _exited = false;
-    private boolean            _completed = false;
-
 }

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -106,6 +106,8 @@
 
 	public int typeIs ()
 	{
+		// TODO add specific record type.
+		
 		return RecordType.USER_DEF_FIRST0;
 	}
 
@@ -115,7 +117,7 @@
 
 	public ClassName className ()
 	{
-		return new ClassName(toString());
+		return new ClassName("WSATParticipantRecord");
 	}
 
 	/**
@@ -621,12 +623,11 @@
 		{
 			try
 			{
-				//TODO
+				result = _resourceHandle.restore_state(os);
+				
+				if (result)
+					_timeout = os.unpackLong();
 
-				//                result = _resourceHandle.unpackState(os);
-
-				_timeout = os.unpackLong();
-
 				/*
 				 * TODO: unpack qualifiers and coord id.
 				 */
@@ -657,11 +658,11 @@
 		{
 			try
 			{
-				// TODO
-				//                result = _resourceHandle.packState(os);
+				result = _resourceHandle.save_state(os);
+				
+				if (result)
+					os.packLong(_timeout);
 
-				os.packLong(_timeout);
-
 				/*
 				 * TODO: pack qualifiers and coord id.
 				 */

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwtests/wscf/common/TwoPhaseParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwtests/wscf/common/TwoPhaseParticipant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwtests/wscf/common/TwoPhaseParticipant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -31,6 +31,8 @@
 
 package com.arjuna.mwtests.wscf.common;
 
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.mw.wsas.exceptions.SystemException;
 import com.arjuna.mw.wsas.exceptions.WrongStateException;
 import com.arjuna.mw.wscf.exceptions.InvalidParticipantException;
@@ -86,6 +88,16 @@
     {
 	return _id;
     }
+    
+    public boolean save_state(OutputObjectState os)
+    {
+        return false ;
+    }
+    
+    public boolean restore_state(InputObjectState os)
+    {
+        return false ;
+    }
 
     private String _id;
     

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/common/Environment.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/common/Environment.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/common/Environment.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -39,24 +39,4 @@
 
     public static final String COORDINATOR_URL = "com.arjuna.mw.wst.coordinatorURL";
 
-    public static final String ACTIVATION_REQUESTER = "com.arjuna.mw.wst.activationrequester";
-    public static final String ACTIVATION_COORDINATOR = "com.arjuna.mw.wst.activationcoordinator";
-    public static final String REGISTRATION_REQUESTER = "com.arjuna.mw.wst.registrationrequester";
-
-    public static final String COMPLETION_PARTICIPANT = "com.arjuna.mw.wst.at.completionparticipant";
-    public static final String COMPLETION_WITH_ACK_PARTICIPANT = "com.arjuna.mw.wst.at.completionwithackparticipant";
-
-    public static final String DURABLE_TWOPC_DISPATCHER = "com.arjuna.mw.wst.at.durabletwopcdispatcher";
-    public static final String DURABLE_TWOPC_PARTICIPANT = "com.arjuna.mw.wst.at.durabletwopcparticipant";
-    public static final String VOLATILE_TWOPC_DISPATCHER = "com.arjuna.mw.wst.at.volatiletwopcdispatcher";
-    public static final String VOLATILE_TWOPC_PARTICIPANT = "com.arjuna.mw.wst.at.volatiletwopcparticipant";
-
-    public static final String BUSINESSAGREEMENTWPC_DISPATCHER = "com.arjuna.mw.wst.ba.businessagreementwpcdispatcher";
-    public static final String BUSINESSAGREEMENTWPC_PARTICIPANT = "com.arjuna.mw.wst.ba.businessagreementwpcparticipant";
-    public static final String BUSINESSAGREEMENTWCC_DISPATCHER = "com.arjuna.mw.wst.ba.businessagreementwccispatcher";
-    public static final String BUSINESSAGREEMENTWCC_PARTICIPANT = "com.arjuna.mw.wst.ba.businessagreementwccparticipant";
-
-    public static final String TERMINATOR_PARTICIPANT = "com.arjuna.mw.wst.ba.businessactivityterminatorparticipant";
-    public static final String TERMINATOR_COORDINATOR = "com.arjuna.mw.wst.ba.businessactivityterminatorcoordinator";
-
 }

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/deploy/WSTXInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/deploy/WSTXInitialisation.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mw/wst/deploy/WSTXInitialisation.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -66,6 +66,8 @@
             configure();
 
             Configuration.initialise("/wstx.xml");
+            // Start recovery
+//            RecoveryManager.manager() ;
         }
         catch (Exception exception)
         {
@@ -184,5 +186,6 @@
      */
     public void contextDestroyed(final ServletContextEvent servletContextEvent)
     {
+//        RecoveryManager.manager().stop() ;
     }
 }

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/RegistrarImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -214,7 +214,7 @@
 			try
 			{
                 final CompletionCoordinatorParticipant participant = new CompletionCoordinatorImple(_coordManager, hier, true) ;
-                CompletionCoordinatorProcessor.getCoordinator().activateParticipant(participant, instanceIdentifier.getInstanceIdentifier()) ;
+                CompletionCoordinatorProcessor.getProcessor().activateParticipant(participant, instanceIdentifier.getInstanceIdentifier()) ;
 
 				_coordManager.suspend();
 

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/CompletionCoordinatorImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/CompletionCoordinatorImple.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/CompletionCoordinatorImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -109,7 +109,7 @@
 	finally
 	{
 	    if (deactivate)
-	        CompletionCoordinatorProcessor.getCoordinator().deactivateParticipant(this);
+	        CompletionCoordinatorProcessor.getProcessor().deactivateParticipant(this);
 	}
     }
     
@@ -161,7 +161,7 @@
 	finally
 	{
         if (deactivate)
-            CompletionCoordinatorProcessor.getCoordinator().deactivateParticipant(this);
+            CompletionCoordinatorProcessor.getProcessor().deactivateParticipant(this);
 	}
     }
 

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -33,6 +33,8 @@
 
 import com.arjuna.wst.Durable2PCParticipant;
 
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.mw.wscf.model.twophase.participants.*;
 import com.arjuna.mw.wscf.model.twophase.exceptions.*;
 import com.arjuna.mw.wscf.model.twophase.vote.*;
@@ -41,6 +43,7 @@
 
 import com.arjuna.mw.wsas.exceptions.SystemException;
 import com.arjuna.mw.wsas.exceptions.WrongStateException;
+import com.arjuna.mwlabs.wst.util.PersistableParticipantHelper;
 
 /**
  * @author Mark Little (mark.little at arjuna.com)
@@ -271,6 +274,17 @@
 		return _id;
 	}
 
+	public boolean save_state (OutputObjectState os)
+	{
+        return PersistableParticipantHelper.save_state(os, _resource) ;
+	}
+	
+	public boolean restore_state (InputObjectState os)
+	{
+        _resource = (Durable2PCParticipant)PersistableParticipantHelper.restore_state(os) ;
+        return true ;
+	}
+	
 	private Durable2PCParticipant _resource;
 	private String _id;
 	private boolean _readonly;

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/TransactionManagerImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -55,6 +55,7 @@
 import com.arjuna.wst.UnknownTransactionException;
 import com.arjuna.wst.Volatile2PCParticipant;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.ParticipantEngine;
 
 /**
  * This is the interface that the core exposes in order to allow different types
@@ -76,7 +77,7 @@
 		{
 			registerParticipant(getParticipant(id) , Protocols.DurableTwoPhaseCommit);
 
-			ParticipantProcessor.getParticipant().activateParticipant(tpp, id) ;
+			ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp), id) ;
 		}
 		catch (com.arjuna.wsc.InvalidProtocolException ex)
 		{
@@ -100,7 +101,7 @@
 		{
 			registerParticipant(getParticipant(id), Protocols.VolatileTwoPhaseCommit);
 
-            ParticipantProcessor.getParticipant().activateParticipant(tpp, id) ;
+            ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp), id) ;
 		}
 		catch (com.arjuna.wsc.InvalidProtocolException ex)
 		{

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/BusinessActivityTerminatorImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/BusinessActivityTerminatorImple.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/BusinessActivityTerminatorImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -106,7 +106,7 @@
         }
         finally
         {
-            TerminationCoordinatorProcessor.getParticipant().deactivateParticipant(this) ;
+            TerminationCoordinatorProcessor.getProcessor().deactivateParticipant(this) ;
         }
     }
 
@@ -155,7 +155,7 @@
 	}
 	finally
 	{
-        TerminationCoordinatorProcessor.getParticipant().deactivateParticipant(this) ;
+        TerminationCoordinatorProcessor.getProcessor().deactivateParticipant(this) ;
 	}
     }
 

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-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/ContextFactoryImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -141,7 +141,7 @@
             InstanceIdentifier.setEndpointInstanceIdentifier(registrationCoordinator, arjunaContext.getTransactionIdentifier()) ;
             coordinationContext.setRegistrationService(registrationCoordinator) ;
             
-            TerminationCoordinatorProcessor.getParticipant().activateParticipant(new BusinessActivityTerminatorImple(), arjunaContext.getTransactionIdentifier()) ;
+            TerminationCoordinatorProcessor.getProcessor().activateParticipant(new BusinessActivityTerminatorImple(), arjunaContext.getTransactionIdentifier()) ;
     
     		_theRegistrar.associate();
     

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/RegistrarImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/RegistrarImple.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/RegistrarImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -57,179 +57,220 @@
 import com.arjuna.wsc.NoActivityException;
 import com.arjuna.wsc.Registrar;
 import com.arjuna.wsc.RegistrarMapper;
+import com.arjuna.wst.messaging.engines.CoordinatorCompletionCoordinatorEngine;
+import com.arjuna.wst.messaging.engines.ParticipantCompletionCoordinatorEngine;
 import com.arjuna.wst.stub.BusinessAgreementWithCoordinatorCompletionStub;
 import com.arjuna.wst.stub.BusinessAgreementWithParticipantCompletionStub;
 
 public class RegistrarImple implements Registrar
 {
 
-    public RegistrarImple ()
-        throws ProtocolNotRegisteredException, SystemException
-    {
-	    _coordManager = CoordinatorManagerFactory.coordinatorManager();
+	public RegistrarImple () throws ProtocolNotRegisteredException,
+			SystemException
+	{
+		_coordManager = CoordinatorManagerFactory.coordinatorManager();
 
-	    // register with mapper using tx id as protocol identifier.
-        final RegistrarMapper mapper = RegistrarMapper.getFactory() ;
+		// register with mapper using tx id as protocol identifier.
+		final RegistrarMapper mapper = RegistrarMapper.getFactory();
 
-	    mapper.addRegistrar(Protocols.BusinessAgreementWithParticipantCompletion, this);
-	    mapper.addRegistrar(Protocols.BusinessAgreementWithCoordinatorCompletion, this);
-        mapper.addRegistrar(Protocols.BusinessAgreementTermination, this) ;
-    }
-    
-    /**
-     * Called when a registrar is added to a register mapper. This method will be called multiple times if the
-     * registrar is added to multiple register mappers or to the same register mapper with different protocol
-     * identifiers.
-     *
-     * @param serviceAddress the address of the service
-     * @param protocolIdentifier the protocol identifier
-     */
+		mapper.addRegistrar(
+				Protocols.BusinessAgreementWithParticipantCompletion, this);
+		mapper.addRegistrar(
+				Protocols.BusinessAgreementWithCoordinatorCompletion, this);
+		mapper.addRegistrar(Protocols.BusinessAgreementTermination, this);
+	}
 
-    public void install (String protocolIdentifier)
-    {
-    }
+	/**
+	 * Called when a registrar is added to a register mapper. This method will
+	 * be called multiple times if the registrar is added to multiple register
+	 * mappers or to the same register mapper with different protocol
+	 * identifiers.
+	 * 
+	 * @param serviceAddress
+	 *            the address of the service
+	 * @param protocolIdentifier
+	 *            the protocol identifier
+	 */
 
-    /**
-     * Registers the interest of participant in a particular protocol.
-     *
-     * @param participantProtocolServiceAddress the address of the participant protocol service
-     * @param protocolIdentifier the protocol identifier
-     *
-     * @return the PortReference of the coordinator protocol service
-     *
-     * @throws AlreadyRegisteredException if the participant is already registered for this coordination protocol under
-     *         this activity identifier
-     * @throws InvalidProtocolException if the coordination protocol is not supported
-     * @throws InvalidStateException if the state of the coordinator no longer allows registration for this
-     *         coordination protocol
-     * @throws NoActivityException if the activity does not exist.
-     *
-     * @message com.arjuna.mwlabs.wst.ba.RegistrarImple_1 [com.arjuna.mwlabs.wst.ba.RegistrarImple_1] - Invalid type URI: < {0} , {1} >
-     */
+	public void install (String protocolIdentifier)
+	{
+	}
 
-    public EndpointReferenceType register (final EndpointReferenceType participantProtocolService, final String protocolIdentifier, final InstanceIdentifier instanceIdentifier)
-        throws AlreadyRegisteredException, InvalidProtocolException, InvalidStateException, NoActivityException
-    {
-        ActivityHierarchy hier = (ActivityHierarchy) _hierarchies.get(instanceIdentifier.getInstanceIdentifier());
-    	
-    	if (hier == null)
-    	    throw new NoActivityException();
-    
-    	try
-    	{
-    	    _coordManager.resume(hier);
-    	}
-    	catch (com.arjuna.mw.wsas.exceptions.InvalidActivityException ex)
-    	{
-    	    throw new NoActivityException();
-    	}
-    	catch (com.arjuna.mw.wsas.exceptions.SystemException ex)
-    	{
-    	    throw new InvalidProtocolException();
-    	}
-    	
-    	// TODO check for AlreadyRegisteredException
-    	
-    	if (Protocols.BusinessAgreementWithParticipantCompletion.equals(protocolIdentifier))
-    	{
-    	    // enlist participant that wraps the requester URI.
-    	    final String id = new Uid().stringForm() ;
+	/**
+	 * Registers the interest of participant in a particular protocol.
+	 * 
+	 * @param participantProtocolServiceAddress
+	 *            the address of the participant protocol service
+	 * @param protocolIdentifier
+	 *            the protocol identifier
+	 * 
+	 * @return the PortReference of the coordinator protocol service
+	 * 
+	 * @throws AlreadyRegisteredException
+	 *             if the participant is already registered for this
+	 *             coordination protocol under this activity identifier
+	 * @throws InvalidProtocolException
+	 *             if the coordination protocol is not supported
+	 * @throws InvalidStateException
+	 *             if the state of the coordinator no longer allows registration
+	 *             for this coordination protocol
+	 * @throws NoActivityException
+	 *             if the activity does not exist.
+	 * 
+	 * @message com.arjuna.mwlabs.wst.ba.RegistrarImple_1
+	 *          [com.arjuna.mwlabs.wst.ba.RegistrarImple_1] - Invalid type URI: <
+	 *          {0} , {1} >
+	 */
 
-    	    try
-    	    {
-                BusinessAgreementWithParticipantCompletionImple participant = new BusinessAgreementWithParticipantCompletionImple(new BusinessAgreementWithParticipantCompletionStub(id, participantProtocolService), id);
-                
-                _coordManager.enlistParticipant(participant);
-    
-                ParticipantCompletionCoordinatorProcessor.getCoordinator().activateParticipant(participant.participantManager(), id);
-    
-                _coordManager.suspend();
-    
-                return getParticipantManager(BusinessActivityConstants.SERVICE_PARTICIPANT_COMPLETION_COORDINATOR, id) ;
-    	    }
-    	    catch (Exception ex)
-    	    {
-                throw new InvalidStateException();
-    	    }
-    	}
-    	else if (Protocols.BusinessAgreementWithCoordinatorCompletion.equals(protocolIdentifier))
-        {
-    	    final String id = new Uid().stringForm() ;
-    		try
-    		{
-    		    BusinessAgreementWithCoordinatorCompletionImple participant = new BusinessAgreementWithCoordinatorCompletionImple(new BusinessAgreementWithCoordinatorCompletionStub(id, participantProtocolService), id);
-    
-    		    _coordManager.enlistParticipant(participant);
-    
-    
-                CoordinatorCompletionCoordinatorProcessor.getCoordinator().activateParticipant(participant.participantManager(), id);
-    
-    		    _coordManager.suspend();
-    		    
-    		    return getParticipantManager(BusinessActivityConstants.SERVICE_COORDINATOR_COMPLETION_COORDINATOR, id) ;
-    		}
-    		catch (Exception ex)
-    		{
-    		    throw new InvalidStateException();
-    		}
-        }
-        else if (Protocols.BusinessAgreementTermination.equals(protocolIdentifier))
-        {
-            try
-            {
-                return getParticipantManager(ArjunaTXConstants.SERVICE_TERMINATION_COORDINATOR, instanceIdentifier.getInstanceIdentifier()) ;
-            }
-            catch (Exception ex)
-            {
-                throw new InvalidStateException();
-            }
-        }
-        else
-        {
-    		wstxLogger.arjLoggerI18N.warn("com.arjuna.mwlabs.wst.ba.RegistrarImple_1",
-    					      new Object[]{Protocols.BusinessActivityAtomic, protocolIdentifier});
-    
-    		throw new InvalidProtocolException();
-    	}
-    }
+	public EndpointReferenceType register (
+			final EndpointReferenceType participantProtocolService,
+			final String protocolIdentifier,
+			final InstanceIdentifier instanceIdentifier)
+			throws AlreadyRegisteredException, InvalidProtocolException,
+			InvalidStateException, NoActivityException
+	{
+		ActivityHierarchy hier = (ActivityHierarchy) _hierarchies
+				.get(instanceIdentifier.getInstanceIdentifier());
 
-    /**
-     * Called when a registrar is removed from a register mapper. This method will be called multiple times if the
-     * registrar is removed from multiple register mappers or from the same register mapper with different protocol
-     * identifiers.
-     *
-     * @param serviceAddress the address of the service
-     * @param protocolIdentifier the protocol identifier
-     */
+		if (hier == null) throw new NoActivityException();
 
-    public void uninstall (String protocolIdentifier)
-    {
-    }
+		try
+		{
+			_coordManager.resume(hier);
+		}
+		catch (com.arjuna.mw.wsas.exceptions.InvalidActivityException ex)
+		{
+			throw new NoActivityException();
+		}
+		catch (com.arjuna.mw.wsas.exceptions.SystemException ex)
+		{
+			throw new InvalidProtocolException();
+		}
 
-    public final void associate () throws Exception
-    {
-    	// TODO colocation won't do suspend
-    
-    	String txIdentifier = _coordManager.identifier().toString();
-    	ActivityHierarchy hier = _coordManager.suspend();
-    
-    	_hierarchies.put(txIdentifier, hier);
-    }
+		// TODO check for AlreadyRegisteredException
 
-    public final void disassociate (String txIdentifier) throws Exception
-    {
-        _hierarchies.remove(txIdentifier);
-    }
-    
-    private EndpointReferenceType getParticipantManager(final String service, final String id)
-    {
-        final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
-        final String participantManagerParticipantURI = soapRegistry.getServiceURI(service) ;
-        final EndpointReferenceType participantManagerParticipant = new EndpointReferenceType(new AttributedURIType(participantManagerParticipantURI)) ;
-        InstanceIdentifier.setEndpointInstanceIdentifier(participantManagerParticipant, id) ;
-        return participantManagerParticipant ;
-    }
-    
-    private CoordinatorManager _coordManager = null;
-    private HashMap            _hierarchies = new HashMap();
+		if (Protocols.BusinessAgreementWithParticipantCompletion
+				.equals(protocolIdentifier))
+		{
+			// enlist participant that wraps the requester URI.
+			final String id = new Uid().stringForm();
+
+			try
+			{
+                final ParticipantCompletionCoordinatorEngine engine = new ParticipantCompletionCoordinatorEngine(id, participantProtocolService) ;
+				BusinessAgreementWithParticipantCompletionImple participant = new BusinessAgreementWithParticipantCompletionImple(
+						new BusinessAgreementWithParticipantCompletionStub(engine), id);
+                engine.setCoordinator(participant.participantManager()) ;
+
+				_coordManager.enlistParticipant(participant);
+
+				_coordManager.suspend();
+
+				return getParticipantManager(
+						BusinessActivityConstants.SERVICE_PARTICIPANT_COMPLETION_COORDINATOR,
+						id);
+			}
+			catch (Exception ex)
+			{
+				throw new InvalidStateException();
+			}
+		}
+		else
+			if (Protocols.BusinessAgreementWithCoordinatorCompletion
+					.equals(protocolIdentifier))
+			{
+				final String id = new Uid().stringForm();
+				try
+				{
+                    final CoordinatorCompletionCoordinatorEngine engine = new CoordinatorCompletionCoordinatorEngine(id, participantProtocolService) ;
+					BusinessAgreementWithCoordinatorCompletionImple participant = new BusinessAgreementWithCoordinatorCompletionImple(
+							new BusinessAgreementWithCoordinatorCompletionStub(engine), id);
+                    engine.setCoordinator(participant.participantManager()) ;
+
+					_coordManager.enlistParticipant(participant);
+
+					_coordManager.suspend();
+
+					return getParticipantManager(
+							BusinessActivityConstants.SERVICE_COORDINATOR_COMPLETION_COORDINATOR,
+							id);
+				}
+				catch (Exception ex)
+				{
+					throw new InvalidStateException();
+				}
+			}
+			else
+				if (Protocols.BusinessAgreementTermination
+						.equals(protocolIdentifier))
+				{
+					try
+					{
+						return getParticipantManager(
+								ArjunaTXConstants.SERVICE_TERMINATION_COORDINATOR,
+								instanceIdentifier.getInstanceIdentifier());
+					}
+					catch (Exception ex)
+					{
+						throw new InvalidStateException();
+					}
+				}
+				else
+				{
+					wstxLogger.arjLoggerI18N
+							.warn(
+									"com.arjuna.mwlabs.wst.ba.RegistrarImple_1",
+									new Object[] { Protocols.BusinessActivityAtomic, protocolIdentifier });
+
+					throw new InvalidProtocolException();
+				}
+	}
+
+	/**
+	 * Called when a registrar is removed from a register mapper. This method
+	 * will be called multiple times if the registrar is removed from multiple
+	 * register mappers or from the same register mapper with different protocol
+	 * identifiers.
+	 * 
+	 * @param serviceAddress
+	 *            the address of the service
+	 * @param protocolIdentifier
+	 *            the protocol identifier
+	 */
+
+	public void uninstall (String protocolIdentifier)
+	{
+	}
+
+	public final void associate () throws Exception
+	{
+		// TODO colocation won't do suspend
+
+		String txIdentifier = _coordManager.identifier().toString();
+		ActivityHierarchy hier = _coordManager.suspend();
+
+		_hierarchies.put(txIdentifier, hier);
+	}
+
+	public final void disassociate (String txIdentifier) throws Exception
+	{
+		_hierarchies.remove(txIdentifier);
+	}
+
+	private EndpointReferenceType getParticipantManager (final String service,
+			final String id)
+	{
+		final SoapRegistry soapRegistry = SoapRegistry.getRegistry();
+		final String participantManagerParticipantURI = soapRegistry
+				.getServiceURI(service);
+		final EndpointReferenceType participantManagerParticipant = new EndpointReferenceType(
+				new AttributedURIType(participantManagerParticipantURI));
+		InstanceIdentifier.setEndpointInstanceIdentifier(
+				participantManagerParticipant, id);
+		return participantManagerParticipant;
+	}
+
+	private CoordinatorManager _coordManager = null;
+
+	private HashMap _hierarchies = new HashMap();
 }

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithCoordinatorCompletionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithCoordinatorCompletionImple.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithCoordinatorCompletionImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -31,64 +31,50 @@
 
 package com.arjuna.mwlabs.wst.ba.participants;
 
-import com.arjuna.webservices.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
-import com.arjuna.wst.BAParticipantManager;
-import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
-
-import com.arjuna.mw.wscf.exceptions.*;
-
 import com.arjuna.mw.wsas.exceptions.SystemException;
 import com.arjuna.mw.wsas.exceptions.WrongStateException;
+import com.arjuna.mw.wscf.exceptions.InvalidParticipantException;
+import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
 
 /**
  * @author Mark Little (mark.little at arjuna.com)
- * @version $Id: BusinessAgreementWithCoordinatorCompletionImple.java,v 1.1.2.2 2004/08/09 12:34:26 nmcl Exp $
+ * @version $Id: BusinessAgreementWithCoordinatorCompletionImple.java,v 1.1.2.2
+ *          2004/08/09 12:34:26 nmcl Exp $
  * @since 1.0.
  */
 
-public class BusinessAgreementWithCoordinatorCompletionImple extends BusinessAgreementWithParticipantCompletionImple implements com.arjuna.mw.wscf.model.sagas.participants.ParticipantWithComplete
+public class BusinessAgreementWithCoordinatorCompletionImple extends
+		BusinessAgreementWithParticipantCompletionImple implements
+		com.arjuna.mw.wscf.model.sagas.participants.ParticipantWithComplete
 {
-    
-    public BusinessAgreementWithCoordinatorCompletionImple (BusinessAgreementWithCoordinatorCompletionParticipant participant, String identifier)
-    {
-	super(participant, identifier);
-    }
-    
-    public void complete () throws InvalidParticipantException, WrongStateException, SystemException
-    {
-	if (_resource != null)
+
+	public BusinessAgreementWithCoordinatorCompletionImple (
+			BusinessAgreementWithCoordinatorCompletionParticipant participant,
+			String identifier)
 	{
-	    try
-	    {
-		((BusinessAgreementWithCoordinatorCompletionParticipant) _resource).complete();
-	    }
-	    catch (com.arjuna.wst.WrongStateException ex)
-	    {
-		throw new WrongStateException(ex.toString());
-	    }
-	    catch (com.arjuna.wst.SystemException ex)
-	    {
-		throw new SystemException(ex.toString());
-	    }
+		super(participant, identifier);
 	}
-	else
-	    throw new InvalidParticipantException();
-    }
 
-    protected void deactivateParticipantManager(final BAParticipantManager participantManager)
-        throws SystemException
-    {
-        try
-        {
-            CoordinatorCompletionCoordinatorProcessor.getCoordinator().deactivateParticipant(participantManager) ;
-        }
-        catch (Throwable ex)
-        {
-            ex.printStackTrace();
-            
-            throw new SystemException(ex.toString());
-        }
-    }
-    
+	public void complete () throws InvalidParticipantException,
+			WrongStateException, SystemException
+	{
+		if (_resource != null)
+		{
+			try
+			{
+				((BusinessAgreementWithCoordinatorCompletionParticipant) _resource)
+						.complete();
+			}
+			catch (com.arjuna.wst.WrongStateException ex)
+			{
+				throw new WrongStateException(ex.toString());
+			}
+			catch (com.arjuna.wst.SystemException ex)
+			{
+				throw new SystemException(ex.toString());
+			}
+		}
+		else
+			throw new InvalidParticipantException();
+	}
 }
-

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithParticipantCompletionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithParticipantCompletionImple.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/participants/BusinessAgreementWithParticipantCompletionImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -31,14 +31,15 @@
 
 package com.arjuna.mwlabs.wst.ba.participants;
 
-//import com.arjuna.mw.wst.resources.BusinessAgreement;
+// import com.arjuna.mw.wst.resources.BusinessAgreement;
 
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.mw.wsas.exceptions.SystemException;
 import com.arjuna.mw.wsas.exceptions.WrongStateException;
 import com.arjuna.mw.wscf.exceptions.InvalidParticipantException;
 import com.arjuna.mw.wscf.model.sagas.exceptions.CompensateFailedException;
-import com.arjuna.webservices.wsba.processors.ParticipantCompletionCoordinatorProcessor;
-import com.arjuna.wst.BAParticipantManager;
+import com.arjuna.mwlabs.wst.util.PersistableParticipantHelper;
 import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
 
 // TODO crash recovery (for EVERYTHING!!)
@@ -47,182 +48,182 @@
 
 /**
  * @author Mark Little (mark.little at arjuna.com)
- * @version $Id: BusinessAgreementWithParticipantCompletionImple.java,v 1.1.2.2 2004/08/09 12:34:26 nmcl Exp $
+ * @version $Id: BusinessAgreementWithParticipantCompletionImple.java,v 1.1.2.2
+ *          2004/08/09 12:34:26 nmcl Exp $
  * @since 1.0.
  */
 
-public class BusinessAgreementWithParticipantCompletionImple implements com.arjuna.mw.wscf.model.sagas.participants.Participant
+public class BusinessAgreementWithParticipantCompletionImple implements
+		com.arjuna.mw.wscf.model.sagas.participants.Participant
 {
-
-    public BusinessAgreementWithParticipantCompletionImple (BusinessAgreementWithParticipantCompletionParticipant resource, String id)
-    {
-	_resource = resource;
-	_identifier = id;
-	_baParticipantManager = new com.arjuna.mwlabs.wst.ba.remote.BAParticipantManagerImple(id);    
-    }
-
-    public void close () throws InvalidParticipantException, WrongStateException, SystemException
-    {
-	try
+//
+	public BusinessAgreementWithParticipantCompletionImple (
+			BusinessAgreementWithParticipantCompletionParticipant resource,
+			String id)
 	{
-	    if (_resource != null)
-	    {
-		_resource.close();
-	    }
-	    else
-		throw new InvalidParticipantException();
+		_resource = resource;
+		_identifier = id;
+		_baParticipantManager = new com.arjuna.mwlabs.wst.ba.remote.BAParticipantManagerImple(
+				id);
 	}
-	catch (com.arjuna.wst.WrongStateException ex)
+
+	public void close () throws InvalidParticipantException,
+			WrongStateException, SystemException
 	{
-	    throw new WrongStateException(ex.toString());
+		try
+		{
+			if (_resource != null)
+			{
+				_resource.close();
+			}
+			else
+				throw new InvalidParticipantException();
+		}
+		catch (com.arjuna.wst.WrongStateException ex)
+		{
+			throw new WrongStateException(ex.toString());
+		}
+		catch (com.arjuna.wst.SystemException ex)
+		{
+			throw new SystemException(ex.toString());
+		}
 	}
-	catch (com.arjuna.wst.SystemException ex)
+
+	public void cancel () throws InvalidParticipantException,
+			WrongStateException, SystemException
 	{
-	    throw new SystemException(ex.toString());
+		try
+		{
+			if (_resource != null)
+			{
+				_resource.cancel();
+			}
+			else
+				throw new InvalidParticipantException();
+		}
+		catch (com.arjuna.wst.WrongStateException ex)
+		{
+			throw new WrongStateException(ex.toString());
+		}
+		catch (com.arjuna.wst.SystemException ex)
+		{
+			throw new SystemException(ex.toString());
+		}
 	}
-	finally
+
+	public void compensate () throws CompensateFailedException,
+			InvalidParticipantException, WrongStateException, SystemException
 	{
-	    deactivateParticipantManager();
+		try
+		{
+			if (_resource != null)
+			{
+				_resource.compensate();
+			}
+			else
+				throw new InvalidParticipantException();
+		}
+		catch (com.arjuna.wst.FaultedException ex)
+		{
+			throw new CompensateFailedException();
+		}
+		catch (com.arjuna.wst.WrongStateException ex)
+		{
+			throw new WrongStateException(ex.toString());
+		}
+		catch (com.arjuna.wst.SystemException ex)
+		{
+			throw new SystemException(ex.toString());
+		}
 	}
-    }
-    
-    public void cancel () throws InvalidParticipantException, WrongStateException, SystemException
-    {
-	try
+
+	/**
+	 * @return the status value.
+	 */
+
+	public String status () throws SystemException
 	{
-	    if (_resource != null)
-	    {
-		_resource.cancel();
-	    }
-	    else
-		throw new InvalidParticipantException();
+		try
+		{
+			if (_resource != null)
+			{
+				return _resource.status();
+			}
+			else
+				throw new SystemException("InvalidParticipant");
+		}
+		catch (com.arjuna.wst.SystemException ex)
+		{
+			throw new SystemException(ex.toString());
+		}
 	}
-	catch (com.arjuna.wst.WrongStateException ex)
+
+	/**
+	 * Inform the participant that is can forget the heuristic result.
+	 * 
+	 * @exception InvalidParticipantException
+	 *                Thrown if the participant identity is invalid.
+	 * @exception WrongStateException
+	 *                Thrown if the participant is in an invalid state.
+	 * @exception SystemException
+	 *                Thrown in the event of a general fault.
+	 */
+
+	public void forget () throws InvalidParticipantException,
+			WrongStateException, SystemException
 	{
-	    throw new WrongStateException(ex.toString());
+		// not supported by the IBM protocol.
 	}
-	catch (com.arjuna.wst.SystemException ex)
+
+	public void unknown () throws SystemException
 	{
-	    throw new SystemException(ex.toString());
+		/*
+		 * If the transaction is unknown, then we assume it cancelled.
+		 */
+
+		try
+		{
+			cancel();
+		}
+		catch (Exception ex)
+		{
+			// TODO
+		}
 	}
-	finally
-	{
-	    deactivateParticipantManager();
-	}
-    }
 
-    public void compensate () throws CompensateFailedException, InvalidParticipantException, WrongStateException, SystemException
-    {
-	try
+	public String id () throws SystemException
 	{
-	    if (_resource != null)
-	    {
-		_resource.compensate();
-	    }
-	    else
-		throw new InvalidParticipantException();
+		return _identifier;
 	}
-	catch (com.arjuna.wst.FaultedException ex)
-	{
-	    throw new CompensateFailedException();
-	}
-	catch (com.arjuna.wst.WrongStateException ex)
-	{
-	    throw new WrongStateException(ex.toString());
-	}
-	catch (com.arjuna.wst.SystemException ex)
-	{
-	    throw new SystemException(ex.toString());
-	}
-	finally
-	{
-	    deactivateParticipantManager();
-	}
-    }
 
-    /**
-     * @return the status value.
-     */
-
-    public String status () throws SystemException
-    {
-	try
+	public final com.arjuna.wst.BAParticipantManager participantManager ()
 	{
-	    if (_resource != null)
-	    {
-		return _resource.status();
-	    }
-	    else
-		throw new SystemException("InvalidParticipant");
+		return _baParticipantManager;
 	}
-	catch (com.arjuna.wst.SystemException ex)
-	{
-	    throw new SystemException(ex.toString());
-	}
-    }
 
-    /**
-     * Inform the participant that is can forget the heuristic result.
-     *
-     * @exception InvalidParticipantException Thrown if the participant identity is invalid.
-     * @exception WrongStateException Thrown if the participant is in an invalid state.
-     * @exception SystemException Thrown in the event of a general fault.
-     */
-
-    public void forget () throws InvalidParticipantException, WrongStateException, SystemException
-    {
-	// not supported by the IBM protocol.
-    }
-    
-    public void unknown () throws SystemException
-    {
-	/*
-	 * If the transaction is unknown, then we assume it cancelled.
-	 */
-
-	try
+	public boolean save_state (OutputObjectState os)
 	{
-	    cancel();
+        return PersistableParticipantHelper.save_state(os, _resource) ;
 	}
-	catch (Exception ex)
+	
+	public boolean restore_state (InputObjectState is)
 	{
-	    // TODO
+        final Object resource = PersistableParticipantHelper.restore_state(is) ;
+        if (resource != null)
+        {
+            _resource = (BusinessAgreementWithParticipantCompletionParticipant)resource ;
+            return true ;
+        }
+        else
+        {
+            return false ;
+        }
 	}
-    }
 
-    public String id () throws SystemException
-    {
-	return _identifier;
-    }
+	protected BusinessAgreementWithParticipantCompletionParticipant _resource;
 
-    public final com.arjuna.wst.BAParticipantManager participantManager ()
-    {
-	return _baParticipantManager;
-    }
+	private String _identifier = null;
 
-    private final void deactivateParticipantManager () throws SystemException
-    {
-        deactivateParticipantManager(_baParticipantManager) ;
-    }
-    
-    protected void deactivateParticipantManager(final BAParticipantManager participantManager)
-        throws SystemException
-    {
-    	try
-    	{
-            ParticipantCompletionCoordinatorProcessor.getCoordinator().deactivateParticipant(participantManager);
-    	}
-    	catch (Throwable ex)
-    	{
-    	    ex.printStackTrace();
-    	    
-    	    throw new SystemException(ex.toString());
-    	}
-    }
-    
-    protected BusinessAgreementWithParticipantCompletionParticipant _resource;
+	private com.arjuna.wst.BAParticipantManager _baParticipantManager = null;
 
-    private String _identifier = null;
-    private com.arjuna.wst.BAParticipantManager _baParticipantManager = null;
-
 }

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/remote/BusinessActivityManagerImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/remote/BusinessActivityManagerImple.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/ba/remote/BusinessActivityManagerImple.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -53,6 +53,8 @@
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.UnknownTransactionException;
 import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine;
+import com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine;
 import com.arjuna.wst.stub.BACoordinatorCompletionParticipantManagerStub;
 import com.arjuna.wst.stub.BAParticipantCompletionParticipantManagerStub;
 
@@ -76,9 +78,10 @@
     	try
     	{
             EndpointReferenceType baPMEndpoint = registerParticipant(participant, Protocols.BusinessAgreementWithParticipantCompletion);
-            ParticipantCompletionParticipantProcessor.getParticipant().activateParticipant(bap, id) ;
+            final ParticipantCompletionParticipantEngine engine = new ParticipantCompletionParticipantEngine(id, baPMEndpoint, bap) ;
+            ParticipantCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id) ;
     
-            return new BAParticipantCompletionParticipantManagerStub(id, baPMEndpoint);
+            return new BAParticipantCompletionParticipantManagerStub(engine);
     	}
     	catch (com.arjuna.wsc.InvalidProtocolException ex)
     	{
@@ -106,9 +109,10 @@
     	try
     	{
     	    EndpointReferenceType baPMEndpoint = registerParticipant(participant, Protocols.BusinessAgreementWithCoordinatorCompletion);
-            CoordinatorCompletionParticipantProcessor.getParticipant().activateParticipant(bawcp, id) ;
+            final CoordinatorCompletionParticipantEngine engine = new CoordinatorCompletionParticipantEngine(id, baPMEndpoint, bawcp) ;
+            CoordinatorCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id) ;
         
-            return new BACoordinatorCompletionParticipantManagerStub(id, baPMEndpoint);
+            return new BACoordinatorCompletionParticipantManagerStub(engine);
     	}
     	catch (com.arjuna.wsc.InvalidProtocolException ex)
     	{

Added: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java	2006-08-04 14:20:59 UTC (rev 5472)
@@ -0,0 +1,121 @@
+/*
+ * 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.mwlabs.wst.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.mw.wstx.logging.wstxLogger;
+import com.arjuna.webservices.util.ClassLoaderHelper;
+import com.arjuna.wst.PersistableParticipant;
+
+/**
+ * Helper class for persisting participants.
+ * @author kevin
+ */
+public class PersistableParticipantHelper
+{
+
+    /**
+     * Save the resource state.
+     * @param os The output object stream.
+     * @param resource The resource to persist.
+     * @return true if successful, false otherwise.
+     * @message com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_1 [com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_1] - Participant not persistable.
+     * @message com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_2 [com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_2] - Error persisting participant.
+     */
+    public static boolean save_state(final OutputObjectState os, final Object resource)
+    {
+        if (resource != null)
+        {
+            try
+            {
+                if (resource instanceof Serializable)
+                {
+                    os.packBoolean(true) ;
+                    final ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
+                    final ObjectOutputStream oos = new ObjectOutputStream(baos) ;
+                    oos.writeObject(resource) ;
+                    oos.flush() ;
+                    os.packBytes(baos.toByteArray()) ;
+                }
+                else if (resource instanceof PersistableParticipant)
+                {
+                    final PersistableParticipant participant = (PersistableParticipant)resource ;
+                    os.packBoolean(false) ;
+                    os.packString(resource.getClass().getName()) ;
+                    participant.saveState(os) ;
+                }
+                else
+                {
+                    wstxLogger.arjLoggerI18N.error("com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_1") ;
+                    return false ;
+                }
+                return true ;
+            }
+            catch(final Throwable th)
+            {
+                wstxLogger.arjLoggerI18N.error("com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_2", th) ;
+                return false ;
+            }
+        }
+        else
+            return false;
+    }
+
+    /**
+     * Restore the resource state.
+     * @param is The input object stream.
+     * @return The resource if successful, null otherwise.
+     * @message com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_3 [com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_3] - Error restoring participant.
+     */
+    public static Object restore_state(final InputObjectState ios)
+    {
+        try
+        {
+            final boolean serializable = ios.unpackBoolean() ;
+            if (serializable)
+            {
+                final ByteArrayInputStream bais = new ByteArrayInputStream(ios.unpackBytes()) ;
+                final ObjectInputStream ois = new ObjectInputStream(bais) ;
+                return ois.readObject() ;
+            }
+            else
+            {
+                final String className = ios.unpackString() ;
+                final Object resource = ClassLoaderHelper.forName(PersistableParticipantHelper.class, className) ;
+                ((PersistableParticipant)resource).restoreState(ios) ;
+                return resource ;
+            }
+        }
+        catch (final Throwable th)
+        {
+            wstxLogger.arjLoggerI18N.error("com.arjuna.mwlabs.wst.util.PersistableParticipantHelper_3", th) ;
+            return null ;
+        }
+    }
+
+}

Modified: labs/jbosstm/trunk/XTS/WSTX/config/wstx.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/config/wstx.xml	2006-08-04 12:48:02 UTC (rev 5471)
+++ labs/jbosstm/trunk/XTS/WSTX/config/wstx.xml	2006-08-04 14:20:59 UTC (rev 5472)
@@ -42,8 +42,9 @@
 	    <property
 	    name="com.arjuna.ats.arjuna.objectstore.objectStoreDir"
 	    value="XTSObjectStore"/>
-	    <!-- property
-	    name="com.arjuna.mw.wst.coordinatorURL"
-	    value="http://localhost:8080/xts/soap/ActivationCoordinator"/ -->
+
+	    <property
+	    name="com.arjuna.ats.arjuna.recovery.recoveryExtension1"
+	    value="com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule"/>
 	</properties>
 </wstx-config>




More information about the jboss-svn-commits mailing list