[jboss-svn-commits] JBL Code SVN: r14176 - in labs/jbosstm/workspace/baframework/trunk: demo and 13 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Aug 13 12:18:25 EDT 2007


Author: maciej.machulak
Date: 2007-08-13 12:18:25 -0400 (Mon, 13 Aug 2007)
New Revision: 14176

Added:
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/CoordinatorCompletion.png
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ParticipantCompletion.png
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawcc.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawpc.jsp
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/AgreementType.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompletedBy.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BADataManagement.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAMethod.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/DataMatch.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionMode.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionOrder.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/MethodType.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ParameterMatch.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyManagedData.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/ManagedData.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/ActionExecutionException.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodNotAccessibleException.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/DataManagement.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompletionNotifier.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyManagedDataFactory.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactory.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactoryImpl.java
Modified:
   labs/jbosstm/workspace/baframework/trunk/build.xml
   labs/jbosstm/workspace/baframework/trunk/demo/build.xml
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/author.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookcasino.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookfitness.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelcasino.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelfitness.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelmeal.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelpackage.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelroom.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/data.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/decreaserating.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/getpackage.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/index.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/initialise.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp
   labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/HotelService.java
   labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/Hotel.java
   labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelImpl.java
   labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/OrderEntityImpl.java
   labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensatedBy.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParam.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAResult.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAService.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ArgumentsProvider.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/CorbaExecution.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/DataProvider.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/EJBExecution.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalExecution.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RMIExecution.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceExecutor.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSConfiguredDII.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSUnconfiguredDII.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CoordinatorCompletionParticipant.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/Participant.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ParticipantCompletionParticipant.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescription.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescriptionImpl.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescription.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescriptionImpl.java
   labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceInformationManager.java
Log:
Version 0.2.0 of the Business Activity Framework:
- significant changes in the API (new BAFrameworkAPI document released)
- support for the Business Agreement With Coordinator Completion protocol
- restructured code

Modified: labs/jbosstm/workspace/baframework/trunk/build.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/build.xml	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/build.xml	2007-08-13 16:18:25 UTC (rev 14176)
@@ -103,8 +103,7 @@
         <jar jarfile="${build}/baframework-client.jar">
             <fileset dir="${build}/classes">
                 <include name="org/jboss/txbridge/ba/annotation/*.class"/>
-                <include name="org/jboss/txbridge/ba/compensation/CompensationManager.class"/>
-                <include name="org/jboss/txbridge/ba/compensation/CompensationManagerImpl.class"/>
+                <include name="org/jboss/txbridge/ba/datamgmt/DataManager.class"/>
             </fileset>
         </jar>
     </target>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/build.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/build.xml	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/build.xml	2007-08-13 16:18:25 UTC (rev 14176)
@@ -133,6 +133,7 @@
                 <include name="*.jsp"/>
                 <include name="*.css"/>
                 <include name="*.jpg"/>
+				<include name="*.png"/>
             </fileset>
         </war>
     </target>

Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/CoordinatorCompletion.png
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/CoordinatorCompletion.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ParticipantCompletion.png
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ParticipantCompletion.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -118,12 +120,14 @@
     increase the frameworks flexibility. For more information about the design of the framework and a more
     detailed description of its API please consider documents located on the framework's website at:
     <br><a href="http://labs.jboss.com/jbosstm/baframework/index.html">http://labs.jboss.com/jbosstm/baframework/index.html</a>
-    .<br>This website also includes a forum where all questions regarding framework's design or usage are welcome.
+    .<br>This website also includes a link to a forum where all questions regarding framework's design or usage are welcome.
     <br>
     <br>
     If no previous experience with extended transactions or Transactional Web Services is possesed, it is
     strongly adviced to familiarise with materials presented in the <b>References</b> section on this page.
-    Mostly [1] and [2] are recommended.
+    Mostly [1] and [2] are recommended.<br>
+	<br>
+	Links to abstract state diagrams of Agreement Protocols that are used in Business Activities:<a href="HotelService?page=bawpc.jsp"><i>BusinessAgreementWithParticipantCompletion</i></a> and <a href="HotelService?page=bawcc.jsp"><i>BusinessAgreementWithCoordinatorCompletion</i></a>
 </p>
 <p align="left">
     <b>Usage</b><br>
@@ -132,21 +136,22 @@
         <li>Initialise data on the server -> <a href="HotelService?page=initialise.jsp">click here</a>
         <li>Start the Business Activity -> <a href="HotelService?method=startBA&baRequest=true">click here</a>
         <li>Use any of provided BA Services
-        <li>End the Business Activity - by either <a href="HotelService?method=closeBA&baRequest=true">completing</a> or <a href="HotelService?method=cancelBA&baRequest=true">cancelling</a> the work.
+        <li>Complete the Business Activity (if "Book Fitness" service is used)
+        <li>End the Business Activity - by either closing or cancelling the work.
     </ul>
 </p>
 <p align="left">
     <b>BA-related code</b>
     <br>
     All services are implemented as methods of a stateless session bean (HotelImpl class) accessible through a remote interface (Hotel class)
-    and exposed as Web Services using the JSR-181 annotations. The HotelImpl class is annotated with the BACompensation annotation to provide
-    common information related to compensation actions.
+    and exposed as Web Services using the JSR-181 annotations. The HotelImpl class is annotated with the BAService annotation to provide
+    common information related to completion and compensation actions.
 </p>
 <p>
     <div id="code">
 <pre>
 //...<br>
-<span class="annotation">@BACompensation</span>(serviceClass=<span class="id">HotelImpl.class</span>,<br>
+<span class="annotation">@BAService</span>(serviceClass=<span class="id">HotelImpl.class</span>,<br>
 &#09;ejbInterface=<span class="id">Hotel.class</span>,<br>
 &#09;jndiName="<span class="id">bademo/HotelImpl/remote</span>")<br>
 public class HotelBAImpl implements HotelBA<br>
@@ -157,7 +162,7 @@
     </div>
 </p>
 <p align="left">
-    Some methods that are exposed as Web Services make use of the Compensation Manager component provided by the Business Activity framework as shown in the code below.
+    Some methods that are exposed as Web Services make use of the Data Manager component provided by the Business Activity framework as shown in the code below.
 </p>
 <p>
     <div id="code">
@@ -167,8 +172,8 @@
 public class HotelBAImpl implements HotelBA<br>
 {
 &#09;//...<br>
-&#09;<span class="annotation">@BACompensationManagement</span><br>
-&#09;<span class="id">CompensationManager</span> cm;<br>
+&#09;<span class="annotation">@BADataManager</span><br>
+&#09;<span class="id">DataManager</span> cm;<br>
 &#09;//...<br>
 }
 </pre>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/author.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/author.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/author.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -51,50 +51,52 @@
 
     ${requestScope.ACTIVE}
 
-    <div id="menu">
-        <p>
-            <a href="HotelService?page=index.jsp">Home</a><br>
-            <a href="HotelService?page=about.jsp">About Demo Application</a><br>
-            <a href="HotelService?page=author.jsp">About Author</a><br>
-        </p>
-        <hr>
-        <p>
-            <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
-            <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
-            <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
-        </p>
-        <hr>
-        <p>
-            <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
-        </p>
-        <hr>
-        <p>
-            <b>BA services:</b><br>
-            <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
-            <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
-            <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
-            <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
-            <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
-            <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
-            <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
-            <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
-        </p>
-        <hr>
-        <p>
-            <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
-            <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
-        </p>
-        <hr>
-        <p>
-            <b>Normal services:</b><br>
-            <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
-            <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
-            <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
-            <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
-            <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
-        </p>
-        <hr>
-    </div>
+<div id="menu">
+    <p>
+        <a href="HotelService?page=index.jsp">Home</a><br>
+        <a href="HotelService?page=about.jsp">About Demo Application</a><br>
+        <a href="HotelService?page=author.jsp">About Author</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
+        <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
+        <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=false" ${requestScope.ORDER}>Show orders</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>BA services:</b><br>
+        <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
+        <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
+        <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
+        <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
+        <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
+        <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
+        <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
+        <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
+        <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
+        <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>Normal services:</b><br>
+        <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
+        <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
+        <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
+        <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
+        <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
+    </p>
+    <hr>
+</div>
 
 
 

Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawcc.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawcc.jsp	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawcc.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2007, Red Hat Middleware LLC, and individual contributors
+as indicated by the @author tags.
+See the copyright.txt in the distribution for a full listing
+of individual contributors.
+This copyrighted material is made available to anyone wishing to use,
+modify, copy, or redistribute it subject to the terms and conditions
+of the GNU 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) 2007,
+ at author JBoss Inc.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <title>Business Activity Framework Demo Application</title>
+    <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
+    <meta http-equiv="content-language" content="en">
+    <meta name="author" content="Maciej Machulak">
+    <link rel="stylesheet" type="text/css" href="green.css"/>
+</head>
+<body>
+
+<div id="main">
+
+<div id="headerLeft">
+    <h1>Business Activity Framework Demo Application</h1>
+</div>
+
+<div id="headerRight">
+    <img src="jboss.jpg">
+</div>
+
+<div id="headerBottom">
+    Debug window (service return value):
+</div>
+
+<div id="headerDebug">
+    ${requestScope.DEBUG}
+</div>
+
+${requestScope.ACTIVE}
+
+<div id="menu">
+    <p>
+        <a href="HotelService?page=index.jsp">Home</a><br>
+        <a href="HotelService?page=about.jsp">About Demo Application</a><br>
+        <a href="HotelService?page=author.jsp">About Author</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
+        <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
+        <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>BA services:</b><br>
+        <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
+        <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
+        <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
+        <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
+        <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
+        <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
+        <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
+        <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
+        <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
+        <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>Normal services:</b><br>
+        <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
+        <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
+        <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
+        <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
+        <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
+    </p>
+    <hr>
+</div>
+
+
+<div id="body" align=center>
+
+<p align="left">
+    <b>Business Agreement With Coordinator Completion</b>
+</p>
+
+<p align="center">
+    <img src="CoordinatorCompletion.png">
+</p>
+
+</div>
+
+
+<div id="footer">
+    <p align=right>
+        &copy; JBoss, a division of Red Hat
+    </p>
+</div>
+
+</div>
+
+</body>
+</html>
\ No newline at end of file

Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawpc.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawpc.jsp	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bawpc.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2007, Red Hat Middleware LLC, and individual contributors
+as indicated by the @author tags.
+See the copyright.txt in the distribution for a full listing
+of individual contributors.
+This copyrighted material is made available to anyone wishing to use,
+modify, copy, or redistribute it subject to the terms and conditions
+of the GNU 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) 2007,
+ at author JBoss Inc.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <title>Business Activity Framework Demo Application</title>
+    <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
+    <meta http-equiv="content-language" content="en">
+    <meta name="author" content="Maciej Machulak">
+    <link rel="stylesheet" type="text/css" href="green.css"/>
+</head>
+<body>
+
+<div id="main">
+
+<div id="headerLeft">
+    <h1>Business Activity Framework Demo Application</h1>
+</div>
+
+<div id="headerRight">
+    <img src="jboss.jpg">
+</div>
+
+<div id="headerBottom">
+    Debug window (service return value):
+</div>
+
+<div id="headerDebug">
+    ${requestScope.DEBUG}
+</div>
+
+${requestScope.ACTIVE}
+
+<div id="menu">
+    <p>
+        <a href="HotelService?page=index.jsp">Home</a><br>
+        <a href="HotelService?page=about.jsp">About Demo Application</a><br>
+        <a href="HotelService?page=author.jsp">About Author</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
+        <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
+        <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>BA services:</b><br>
+        <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
+        <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
+        <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
+        <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
+        <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
+        <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
+        <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
+        <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
+        <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
+        <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>Normal services:</b><br>
+        <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
+        <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
+        <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
+        <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
+        <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
+    </p>
+    <hr>
+</div>
+
+
+<div id="body" align=center>
+
+<p align="left">
+    <b>Business Agreement With Participant Completion</b>
+</p>
+
+<p align="center">
+    <img src="ParticipantCompletion.png">
+</p>
+
+</div>
+
+
+<div id="footer">
+    <p align=right>
+        &copy; JBoss, a division of Red Hat
+    </p>
+</div>
+
+</div>
+
+</body>
+</html>
\ No newline at end of file

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookcasino.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookcasino.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookcasino.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -129,17 +131,21 @@
 </p>
 
 <p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
+<p align="left">
     <b>Method's signature</b><br>
 
     <div id="code">
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelCasinoToken</span>",<br>
-&#09;type=BACompensationType.<span class="enum">RETURN_VALUE</span>,<br>
-&#09;mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+&#09;type=DataMatch.<span class="enum">RETURN_VALUE</span>,<br>
+&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
 public Integer getCasinoToken(String username, String password, Integer amount)<br>
 <br>
 throws HotelCustomException
@@ -157,7 +163,7 @@
 <pre>
 {
 &#09;//...<br>
-&#09;cm.<span class="annotation">put</span>("<span class="id">refund</span>",amount/2);<br>
+&#09;dm.<span class="annotation">put</span>("<span class="id">refund</span>",amount/2);<br>
 &#09;//...<br>
 }
 </pre>
@@ -197,6 +203,11 @@
 </p>
 
 <p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+
+<p align="left">
     <b>Compensation action</b>
     <br>
     <a href="HotelService?page=cancelcasino.jsp">cancelCasinoToken()</a>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookfitness.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookfitness.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookfitness.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -138,13 +140,19 @@
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">COORDINATOR_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
+<span class="annotation">@BACompletedBy</span>(value="<span class="id">checkoutFitnessPass</span>",<br>
+&#09;match=DataMatch.<span class="enum">CUSTOM</span>,<br>
+&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelFitnessPass</span>",<br>
-&#09;type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>,<br>
-&#09;mode=BACompensationMode.<span class="enum">EJB</span>)<br>
-public boolean bookFitnessPass(String username, String password,<br>
-&#09;&#09;&#09;&#09;Integer reservationNumber, Integer amount)<br>
+&#09;type=DataMatch.<span class="enum">PARAMETERS_MATCH</span>,<br>
+&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
+ at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)<br>
+public boolean bookFitnessPass(<span class="annotation">@BAParam</span>("<span
+        class="id">username</span>")String username,<br>
+		<span class="annotation">@BAParam</span>("<span class="id">password</span>") String password,<br>
+		<span class="annotation">@BAParam</span>("<span class="id">reservationNumber</span>")Integer reservationNumber,<br>
+		Integer amount)<br>
 <br>
 throws HotelCustomException
 </pre>
@@ -160,7 +168,7 @@
         <b>Service description</b>
         <br>
         This service books a given number of Fitness Passes for the given reservation number. It must be executed within
-        a Business Activity.<br>
+        a Business Activity. All bookings for a given reservation are transient until the client decides to checkout.<br>
         This service takes following parameters:
         <ul align="left">
             <li>Username
@@ -186,7 +194,18 @@
         or the reservation number is incorrect (reservation does not exist).
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawcc.jsp">Business Agreement With Coordinator Completion</a>
+</p>
+
     <p align="left">
+        <b>Completion action</b>
+        <br>
+        checkoutFitnessPass() <i>(executed implicitly when Business Activity completes)</i>
+    </p>
+
+    <p align="left">
         <b>Compensation action</b>
         <br>
         <a href="HotelService?page=cancelfitness.jsp">cancelFitnessPass()</a>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -128,6 +130,11 @@
         com.jboss.ba.demo.service.HotelImpl
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
     <p align="left">
         <b>Method's signature</b><br>
 
@@ -135,11 +142,10 @@
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelRoom</span>",<br>
-&#09;type=BACompensationType.<span class="enum">CUSTOM</span>,<br>
-&#09;mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+&#09;type=DataMatch.<span class="enum">CUSTOM</span>,<br>
+&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
 <span class="annotation">@BAResult</span>("<span class="id">reservationNumber</span>")<br>
 public Integer bookRoom(<span class="annotation">@BAParam</span>("<span
         class="id">username</span>")String username,<span class="annotation">@BAParam</span>("<span
@@ -188,6 +194,11 @@
         occupied then RoomAlreadyOccupiedException is thrown.
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+
     <p align="left">
         <b>Compensation action</b>
         <br>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelcasino.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelcasino.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelcasino.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelfitness.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelfitness.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelfitness.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelmeal.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelmeal.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelmeal.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelpackage.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelpackage.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelpackage.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelroom.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelroom.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelroom.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/data.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/data.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/data.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -51,50 +51,52 @@
 
     ${requestScope.ACTIVE}
 
-    <div id="menu">
-        <p>
-            <a href="HotelService?page=index.jsp">Home</a><br>
-            <a href="HotelService?page=about.jsp">About Demo Application</a><br>
-            <a href="HotelService?page=author.jsp">About Author</a><br>
-        </p>
-        <hr>
-        <p>
-            <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
-            <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
-            <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
-        </p>
-        <hr>
-        <p>
-            <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
-        </p>
-        <hr>
-        <p>
-            <b>BA services:</b><br>
-            <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
-            <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
-            <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
-            <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
-            <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
-            <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
-            <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
-            <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
-        </p>
-        <hr>
-        <p>
-            <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
-            <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
-        </p>
-        <hr>
-        <p>
-            <b>Normal services:</b><br>
-            <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
-            <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
-            <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
-            <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
-            <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
-        </p>
-        <hr>
-    </div>
+<div id="menu">
+    <p>
+        <a href="HotelService?page=index.jsp">Home</a><br>
+        <a href="HotelService?page=about.jsp">About Demo Application</a><br>
+        <a href="HotelService?page=author.jsp">About Author</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
+        <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
+        <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>BA services:</b><br>
+        <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
+        <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
+        <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
+        <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
+        <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
+        <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
+        <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
+        <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
+    </p>
+    <hr>
+    <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
+        <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
+        <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
+    </p>
+    <hr>
+    <p>
+        <b>Normal services:</b><br>
+        <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
+        <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
+        <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
+        <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
+        <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
+    </p>
+    <hr>
+</div>
 
 
     <div id="body" align=center>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/decreaserating.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/decreaserating.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/decreaserating.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -128,6 +130,11 @@
         com.jboss.ba.demo.service.HotelImpl
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
     <p align="left">
         <b>Method's signature</b><br>
 
@@ -135,10 +142,9 @@
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">increaseHotelRating</span>",<br>
-&#09;type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>)<br>
+&#09;type=DataMatch..<span class="enum">PARAMETERS_MATCH</span>)<br>
 public void decreaseHotelRating(String username,String password,Integer points)<br>
 <br>
 throws HotelCustomException
@@ -174,8 +180,13 @@
     </p>
     <p align="left">
         HotelCustomException is thrown if the user cannot log in (username, password or both are incorrect).
-    </p>
+</p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+
     <p align="left">
         <b>Compensation action</b>
         <br>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/getpackage.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/getpackage.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/getpackage.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -129,6 +131,11 @@
         com.jboss.ba.demo.service.HotelImpl
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
     <p align="left">
         <b>Method's signature</b><br>
 
@@ -136,12 +143,11 @@
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelComplimentaryPackageNumber</span>",<br>
 &#09;single=<span class="id">true</span>,<br>
-&#09;type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>)<br>
-&#09;mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+&#09;type=DataMatch..<span class="enum">PARAMETERS_MATCH</span>)<br>
+&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
 public Integer getComplimentaryPackageNumber(String username, String password,<br>
 Integer reservationNumber)<br>
 <br>
@@ -189,7 +195,12 @@
         or the reservation number is incorrect (reservation does not exist).
     </p>
 
-    <p align="left">
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+	
+	<p align="left">
         <b>Compensation action</b>
         <br>
         <a href="HotelService?page=cancelpackage.jsp">cancelComplimentaryPackageNumber()</a>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -115,6 +117,11 @@
         com.jboss.ba.demo.service.HotelImpl
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
     <p align="left">
         <b>Method's signature</b><br>
 
@@ -122,7 +129,7 @@
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">READONLY</span>,BAAgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">READONLY</span>)<br>
 public String getHotelInfo()
 </pre>
 
@@ -147,7 +154,13 @@
             <li>Service description
         </ul>
     </p>
-    <p align="left">
+
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+	
+	<p align="left">
         <b>Compensation action</b>
         <br>
         None

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -128,6 +130,11 @@
         com.jboss.ba.demo.service.HotelImpl
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
     <p align="left">
         <b>Method's signature</b><br>
 
@@ -135,10 +142,9 @@
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">decreaseHotelRating</span>",<br>
-&#09;type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>)<br>
+&#09;type=DataMatch.<span class="enum">PARAMETERS_MATCH</span>)<br>
 public void increaseHotelRating(String username,String password,Integer points)<br>
 <br>
 throws HotelCustomException
@@ -176,6 +182,11 @@
         HotelCustomException is thrown if the user cannot log in (username, password or both are incorrect).
     </p>
 
+<p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+
     <p align="left">
         <b>Compensation action</b>
         <br>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/index.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/index.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/index.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -37,6 +37,11 @@
     {
         showAttr = "/><a";
     }
+    String orderAttr = (String) request.getAttribute("ORDER");
+    if (orderAttr == null)
+    {
+        orderAttr = "/><a";
+    }
     String beginAttr = (String) request.getAttribute("BEGIN");
     if (beginAttr == null)
     {
@@ -47,6 +52,11 @@
     {
         baServiceAttr = "/><a";
     }
+    String completeAttr = (String) request.getAttribute("COMPLETE");
+    if (completeAttr == null)
+    {
+        completeAttr = "/><a";
+    }
     String closeAttr = (String) request.getAttribute("CLOSE");
     if (closeAttr == null)
     {
@@ -107,6 +117,7 @@
         <a href="HotelService?page=initialise.jsp" <%=initialiseAttr%>>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" <%=dropAttr%>>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" <%=showAttr%>>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" <%=orderAttr%>>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -126,6 +137,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true"<%=completeAttr%>>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" <%=closeAttr%>>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" <%=cancelAttr%>>Cancel Business Activity</a><br>
     </p>
@@ -165,7 +177,8 @@
             <li>Initialise data on the server -> <a href="HotelService?page=initialise.jsp">click here</a>
             <li>Start the Business Activity -> <a href="HotelService?method=startBA&baRequest=true">click here</a>
             <li>Use any of provided BA Services
-            <li>End the Business Activity - by either <a href="HotelService?method=closeBA&baRequest=true">completing</a> or <a href="HotelService?method=cancelBA&baRequest=true">cancelling</a> the work.
+            <li>Complete the Business Activity (if "Book Fitness" service is used)
+            <li>End the Business Activity - by either closing or cancelling the work.
         </ul>
     </p>
     <p align="left">
@@ -173,8 +186,8 @@
 
     </p>
     <p align="left">
-        BA Framework version: 0.1.0<br>
-        BA Demo Application version: 0.1.0<br>
+        BA Framework version: 0.2.0<br>
+        BA Demo Application version: 0.2.0<br>
     </p>
     <p align="center">
         <a href="http://labs.jboss.com/jbosstm/baframework">http://labs.jboss.com/jbosstm/baframework</a><br>
@@ -182,7 +195,7 @@
         <br>
         Maciej Machulak<br>
         <a href="mailto:mmachulak-at-redhat.com">mmachulak-at-redhat.com</a><br>
-        August 03, 2007<br>
+        August 13, 2007<br>
         JBoss, a division of Red Hat.
     </p>
 

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/initialise.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/initialise.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/initialise.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp	2007-08-13 16:18:25 UTC (rev 14176)
@@ -62,6 +62,7 @@
         <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
         <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
         <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
+        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
     </p>
     <hr>
     <p>
@@ -81,6 +82,7 @@
     </p>
     <hr>
     <p>
+        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
         <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
         <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
     </p>
@@ -129,17 +131,21 @@
 </p>
 
 <p align="left">
+    <b>Agreement Protocol</b><br>
+    Business Agreement With Participant Completion
+</p>
+
+<p align="left">
     <b>Method's signature</b><br>
 
     <div id="code">
 
 <pre>
 @WebMethod<br>
-<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
-        class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
 <span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelMeal</span>",<br>
-&#09;type=BACompensationType.<span class="enum">CUSTOM</span>,<br>
-&#09;mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+&#09;type=DataMatch.<span class="enum">CUSTOM</span>,<br>
+&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
 public MealOrder orderMeal(<span class="annotation">@BAParam</span>("<span class="id">user</span>")String username,<br>
 &#09;<span class="annotation">@BAParam</span>("<span class="id">password</span>")String password, Integer reservationNumber)<br>
 <br>
@@ -158,7 +164,7 @@
 <pre>
 {
 &#09;//...<br>
-&#09;cm.<span class="annotation">put</span>("<span class="id">order</span>",orderId);<br>
+&#09;dm.<span class="annotation">put</span>("<span class="id">order</span>",orderId);<br>
 &#09;//...<br>
 }
 </pre>
@@ -199,7 +205,13 @@
         <li>Complex object representing a meal order
     </ul>
 </p>
+
 <p align="left">
+    <b>Agreement Protocol</b><br>
+    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
+</p>
+
+<p align="left">
     <b>Compensation action</b>
     <br>
     <a href="HotelService?page=cancelmeal.jsp">cancelMeal()</a>

Modified: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/HotelService.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/HotelService.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/HotelService.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -188,6 +188,10 @@
                             {
                                 methodResponse = getHotelInfo();
                             }
+                            else if (methodName.equals("getHotelOrders"))
+                            {
+                                methodResponse = getHotelOrders();
+                            }
                             else if (methodName.equals("increaseHotelRating"))
                             {
                                 if (increaseHotelRating(parameters))
@@ -213,6 +217,7 @@
                             else if (methodName.equals("bookRoom"))
                             {
                                 methodResponse = bookRoom(parameters).toString();
+                                state = 3;
                             }
                             else if (methodName.equals("bookFitnessPass"))
                             {
@@ -248,6 +253,12 @@
                                     methodResponse = "false";
                                 }
                             }
+                            else if (methodName.equals("completeBA"))
+                            {
+                                completeBusinessActivity(uba);
+                                methodResponse = "Transaction completed successfully.";
+                                state = 2;
+                            }
                             else if (methodName.equals("closeBA"))
                             {
                                 closeBusinessActivity(uba);
@@ -421,8 +432,10 @@
         String initialiseResponse = "";
         String dropResponse = "";
         String showResponse = "";
+        String orderResponse = "";
         String beginResponse = "";
         String baserviceResponse = "";
+        String completeResponse = "";
         String closeResponse = "";
         String cancelResponse = "";
         String serviceResponse = "";
@@ -432,8 +445,10 @@
             initialiseResponse = "";
             dropResponse = "/><a";
             showResponse = "/><a";
+            orderResponse = "/><a";
             beginResponse = "/><a";
             baserviceResponse = "/><a";
+            completeResponse = "/><a";
             closeResponse = "/><a";
             cancelResponse = "/><a";
             serviceResponse = "/><a";
@@ -444,8 +459,10 @@
             initialiseResponse = "/><a";
             dropResponse = "";
             showResponse = "";
+            orderResponse = "/><a";
             beginResponse = "";
             baserviceResponse = "/><a";
+            completeResponse = "/><a";
             closeResponse = "/><a";
             cancelResponse = "/><a";
             serviceResponse = "";
@@ -456,19 +473,37 @@
             initialiseResponse = "/><a";
             dropResponse = "/><a";
             showResponse = "";
+            orderResponse = "";
             beginResponse = "/><a";
             baserviceResponse = "";
+            completeResponse = "/><a";
             closeResponse = "";
             cancelResponse = "";
             serviceResponse = "/><a";
         }
+        else if ( state == 3 )
+        {
+            // Coordinator completion method has been used
+            initialiseResponse = "/><a";
+            dropResponse = "/><a";
+            showResponse = "";
+            orderResponse = "";
+            beginResponse = "/><a";
+            baserviceResponse = "";
+            completeResponse = "";
+            closeResponse = "/><a";
+            cancelResponse = "";
+            serviceResponse = "/><a";
+        }
 
         theSession.setAttribute("state",state);
         request.setAttribute("INITIALISE",initialiseResponse);
         request.setAttribute("DROP",dropResponse);
         request.setAttribute("SHOW",showResponse);
+        request.setAttribute("ORDER",orderResponse);
         request.setAttribute("BEGIN",beginResponse);
         request.setAttribute("BASERVICE",baserviceResponse);
+        request.setAttribute("COMPLETE",completeResponse);
         request.setAttribute("CLOSE",closeResponse);
         request.setAttribute("CANCEL",cancelResponse);
         request.setAttribute("SERVICE",serviceResponse);
@@ -486,6 +521,11 @@
         return hotel.getHotelData();
     }
 
+    private String getHotelOrders()
+    {
+        return hotel.getHotelOrders();
+    }
+
     private void dropHotelData()
     {
         hotel.dropHotelData();
@@ -507,6 +547,13 @@
         return uba;
     }
 
+    private void completeBusinessActivity(UserBusinessActivity uba)
+            throws SystemException, WrongStateException, UnknownTransactionException, TransactionRolledBackException
+    {
+        // Completeing the transaction
+        uba.complete();
+    }
+
     private void closeBusinessActivity(UserBusinessActivity uba)
             throws SystemException, WrongStateException, UnknownTransactionException, TransactionRolledBackException
     {

Modified: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/Hotel.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/Hotel.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/Hotel.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -20,6 +20,8 @@
  */
 package com.jboss.ba.demo.service;
 
+import org.jboss.txbridge.ba.annotation.BAParam;
+
 import javax.jws.WebService;
 
 /**
@@ -46,6 +48,7 @@
     // * parameters match
     public boolean bookFitnessPass(String username, String password, Integer reservationNumber, Integer amount) throws HotelCustomException;
     public boolean cancelFitnessPass(String username, String password, Integer reservationNumber, Integer amount) throws HotelCustomException;
+    public boolean checkoutFitnessPass(String username, String password, Integer reservationNumber);
     // * return value
     public Integer getCasinoToken(String username,String password, Integer amount) throws HotelCustomException;
     public boolean cancelCasinoToken(Integer token) throws HotelCustomException;
@@ -64,5 +67,6 @@
     public void compensationView(boolean value);
     public void resetView();
     public String getHotelData();
+    public String getHotelOrders();
 
 }

Modified: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelImpl.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelImpl.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,18 +22,17 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.annotation.*;
-import org.jboss.txbridge.ba.compensation.CompensationManager;
+import org.jboss.txbridge.ba.datamgmt.DataManager;
 
-import javax.persistence.PersistenceContext;
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
+import javax.persistence.*;
 import javax.jws.WebMethod;
 import javax.jws.WebService;
 import javax.jws.HandlerChain;
 import javax.jws.soap.SOAPBinding;
 import javax.ejb.Stateless;
 import javax.ejb.Remote;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
 
 import java.util.*;
 
@@ -54,7 +53,7 @@
 @WebService(name="Hotel")
 @SOAPBinding(style = SOAPBinding.Style.RPC)
 @HandlerChain(file = "jaxws-handlers-server.xml")
- at BACompensation(serviceClass=HotelImpl.class,ejbInterface=Hotel.class,jndiName="bademo/HotelImpl/remote")
+ at BAService(serviceClass=HotelImpl.class,ejbInterface=Hotel.class,jndiName="bademo/HotelImpl/remote")
 public class HotelImpl implements Hotel
 {
     // Logger
@@ -72,8 +71,8 @@
     @PersistenceContext(unitName="hotelPC")
     protected EntityManager em;
 
-    @BACompensationManagement
-    private CompensationManager cm;
+    @BADataManagement
+    private DataManager dm;
 
     public HotelImpl()
     {
@@ -103,7 +102,7 @@
         {
             log.info(i);
             RoomEntityImpl room = new RoomEntityImpl();
-			room.setRoomNumber(i+1);
+            room.setRoomNumber(i+1);
             room.setRoomName("Room " + (i+1));
             em.persist(room);
         }
@@ -197,7 +196,26 @@
     }
 
     @WebMethod
-    @BAService(type= BAServiceType.READONLY)
+    public String getHotelOrders()
+    {
+        log.info("getHotelOrders()");
+
+        hotelView.newMethod("getHotelOrders()");
+        // Display orders
+        StringBuffer sb = new StringBuffer();
+        List<OrderEntityImpl> orders = getOrders();
+        for (OrderEntityImpl order : orders)
+        {
+            sb.append("(");
+            sb.append(order.toString());
+            sb.append(") ");
+        }
+        hotelView.endMethod();
+        return sb.toString();
+    }
+
+    @WebMethod
+    @BAMethod(type= MethodType.READONLY)
     public String getHotelInfo()
     {
         log.info("getHotelInfo()");
@@ -210,8 +228,8 @@
     }
 
     @WebMethod
-    @BAService(agreement=BAAgreementType.PARTICIPANT_COMPLETION)
-    @BACompensatedBy(value="decreaseHotelRating",type=BACompensationType.PARAMETERS_MATCH)
+    @BAMethod(agreement=AgreementType.PARTICIPANT_COMPLETION)
+    @BACompensatedBy(value="decreaseHotelRating",type=DataMatch.PARAMETERS_MATCH)
     public boolean increaseHotelRating(String username,String password, Integer points)
     {
         log.info("increaseHotelRating()");
@@ -228,8 +246,8 @@
     }
 
     @WebMethod
-    @BAService(agreement=BAAgreementType.PARTICIPANT_COMPLETION)
-    @BACompensatedBy(value="increaseHotelRating",type=BACompensationType.PARAMETERS_MATCH)
+    @BAMethod(agreement=AgreementType.PARTICIPANT_COMPLETION)
+    @BACompensatedBy(value="increaseHotelRating",type=DataMatch.PARAMETERS_MATCH)
     public boolean decreaseHotelRating(String username,String password, Integer points)
     {
         log.info("decreaseHotelRating()");
@@ -246,8 +264,8 @@
     }
 
     @WebMethod
-    @BAService
-    @BACompensatedBy(value="cancelRoom",type=BACompensationType.CUSTOM)
+    @BAMethod(agreement=AgreementType.PARTICIPANT_COMPLETION)
+    @BACompensatedBy(value="cancelRoom",type=DataMatch.CUSTOM)
     @BAResult("reservationNumber")
     public Integer bookRoom(@BAParam("username")String username, at BAParam("password")String password, Integer roomNumber)
             throws HotelCustomException, RoomAlreadyOccupiedException
@@ -320,8 +338,8 @@
     }
 
     @WebMethod
-    @BAService
-    @BACompensatedBy(value="cancelComplimentaryPackageNumber",single=true,type=BACompensationType.PARAMETERS_MATCH)
+    @BAMethod
+    @BACompensatedBy(value="cancelComplimentaryPackageNumber",single=true,type=DataMatch.PARAMETERS_MATCH)
     public Integer getComplimentaryPackageNumber(String username, String password, Integer reservationNumber)
             throws HotelCustomException
     {
@@ -333,7 +351,7 @@
         CustomerEntityImpl customer = getCustomer(username,password);
         if (customer == null)
         {
-            hotelView.addMessage("Reservation incorrect - throwing exception");
+            hotelView.addMessage("Login incorrect - throwing exception");
             throw new HotelCustomException("Login incorrect");
         }
         OrderEntityImpl order = getReservation(reservationNumber);
@@ -366,7 +384,7 @@
         CustomerEntityImpl customer = getCustomer(username,password);
         if (customer == null)
         {
-            hotelView.addMessage("Reservation incorrect - throwing exception");
+            hotelView.addMessage("Login incorrect - throwing exception");
             throw new HotelCustomException("Login incorrect");
         }
         OrderEntityImpl order = getReservation(reservationNumber);
@@ -382,9 +400,10 @@
     }
 
     @WebMethod
-    @BAService
-    @BACompensatedBy(value="cancelFitnessPass",type=BACompensationType.PARAMETERS_MATCH)
-    public boolean bookFitnessPass(String username, String password, Integer reservationNumber, Integer amount)
+    @BAMethod(agreement=AgreementType.COORDINATOR_COMPLETION)
+    @BACompletedBy(value="checkoutFitnessPass",type=DataMatch.CUSTOM)
+    @BACompensatedBy(value="cancelFitnessPass",type=DataMatch.PARAMETERS_MATCH)
+    public boolean bookFitnessPass(@BAParam("username")String username, at BAParam("password")String password, at BAParam("reservationNumber")Integer reservationNumber, Integer amount)
             throws HotelCustomException
     {
         log.info("bookFitnessPass()");
@@ -396,9 +415,10 @@
         CustomerEntityImpl customer = getCustomer(username,password);
         if (customer == null)
         {
-            hotelView.addMessage("Reservation incorrect - throwing exception");
+            hotelView.addMessage("Login incorrect - throwing exception");
             throw new HotelCustomException("Login incorrect");
         }
+        hotelView.addMessage("Getting Reservation");
         OrderEntityImpl order = getReservation(reservationNumber);
         if (order == null)
         {
@@ -417,6 +437,21 @@
         return true;
     }
 
+    @TransactionAttribute(TransactionAttributeType.MANDATORY)
+    public boolean checkoutFitnessPass(@BAParam("username") String username, @BAParam("password") String password, @BAParam("reservationNumber") Integer reservationNumber)
+    {
+        log.info("checkoutFitnessPass()");
+        hotelView.newMethod("checkoutFitnessPass()");
+        hotelView.addMessage("Username: " + username);
+        hotelView.addMessage("Password: " + password);
+        hotelView.addMessage("Reservation no: " + reservationNumber);
+        hotelView.addMessage("Validating fitness passes...");
+        // TODO: Implement...
+        hotelView.addMessage("Returning true");
+        hotelView.endMethod();
+        return true;
+    }
+
     @WebMethod
     public boolean cancelFitnessPass(String username, String password, Integer reservationNumber, Integer amount)
             throws HotelCustomException
@@ -430,7 +465,7 @@
         CustomerEntityImpl customer = getCustomer(username,password);
         if (customer == null)
         {
-            hotelView.addMessage("Reservation incorrect - throwing exception");
+            hotelView.addMessage("Login incorrect - throwing exception");
             throw new HotelCustomException("Login incorrect");
         }
         OrderEntityImpl order = getReservation(reservationNumber);
@@ -451,7 +486,7 @@
     }
 
     @WebMethod
-    @BAService
+    @BAMethod
     @BACompensatedBy("cancelCasinoToken")
     public Integer getCasinoToken(String username, String password, Integer amount)
             throws HotelCustomException
@@ -464,7 +499,7 @@
         CustomerEntityImpl customer = getCustomer(username,password);
         if (customer == null)
         {
-            hotelView.addMessage("Reservation incorrect - throwing exception");
+            hotelView.addMessage("Login incorrect - throwing exception");
             throw new HotelCustomException("Login incorrect");
         }
         Integer token = Math.abs(randomGenerator.nextInt());
@@ -473,7 +508,7 @@
         // TODO: Implement 
         //
 
-        cm.put("refund",amount/2);
+        dm.put("refund",amount/2);
 
         hotelView.addMessage("Returning token: " + token);
         hotelView.endMethod();
@@ -494,7 +529,7 @@
         // ... if not - throw an exception
         // ... if yes - invalidate it
 
-        Integer refund = (Integer) cm.get("refund");
+        Integer refund = (Integer) dm.get("refund");
         if (refund != null)
         {
             hotelView.addMessage("Refund given: " + refund);
@@ -505,8 +540,8 @@
     }
 
     @WebMethod
-    @BAService
-    @BACompensatedBy(value="cancelMeal",type=BACompensationType.CUSTOM)
+    @BAMethod
+    @BACompensatedBy(value="cancelMeal",type=DataMatch.CUSTOM)
     public MealOrder orderMeal(@BAParam("user")String username, at BAParam("password")String password, at BAParam("reservation")Integer reservationNumber)
             throws HotelCustomException
     {
@@ -535,7 +570,7 @@
         mealOrder.setName("Some name");
 
         // BA-related code - BEGIN
-        cm.put("order",orderNumber);
+        dm.put("order",orderNumber);
         // BA-related code - END
 
         order.addMealOrder(mealOrder);
@@ -580,8 +615,8 @@
     }
 
     @WebMethod
-    @BAService
-    @BACompensatedBy(value="cancelExtraMiniBar",type=BACompensationType.PARAMETERS_MATCH)
+    @BAMethod
+    @BACompensatedBy(value="cancelExtraMiniBar",type=DataMatch.PARAMETERS_MATCH)
     public boolean orderExtraMiniBar(String username, String password, Integer reservationNumber)
             throws HotelCustomException
     {
@@ -633,7 +668,6 @@
         return true;
     }
 
-
     private List<CustomerEntityImpl> getCustomers()
     {
         return em.createQuery("select C from CustomerEntityImpl C").getResultList();
@@ -644,6 +678,11 @@
         return em.createQuery("select C from RoomEntityImpl C").getResultList();
     }
 
+    private List<OrderEntityImpl> getOrders()
+    {
+        return em.createQuery("select C from OrderEntityImpl C").getResultList();
+    }
+
     private CustomerEntityImpl getCustomer(String username, String password)
     {
         try

Modified: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/OrderEntityImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/OrderEntityImpl.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/OrderEntityImpl.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -151,9 +151,9 @@
         sb.append("ID: ").append(id);
         sb.append(" Customer: ").append(customer.getUsername());
         sb.append(" Room: ").append(room.getRoomName());
+        sb.append(" Fitness: ").append(fitnessPass);
         sb.append(" Free pack: ").append(freePack);
         sb.append(" Casino Tokens: ").append(casinoTokens);
-        sb.append(" Extra mini bar: ").append(extraMiniBar);
         return sb.toString();
     }
 }

Modified: labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml	2007-08-13 16:18:25 UTC (rev 14176)
@@ -27,10 +27,10 @@
     <typedef name="baPackageTypedef" expr="class(org.jboss.txbridge.ba.*)"/>
 
     <!-- Specification of the pointcuts -->
-    <pointcut name="baServiceAnnotation" expr="execution(* *->@org.jboss.txbridge.ba.annotation.BAService(..))"/>
+    <pointcut name="baServiceAnnotation" expr="execution(* *->@org.jboss.txbridge.ba.annotation.BAMethod(..))"/>
 
 
-    <pointcut name="baCompensationManagement" expr="field(org.jboss.txbridge.ba.compensation.CompensationManager *->@org.jboss.txbridge.ba.annotation.BACompensationManagement)"/>
+    <pointcut name="baCompensationManagement" expr="field(org.jboss.txbridge.ba.datamgmt.DataManager *->@org.jboss.txbridge.ba.annotation.BADataManagement)"/>
 
     <!-- BA Processing Aspect -->
     <aspect class="org.jboss.txbridge.ba.aspect.JaxWSBAProcessingAspect" scope="PER_INSTANCE"/>

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -152,7 +152,7 @@
                 // If service is unknown - process it
                 // May throw:
                 // - MethodIncorrectlyAnnotatedException
-                // - CompensationMethodNotAccessible
+                // - MethodNotAccessibleException
                 // TODO: Processing services and checking should be done during deployment time
                 log.info("Service unknown - processing");
                 serviceManager.storeServiceDescription(BAServiceVisitor.processMethod(method));
@@ -211,7 +211,7 @@
     }
 
     /**
-     * This method compensates a transaction with a given ID. It delegates the compensation management
+     * This method compensates a transaction with a given ID. It delegates the datamgmt management
      * to an appropriate single transaction manager.
      *
      * @param txId is the ID of the transaction which should be compensated.
@@ -229,7 +229,7 @@
             return;
         }
 
-        // Execute compensation
+        // Execute datamgmt
         log.info("Compensating tasks");
         singleTransactionManager.compensate();
         log.info("Compensation completed.");
@@ -260,12 +260,12 @@
     /**
      * This method completes the invocation of a service within a scope of a transaction. It is responsible
      * for remembering necessary arguments that were passed to this service and a return object (those objects
-     * may be used later if compensation action is being invoked).
+     * may be used later if datamgmt action is being invoked).
      *
      * @param taskDesc describes the task.
      * @param arguments is the list of the arguments for this service.
      * @param returnObject is the return object of this service.
-     * @throws org.jboss.txbridge.ba.exception.TransactionProcessingException if it was impossible to complete invocation.
+     * @throws org.jboss.txbridge.ba.exception.TransactionProcessingException if it was impossible to completeTask invocation.
      */
     public synchronized void completeInvocation(TaskDescription taskDesc, Object[] arguments, Object returnObject)
             throws TransactionProcessingException
@@ -294,7 +294,7 @@
     }
 
     /**
-     * This method is invoked if the business logic could not complete and the fault
+     * This method is invoked if the business logic could not completeTask and the fault
      * is to be propagated to the client. It removes information about this task.
      *
      * @param taskDesc is the description of the task.

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -36,11 +36,12 @@
 import org.jboss.txbridge.ba.participant.*;
 import org.jboss.txbridge.ba.participant.Participant;
 import org.jboss.txbridge.ba.service.ServiceInformationManager;
+import org.jboss.txbridge.ba.service.MethodDescription;
 import org.jboss.txbridge.ba.exception.TransactionProcessingException;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
-import org.jboss.txbridge.ba.annotation.BAServiceType;
-import org.jboss.txbridge.ba.annotation.BAAgreementType;
-import org.jboss.txbridge.ba.annotation.BACompensationType;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.annotation.MethodType;
+import org.jboss.txbridge.ba.annotation.AgreementType;
+import org.jboss.txbridge.ba.annotation.DataMatch;
 import org.apache.log4j.Logger;
 
 /**
@@ -66,6 +67,9 @@
     // Transaction identifier
     private String txId;
 
+    // Completed transaction
+    private boolean transactionCompleted;
+
     // List of tasks for this transaction
     private List<String> taskList;
 
@@ -93,6 +97,8 @@
     // (participant , participant manager) mapping - for coordinator completion
     private ConcurrentMap<Participant,BAParticipantManager> participantManagerMapping;
 
+
+
     public SingleTransactionManager(String txId)
     {
         log.info("constructor()");
@@ -130,6 +136,9 @@
         // Initialise (participant, participant manager mapping)
         participantManagerMapping = new ConcurrentHashMap<Participant,BAParticipantManager>();
 
+        // By default transaction is not completed
+        transactionCompleted = false;
+
     }
 
     /**
@@ -171,47 +180,32 @@
             // 2) Get the participant - if null then create a new one
             log.info("Checking for participant...");
             Participant participant = serviceParticipantMapping.get(serviceId);
-            boolean participantCreated = (participant == null);
+            boolean participantCreated = !(participant == null);
             if ( participant == null )
             {
                 log.info("Participant for this transaction and this service is unknown");
 
                 // Create a new participant
-                // 1) Determine the compensation data factory that should be used
-                CompensationDataFactory cdf;
-                BACompensationType compensationType = sd.getCompensationType();
-                BAServiceType serviceType = sd.getServiceType();
-                if (compensationType == BACompensationType.CUSTOM)
+                // 1) Determine the datamgmt data factory that should be used
+                ManagedDataFactory cdf;
+                DataMatch compensationType = sd.getDataMatch();
+                MethodType serviceType = sd.getMethodType();
+                cdf = new ManagedDataFactoryImpl();
+                if (serviceType == MethodType.READONLY)
                 {
-                    cdf = new CompensationDataCustomFactory();
+                    cdf = new DummyManagedDataFactory();
                 }
-                else if (compensationType == BACompensationType.PARAMETERS_MATCH)
-                {
-                    cdf = new CompensationDataParamFactory();
-                }
-                else if (compensationType == BACompensationType.RETURN_VALUE)
-                {
-                    cdf = new CompensationDataReturnFactory();
-                }
-                else if (serviceType == BAServiceType.READONLY)
-                {
-                    cdf = new DummyCompensationDataFactory();
-                }
-                else
-                {
-                    throw new TransactionProcessingException("Unsupported compensation type: " + compensationType);
-                }
                 // 2) Create the participant
                 log.info("Creating a new participant");
-                BAAgreementType agreementType = sd.getAgreementType();
-                if (agreementType == BAAgreementType.PARTICIPANT_COMPLETION)
+                AgreementType agreementType = sd.getAgreementType();
+                if (agreementType == AgreementType.PARTICIPANT_COMPLETION)
                 {
-                    log.info("Agreement protocol type: " + BAAgreementType.PARTICIPANT_COMPLETION);
+                    log.info("Agreement protocol type: " + AgreementType.PARTICIPANT_COMPLETION);
                     participant = new ParticipantCompletionParticipant(txId,serviceId,this,cdf);
                 }
-                else if (agreementType == BAAgreementType.COORDINATOR_COMPLETION)
+                else if (agreementType == AgreementType.COORDINATOR_COMPLETION)
                 {
-                    log.info("Agreement protocol type: " + BAAgreementType.COORDINATOR_COMPLETION);
+                    log.info("Agreement protocol type: " + AgreementType.COORDINATOR_COMPLETION);
                     participant = new CoordinatorCompletionParticipant(txId,serviceId,this,cdf);
                 }
                 else
@@ -227,18 +221,18 @@
             // Check the required agreement protocol and enlist the participant
             log.info("Enlisting participant if necessary");
             BAParticipantManager participantManager;
-            if (sd.getAgreementType() == BAAgreementType.PARTICIPANT_COMPLETION)
+            if (sd.getAgreementType() == AgreementType.PARTICIPANT_COMPLETION)
             {
-                log.info("Protocol: " + BAAgreementType.PARTICIPANT_COMPLETION);
+                log.info("Protocol: " + AgreementType.PARTICIPANT_COMPLETION);
                 participantManager = businessActivityManager.enlistForBusinessAgreementWithParticipantCompletion((BusinessAgreementWithParticipantCompletionParticipant)participant,new Uid().toString());
 
                 // Remember the participant manager for this specific participant
                 log.info("Storing reference to the participant manager for task: " + taskId);
                 taskBAManagerMapping.put(taskId,participantManager);
             }
-            else if (sd.getAgreementType() == BAAgreementType.COORDINATOR_COMPLETION)
+            else if (sd.getAgreementType() == AgreementType.COORDINATOR_COMPLETION)
             {
-                log.info("Protocol: " + BAAgreementType.COORDINATOR_COMPLETION);
+                log.info("Protocol: " + AgreementType.COORDINATOR_COMPLETION);
                 if (!participantCreated)
                 {
                     participantManager = businessActivityManager.enlistForBusinessAgreementWithCoordinatorCompletion((BusinessAgreementWithCoordinatorCompletionParticipant)participant,new Uid().toString());
@@ -313,15 +307,19 @@
             throw new TransactionProcessingException("No service description");
         }
 
+        // Get method descriptions
+        MethodDescription completeMethod = sd.getCompletionService();
+        MethodDescription compensateMethod = sd.getCompensationService();
+
         // Get reference to the participant
         Participant participant = taskDesc.getParticipant();
         String taskId = taskDesc.getTaskId();
 
         // Remember necessary data basing upon the service type
-        BAServiceType serviceType = sd.getServiceType();
-        if (serviceType == BAServiceType.MODIFY)
+        MethodType serviceType = sd.getMethodType();
+        if (serviceType == MethodType.MODIFY)
         {
-            if (sd.getCompensationType() == BACompensationType.CUSTOM)
+            if (completeMethod.getDataMatch() == DataMatch.CUSTOM || compensateMethod.getDataMatch() == DataMatch.CUSTOM)
             {
 
                 // 2) Get the annotation values
@@ -349,12 +347,12 @@
                     participant.put(taskId,returnId,returnObject);
                 }
             }
-            else if (sd.getCompensationType() == BACompensationType.PARAMETERS_MATCH)
+            if (completeMethod.getDataMatch() == DataMatch.PARAMETERS_MATCH || compensateMethod.getDataMatch() == DataMatch.PARAMETERS_MATCH)
             {
                 log.info("Remembering arguments");
                 participant.putArguments(taskId,arguments);
             }
-            else if (sd.getCompensationType() == BACompensationType.RETURN_VALUE)
+            if (completeMethod.getDataMatch() == DataMatch.RETURN_VALUE || compensateMethod.getDataMatch() == DataMatch.RETURN_VALUE)
             {
                 log.info("Remembering return value");
                 participant.putReturn(taskId,returnObject);
@@ -362,10 +360,10 @@
 
         }
 
-        if (sd.getAgreementType() == BAAgreementType.PARTICIPANT_COMPLETION)
+        if (sd.getAgreementType() == AgreementType.PARTICIPANT_COMPLETION)
         {
             log.info("Completeing work");
-            complete(taskId,serviceType);
+            completeTask(taskId,serviceType);
         }
         else
         {
@@ -376,29 +374,30 @@
     /**
      * This method completes the work done by the given participant within a certain transaction.
      *
-     * @param taskId is the participant which wants to complete its work.
+     * @param taskId is the participant which wants to completeTask its work.
      * @param serviceType is the type of the service.
      * @throws org.jboss.txbridge.ba.exception.TransactionProcessingException if processing was not successful.
      * @throws com.arjuna.wst.SystemException if processing was not successful.
      * @throws com.arjuna.wst.UnknownTransactionException if processing was not successful.
      * @throws com.arjuna.wst.WrongStateException if processing was not successful.
      */
-    public void complete(String taskId, BAServiceType serviceType)
+    public void completeTask(String taskId, MethodType serviceType)
             throws TransactionProcessingException, SystemException, UnknownTransactionException, WrongStateException
     {
-        log.info("complete()");
+        log.info("completeTask()");
         log.info("Getting reference to the BA Participant Manager for task: " + taskId);
         BAParticipantManager baParticipantManager = taskBAManagerMapping.get(taskId);
         if ( baParticipantManager != null )
         {
-            if (serviceType == BAServiceType.MODIFY)
+            if (serviceType == MethodType.MODIFY)
             {
                 log.info("Informing coordinator that work has completed");
                 baParticipantManager.completed();
             }
-            else if (serviceType == BAServiceType.READONLY)
+            else if (serviceType == MethodType.READONLY)
             {
                 log.info("Exiting from BA");
+                baParticipantManager.completed();
                 baParticipantManager.exit();
             }
             else
@@ -454,7 +453,120 @@
     }
 
     /**
-     * This method executes compensation for all tasks that are associated with this transaction.
+     * This method is executed by the participant. It asks the Single Transaction Manager to complete
+     * all the work that needs to be completed within the transaction.
+     */
+    public void complete()
+    {
+        log.info("complete()");
+        transactionCompleted = true;
+        synchronized(this)
+        {
+            log.info("Transaction asked for completion: " + transactionCompleted);
+            if (!transactionCompleted)
+            {
+                return;
+            }
+        }
+
+        log.info("Building list of CoordinatorCompletionParticipants");
+        List<Participant> participantList = new ArrayList<Participant>();
+        Map<Participant,BAParticipantManager> managerList = new HashMap<Participant,BAParticipantManager>();
+
+        for (String task : taskList)
+        {
+            log.info("Checking task: " + task);
+            // Get reference to the required participant
+            log.info("Getting service ID for this task");
+            String serviceId = taskServiceMapping.get(task);
+            log.info("Service ID: " + serviceId);
+            if (serviceId == null)
+            {
+                // TODO: Reconsider this
+                log.info("Incorrect service!");
+                continue;
+            }
+            ServiceDescription sd = serviceInformationManager.getServiceById(serviceId);
+            Participant participant = serviceParticipantMapping.get(serviceId);
+            if (participant instanceof CoordinatorCompletionParticipant)
+            {
+                log.info("This service was enlisted for CoordinatorCompletion protocol");
+                if (!participantList.contains(participant))
+                {
+                    // Get reference to the BA Participant manager
+                    log.info("Getting reference to the BA Participant Manager for task: " + task);
+                    BAParticipantManager participantManager = taskBAManagerMapping.get(task);
+                    if (participantManager != null)
+                    {
+                        log.info("Adding participant");
+                        participantList.add(participant);
+                        managerList.put(participant,participantManager);
+                    }
+                    else
+                    {
+                        log.info("Cannot find participant manager - participant not added.");
+                    }
+                }
+                else
+                {
+                    log.info("Participant already added to the list");
+                }
+
+            }
+            else
+            {
+                log.info("This service was enlisted for ParticipantCompletion protocol");
+            }
+
+        }
+        completeList(participantList,managerList);
+    }
+
+    /**
+     * This method loops through a list of participants that should complete its work. After each
+     * participant completes its work, its associated BAParticipantManager informs the coordinator
+     * that the work has completed. Otherwise a fault is sent to the Coordinator.
+     *
+     * @param participantList is the list of participants that should complete their work.
+     * @param managerList is the list of BAParticipantManagers associated with participants
+     */
+    private void completeList(List<Participant> participantList, Map<Participant,BAParticipantManager> managerList)
+    {
+        log.info("completeList()");
+
+        for (Participant participant : participantList)
+        {
+            BAParticipantManager participantManager = managerList.get(participant);
+            if (participantManager != null)
+            {
+                try
+                {
+                    log.info("Completing work of a single participant.");
+                    participant.completeWork();
+                    log.info("Informing coordinator that work has completed");
+                    participantManager.completed();
+                }
+                catch (Exception e)
+                {
+                    log.info("Could not inform coordinator that work has completed!");
+                    e.printStackTrace();
+                    try
+                    {
+                        log.info("Informing coordinator that there is a fault!");
+                        participantManager.fault();
+                    }
+                    catch (SystemException e1)
+                    {
+                        log.info("Could not inform coordinator that there is a fault!");
+                        e1.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * This method executes datamgmt for all tasks that are associated with this transaction.
      * It executes a compensationList() method on all lists that have been defined.
      */
     public void compensate()
@@ -473,7 +585,7 @@
     }
 
     /**
-     * This method executes a compensation for a given list of tasks. It gets reference to participants
+     * This method executes a datamgmt for a given list of tasks. It gets reference to participants
      * responsible for different tasks and asks them to compensate those tasks. If there is an error with
      * compensating a task it is communicated to the coordinator so that the client knows if heuristics
      * occur.
@@ -507,7 +619,7 @@
             // If service was read only then take another task
             log.info("Checking if the service was read-only");
             ServiceDescription sd = serviceInformationManager.getServiceById(serviceId);
-            if (sd.getServiceType() == BAServiceType.READONLY)
+            if (sd.getMethodType() == MethodType.READONLY)
             {
                 log.info("Service was read-only. There is nothing to compensate.");
                 continue;
@@ -549,7 +661,7 @@
                 {
                     participant.compensateTask(taskId);
                 }
-                catch (CompensationActionUnsuccessfulException e)
+                catch (ActionExecutionException e)
                 {
                     e.printStackTrace();
                     log.info("Could not compensate a task - informing the coordinator about an error");

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/AgreementType.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/AgreementType.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/AgreementType.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+/**
+ * List of supported agreement protocols the BA Service may enlist for. Those are
+ * the protocols defined in the WS-BusinessActivity specification:
+ * PARTICIPANT_COMPLETION - Business Agreement With Participant Completion
+ * COORDINATOR_COMPLETION - Business Agreement With Coordinator Completion
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum AgreementType
+{
+    PARTICIPANT_COMPLETION,
+    COORDINATOR_COMPLETION
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensatedBy.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensatedBy.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensatedBy.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -23,16 +23,16 @@
 import java.lang.annotation.*;
 
 /**
- * Specifies all information related to the compensation action for a single service (method).
+ * Specifies all information related to the datamgmt action for a single service (method).
  * Following information is required:
- * - name of the compensation action
- * - location of the compensation action
- * - should the compensation action be executed only once in a BA
- * - what data should be remembered so that compensation can be executed
- * - what is the mode of compensation (is compensation action present as a method of an EJB,
+ * - name of the datamgmt action
+ * - location of the datamgmt action
+ * - should the datamgmt action be executed only once in a BA
+ * - what data should be remembered so that datamgmt can be executed
+ * - what is the mode of datamgmt (is datamgmt action present as a method of an EJB,
  *   POJO or a Web Service)
  * 
- * All set member values of this annotation override those which were set using the @BACompensation
+ * All set member values of this annotation override those which were set using the @BAService
  * annotation.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
@@ -53,8 +53,8 @@
     public String namespace() default "";
     public String serviceName() default "";
     public boolean single() default false;
-    public BAParameterMatch match() default BAParameterMatch.STRICT;
-    public BACompensationOrder order() default BACompensationOrder.NORMAL;
-    public BACompensationType type() default BACompensationType.RETURN_VALUE;
-    public BACompensationMode mode() default BACompensationMode.EJB;
+    public ParameterMatch match() default ParameterMatch.STRICT;
+    public ExecutionOrder order() default ExecutionOrder.NORMAL;
+    public DataMatch type() default DataMatch.RETURN_VALUE;
+    public ExecutionMode mode() default ExecutionMode.EJB;
 }
\ No newline at end of file

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompletedBy.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompletedBy.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompletedBy.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * Specifies all information related to the datamgmt action for a single service (method).
+ * Following information is required:
+ * - name of the datamgmt action
+ * - location of the datamgmt action
+ * - should the datamgmt action be executed only once in a BA
+ * - what data should be remembered so that datamgmt can be executed
+ * - what is the mode of datamgmt (is datamgmt action present as a method of an EJB,
+ *   POJO or a Web Service)
+ *
+ * All set member values of this annotation override those which were set using the @BAService
+ * annotation.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BACompletedBy
+{
+    public String value();
+    public Class[] serviceClass() default {};
+    public Class[] ejbInterface() default {};
+    public String jndiName() default "";
+    public String providerURL() default "";
+    public String wsdl() default "";
+    public String address() default "";
+    public String namespace() default "";
+    public String serviceName() default "";
+    public boolean single() default false;
+    public ParameterMatch match() default ParameterMatch.STRICT;
+    public ExecutionOrder order() default ExecutionOrder.NORMAL;
+    public DataMatch type() default DataMatch.RETURN_VALUE;
+    public ExecutionMode mode() default ExecutionMode.EJB;
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BADataManagement.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BADataManagement.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BADataManagement.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * Marker annotation used to tag a DataManager object so that it can be transparently
+ * injected by the Business Activity Framework.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.FIELD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BADataManagement
+{
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAMethod.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAMethod.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAMethod.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * Specifies the service in terms of its state management and the agreement protocol the
+ * service wants to enlist for.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BAMethod
+{
+    public MethodType type() default MethodType.MODIFY;
+    public AgreementType agreement() default AgreementType.PARTICIPANT_COMPLETION;
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParam.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParam.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParam.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -23,8 +23,8 @@
 import java.lang.annotation.*;
 
 /**
- * Annotates the service's parameter so that it can be processed by the compensation mechanism
- * and used as an argument or within a compensation action.
+ * Annotates the service's parameter so that it can be processed by the datamgmt mechanism
+ * and used as an argument or within a datamgmt action.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAResult.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAResult.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAResult.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -23,8 +23,8 @@
 import java.lang.annotation.*;
 
 /**
- * Annotates the service's return value to be processed by the compensation mechanism
- * so that it can be used as an argument or within a compensation action.
+ * Annotates the service's return value to be processed by the datamgmt mechanism
+ * so that it can be used as an argument or within a datamgmt action.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAService.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAService.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAService.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -23,17 +23,23 @@
 import java.lang.annotation.*;
 
 /**
- * Specifies the service in terms of its state management and the agreement protocol the
- * service wants to enlist for.
+ * Specifies the datamgmt action and a type of datamgmt for a group of services (class).
+ * This annotation can be used to provide common values so that it is not necessary to explicitly
+ * define all required member values of the @CompensatedBy annotation.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
  */
- at Target(ElementType.METHOD)
+ at Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface BAService
-{
-    public BAServiceType type() default BAServiceType.MODIFY;
-    public BAAgreementType agreement() default BAAgreementType.PARTICIPANT_COMPLETION;
+public @interface BAService {
+    public Class[] serviceClass() default {};
+    public Class[] ejbInterface() default {};
+    public String jndiName() default "";
+    public String providerURL() default "";
+    public String wsdl() default "";   
+    public String address() default "";
+    public String namespace() default "";
+    public String serviceName() default "";
 }

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/DataMatch.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/DataMatch.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/DataMatch.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+/**
+ * List of supported datamgmt types. Compensation type defines what data needs
+ * to be remembered so that datamgmt action can be executed.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum DataMatch 
+{
+    RETURN_VALUE,
+    PARAMETERS_MATCH,
+    CUSTOM
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionMode.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionMode.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionMode.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+/**
+ * List of supported datamgmt modes. The datamgmt mode defines how a datamgmt
+ * action should be accessed (if it is located in POJO class, if it should be looked up
+ * as it is exposed as a method of an EJB, etc).
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum ExecutionMode
+{
+    POJO,
+    EJB,
+    UDII,
+    CDII,
+    RMI,
+    CORBA
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionOrder.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionOrder.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ExecutionOrder.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+/**
+ * List of supported datamgmt order types. Compensation order defines if the
+ * datamgmt action should be executed as the first, the last one or normally
+ * among other datamgmt actions of a Business Activity.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum ExecutionOrder
+{
+    NORMAL,
+    FIRST,
+    LAST
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/MethodType.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/MethodType.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/MethodType.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+/**
+ * Supported Business Activity service types. This type defines if a service modifies
+ * any data (MODIFY) and should provide datamgmt action or if it is READONLY and
+ * can exit the Business Activity after finishing its work.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1 
+ */
+public enum MethodType
+{
+    READONLY,
+    MODIFY
+}
+

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ParameterMatch.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ParameterMatch.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/ParameterMatch.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.annotation;
+
+/**
+ * List of supported parameter match types. If the service requires STRICT parameter
+ * match then datamgmt action will be executed only if all arguments can be provided.
+ * If the service uses ALLOW_NULL parameter match then the execution mechanism will try
+ * to invoke the service even if not enough arguments can be found.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum ParameterMatch
+{
+    STRICT,
+    ALLOW_NULL
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -25,9 +25,8 @@
 import org.jboss.aop.joinpoint.FieldWriteInvocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.txbridge.ba.BATransactionManager;
-import org.jboss.txbridge.ba.participant.Participant;
-import org.jboss.txbridge.ba.compensation.CompensationManagerImpl;
-import org.jboss.txbridge.ba.compensation.CompensationManagerProvider;
+import org.jboss.txbridge.ba.datamgmt.DataManagerImpl;
+import org.jboss.txbridge.ba.datamgmt.DataManagerProvider;
 import org.jboss.txbridge.ba.data.TaskDescription;
 
 import java.lang.reflect.Method;
@@ -36,9 +35,9 @@
  * This aspect provides three advices:
  * - process() - intercepts a call to a Business Activity service and applies necessary 
  * transaction-related mechanisms (handling a single invocation). 
- * - access() - used for transparently injecting the compensation manager associated
+ * - access() - used for transparently injecting the datamgmt manager associated
  * with the current thread of execution.
- * - access() - used to prevent from setting the compensation manager object.
+ * - access() - used to prevent from setting the datamgmt manager object.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
@@ -52,7 +51,7 @@
     private static BATransactionManager baTransactionManager = BATransactionManager.getSingletonInstance();
 
     // Compensation Manager Provider
-    private static CompensationManagerProvider cmp = CompensationManagerProvider.getSingletonInstance();
+    private static DataManagerProvider cmp = DataManagerProvider.getSingletonInstance();
 
     /**
      * Advice that processes methods execution according to the BA management.
@@ -97,10 +96,10 @@
             log.info("Handling invocation");
             TaskDescription taskDesc = baTransactionManager.handleInvocation(method);
 
-            // Associate compensation manager with thread of execution
+            // Associate datamgmt manager with thread of execution
             Long threadId = Thread.currentThread().getId();
-            log.info("Associating compensation manager for thread: " + threadId);
-            cmp.associateCompensationManager(threadId,new CompensationManagerImpl(taskDesc.getTaskId(),taskDesc.getParticipant()));
+            log.info("Associating datamgmt manager for thread: " + threadId);
+            cmp.associateCompensationManager(threadId,new DataManagerImpl(taskDesc.getTaskId(),taskDesc.getParticipant()));
 
             try
             {
@@ -111,7 +110,7 @@
                 // #### IMPLEMENTATION SPECIFIC PART - END
 
                 // Dissassociate the thread
-                log.info("Disassociating compensation manager for thread: " + threadId);
+                log.info("Disassociating datamgmt manager for thread: " + threadId);
                 cmp.removeCompensationManager(threadId);
 
                 log.info("No exception - proceeding");
@@ -125,7 +124,7 @@
             catch (Exception e)
             {
                 // Dissassociate the thread
-                log.info("Disassociating compensation manager for thread: " + threadId);
+                log.info("Disassociating datamgmt manager for thread: " + threadId);
                 cmp.removeCompensationManager(threadId);
 
                 // Clean the transaction
@@ -153,30 +152,30 @@
     }
 
     /**
-     * Advice that returns the required CompensationManager object for every read
-     * access to the CompensationManager object annotated by the @BACompensationManagement
+     * Advice that returns the required DataManager object for every read
+     * access to the DataManager object annotated by the @BADataManagement
 	 * annotation.
      *
-     * @param invocation is the read access of the CompensationManager field.
+     * @param invocation is the read access of the DataManager field.
      * @return the object returned by the method.
      * @throws Throwable is any exception that should be propagated.
      */
     public Object access(FieldReadInvocation invocation) throws Throwable
     {
-        log.info("Returning compensation manager for thread: " + Thread.currentThread().getId());
+        log.info("Returning datamgmt manager for thread: " + Thread.currentThread().getId());
         return cmp.getCompensationManager(Thread.currentThread().getId());
     }
 
     /**
-     * Advice that prevents from setting the annotated CompensationManager object. 
+     * Advice that prevents from setting the annotated DataManager object.
      *
-     * @param invocation is the write access of the CompensationManager field.
+     * @param invocation is the write access of the DataManager field.
      * @return the object returned by the method.
      * @throws Throwable is any exception that should be propagated.
      */
     public Object access(FieldWriteInvocation invocation) throws Throwable
     {
-        throw new RuntimeException("Setting a @BACompensationManagement variable is illegal.");
+        throw new RuntimeException("Setting a @BADataManagement variable is illegal.");
     }
 
 }

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyManagedData.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyManagedData.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyManagedData.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.data;
+
+/**
+ * This class represents a dummy datamgmt object which is used when services are
+ * executed outside the scope of a Business Activity and no data should be remembered.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class DummyManagedData extends ManagedData
+{
+    public DummyManagedData()
+    {
+        super();
+    }
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -21,13 +21,13 @@
 package org.jboss.txbridge.ba.data;
 
 /**
- * List of supported identification types. Identification type defines how compensation
- * data should be processed when executing the compensation action. If data has been 
- * remembered with textual identifiers (names) then the signature of the compensation
+ * List of supported identification types. Identification type defines how datamgmt
+ * data should be processed when executing the datamgmt action. If data has been
+ * remembered with textual identifiers (names) then the signature of the datamgmt
  * action must provide information how this data can be matched with parameters of that
- * compensation action. If identifiers are represented by numbers then the execution
- * mechanism simply use compensation data in the required order (this can be used for
- * remote compensation where third-party services are used).
+ * datamgmt action. If identifiers are represented by numbers then the execution
+ * mechanism simply use datamgmt data in the required order (this can be used for
+ * remote datamgmt where third-party services are used).
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/ManagedData.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/ManagedData.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/ManagedData.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.data;
+
+import org.apache.log4j.Logger;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.io.Serializable;
+
+/**
+ * This class represents the basic datamgmt data that is used for datamgmt.
+ * It provides implementation of methods to store and retrieve data with given identifiers.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class ManagedData implements Serializable
+{
+
+    // Logger
+    private static Logger log = Logger.getLogger(ManagedData.class);
+
+    // Array of parameters
+    private Object[] arguments;
+
+    // The return object
+    private Object[] returnObject;
+
+    private ConcurrentMap<Object,Object> compensationData;
+
+    public ManagedData()
+    {
+        returnObject = new Object[1];
+        compensationData = new ConcurrentHashMap<Object,Object>();
+    }
+
+    public Object get(Object key)
+    {
+        return compensationData.get(key);
+    }
+
+    public void put(Object key, Object value)
+    {
+        compensationData.put(key, value);
+    }
+
+    /**
+     * This method stores arguments of the method's invocation.
+     *
+     * @param arguments is the array of arguments.
+     */
+    public void putArguments(Object[] arguments)
+    {
+        log.info("putArguments()");
+        this.arguments = arguments;
+    }
+
+    /**
+     * This method returns the array of arguments for a certain method invocation.
+     *
+     * @return is the array of arguments.
+     */
+    public Object[] getArguments()
+    {
+        log.info("getArguments()");
+        return arguments;
+    }
+
+    public Object[] getReturnObject()
+    {
+        log.info("getReturnObject()");
+        return returnObject;
+    }
+
+    public void putReturnObject(Object returnObject)
+    {
+        log.info("putReturnObject()");
+        this.returnObject[0] = returnObject;
+    }
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/ActionExecutionException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/ActionExecutionException.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/ActionExecutionException.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.exception;
+
+/**
+ * This exception is thrown if there was an error with executing a single datamgmt action.
+ * It is an internal exception and is not passed back to the client of the Business Activity.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class ActionExecutionException extends Exception
+{
+
+    public ActionExecutionException()
+    {
+        super();
+    }
+
+    public ActionExecutionException(String message)
+    {
+        super(message);
+    }
+
+
+    public ActionExecutionException(Throwable cause)
+    {
+        super(cause);
+    }
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodNotAccessibleException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodNotAccessibleException.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodNotAccessibleException.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.exception;
+
+/**
+ * This exception is thrown when the datamgmt method during a static analysis is
+ * not accessible (i.e. the name is incorrect, parameter types do not match, the specified
+ * class does not exist, etc).
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class MethodNotAccessibleException extends Exception
+{
+
+    public MethodNotAccessibleException()
+    {
+        super();
+    }
+
+    public MethodNotAccessibleException(String message)
+    {
+        super(message);
+    }
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ArgumentsProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ArgumentsProvider.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ArgumentsProvider.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -21,33 +21,33 @@
 package org.jboss.txbridge.ba.execute;
 
 import org.apache.log4j.Logger;
-import org.jboss.txbridge.ba.annotation.BACompensationType;
-import org.jboss.txbridge.ba.compensation.CompensationDataProvider;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.annotation.DataMatch;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProvider;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 /**
  * Arguments Provider component provides methods to obtain necessary data, which has been
  * remembered during execution of the original method. This data will be used when invoking
- * the compensation action.
+ * the datamgmt action.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
  */
-public class ArgumentsProvider implements DataProvider
+public class ArgumentsProvider implements org.jboss.txbridge.ba.execute.DataProvider
 {
     private static Logger log = Logger.getLogger(ArgumentsProvider.class);
 
     /**
      * This method 
      *
-     * @param sd is the service description which describes the original and compensation services.
-     * @param cdp is the compensation data provider.
+     * @param md is the service description.
+     * @param cdp is the datamgmt data provider.
      * @return array of objects.
-     * @throws CompensationActionUnsuccessfulException
+     * @throws ActionExecutionException
      */
-    public Object[] getArguments(ServiceDescription sd, CompensationDataProvider cdp)
-            throws CompensationActionUnsuccessfulException
+    public Object[] getArguments(MethodDescription md, ExecutionDataProvider cdp)
+            throws ActionExecutionException
     {
         log.info("getArguments()");
         int successfullMatches = 0;
@@ -57,11 +57,10 @@
         Class[] parameterTypes = null;
 
         // Check the type of the service
-        BACompensationType baCompensationType = sd.getCompensationType();
-        log.info("Compensation type: " + baCompensationType);
+        log.info("Compensation type: " + md.getDataMatch());
 
-        // Depending on the compensation type try to cast the compensation data and proceed
-        if (baCompensationType == BACompensationType.PARAMETERS_MATCH)
+        // Depending on the datamgmt type try to cast the datamgmt data and proceed
+        if (md.getDataMatch() == DataMatch.PARAMETERS_MATCH)
         {
             // Get parameters
             log.info("Getting parameters");
@@ -78,11 +77,11 @@
             }
             else
             {
-                throw new CompensationActionUnsuccessfulException("Compensation data incorrect.");
+                throw new ActionExecutionException("Compensation data incorrect.");
             }
 
         }
-        else if (baCompensationType == BACompensationType.RETURN_VALUE)
+        else if (md.getDataMatch() == DataMatch.RETURN_VALUE)
         {
             // Get parameter
             log.info("Getting return value");
@@ -95,15 +94,15 @@
             }
             else
             {
-                throw new CompensationActionUnsuccessfulException("Compensation data incorrect.");
+                throw new ActionExecutionException("Compensation data incorrect.");
             }
         }
-        else if (baCompensationType == BACompensationType.CUSTOM)
+        else if (md.getDataMatch() == DataMatch.CUSTOM)
         {
 
             // Get parameter annotations
-            log.info("Getting compensation parameter annotations");
-            Object[] parameterAnnotations = sd.getCompensationParameterAnnotations();
+            log.info("Getting datamgmt parameter annotations");
+            Object[] parameterAnnotations = md.getParameterAnnotations();
             if (parameterAnnotations != null)
             {
                 parameterObjects = new Object[parameterAnnotations.length];
@@ -140,7 +139,7 @@
             else
             {
                 log.info("No annotations present - adding parameters by order.");
-                parameterTypes = sd.getCompensationParameterTypes();
+                parameterTypes = md.getParameterTypes();
                 if (parameterTypes != null)
                 {
                     log.info("Number of required objects: " + parameterTypes.length);
@@ -167,22 +166,22 @@
          if (successfullMatches < compensationParameters)
          {
          log.info("Number of parameters is smaller");
-         BAParameterMatch parameterMatch = sd.getParameterMatch();
+         ParameterMatch parameterMatch = sd.getParameterMatch();
          log.info("ParameterMatch: " + parameterMatch);
-         if ((parameterMatch == BAParameterMatch.STRICT))
+         if ((parameterMatch == ParameterMatch.STRICT))
          {
-         throw new CompensationActionUnsuccessfulException("Original parameters do not match compensation parameters.");
+         throw new ActionExecutionException("Original parameters do not match datamgmt parameters.");
          }
-         else if (sd.getParameterMatch().equals(BAParameterMatch.ALLOW_NULL))
+         else if (sd.getParameterMatch().equals(ParameterMatch.ALLOW_NULL))
          {
-         if ( baCompensationType == BACompensationType.RETURN_VALUE )
+         if ( dataMatch == DataMatch.RETURN_VALUE )
          {
          log.info("Return value extended with null values to match argument list");
          Object tempObject = parameterObjects[0];
          parameterObjects = new Object[compensationParameters];
          parameterObjects[0] = tempObject;
          }
-         else if ( baCompensationType == BACompensationType.PARAMETERS_MATCH )
+         else if ( dataMatch == DataMatch.PARAMETERS_MATCH )
          {
          log.info("Parameter list extended with null values to match argument list");
          Object[] tempObjects = parameterObjects;
@@ -191,7 +190,7 @@
          }
          else
          {
-         // If the compensation type was CUSTOM we don't have to do anything.
+         // If the datamgmt type was CUSTOM we don't have to do anything.
          }
          }
          }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/CorbaExecution.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/CorbaExecution.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/CorbaExecution.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,8 +22,9 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
 import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 /**
  * This class provides implementation of the CORBA execution.
@@ -36,8 +37,7 @@
     // Logger
     private static Logger log = Logger.getLogger(CorbaExecution.class);
 
-    public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
-    {
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
         log.info("invokeService()");
 
         // TODO: Implement

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/DataProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/DataProvider.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/DataProvider.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -20,9 +20,10 @@
  */
 package org.jboss.txbridge.ba.execute;
 
-import org.jboss.txbridge.ba.compensation.CompensationDataProvider;
-import org.jboss.txbridge.ba.service.ServiceDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.MethodDescription;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProvider;
+import org.jboss.txbridge.ba.annotation.DataMatch;
 
 /**
  * @author Maciej P. Machulak (mmachulak at redhat.com)
@@ -30,6 +31,6 @@
  */
 public interface DataProvider
 {
-    public Object[] getArguments(ServiceDescription sd, CompensationDataProvider cdp) throws CompensationActionUnsuccessfulException;
+    public Object[] getArguments(MethodDescription md, ExecutionDataProvider cdp) throws ActionExecutionException;
     public Class[] getArgumentTypes(Object[] arguments);
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/EJBExecution.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/EJBExecution.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/EJBExecution.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,8 +22,8 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 import java.lang.reflect.Method;
 
@@ -44,27 +44,26 @@
      * and argument types.
      *
      * @param taskDesc describes the task (needed to inject the proper participant).
-     * @param sd describes the service.
+     * @param md describes the service.
      * @param arguments is the list of arguments.
      * @param argumentTypes is the list of argument types.
-     * @throws CompensationActionUnsuccessfulException if invoking compensation action was not successful.
+     * @throws ActionExecutionException if invoking datamgmt action was not successful.
      */
-    public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes)
-            throws CompensationActionUnsuccessfulException
-    {
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes)
+            throws ActionExecutionException {
         log.info("invokeService()");
         try
         {
 
             // Get necessary data
             log.info("Getting necessary data");
-            String providerURL = sd.getCompensationProviderURL();
+            String providerURL = md.getProviderURL();
             log.info("Provider URL: " + providerURL);
-            String ejbName = sd.getCompensationJNDIName();
+            String ejbName = md.getJndiName();
             log.info("EJB name: " + ejbName);
-            Class ejbInterface = sd.getCompensationEjbInterface();
+            Class ejbInterface = md.getEjbInterface();
             log.info("EJB interface: " + ejbInterface);
-            String methodName = sd.getCompensationMethodName();
+            String methodName = md.getMethodName();
 
             // Lookup the bean
             log.info("Getting the Service Locator");
@@ -73,18 +72,18 @@
             log.info("Bean looked up successfully: " + theBean.getClass());
 
             // Invoke the method
-            log.info("Getting compensation method");
+            log.info("Getting datamgmt method");
             Method compensationMethod = ejbInterface.getMethod(methodName,argumentTypes);
             if (compensationMethod == null)
             {
-                throw new CompensationActionUnsuccessfulException("Could not get access to the compensation method");
+                throw new ActionExecutionException("Could not get access to the datamgmt method");
             }
-            log.info("Invoking compensation method");
+            log.info("Invoking datamgmt method");
             compensationMethod.invoke(theBean,arguments);
         }
         catch (Exception e)
         {
-            throw new CompensationActionUnsuccessfulException(e);
+            throw new ActionExecutionException(e);
         }
     }
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -21,12 +21,12 @@
 package org.jboss.txbridge.ba.execute;
 
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 /**
  * The interface for any class that provides execution mechanism, which can be used during
- * compensation.
+ * datamgmt.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
@@ -38,10 +38,10 @@
      * and argument types.
      *
      * @param taskDesc describes the task (needed to inject the proper participant).
-     * @param sd describes the service.
+     * @param md describes the service.
      * @param arguments is the list of arguments.
      * @param argumentTypes is the list of argument types.
-     * @throws CompensationActionUnsuccessfulException if invoking compensation action was not successful.
+     * @throws ActionExecutionException if invoking datamgmt action was not successful.
      */
-    public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments,Class[] argumentTypes) throws CompensationActionUnsuccessfulException;
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments,Class[] argumentTypes) throws ActionExecutionException;
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalExecution.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalExecution.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalExecution.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,8 +22,9 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.service.MethodDescription;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 
@@ -44,29 +45,30 @@
      * and argument types.
      *
      * @param taskDesc describes the task (needed to inject the proper participant).
-     * @param sd describes the service.
+     * @param md describes the service.
      * @param arguments is the list of arguments.
      * @param argumentTypes is the list of argument types.
-     * @throws CompensationActionUnsuccessfulException if invoking compensation action was not successful.
+     * @throws ActionExecutionException if invoking datamgmt action was not successful.
      */
-    public void invokeService(TaskDescription taskDesc,ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes)
+            throws ActionExecutionException
     {
         log.info("invokeService()");
 
         try
         {
-            // 1) Get the class of the compensation method
-            Class clazz = sd.getCompensationClass();
+            // 1) Get the class of the datamgmt method
+            Class clazz = md.getClazz();
             log.info("Compensation class: " + clazz.getName());
-            // 2) Get the name of the compensation method
-            String methodName = sd.getCompensationMethodName();
+            // 2) Get the name of the datamgmt method
+            String methodName = md.getMethodName();
             log.info("Compensation method: " + methodName);
-            // 3) Get the compensation method
+            // 3) Get the datamgmt method
             log.info("Getting reference to the method...");
             Method compensationMethod = clazz.getMethod(methodName,argumentTypes);
             if ( compensationMethod == null )
             {
-                throw new CompensationActionUnsuccessfulException("Could not get access to the compensation method");
+                throw new ActionExecutionException("Could not get access to the datamgmt method");
             }
             // 4) Invoke the service
             log.info("Getting reference to the class constructor");
@@ -78,7 +80,7 @@
         }
         catch (Exception e)
         {
-            throw new CompensationActionUnsuccessfulException(e.getMessage());
+            throw new ActionExecutionException(e.getMessage());
         }
     }
 

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RMIExecution.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RMIExecution.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RMIExecution.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,8 +22,9 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
 import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 /**
  * This class provides implementation of the RMI execution.
@@ -36,8 +37,7 @@
     // Logger
     private static Logger log = Logger.getLogger(RMIExecution.class);
 
-    public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
-    {
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
         log.info("invokeService");
 
         // TODO: Implement

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceExecutor.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceExecutor.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceExecutor.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -21,16 +21,17 @@
 package org.jboss.txbridge.ba.execute;
 
 import org.apache.log4j.Logger;
-import org.jboss.txbridge.ba.compensation.CompensationDataProvider;
-import org.jboss.txbridge.ba.compensation.CompensationManagerProvider;
-import org.jboss.txbridge.ba.compensation.CompensationManagerImpl;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProvider;
+import org.jboss.txbridge.ba.datamgmt.DataManagerProvider;
+import org.jboss.txbridge.ba.datamgmt.DataManagerImpl;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.jboss.txbridge.ba.service.MethodDescription;
+import org.jboss.txbridge.ba.annotation.DataMatch;
 
 /**
  * This is an abstract class that describes a basic ServiceExecutor. Service Executors are used for
- * executing compensation actions.
+ * executing datamgmt actions.
  *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
@@ -41,7 +42,7 @@
     private static Logger log = Logger.getLogger(ServiceExecutor.class);
 
     // Compensation manager provider
-    private static CompensationManagerProvider cmp = CompensationManagerProvider.getSingletonInstance();
+    private static DataManagerProvider cmp = DataManagerProvider.getSingletonInstance();
 
     // Task description
     private TaskDescription taskDescription;
@@ -50,7 +51,7 @@
     ExecutionInterface execution;
 
     // Data provider
-    DataProvider dataProvider;
+    org.jboss.txbridge.ba.execute.DataProvider dataProvider;
 
 
     /**
@@ -71,7 +72,7 @@
      * @param execution is the execution interface that should be used.
      * @param dp is the data provider for arguments.
      */
-    public ServiceExecutor(TaskDescription taskDesc, ExecutionInterface execution, DataProvider dp)
+    public ServiceExecutor(TaskDescription taskDesc, ExecutionInterface execution, org.jboss.txbridge.ba.execute.DataProvider dp)
     {
         log.info("constructor()");
         this.taskDescription = taskDesc;
@@ -91,35 +92,34 @@
     }
 
     /**
-     * This method invokes the compensation task which is specified in the service description.
-     * It uses compensation data which are passed as a parameter.
+     * This method invokes the datamgmt task which is specified in the service description.
+     * It uses datamgmt data which are passed as a parameter.
      *
-     * @param sd represents the service description.
-     * @param cdp represents the compensation data provider.
-     * @throws CompensationActionUnsuccessfulException if it was not possible to execute compensation action.
+     * @param md represents the service description.
+     * @param edp represents the datamgmt data provider.
+     * @throws ActionExecutionException if it was not possible to execute datamgmt action.
      */
-    public void invokeService(ServiceDescription sd, CompensationDataProvider cdp)
-            throws CompensationActionUnsuccessfulException
-    {
+    public void invokeService(MethodDescription md, ExecutionDataProvider edp)
+            throws ActionExecutionException {
         log.info("invokeService()");
         log.info("Getting list of arguments");
-        Object[] arguments = dataProvider.getArguments(sd,cdp);
+        Object[] arguments = dataProvider.getArguments(md,edp);
         log.info("Getting list of argument types");
         Class[] argumentTypes = dataProvider.getArgumentTypes(arguments);
         Long threadId = Thread.currentThread().getId();
-        log.info("Associating compensation manager to thread: " + threadId);
-        cmp.associateCompensationManager(threadId,new CompensationManagerImpl(taskDescription.getTaskId(),taskDescription.getParticipant()));
+        log.info("Associating datamgmt manager to thread: " + threadId);
+        cmp.associateCompensationManager(threadId,new DataManagerImpl(taskDescription.getTaskId(),taskDescription.getParticipant()));
         try
         {
-            execution.invokeService(taskDescription,sd,arguments,argumentTypes);
-            log.info("Removing compensation manager association for thread: " + threadId);
+            execution.invokeService(taskDescription,md,arguments,argumentTypes);
+            log.info("Removing datamgmt manager association for thread: " + threadId);
             cmp.removeCompensationManager(threadId);
         }
-        catch (CompensationActionUnsuccessfulException e)
+        catch (ActionExecutionException e)
         {
-            log.info("Removing compensation manager association for thread: " + threadId);
+            log.info("Removing datamgmt manager association for thread: " + threadId);
             cmp.removeCompensationManager(threadId);
-            throw new CompensationActionUnsuccessfulException(e);
+            throw new ActionExecutionException(e);
         }
     }
 

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSConfiguredDII.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSConfiguredDII.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSConfiguredDII.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,8 +22,9 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
 import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 /**
  * This class provides implementation of the Web Services Configured DII execution.
@@ -36,8 +37,7 @@
     // Logger
     private static Logger log = Logger.getLogger(WSConfiguredDII.class);
 
-    public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
-    {
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
         log.info("invokeService()");
         
     }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSUnconfiguredDII.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSUnconfiguredDII.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSUnconfiguredDII.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,8 +22,9 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
 import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
 
 /**
  * This class provides implementation of the Web Services Unconfigured DII execution.
@@ -36,8 +37,7 @@
     // Logger
     private static Logger log = Logger.getLogger(WSUnconfiguredDII.class);
 
-    public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
-    {
+    public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
         log.info("invokeService()");
 
         // TODO: Implement

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -23,9 +23,11 @@
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.annotation.*;
 import org.jboss.txbridge.ba.exception.MethodIncorrectlyAnnotatedException;
-import org.jboss.txbridge.ba.exception.CompensationMethodNotAccessible;
+import org.jboss.txbridge.ba.exception.MethodNotAccessibleException;
 import org.jboss.txbridge.ba.service.ServiceDescription;
 import org.jboss.txbridge.ba.service.ServiceDescriptionImpl;
+import org.jboss.txbridge.ba.service.MethodDescription;
+import org.jboss.txbridge.ba.service.MethodDescriptionImpl;
 
 import javax.jws.WebMethod;
 import java.lang.reflect.Method;
@@ -52,11 +54,10 @@
      * @param method is the method to be processed.
      * @return the service description.
      * @throws org.jboss.txbridge.ba.exception.MethodIncorrectlyAnnotatedException if the method is not annotated correctly.
-     * @throws org.jboss.txbridge.ba.exception.CompensationMethodNotAccessible if the specified compensatiom method is not accessible.
+     * @throws org.jboss.txbridge.ba.exception.MethodNotAccessibleException if the specified compensatiom method is not accessible.
      */
     public static synchronized ServiceDescription processMethod(Method method)
-            throws MethodIncorrectlyAnnotatedException, CompensationMethodNotAccessible
-    {
+            throws MethodIncorrectlyAnnotatedException, MethodNotAccessibleException {
         log.info("processMethod()");
 
         // Create new ServiceDescription
@@ -77,17 +78,17 @@
         Class[] baInterface = null;
         String baJndiName = null;
         String baProviderURL = null;
-        BACompensation BACompensationAnnotation = (BACompensation) methodClass.getAnnotation(BACompensation.class);
-        if (BACompensationAnnotation != null)
+        BAService BAServiceAnnotation = (BAService) methodClass.getAnnotation(BAService.class);
+        if (BAServiceAnnotation != null)
         {
-            log.info("BACompensation annotation found.");
-            baClass = BACompensationAnnotation.serviceClass();
+            log.info("BAService annotation found.");
+            baClass = BAServiceAnnotation.serviceClass();
             log.info("Compensation class: " + baClass);
-            baInterface = BACompensationAnnotation.ejbInterface();
+            baInterface = BAServiceAnnotation.ejbInterface();
             log.info("EJB Interface: " + baInterface);
-            baJndiName = BACompensationAnnotation.jndiName();
+            baJndiName = BAServiceAnnotation.jndiName();
             log.info("JNDI name: " + baJndiName);
-            baProviderURL = BACompensationAnnotation.providerURL();
+            baProviderURL = BAServiceAnnotation.providerURL();
             log.info("Provider URL: " + baProviderURL);
 
         }
@@ -122,28 +123,30 @@
 
 
         // Check if this method is a BA service
-        BAService baService = method.getAnnotation(BAService.class);
-        BAServiceType baServiceType;
-        if (baService != null)
+        BAMethod baMethod = method.getAnnotation(BAMethod.class);
+        MethodType methodType;
+        AgreementType agreementType;
+        if (baMethod != null)
         {
             log.info("Method " + methodName + " is a BA service.");
 
             // Get the type of the service
-            baServiceType = baService.type();
-            log.info("BAServiceType: " + baServiceType);
-            serviceDescription.setServiceType(baServiceType);
+            methodType = baMethod.type();
+            log.info("MethodType: " + methodType);
+            serviceDescription.setMethodType(methodType);
 
             // Get the agreement type
-            BAAgreementType baAgreeementType = baService.agreement();
-            log.info("BAAgreementType: " + baAgreeementType);
-            serviceDescription.setAgreementType(baAgreeementType);
+            agreementType = baMethod.agreement();
+            log.info("AgreementType: " + agreementType);
+            serviceDescription.setAgreementType(agreementType);
         }
         else
         {
-            throw new MethodIncorrectlyAnnotatedException("Method does not have @BAService annotation.");
+            throw new MethodIncorrectlyAnnotatedException("Method does not have @BAMethod annotation.");
         }
 
         // Check the compensation method
+        MethodDescription md = new MethodDescriptionImpl();
         BACompensatedBy baComp = method.getAnnotation(BACompensatedBy.class);
         if (baComp != null)
         {
@@ -151,27 +154,27 @@
 
             String compensationMethodName = baComp.value();
             log.info("Compensation method: " + compensationMethodName);
-            serviceDescription.setCompensationMethodName(compensationMethodName);
+            md.setMethodName(compensationMethodName);
 
-            // Check the compensation type
+            // Check the datamgmt type
             log.info("Compensation type: " + baComp.type());
-            serviceDescription.setCompensationType(baComp.type());
+            md.setDataMatch(baComp.type());
 
             // Set parameter match
             log.info("Parameters match: " + baComp.match());
-            serviceDescription.setParameterMatch(baComp.match());
+            md.setParameterMatch(baComp.match());
 
-            // Check if this is a single compensation
+            // Check if this is a single datamgmt
             log.info("Compensation single: " + baComp.single());
-            serviceDescription.setCompensationSingle(baComp.single());
+            md.setSingle(baComp.single());
 
-            // Get compensation mode
-            BACompensationMode compensationMode = baComp.mode();
-            serviceDescription.setCompensationMode(baComp.mode());
+            // Get datamgmt mode
+            ExecutionMode compensationMode = baComp.mode();
+            md.setExecutionMode(compensationMode);
             log.info("Compensation mode: " + compensationMode);
 
-            // Get information according to the required compensation
-            if (compensationMode == BACompensationMode.POJO)
+            // Get information according to the required datamgmt
+            if (compensationMode == ExecutionMode.POJO)
             {
                 // We need following information
                 // 1) Method name (already obtained)
@@ -181,7 +184,7 @@
                 Class compensationMethodClass = baComp.serviceClass()[0];
                 if (compensationMethodClass == null)
                 {
-                    // It can be either local class or a class specified in BACompensation annotation
+                    // It can be either local class or a class specified in BAService annotation
                     if (baClass != null)
                     {
                         log.info("Compensation method class specified in BA");
@@ -197,10 +200,10 @@
                 {
                     log.info("Compensation class: " + compensationMethodClass);
                 }
-                serviceDescription.setCompensationClass(compensationMethodClass);
+                md.setClazz(compensationMethodClass);
 
-                // Checking if the compensation method exists
-                log.info("Checking if compensation method exists");
+                // Checking if the datamgmt method exists
+                log.info("Checking if datamgmt method exists");
                 Method[] methodList = compensationMethodClass.getMethods();
                 boolean methodFound = false;
                 for (Method singleMethod : methodList)
@@ -216,10 +219,10 @@
                         {
                             log.info("Compensation method has parameters");
 
-                            log.info("Setting compensation type");
-                            serviceDescription.setCompensationParameterTypes(singleMethod.getParameterTypes());
+                            log.info("Setting datamgmt type");
+                            md.setParameterTypes(singleMethod.getParameterTypes());
 
-                            // Remember annotations of the parameters of the compensation method
+                            // Remember annotations of the parameters of the datamgmt method
                             log.info("Checking annotations");
                             Object[] parameterAnnotation = new Object[singleMethod.getParameterTypes().length];
                             Annotation[][] parameterAnnotations = singleMethod.getParameterAnnotations();
@@ -249,7 +252,7 @@
                                 }
                                 i++;
                             }
-                            serviceDescription.setCompensationParameterAnnotations(parameterAnnotation);
+                            md.setParameterAnnotations(parameterAnnotation);
                         }
                         else
                         {
@@ -261,11 +264,11 @@
                 }
                 if (!methodFound)
                 {
-                    throw new CompensationMethodNotAccessible("Compensation method not found.");
+                    throw new MethodNotAccessibleException("Compensation method not found.");
                 }
 
             }
-            else if (compensationMode == BACompensationMode.EJB)
+            else if (compensationMode == ExecutionMode.EJB)
             {
 
                 // We need following information
@@ -283,17 +286,17 @@
                 {
                     log.info("Method's class not specified");
 
-                    // Class can be either specified in the Business Activity annotation or compensation is remote
-                    log.info("Checking if method's class has been specified in BACompensation");
+                    // Class can be either specified in the Business Activity annotation or datamgmt is remote
+                    log.info("Checking if method's class has been specified in BAService");
                     if (baClass != null && baClass.length > 0 && baClass[0] != null)
                     {
-                        log.info("Compensation class specified in the BACompensation annotation");
+                        log.info("Compensation class specified in the BAService annotation");
                         compensationMethodClass = new Class[1];
                         compensationMethodClass[0] = baClass[0];
                     }
                     else
                     {
-                        log.info("Compensation class not specified - remote compensation.");
+                        log.info("Compensation class not specified - remote datamgmt.");
                     }
                 }
                 else
@@ -306,8 +309,8 @@
                     // Compensation class specified
                     log.info("Compensation class: " + compensationMethodClass[0]);
 
-                    // Checking if the compensation method exists
-                    log.info("Checking if compensation method exists");
+                    // Checking if the datamgmt method exists
+                    log.info("Checking if datamgmt method exists");
                     Method[] methodList = compensationMethodClass[0].getMethods();
                     boolean methodFound = false;
                     for (Method singleMethod : methodList)
@@ -325,10 +328,10 @@
                             {
                                 log.info("Compensation method has parameters");
 
-                                log.info("Setting compensation type");
-                                serviceDescription.setCompensationParameterTypes(singleMethod.getParameterTypes());
+                                log.info("Setting datamgmt type");
+                                md.setParameterTypes(singleMethod.getParameterTypes());
 
-                                // Remember annotations of the parameters of the compensation method
+                                // Remember annotations of the parameters of the datamgmt method
                                 log.info("Checking annotations");
                                 Object[] parameterAnnotation = new Object[singleMethod.getParameterTypes().length];
                                 Annotation[][] parameterAnnotations = singleMethod.getParameterAnnotations();
@@ -359,7 +362,7 @@
                                     }
                                     i++;
                                 }
-                                serviceDescription.setCompensationParameterAnnotations(parameterAnnotation);
+                                md.setParameterAnnotations(parameterAnnotation);
                             }
                             else
                             {
@@ -371,11 +374,11 @@
                     }
                     if (!methodFound)
                     {
-                        throw new CompensationMethodNotAccessible("Compensation method not found.");
+                        throw new MethodNotAccessibleException("Compensation method not found.");
                     }
 
                 }
-                serviceDescription.setCompensationClass(compensationMethodClass[0]);
+                md.setClazz(compensationMethodClass[0]);
 
                 // Get the interface
                 Class[] ejbInterface = baComp.ejbInterface();
@@ -384,7 +387,7 @@
                     log.info("EJB interface not specified");
                     if (baInterface != null && baInterface.length > 0 && !baInterface[0].equals(""))
                     {
-                        log.info("EJB interface specified in BACompensation - storing value");
+                        log.info("EJB interface specified in BAService - storing value");
                         ejbInterface = new Class[1];
                         ejbInterface[0] = baInterface[0];
                     }
@@ -402,8 +405,8 @@
                     // Interface specified
                     log.info("EJB Interface: " + ejbInterface[0]);
 
-                    // Checking if the compensation method exists
-                    log.info("Checking if compensation method exists");
+                    // Checking if the datamgmt method exists
+                    log.info("Checking if datamgmt method exists");
                     Method[] methodList = ejbInterface[0].getMethods();
                     boolean methodFound = false;
                     for (Method singleMethod : methodList)
@@ -421,10 +424,10 @@
                             {
                                 log.info("Compensation method has parameters");
 
-                                log.info("Setting compensation type");
-                                serviceDescription.setCompensationParameterTypes(singleMethod.getParameterTypes());
+                                log.info("Setting datamgmt type");
+                                md.setParameterTypes(singleMethod.getParameterTypes());
 
-                                // Remember annotations of the parameters of the compensation method
+                                // Remember annotations of the parameters of the datamgmt method
                                 if (!baParamAnnotationFound)
                                 {
 
@@ -457,7 +460,7 @@
                                         }
                                         i++;
                                     }
-                                    serviceDescription.setCompensationParameterAnnotations(parameterAnnotation);
+                                    md.setParameterAnnotations(parameterAnnotation);
                                 }
                             }
                             else
@@ -470,11 +473,11 @@
                     }
                     if (!methodFound)
                     {
-                        throw new CompensationMethodNotAccessible("Compensation method not found.");
+                        throw new MethodNotAccessibleException("Compensation method not found.");
                     }
 
                 }
-                serviceDescription.setCompensationEjbInterface(ejbInterface[0]);
+                md.setEjbInterface(ejbInterface[0]);
 
                 // Get the JNDI name of the EJB
                 log.info("Getting JNDI name of the EJB");
@@ -495,7 +498,7 @@
                         throw new MethodIncorrectlyAnnotatedException("JNDI name not specified");
                     }
                 }
-                serviceDescription.setCompensationJNDIName(jndiName);
+                md.setJndiName(jndiName);
 
                 // Check if the URL provider has been specified
                 String providerURL = baComp.providerURL();
@@ -515,7 +518,7 @@
                         providerURL = null;
                     }
                 }
-                serviceDescription.setCompensationProviderURL(providerURL);
+                md.setProviderURL(providerURL);
             }
 
         }
@@ -523,7 +526,7 @@
         {
             log.info("BACompensatedBy annotation missing.");
             log.info("Checking the type of the service.");
-            if (baServiceType == BAServiceType.READONLY)
+            if (methodType == MethodType.READONLY)
             {
                 log.info("Service is read only. BACompensatedBy is not necessary.");
             }
@@ -532,8 +535,401 @@
                 throw new MethodIncorrectlyAnnotatedException("BACompensatedBy annotation missing.");
             }
         }
+        serviceDescription.putMethod("compensate",md);
 
+        // Check the Completion method
+        md = new MethodDescriptionImpl();
+        BACompletedBy baCompleted = method.getAnnotation(BACompletedBy.class);
+        if (baCompleted != null)
+        {
+            log.info("BACompletedBy annotation present!");
 
+            String CompletionMethodName = baCompleted.value();
+            log.info("Completion method: " + CompletionMethodName);
+            md.setMethodName(CompletionMethodName);
+
+            // Check the Completion type
+            log.info("Data match type: " + baCompleted.type());
+            md.setDataMatch(baCompleted.type());
+
+            // Set parameter match
+            log.info("Parameters match: " + baCompleted.match());
+            md.setParameterMatch(baCompleted.match());
+
+            // Check if this is a single Completion
+            log.info("Completion single: " + baCompleted.single());
+            md.setSingle(baCompleted.single());
+
+            // Get Completion mode
+            ExecutionMode CompletionMode = baCompleted.mode();
+            md.setExecutionMode(baCompleted.mode());
+            log.info("Completion mode: " + CompletionMode);
+
+            // Get information according to the required Completion
+            if (CompletionMode == ExecutionMode.POJO)
+            {
+                // We need following information
+                // 1) Method name (already obtained)
+                // 2) Method's class
+
+                // Getting method's class
+                Class CompletionMethodClass = baCompleted.serviceClass()[0];
+                if (CompletionMethodClass == null)
+                {
+                    // It can be either local class or a class specified in BAService annotation
+                    if (baClass != null)
+                    {
+                        log.info("Completion method class specified in BA");
+                        CompletionMethodClass = baClass[0];
+                    }
+                    else
+                    {
+                        log.info("Completion method is in the same class: ");
+                        CompletionMethodClass = method.getDeclaringClass();
+                    }
+                }
+                else
+                {
+                    log.info("Completion class: " + CompletionMethodClass);
+                }
+                md.setClazz(CompletionMethodClass);
+
+                // Checking if the Completion method exists
+                log.info("Checking if Completion method exists");
+                Method[] methodList = CompletionMethodClass.getMethods();
+                boolean methodFound = false;
+                for (Method singleMethod : methodList)
+                {
+                    log.info("Comparing " + CompletionMethodName + " against " + singleMethod.getName() + ".");
+                    if (singleMethod.getName().equals(CompletionMethodName))
+                    {
+                        // Remember types of parameters
+                        log.info("Getting parameter types");
+                        Class[] parameterTypes = singleMethod.getParameterTypes();
+
+                        if (parameterTypes != null)
+                        {
+                            log.info("Completion method has parameters");
+
+                            log.info("Setting Completion type");
+                            md.setParameterTypes(singleMethod.getParameterTypes());
+
+                            // Remember annotations of the parameters of the Completion method
+                            log.info("Checking annotations");
+                            Object[] parameterAnnotation = new Object[singleMethod.getParameterTypes().length];
+                            Annotation[][] parameterAnnotations = singleMethod.getParameterAnnotations();
+                            int i = 0;
+                            for (Annotation[] annotationArray : parameterAnnotations)
+                            {
+                                for (Annotation annotation : annotationArray)
+                                {
+                                    if (annotation instanceof BAParam)
+                                    {
+                                        log.info("BAParam annotation present for parameter: " + i);
+                                        String valueS = ((BAParam)annotation).value();
+                                        try
+                                        {
+                                            Integer valueI = new Integer(valueS);
+                                            parameterAnnotation[i] = valueI;
+                                        }
+                                        catch (NumberFormatException nfe)
+                                        {
+                                            parameterAnnotation[i] = valueS;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        log.info("No BAParam annotation for parameter: " + i);
+                                    }
+                                }
+                                i++;
+                            }
+                            md.setParameterAnnotations(parameterAnnotation);
+                        }
+                        else
+                        {
+                            log.info("Completion method does not take any parameters");
+                        }
+                        methodFound = true;
+                        break;
+                    }
+                }
+                if (!methodFound)
+                {
+                    throw new MethodNotAccessibleException("Completion method not found.");
+                }
+
+            }
+            else if (CompletionMode == ExecutionMode.EJB)
+            {
+
+                // We need following information
+                // 1) Method name (already obtained)
+                // 2) Method's class (optional)
+                // 3) Interface of the EJB
+                // 4) JNDI name of the EJB
+                // 5) Provider URL (optional)
+
+                // Method's class
+                log.info("Getting method's class");
+                Class[] CompletionMethodClass = baCompleted.serviceClass();
+                boolean baParamAnnotationFound = true;
+                if (CompletionMethodClass.length == 0)
+                {
+                    log.info("Method's class not specified");
+
+                    // Class can be either specified in the Business Activity annotation or Completion is remote
+                    log.info("Checking if method's class has been specified in BAService");
+                    if (baClass != null && baClass.length > 0 && baClass[0] != null)
+                    {
+                        log.info("Completion class specified in the BAService annotation");
+                        CompletionMethodClass = new Class[1];
+                        CompletionMethodClass[0] = baClass[0];
+                    }
+                    else
+                    {
+                        log.info("Completion class not specified - remote Completion.");
+                    }
+                }
+                else
+                {
+                    log.info("Method's class specified");
+                }
+
+                if (CompletionMethodClass.length > 0)
+                {
+                    // Completion class specified
+                    log.info("Completion class: " + CompletionMethodClass[0]);
+
+                    // Checking if the Completion method exists
+                    log.info("Checking if Completion method exists");
+                    Method[] methodList = CompletionMethodClass[0].getMethods();
+                    boolean methodFound = false;
+                    for (Method singleMethod : methodList)
+                    {
+                        log.info("Comparing " + CompletionMethodName + " against " + singleMethod.getName() + ".");
+                        if (singleMethod.getName().equals(CompletionMethodName))
+                        {
+                            log.info("Method found!");
+
+                            // Remember types of parameters
+                            log.info("Getting parameter types");
+                            Class[] parameterTypes = singleMethod.getParameterTypes();
+
+                            if (parameterTypes != null)
+                            {
+                                log.info("Completion method has parameters");
+
+                                log.info("Setting Completion type");
+                                md.setParameterTypes(singleMethod.getParameterTypes());
+
+                                // Remember annotations of the parameters of the Completion method
+                                log.info("Checking annotations");
+                                Object[] parameterAnnotation = new Object[singleMethod.getParameterTypes().length];
+                                Annotation[][] parameterAnnotations = singleMethod.getParameterAnnotations();
+                                int i = 0;
+                                for (Annotation[] annotationArray : parameterAnnotations)
+                                {
+                                    for (Annotation annotation : annotationArray)
+                                    {
+                                        if (annotation instanceof BAParam)
+                                        {
+                                            baParamAnnotationFound = true;
+                                            log.info("BAParam annotation present for parameter: " + i);
+                                            String valueS = ((BAParam)annotation).value();
+                                            try
+                                            {
+                                                Integer valueI = new Integer(valueS);
+                                                parameterAnnotation[i] = valueI;
+                                            }
+                                            catch (NumberFormatException nfe)
+                                            {
+                                                parameterAnnotation[i] = valueS;
+                                            }
+                                        }
+                                        else
+                                        {
+                                            log.info("No BAParam annotation for parameter: " + i);
+                                        }
+                                    }
+                                    i++;
+                                }
+                                md.setParameterAnnotations(parameterAnnotation);
+                            }
+                            else
+                            {
+                                log.info("Completion method does not take any parameters");
+                            }
+                            methodFound = true;
+                            break;
+                        }
+                    }
+                    if (!methodFound)
+                    {
+                        throw new MethodNotAccessibleException("Completion method not found.");
+                    }
+
+                }
+                md.setClazz(CompletionMethodClass[0]);
+
+                // Get the interface
+                Class[] ejbInterface = baCompleted.ejbInterface();
+                if (ejbInterface.length == 0)
+                {
+                    log.info("EJB interface not specified");
+                    if (baInterface != null && baInterface.length > 0 && !baInterface[0].equals(""))
+                    {
+                        log.info("EJB interface specified in BAService - storing value");
+                        ejbInterface = new Class[1];
+                        ejbInterface[0] = baInterface[0];
+                    }
+                    else
+                    {
+                        throw new MethodIncorrectlyAnnotatedException("Interface to EJB not specified.");
+                    }
+                }
+                else
+                {
+                    log.info("EJB Interface specified.");
+                }
+                if (ejbInterface.length > 0 )
+                {
+                    // Interface specified
+                    log.info("EJB Interface: " + ejbInterface[0]);
+
+                    // Checking if the Completion method exists
+                    log.info("Checking if Completion method exists");
+                    Method[] methodList = ejbInterface[0].getMethods();
+                    boolean methodFound = false;
+                    for (Method singleMethod : methodList)
+                    {
+                        log.info("Comparing " + CompletionMethodName + " against " + singleMethod.getName() + ".");
+                        if (singleMethod.getName().equals(CompletionMethodName))
+                        {
+                            log.info("Method found!");
+
+                            // Remember types of parameters
+                            log.info("Getting parameter types");
+                            Class[] parameterTypes = singleMethod.getParameterTypes();
+
+                            if (parameterTypes != null)
+                            {
+                                log.info("Completion method has parameters");
+
+                                log.info("Setting Completion type");
+                                md.setParameterTypes(singleMethod.getParameterTypes());
+
+                                // Remember annotations of the parameters of the Completion method
+                                if (!baParamAnnotationFound)
+                                {
+
+                                    log.info("Checking annotations");
+                                    Object[] parameterAnnotation = new Object[singleMethod.getParameterTypes().length];
+                                    Annotation[][] parameterAnnotations = singleMethod.getParameterAnnotations();
+                                    int i = 0;
+                                    for (Annotation[] annotationArray : parameterAnnotations)
+                                    {
+                                        for (Annotation annotation : annotationArray)
+                                        {
+                                            if (annotation instanceof BAParam)
+                                            {
+                                                log.info("BAParam annotation present for parameter: " + i);
+                                                String valueS = ((BAParam)annotation).value();
+                                                try
+                                                {
+                                                    Integer valueI = new Integer(valueS);
+                                                    parameterAnnotation[i] = valueI;
+                                                }
+                                                catch (NumberFormatException nfe)
+                                                {
+                                                    parameterAnnotation[i] = valueS;
+                                                }
+                                            }
+                                            else
+                                            {
+                                                log.info("No BAParam annotation for parameter: " + i);
+                                            }
+                                        }
+                                        i++;
+                                    }
+                                    md.setParameterAnnotations(parameterAnnotation);
+                                }
+                            }
+                            else
+                            {
+                                log.info("Completion method does not take any parameters");
+                            }
+                            methodFound = true;
+                            break;
+                        }
+                    }
+                    if (!methodFound)
+                    {
+                        throw new MethodNotAccessibleException("Completion method not found.");
+                    }
+
+                }
+                md.setEjbInterface(ejbInterface[0]);
+
+                // Get the JNDI name of the EJB
+                log.info("Getting JNDI name of the EJB");
+                String jndiName = baCompleted.jndiName();
+                if (!jndiName.equals(""))
+                {
+                    log.info("JNDI name: " + jndiName);
+                }
+                else
+                {
+                    // Check if the JNDI name has been specified
+                    if (baJndiName != null && !baJndiName.equals(""))
+                    {
+                        jndiName = baJndiName;
+                    }
+                    else
+                    {
+                        throw new MethodIncorrectlyAnnotatedException("JNDI name not specified");
+                    }
+                }
+                md.setJndiName(jndiName);
+
+                // Check if the URL provider has been specified
+                String providerURL = baCompleted.providerURL();
+                if (!providerURL.equals(""))
+                {
+                    log.info("Provider URL: " + providerURL);
+                }
+                else
+                {
+                    // Check if the provider URL has been specified
+                    if (baProviderURL != null && !baProviderURL.equals(""))
+                    {
+                        providerURL = baProviderURL;
+                    }
+                    else
+                    {
+                        providerURL = null;
+                    }
+                }
+                md.setProviderURL(providerURL);
+            }
+
+        }
+        else
+        {
+            log.info("BACompletedBy annotation missing.");
+            log.info("Checking the agreement protocol type.");
+            if (agreementType == AgreementType.PARTICIPANT_COMPLETION)
+            {
+                log.info("Agreement protocol is participant completion. BACompletedBy is not necessary.");
+            }
+            else
+            {
+                throw new MethodIncorrectlyAnnotatedException("BACompletedBy annotation missing.");
+            }
+        }
+        serviceDescription.putMethod("complete",md);
+
+
         // Remember @BAParam annotation values
         Object[] parameterAnnotation = new Object[method.getParameterTypes().length];
         Annotation[][] parameterAnnotations = method.getParameterAnnotations();

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/DataManagement.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/DataManagement.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/DataManagement.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.helper;
+
+import org.jboss.txbridge.ba.annotation.BADataManagement;
+import org.jboss.txbridge.ba.datamgmt.DataManagerImpl;
+import org.jboss.txbridge.ba.datamgmt.DataManager;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.apache.log4j.Logger;
+
+import java.lang.reflect.Field;
+
+/**
+ * This component provides a method that can be used to inject a datamgmt manager to an object on
+ * which a datamgmt action is to be executed. Such datamgmt manager can be used to retrieve
+ * and additional data, which may be required by the datamgmt action.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class DataManagement
+{
+    // Logger
+    private static Logger log = Logger.getLogger(DataManagement.class);
+
+    public static synchronized Object injectCompensationManager(Object targetObject, TaskDescription taskDesc)
+    {
+        // Inject the transaction identifier
+        log.info("injectCompensationManager()");
+        log.info(taskDesc);
+        try
+        {
+            Class clazz = targetObject.getClass();
+            log.info("Injecting datamgmt manager");
+            Field[] fields = clazz.getDeclaredFields();
+            for (Field singleField : fields)
+            {
+                BADataManagement cm = singleField.getAnnotation(BADataManagement.class);
+                if (cm != null)
+                {
+                    if (singleField.getType().equals(DataManager.class))
+                    {
+                        log.info("DataManager object found...");
+                        log.info("Setting field...");
+                        singleField.setAccessible(true);
+                        log.info("Injecting...");
+                        singleField.set(targetObject,new DataManagerImpl(taskDesc.getTaskId(),taskDesc.getParticipant()));
+                        log.info("Returning...");
+                        return targetObject;
+                    }
+                }
+            }
+        }
+        catch (IllegalAccessException iae)
+        {
+            iae.printStackTrace();
+            return null;
+        }
+        return null;
+    }
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompletionNotifier.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompletionNotifier.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompletionNotifier.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.participant;
+
+import org.jboss.txbridge.ba.BATransactionManager;
+import org.jboss.txbridge.ba.SingleTransactionManager;
+
+/**
+ * CompletionNotifier is started by the participant. Its purpose is to inform the
+ * BA Transaction Manager that a given transaction should be completed.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class CompletionNotifier implements Runnable
+{
+    private String txId;
+    private SingleTransactionManager stm;
+
+    public CompletionNotifier(String txId, SingleTransactionManager stm)
+    {
+        this.txId = txId;
+        this.stm = stm;
+    }
+
+    public void run()
+    {
+        stm.complete();
+    }
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CoordinatorCompletionParticipant.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CoordinatorCompletionParticipant.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CoordinatorCompletionParticipant.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -23,7 +23,6 @@
 import com.arjuna.wst.*;
 import org.apache.log4j.Logger;
 import org.jboss.txbridge.ba.SingleTransactionManager;
-import org.jboss.txbridge.ba.service.ServiceDescription;
 
 /**
  * Implementation of the Participant that is enlisted for the Business Agreement with Coordinator
@@ -43,9 +42,9 @@
      * @param txId      is the transaction identifier.
      * @param serviceId is the service identifier.
      * @param stm is the single transaction manager.
-     * @param cdf is the compensation data factory that should be used by the participant
+     * @param cdf is the datamgmt data factory that should be used by the participant
      */
-    public CoordinatorCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm, CompensationDataFactory cdf)
+    public CoordinatorCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm, ManagedDataFactory cdf)
     {
         super(txId, serviceId, stm, cdf);
         log.info("constructor()");
@@ -86,15 +85,7 @@
 
     public void complete() throws WrongStateException, SystemException
     {
-        log.info("complete()");
-        ServiceDescription sd = sim.getServiceById(serviceId);
-        try
-        {
-            stm.complete(taskList.get(0),sd.getServiceType());
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
+        log.info("completeTask()");
+        completeTransaction();
     }
 }

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyManagedDataFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyManagedDataFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyManagedDataFactory.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.participant;
+
+import org.jboss.txbridge.ba.data.ManagedData;
+import org.jboss.txbridge.ba.data.DummyManagedData;
+
+/**
+ * Responsible for instantiating dummy datamgmt object. This factory is used if a certain
+ * service is executed outside the scope of a Business Activity.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class DummyManagedDataFactory implements ManagedDataFactory
+{
+    public ManagedData createManagedData()
+    {
+        return new DummyManagedData();
+    }
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactory.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.participant;
+
+import org.jboss.txbridge.ba.data.ManagedData;
+
+/**
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public interface ManagedDataFactory 
+{
+    public ManagedData createManagedData();
+}

Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactoryImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactoryImpl.java	                        (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ManagedDataFactoryImpl.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU 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) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.participant;
+
+import org.jboss.txbridge.ba.data.ManagedData;
+
+/**
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class ManagedDataFactoryImpl implements ManagedDataFactory
+{
+    public ManagedData createManagedData()
+    {
+        return new ManagedData();
+    }
+}

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/Participant.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/Participant.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/Participant.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -20,25 +20,26 @@
  */
 package org.jboss.txbridge.ba.participant;
 
-import org.jboss.txbridge.ba.data.CompensationData;
+import org.jboss.txbridge.ba.data.ManagedData;
 import org.jboss.txbridge.ba.service.ServiceDescription;
 import org.jboss.txbridge.ba.data.TaskDescription;
-import org.jboss.txbridge.ba.data.CompensationDataParam;
-import org.jboss.txbridge.ba.data.CompensationDataReturn;
 import org.jboss.txbridge.ba.service.ServiceInformationManager;
+import org.jboss.txbridge.ba.service.MethodDescription;
 import org.jboss.txbridge.ba.execute.ServiceExecutor;
 import org.jboss.txbridge.ba.execute.RemoteServiceExecutor;
 import org.jboss.txbridge.ba.execute.LocalServiceExecutor;
 import org.jboss.txbridge.ba.execute.EJBExecution;
-import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
 import org.jboss.txbridge.ba.exception.TaskAssociationFailedException;
 import org.jboss.txbridge.ba.BATransactionManager;
 import org.jboss.txbridge.ba.SingleTransactionManager;
-import org.jboss.txbridge.ba.compensation.CompensationDataProviderImpl;
-import org.jboss.txbridge.ba.annotation.BACompensationMode;
-import org.jboss.txbridge.ba.annotation.BAServiceType;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProviderImpl;
+import org.jboss.txbridge.ba.annotation.ExecutionMode;
+import org.jboss.txbridge.ba.annotation.MethodType;
 import org.apache.log4j.Logger;
 
+import javax.transaction.UserTransaction;
+import javax.naming.InitialContext;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.List;
@@ -46,7 +47,7 @@
 
 /**
  * This is an abstract class for Participant. It provides the implemention of methods that
- * are related to compensation and completing the work and are common for following participants:
+ * are related to datamgmt and completing the work and are common for following participants:
  * - Coordinator Completion Participant
  * - Participant Completion Participant
  *
@@ -64,8 +65,8 @@
     // BA Manager
     private static BATransactionManager baTransactionManager = null;
 
-    // CompensationDataFactory
-    private CompensationDataFactory cdf = null;
+    // ManagedDataFactory
+    private ManagedDataFactory cdf = null;
 
     // Single transaction manager
     protected SingleTransactionManager stm = null;
@@ -79,18 +80,21 @@
     // List of all tasks
     protected List<String> taskList = null;
 
+    // List of compensated tasks
+    private boolean compensated;
+
     // Mapping (taskId,compensation_data)
-    private ConcurrentMap<String,CompensationData> compensationData = null;
+    private ConcurrentMap<String, ManagedData> compensationData = null;
 
     /**
      * Constructor.
      *
      * @param txId is the transaction identifier.
      * @param serviceId is the service identifier.
-     * @param cdf is the compensation data factory that should be used.
+     * @param cdf is the datamgmt data factory that should be used.
      * @param stm is the single transaction manager.
      */
-    public Participant(String txId,String serviceId, SingleTransactionManager stm,CompensationDataFactory cdf)
+    public Participant(String txId,String serviceId, SingleTransactionManager stm, ManagedDataFactory cdf)
     {
         log.info("constructor()");
 
@@ -103,7 +107,7 @@
         // Remember the service identifier
         this.serviceId = serviceId;
 
-        // Remember the compensation data factory
+        // Remember the datamgmt data factory
         this.cdf = cdf;
 
         // Get reference to the service information manager
@@ -112,16 +116,19 @@
         // Initialise the list of tasks
         taskList = new ArrayList<String>();
 
-        // Initialise (taskId, compensation data) mapping
-        compensationData = new ConcurrentHashMap<String,CompensationData>();
+        // Not compensated
+        compensated = false;
 
+        // Initialise (taskId, datamgmt data) mapping
+        compensationData = new ConcurrentHashMap<String, ManagedData>();
+
         // Get reference to the BA Transaction Manager
         baTransactionManager = BATransactionManager.getSingletonInstance();
 
     }
 
     /**
-     * This method stores an object withing the compensation data for a given task.
+     * This method stores an object withing the datamgmt data for a given task.
      * The object is assigned an ID.
      *
      * @param taskId is the ID of the task.
@@ -131,8 +138,8 @@
     public void put(String taskId,Object objectId,Object object)
     {
         log.info("put(" + objectId + ")");
-        // Get the correct compensation data
-        CompensationData cd = compensationData.get(taskId);
+        // Get the correct datamgmt data
+        ManagedData cd = compensationData.get(taskId);
         if (cd == null)
         {
             return;
@@ -145,7 +152,7 @@
     }
 
     /**
-     * This method retrieves an object with a given identifier from the compensation data
+     * This method retrieves an object with a given identifier from the datamgmt data
      * that is stored for a given task id.
      *
      * @param taskId is the ID of the task.
@@ -155,8 +162,8 @@
     public Object get(String taskId,Object objectId)
     {
         log.info("get(" + objectId + ")");
-        // Get the correct compensation data
-        CompensationData cd = compensationData.get(taskId);
+        // Get the correct datamgmt data
+        ManagedData cd = compensationData.get(taskId);
         if (cd == null)
         {
             return null;
@@ -189,12 +196,12 @@
         log.info("Remember task ID: " + taskId);
         taskList.add(taskId);
 
-        // Create a new compensation object
-        log.info("Creating new compensation object");
-        CompensationData cd = cdf.createCompensationData();
+        // Create a new datamgmt object
+        log.info("Creating new datamgmt object");
+        ManagedData cd = cdf.createManagedData();
 
         // Remember the (taskid,compensationdata) association
-        log.info("Remembering compensation data");
+        log.info("Remembering datamgmt data");
         compensationData.put(taskId,cd);
 
     }
@@ -222,6 +229,17 @@
     }
 
     /**
+     * This method is invoked by the participant object if a transaction should complete.
+     * It asks the Single Transaction Manager to complete the transaction.
+     */
+    void completeTransaction()
+    {
+        log.info("completeTransaction()");
+        Thread completionNotifier = new Thread(new CompletionNotifier(txId,stm));
+        completionNotifier.start();
+    }
+
+    /**
      * This method is invoked by the participant object if a transaction should compensate.
      * It asks the BA Transaction Manager to compensate the transaction.
      */
@@ -244,49 +262,108 @@
     }
 
 
+    public void completeWork() throws ActionExecutionException
+    {
+        log.info("completeWork()");
+        log.info("Starting transaction");
+        try
+        {
+            InitialContext initialContext = new InitialContext();
+            UserTransaction transaction = (UserTransaction) initialContext.lookup("java:comp/UserTransaction");
+            transaction.begin();
+            for (String taskId : taskList)
+            {
+                log.info("Completeing task ID: " + taskId);
+
+                // Obtain information about the service
+                // TODO: Participant should have access to the service description, not just the ID
+                log.info("Getting information about the service ID: " + serviceId);
+                ServiceDescription sd = sim.getServiceById(serviceId);
+
+                // If the execution is remote than use remote executor. Otherwise use the local one.
+                // TODO: Following "if" statement is bad - I should change that -> factory! :)
+                MethodDescription completeMethod = sd.getCompletionService();
+                ExecutionMode executionMode = completeMethod.getExecutionMode();
+                log.info("Execution mode: " + executionMode);
+                ServiceExecutor se;
+                if (executionMode == ExecutionMode.UDII)
+                {
+                    // Use the remote executor.
+                    log.info("Using remote executor");
+                    se = new RemoteServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
+                }
+                else if (executionMode == ExecutionMode.POJO)
+                {
+                    // Use the local executor.
+                    log.info("Using local executor");
+                    se = new LocalServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
+                }
+                else if (executionMode == ExecutionMode.EJB)
+                {
+                    // Use the local executor.
+                    log.info("Using local executor");
+                    se = new LocalServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
+                    se.setExecutionType(new EJBExecution());
+                }
+                else
+                {
+                    throw new ActionExecutionException("Incorrect execution mode");
+                }
+                // Invoke the datamgmt action
+                log.info("Invoking the completion action");
+                se.invokeService(completeMethod,new ExecutionDataProviderImpl(taskId,this));
+            }
+            log.info("Committing");
+            transaction.commit();
+        }
+        catch (Exception e)
+        {
+            throw new ActionExecutionException(e);
+        }
+
+    }
+
     /**
-     * This method provides the implementation for executing the compensation action.
+     * This method provides the implementation for executing the datamgmt action.
      * It uses the Executor class for executing a single method/service.
      *
      * @param taskId is the ID of the task that is supposed to be compensated.
-     * @throws org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException if compensation was not successful.
+     * @throws org.jboss.txbridge.ba.exception.ActionExecutionException if datamgmt was not successful.
      */
-    public void compensateTask(String taskId) throws CompensationActionUnsuccessfulException
+    public void compensateTask(String taskId) throws ActionExecutionException
     {
         log.info("compensateTask()");
 
         log.info("Compensating task ID: " + taskId);
 
-        // TODO: Redesign this !!!
+// TODO: Redesign this !!!
+        log.info("Getting information about the service ID: " + serviceId);
         ServiceDescription sd = sim.getServiceById(serviceId);
-        if (sd.getServiceType() == BAServiceType.READONLY)
+        if (sd.getMethodType() == MethodType.READONLY)
         {
             return;
         }
 
-        // Obtain information about the service
-        // TODO: Participant should have access to the service description, not just the ID
-        log.info("Getting information about the service ID: " + serviceId);
-        ServiceDescription serviceDescription = sim.getServiceById(serviceId);
+        // If the datamgmt is remote than use remote executor. Otherwise use the local one.
+        // TODO: Following "if" statement is bad - I should change that -> factory! :)
+        MethodDescription compensationMethod = sd.getCompensationService();
 
-        // If the compensation is remote than use remote executor. Otherwise use the local one.
-        // TODO: Following "if" statement is bad - I should change that -> factory! :)
-        BACompensationMode compensationMode = serviceDescription.getCompensationMode();
-        log.info("Compensation mode: " + compensationMode);
+        ExecutionMode executionMode = compensationMethod.getExecutionMode();
+        log.info("Execution mode: " + executionMode);
         ServiceExecutor se;
-        if (compensationMode == BACompensationMode.UDII)
+        if (executionMode == ExecutionMode.UDII)
         {
             // Use the remote executor.
             log.info("Using remote executor");
             se = new RemoteServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
         }
-        else if (compensationMode == BACompensationMode.POJO)
+        else if (executionMode == ExecutionMode.POJO)
         {
             // Use the local executor.
             log.info("Using local executor");
             se = new LocalServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
         }
-        else if (compensationMode == BACompensationMode.EJB)
+        else if (executionMode == ExecutionMode.EJB)
         {
             // Use the local executor.
             log.info("Using local executor");
@@ -295,17 +372,17 @@
         }
         else
         {
-            throw new CompensationActionUnsuccessfulException("Incorrect compensation mode");
+            throw new ActionExecutionException("Incorrect execution mode");
         }
-        // Invoke the compensation action
+        // Invoke the datamgmt action
         log.info("Invoking the compensation action");
-        se.invokeService(serviceDescription,new CompensationDataProviderImpl(taskId,this));
+        se.invokeService(sd.getCompensationService(),new ExecutionDataProviderImpl(taskId,this));
 
     }
 
     /**
      * This method stores a list of arguments that was passed for method's invocation. It is used
-     * if the service has its BACompensationType set to PARAM_MATCH.
+     * if the service has its DataMatch set to PARAM_MATCH.
      *
      * @param taskId is the ID of the task.
      * @param arguments is the list of arguments.
@@ -313,19 +390,19 @@
     public void putArguments(String taskId, Object[] arguments)
     {
         log.info("putArguments()");
-        // Get the correct compensation data
-        CompensationData cd = compensationData.get(taskId);
-        if (cd == null || !(cd instanceof CompensationDataParam))
+// Get the correct datamgmt data
+        ManagedData cd = compensationData.get(taskId);
+        if (cd == null)
         {
             return;
         }
         // Put the data
-        ((CompensationDataParam)cd).putArguments(arguments);
+        cd.putArguments(arguments);
     }
 
     /**
      * This method retrieves a list of arguments that was passed for method's invocation. It is
-     * used when executing the compensation action if the BACompensationType is set to PARAM_MATCH.
+     * used when executing the datamgmt action if the DataMatch is set to PARAM_MATCH.
      *
      * @param taskId is the task ID.
      * @return the list of arguments.
@@ -333,19 +410,19 @@
     public Object[] getArguments(String taskId)
     {
         log.info("getArguments()");
-        // Get the correct compensation data
-        CompensationData cd = compensationData.get(taskId);
-        if (cd == null || !(cd instanceof CompensationDataParam))
+// Get the correct datamgmt data
+        ManagedData cd = compensationData.get(taskId);
+        if (cd == null)
         {
             return null;
         }
         // Get the data
-        return ((CompensationDataParam)cd).getArguments();
+        return cd.getArguments();
     }
 
     /**
-     * This method stores the return value that will be used as an argument when executing compensation
-     * action (when BACompensationType is set to RETURN_VALUE)
+     * This method stores the return value that will be used as an argument when executing datamgmt
+     * action (when DataMatch is set to RETURN_VALUE)
      *
      * @param taskId is the task identifier.
      * @param returnObject is the return object.
@@ -353,19 +430,19 @@
     public void putReturn(String taskId, Object returnObject)
     {
         log.info("putReturn()");
-        // Get the correct compensation data
-        CompensationData cd = compensationData.get(taskId);
-        if (cd == null || !(cd instanceof CompensationDataReturn))
+// Get the correct datamgmt data
+        ManagedData cd = compensationData.get(taskId);
+        if (cd == null)
         {
             return;
         }
         // Put the data
-        ((CompensationDataReturn)cd).putReturnObject(returnObject);
+        cd.putReturnObject(returnObject);
     }
 
     /**
-     * This method gets the return value that will be used as an argument when executing compensation
-     * action (when BACompensationType is set to RETURN_VALUE)
+     * This method gets the return value that will be used as an argument when executing datamgmt
+     * action (when DataMatch is set to RETURN_VALUE)
      *
      * @param taskId is the task ID.
      * @return the return object.
@@ -373,14 +450,14 @@
     public Object[] getReturn(String taskId)
     {
         log.info("getReturn()");
-        // Get the correct compensation data
-        CompensationData cd = compensationData.get(taskId);
-        if (cd == null || !(cd instanceof CompensationDataReturn))
+// Get the correct datamgmt data
+        ManagedData cd = compensationData.get(taskId);
+        if (cd == null)
         {
             return null;
         }
         // Get the data
-        return ((CompensationDataReturn)cd).getReturnObject();
+        return cd.getReturnObject();
     }
 
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ParticipantCompletionParticipant.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ParticipantCompletionParticipant.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ParticipantCompletionParticipant.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -36,7 +36,7 @@
     // Logger
     private static Logger log = Logger.getLogger(ParticipantCompletionParticipant.class);
 
-    public ParticipantCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm,CompensationDataFactory cdf)
+    public ParticipantCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm, ManagedDataFactory cdf)
     {
         super(txId, serviceId, stm, cdf);
         log.info("constructor()");

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescription.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescription.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescription.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -20,6 +20,10 @@
  */
 package org.jboss.txbridge.ba.service;
 
+import org.jboss.txbridge.ba.annotation.DataMatch;
+import org.jboss.txbridge.ba.annotation.ExecutionMode;
+import org.jboss.txbridge.ba.annotation.ParameterMatch;
+
 /**
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
@@ -72,4 +76,16 @@
 
     void setSingle(boolean value);
 
+    DataMatch getDataMatch();
+
+    void setDataMatch(DataMatch compensationType);
+
+    public ExecutionMode getExecutionMode();
+
+    public void setExecutionMode(ExecutionMode compensationMode);
+
+    public ParameterMatch getParameterMatch();
+
+    public void setParameterMatch(ParameterMatch parameterMatch);
+
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescriptionImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescriptionImpl.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescriptionImpl.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -20,6 +20,10 @@
  */
 package org.jboss.txbridge.ba.service;
 
+import org.jboss.txbridge.ba.annotation.DataMatch;
+import org.jboss.txbridge.ba.annotation.ExecutionMode;
+import org.jboss.txbridge.ba.annotation.ParameterMatch;
+
 /**
  * This class describes a single method with all information related to participation
  * in Business Activities.
@@ -40,6 +44,9 @@
     private Object returnId;
     private Class returnType;
     private boolean isSingle;
+    private DataMatch dataMatch;
+    private ExecutionMode executionMode;
+    private ParameterMatch parameterMatch;
 
     // TODO: Put this into a new class!
     private String jndiName;
@@ -135,7 +142,7 @@
         this.providerURL = providerURL;
     }
 
-    public boolean isSingle() 
+    public boolean isSingle()
     {
         return isSingle;
     }
@@ -145,7 +152,36 @@
         this.isSingle = value;
     }
 
+    public DataMatch getDataMatch()
+    {
+        return dataMatch;
+    }
 
+    public void setDataMatch(DataMatch compensationType)
+    {
+        this.dataMatch = compensationType;
+    }
+
+    public ExecutionMode getExecutionMode()
+    {
+        return executionMode;
+    }
+
+    public void setExecutionMode(ExecutionMode compensationMode)
+    {
+        this.executionMode = compensationMode;
+    }
+
+    public ParameterMatch getParameterMatch()
+    {
+        return parameterMatch;
+    }
+
+    public void setParameterMatch(ParameterMatch parameterMatch)
+    {
+        this.parameterMatch = parameterMatch;
+    }
+
     public Class getEjbInterface()
     {
         return ejbInterface;

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescription.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescription.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescription.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -30,22 +30,32 @@
  */
 public interface ServiceDescription extends Serializable
 {
-    BAServiceType getServiceType();
+    MethodType getMethodType();
 
-    void setServiceType(BAServiceType serviceType);
+    void setMethodType(MethodType serviceType);
 
-    BAAgreementType getAgreementType();
+    AgreementType getAgreementType();
 
-    void setAgreementType(BAAgreementType agreementType);
+    void setAgreementType(AgreementType agreementType);
 
-    BACompensationType getCompensationType();
+    public void putMethod(String methodName, MethodDescription method);
 
-    void setCompensationType(BACompensationType compensationType);
+    public MethodDescription getMethod(String methodName);
 
-    public BACompensationMode getCompensationMode();
 
-    public void setCompensationMode(BACompensationMode compensationMode);
 
+
+
+
+
+    DataMatch getDataMatch();
+
+    void setDataMatch(DataMatch compensationType);
+
+    public ExecutionMode getExecutionMode();
+
+    public void setExecutionMode(ExecutionMode compensationMode);
+
     Class getOriginalClass();
 
     void setOriginalClass(Class originalClass);
@@ -98,9 +108,9 @@
 
     public void setCompensationParameterAnnotations(Object[] compensationParameterAnnotations);
 
-    public BAParameterMatch getParameterMatch();
+    public ParameterMatch getParameterMatch();
 
-    public void setParameterMatch(BAParameterMatch parameterMatch);
+    public void setParameterMatch(ParameterMatch parameterMatch);
 
     public String getCompensationJNDIName();
 
@@ -118,4 +128,48 @@
 
     public void setCompensationEjbInterface(Class ejbInterface);
 
+    public Class getCompletionClass();
+
+    public void setCompletionClass(Class completionClass);
+
+    public String getCompletionMethodName();
+
+    public void setCompletionMethodName(String completionMethodName);
+
+    public String getCompletionWebMethodName();
+
+    public void setCompletionWebMethodName(String completionWebMethodName);
+
+    public Class getCompletionReturnType();
+
+    public void setCompletionReturnType(Class completionReturnType);
+
+    public Class[] getCompletionParameterTypes();
+
+    public void setCompletionParameterTypes(Class[] completionParameterTypes);
+
+    public Object[] getCompletionParameterAnnotations();
+
+    public void setCompletionParameterAnnotations(Object[] completionParameterAnnotations);
+
+    public String getCompletionJNDIName();
+
+    public void setCompletionJNDIName(String jndiName);
+
+    public String getCompletionProviderURL();
+
+    public void setCompletionProviderURL(String providerURL);
+
+    public boolean isCompletionSingle();
+
+    public void setCompletionSingle(boolean value);
+
+    public Class getCompletionEjbInterface();
+
+    public void setCompletionEjbInterface(Class ejbInterface);
+
+    public MethodDescription getCompletionService();
+
+    public MethodDescription getCompensationService();
+
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescriptionImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescriptionImpl.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescriptionImpl.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -22,12 +22,16 @@
 
 import org.jboss.txbridge.ba.annotation.*;
 
+import java.util.Map;
+import java.util.HashMap;
+
 /**
  * This class describes the service in terms of all its requirements related to participation
  * in Business Activities.
  *
- * TODO: Redesign this - this should use a simple map
+ * TODO: Redesign this - it's really inefficient now!
  *
+ *
  * @author Maciej P. Machulak (mmachulak at redhat.com)
  * @version 0.1
  */
@@ -37,74 +41,115 @@
     /**
      * BA-related information.
      */
-    private BAServiceType serviceType;
-    private BAAgreementType agreementType;
-    private BACompensationType compensationType;
-    private BACompensationMode compensationMode;
-    private BAParameterMatch parameterMatch;
+    private MethodType methodType;
+    private AgreementType agreementType;
 
+    private Map<String,MethodDescription> methods;
+
+
+    //TODO: This should be separate for completion and datamgmt!!
+    private DataMatch dataMatch;
+    private ExecutionMode executionMode;
+    private ParameterMatch parameterMatch;
+
     /**
      * Information about the original method.
      */
     private MethodDescription originalMethod;
 
     /**
-     * Information about the compensation method.
+     * Information about the datamgmt method.
      */
     private MethodDescription compensationMethod;
 
+    /**
+     * Information about the completion method
+     */
+    private MethodDescription completionMethod;
+
     public ServiceDescriptionImpl()
     {
+        methods = new HashMap<String,MethodDescription>();
         originalMethod = new MethodDescriptionImpl();
         compensationMethod = new MethodDescriptionImpl();
+        completionMethod = new MethodDescriptionImpl();
     }
 
-    public BAServiceType getServiceType()
+    public MethodType getMethodType()
     {
-        return serviceType;
+        return methodType;
     }
 
-    public void setServiceType(BAServiceType serviceType)
+    public void setMethodType(MethodType methodType)
     {
-        this.serviceType = serviceType;
+        this.methodType = methodType;
     }
 
-    public BAAgreementType getAgreementType()
+    public AgreementType getAgreementType()
     {
         return agreementType;
     }
 
-    public void setAgreementType(BAAgreementType agreementType)
+    public void setAgreementType(AgreementType agreementType)
     {
         this.agreementType = agreementType;
     }
 
-    public BACompensationType getCompensationType()
+    public void putMethod(String methodName, MethodDescription method)
     {
-        return compensationType;
+        this.methods.put(methodName,method);
     }
 
-    public void setCompensationType(BACompensationType compensationType)
+    public MethodDescription getMethod(String methodName)
     {
-        this.compensationType = compensationType;
+        return this.methods.get(methodName);
     }
 
-    public BACompensationMode getCompensationMode()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    public DataMatch getDataMatch()
     {
-        return compensationMode;
+        return dataMatch;
     }
 
-    public void setCompensationMode(BACompensationMode compensationMode)
+    public void setDataMatch(DataMatch dataMatch)
     {
-        this.compensationMode = compensationMode;
+        this.dataMatch = dataMatch;
     }
 
-    public BAParameterMatch getParameterMatch()
+    public ExecutionMode getExecutionMode()
     {
+        return executionMode;
+    }
+
+    public void setExecutionMode(ExecutionMode executionMode)
+    {
+        this.executionMode = executionMode;
+    }
+
+    public ParameterMatch getParameterMatch()
+    {
         return parameterMatch;
     }
 
-    public void setParameterMatch(BAParameterMatch parameterMatch)
+    public void setParameterMatch(ParameterMatch parameterMatch)
     {
         this.parameterMatch = parameterMatch;
     }
@@ -261,7 +306,7 @@
 
     public boolean isCompensationSingle()
     {
-        return compensationMethod.isSingle();
+        return methods.get("compensate").isSingle();
     }
 
     public void setCompensationSingle(boolean value)
@@ -279,4 +324,114 @@
         compensationMethod.setEjbInterface(ejbInterface);
     }
 
+    public Class getCompletionClass()
+    {
+        return completionMethod.getClazz();
+    }
+
+    public void setCompletionClass(Class completionClass)
+    {
+        completionMethod.setClazz(completionClass);
+    }
+
+    public String getCompletionMethodName()
+    {
+        return completionMethod.getMethodName();
+    }
+
+    public void setCompletionMethodName(String completionMethodName)
+    {
+        completionMethod.setMethodName(completionMethodName);
+    }
+
+    public String getCompletionWebMethodName()
+    {
+        return completionMethod.getWebMethodName();
+    }
+
+    public void setCompletionWebMethodName(String completionWebMethodName)
+    {
+        completionMethod.setWebMethodName(completionWebMethodName);
+    }
+
+    public Class getCompletionReturnType()
+    {
+        return completionMethod.getReturnType();
+    }
+
+    public void setCompletionReturnType(Class completionReturnType)
+    {
+        completionMethod.setReturnType(completionReturnType);
+    }
+
+    public Class[] getCompletionParameterTypes()
+    {
+        return completionMethod.getParameterTypes();
+    }
+
+    public void setCompletionParameterTypes(Class[] completionParameterTypes)
+    {
+        completionMethod.setParameterTypes(completionParameterTypes);
+    }
+
+    public Object[] getCompletionParameterAnnotations()
+    {
+        return completionMethod.getParameterAnnotations();
+    }
+
+    public void setCompletionParameterAnnotations(Object[] completionParameterAnnotations)
+    {
+        completionMethod.setParameterAnnotations(completionParameterAnnotations);
+    }
+
+    public String getCompletionJNDIName()
+    {
+        return completionMethod.getJndiName();
+    }
+
+    public void setCompletionJNDIName(String jndiName)
+    {
+        completionMethod.setJndiName(jndiName);
+    }
+
+    public String getCompletionProviderURL()
+    {
+        return completionMethod.getProviderURL();
+    }
+
+    public void setCompletionProviderURL(String providerURL)
+    {
+        completionMethod.setProviderURL(providerURL);
+    }
+
+    public boolean isCompletionSingle()
+    {
+        return methods.get("complete").isSingle();
+    }
+
+    public void setCompletionSingle(boolean value)
+    {
+        completionMethod.setSingle(value);
+    }
+
+    public Class getCompletionEjbInterface()
+    {
+        return completionMethod.getEjbInterface();
+    }
+
+    public void setCompletionEjbInterface(Class ejbInterface)
+    {
+        completionMethod.setEjbInterface(ejbInterface);
+    }
+
+    public MethodDescription getCompletionService()
+    {
+        return methods.get("complete");
+    }
+
+    public MethodDescription getCompensationService()
+    {
+        return methods.get("compensate");
+    }
+
 }

Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceInformationManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceInformationManager.java	2007-08-13 16:09:48 UTC (rev 14175)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceInformationManager.java	2007-08-13 16:18:25 UTC (rev 14176)
@@ -96,11 +96,11 @@
     }
 
     /**
-     * This method stores a service description for a service with a given complete name and
+     * This method stores a service description for a service with a given completeTask name and
      * returns a unique associated service ID.
      *
      * @param serviceId is the unique service Id.
-     * @param completeMethodName is the complete method's name.
+     * @param completeMethodName is the completeTask method's name.
      * @param serviceDescription is the service description.
      */
     private void storeServiceDescription(String serviceId, String completeMethodName,ServiceDescription serviceDescription)
@@ -113,7 +113,7 @@
     /**
      * This method returns the service description for a service with a given identifier.
      *
-     * @param completeMethodName is the complete method name (classname+methodname)
+     * @param completeMethodName is the completeTask method name (classname+methodname)
      * @return service description.
      */
     public ServiceDescription getServiceByName(String completeMethodName)
@@ -142,7 +142,7 @@
     /**
      * This method returns the ID for the service with a given class name and given method name.
      *
-     * @param completeMethodName is the complete method name (classname+methodname)
+     * @param completeMethodName is the completeTask method name (classname+methodname)
      * @return the service ID.
      */
     public String getServiceId(String completeMethodName)




More information about the jboss-svn-commits mailing list