[jboss-svn-commits] JBL Code SVN: r14794 - in labs/jbosstm/workspace/baframework/trunk: demo/resources/web and 12 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Sep 1 14:14:56 EDT 2007
Author: maciej.machulak
Date: 2007-09-01 14:14:55 -0400 (Sat, 01 Sep 2007)
New Revision: 14794
Added:
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/Executable.java
Removed:
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java
Modified:
labs/jbosstm/workspace/baframework/trunk/changelog.txt
labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.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/HotelImpl.java
labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.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/DummyManagedData.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/ManagedData.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.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/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/EJBExecution.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/LocalServiceExecutor.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/RemoteServiceExecutor.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/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:
Thu Sep 01 19:11:00 GMT 2007
- cleaned and restructured code
- corrected minor errors in the demo application
- corrected wrong management of readonly services (!)
Modified: labs/jbosstm/workspace/baframework/trunk/changelog.txt
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/changelog.txt 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/changelog.txt 2007-09-01 18:14:55 UTC (rev 14794)
@@ -1,3 +1,9 @@
+Thu Sep 01 19:11:00 GMT 2007
+
+- cleaned and restructured code
+- corrected minor errors in the demo application
+- corrected wrong management of readonly services (!)
++---+
Thu Aug 13 18:11:00 GMT 2007
Release of the Business Activity Framework version 0.2
Modified: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp 2007-09-01 18:14:55 UTC (rev 14794)
@@ -130,11 +130,6 @@
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>
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/HotelService.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -217,14 +217,14 @@
else if (methodName.equals("bookRoom"))
{
methodResponse = bookRoom(parameters).toString();
- state = 3;
}
else if (methodName.equals("bookFitnessPass"))
{
if (bookFitnessPass(parameters))
{
methodResponse = "true";
- }
+ state = 3;
+ }
else
{
methodResponse = "false";
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelImpl.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -407,7 +407,7 @@
throws HotelCustomException
{
log.info("bookFitnessPass()");
- hotelView.newMethod("bookFitnessPack()");
+ hotelView.newMethod("bookFitnessPass()");
hotelView.addMessage("Username: " + username);
hotelView.addMessage("Password: " + password);
hotelView.addMessage("Reservation no: " + reservationNumber);
@@ -433,7 +433,6 @@
em.merge(order);
hotelView.addMessage("Returning true");
hotelView.endMethod();
- compensationView.compensationMethod("cancelFitnessPass()");
return true;
}
@@ -449,6 +448,7 @@
// TODO: Implement...
hotelView.addMessage("Returning true");
hotelView.endMethod();
+ compensationView.compensationMethod("cancelFitnessPass()");
return true;
}
Modified: labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml 2007-09-01 18:14:55 UTC (rev 14794)
@@ -27,7 +27,8 @@
<typedef name="baPackageTypedef" expr="class(org.jboss.txbridge.ba.*)"/>
<!-- Specification of the pointcuts -->
- <pointcut name="baServiceAnnotation" expr="execution(* *->@org.jboss.txbridge.ba.annotation.BAMethod(..))"/>
+ <pointcut name="baServiceAnnotation" expr="execution(* *->@org.jboss.txbridge.ba.annotation.BAMethod(..))
+ AND execution(* *->@javax.jws.WebMethod(..))"/>
<pointcut name="baCompensationManagement" expr="field(org.jboss.txbridge.ba.datamgmt.DataManager *->@org.jboss.txbridge.ba.annotation.BADataManagement)"/>
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -181,14 +181,14 @@
log.info("Checking for participant...");
Participant participant = serviceParticipantMapping.get(serviceId);
boolean participantCreated = !(participant == null);
+ AgreementType agreementType = sd.getAgreementType();
if ( participant == null )
{
log.info("Participant for this transaction and this service is unknown");
// Create a new participant
- // 1) Determine the datamgmt data factory that should be used
+ // 1) Determine if the service will need a real managed object
ManagedDataFactory cdf;
- DataMatch compensationType = sd.getDataMatch();
MethodType serviceType = sd.getMethodType();
cdf = new ManagedDataFactoryImpl();
if (serviceType == MethodType.READONLY)
@@ -197,7 +197,7 @@
}
// 2) Create the participant
log.info("Creating a new participant");
- AgreementType agreementType = sd.getAgreementType();
+
if (agreementType == AgreementType.PARTICIPANT_COMPLETION)
{
log.info("Agreement protocol type: " + AgreementType.PARTICIPANT_COMPLETION);
@@ -210,7 +210,7 @@
}
else
{
- throw new TransactionProcessingException("Unsupported agreement type: " + compensationType);
+ throw new TransactionProcessingException("Unsupported agreement type: " + agreementType);
}
// Remember the participant
@@ -218,10 +218,10 @@
serviceParticipantMapping.put(serviceId,participant);
}
- // Check the required agreement protocol and enlist the participant
+ // Enlist the participant
log.info("Enlisting participant if necessary");
BAParticipantManager participantManager;
- if (sd.getAgreementType() == AgreementType.PARTICIPANT_COMPLETION)
+ if (agreementType == AgreementType.PARTICIPANT_COMPLETION)
{
log.info("Protocol: " + AgreementType.PARTICIPANT_COMPLETION);
participantManager = businessActivityManager.enlistForBusinessAgreementWithParticipantCompletion((BusinessAgreementWithParticipantCompletionParticipant)participant,new Uid().toString());
@@ -230,7 +230,7 @@
log.info("Storing reference to the participant manager for task: " + taskId);
taskBAManagerMapping.put(taskId,participantManager);
}
- else if (sd.getAgreementType() == AgreementType.COORDINATOR_COMPLETION)
+ else if (agreementType == AgreementType.COORDINATOR_COMPLETION)
{
log.info("Protocol: " + AgreementType.COORDINATOR_COMPLETION);
if (!participantCreated)
@@ -308,8 +308,9 @@
}
// Get method descriptions
- MethodDescription completeMethod = sd.getCompletionService();
- MethodDescription compensateMethod = sd.getCompensationService();
+ MethodDescription originalMethod = sd.getMethod("original");
+ MethodDescription completeMethod = sd.getMethod("complete");
+ MethodDescription compensateMethod = sd.getMethod("compensate");
// Get reference to the participant
Participant participant = taskDesc.getParticipant();
@@ -324,7 +325,7 @@
// 2) Get the annotation values
log.info("Getting annotation values");
- Object[] annotations = sd.getOriginalParameterAnnotations();
+ Object[] annotations = originalMethod.getParameterAnnotations();
// 3) Remember parameters
log.info("Remembering parameters");
@@ -340,7 +341,7 @@
// 4) Remember the return object if necessary
log.info("Remembering return object if necessary");
- Object returnId = sd.getOriginalReturnId();
+ Object returnId = originalMethod.getReturnId();
if (returnId != null)
{
log.info("Return ID: " + returnId);
@@ -397,7 +398,6 @@
else if (serviceType == MethodType.READONLY)
{
log.info("Exiting from BA");
- baParticipantManager.completed();
baParticipantManager.exit();
}
else
@@ -470,7 +470,7 @@
}
log.info("Building list of CoordinatorCompletionParticipants");
- List<Participant> participantList = new ArrayList<Participant>();
+ List<CoordinatorCompletionParticipant> participantList = new ArrayList<CoordinatorCompletionParticipant>();
Map<Participant,BAParticipantManager> managerList = new HashMap<Participant,BAParticipantManager>();
for (String task : taskList)
@@ -499,7 +499,7 @@
if (participantManager != null)
{
log.info("Adding participant");
- participantList.add(participant);
+ participantList.add((CoordinatorCompletionParticipant)participant);
managerList.put(participant,participantManager);
}
else
@@ -530,11 +530,11 @@
* @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)
+ private void completeList(List<CoordinatorCompletionParticipant> participantList, Map<Participant,BAParticipantManager> managerList)
{
log.info("completeList()");
- for (Participant participant : participantList)
+ for (CoordinatorCompletionParticipant participant : participantList)
{
BAParticipantManager participantManager = managerList.get(participant);
if (participantManager != null)
@@ -630,8 +630,9 @@
}
// Check if the service should be compensated only once
+ MethodDescription compensationMethod = sd.getMethod("compensate");
log.info("Checking if the service should be compensated only once");
- if (sd.isCompensationSingle())
+ if (compensationMethod.isSingle())
{
log.info("Service should be compensated only once");
// If it has been already executed then take another task
@@ -650,8 +651,9 @@
log.info("This task is associated with service ID: " + serviceId);
Participant participant = serviceParticipantMapping.get(serviceId);
- log.info("Compensating: " + sd.getOriginalMethodName());
- log.info("Compensation action: " + sd.getCompensationMethodName());
+ MethodDescription originalMethod = sd.getMethod("original");
+ log.info("Compensating: " + originalMethod.getMethodName());
+ log.info("Compensation action: " + compensationMethod.getMethodName());
if ( participant != null )
{
// Order the participant to compensate a given single task
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -99,7 +99,7 @@
// Associate datamgmt manager with thread of execution
Long threadId = Thread.currentThread().getId();
log.info("Associating datamgmt manager for thread: " + threadId);
- cmp.associateCompensationManager(threadId,new DataManagerImpl(taskDesc.getTaskId(),taskDesc.getParticipant()));
+ cmp.associateManager(threadId,new DataManagerImpl(taskDesc.getTaskId(),taskDesc.getParticipant()));
try
{
@@ -111,7 +111,7 @@
// Dissassociate the thread
log.info("Disassociating datamgmt manager for thread: " + threadId);
- cmp.removeCompensationManager(threadId);
+ cmp.removeManager(threadId);
log.info("No exception - proceeding");
@@ -125,7 +125,7 @@
{
// Dissassociate the thread
log.info("Disassociating datamgmt manager for thread: " + threadId);
- cmp.removeCompensationManager(threadId);
+ cmp.removeManager(threadId);
// Clean the transaction
log.info("Cleaning information about the transaction");
@@ -163,7 +163,7 @@
public Object access(FieldReadInvocation invocation) throws Throwable
{
log.info("Returning datamgmt manager for thread: " + Thread.currentThread().getId());
- return cmp.getCompensationManager(Thread.currentThread().getId());
+ return cmp.getManager(Thread.currentThread().getId());
}
/**
Modified: 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 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyManagedData.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,8 +21,8 @@
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.
+ * This class represents a dummy manageddata object which is used when services are
+ * executed outside the scope of a Business Activity and no data should be stored.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,13 +21,13 @@
package org.jboss.txbridge.ba.data;
/**
- * 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
- * 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).
+ * List of supported identification types. Identification type defines how managed
+ * data should be processed when executing the completion or compensation action.
+ * If data has been remembered with textual identifiers (names) then the signature of the
+ * action (completion or compensation) must provide information how this data can be matched
+ * with parameters of that action. If identifiers are represented by numbers then the execution
+ * mechanism simply use managed data in the required order (this can be used for
+ * remote completion or compensation where third-party services are used).
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
Modified: 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 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/ManagedData.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -27,7 +27,7 @@
import java.io.Serializable;
/**
- * This class represents the basic datamgmt data that is used for datamgmt.
+ * This class represents the managed data object.
* It provides implementation of methods to store and retrieve data with given identifiers.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
@@ -45,22 +45,34 @@
// The return object
private Object[] returnObject;
- private ConcurrentMap<Object,Object> compensationData;
+ private ConcurrentMap<Object,Object> managedData;
public ManagedData()
{
returnObject = new Object[1];
- compensationData = new ConcurrentHashMap<Object,Object>();
+ managedData = new ConcurrentHashMap<Object,Object>();
}
+ /**
+ * Retrieves an object of a given identifier.
+ *
+ * @param key is the object's identifier.
+ * @return the object.
+ */
public Object get(Object key)
{
- return compensationData.get(key);
+ return managedData.get(key);
}
+ /**
+ * Stores the object with a given identifier.
+ *
+ * @param key is the identifier.
+ * @param value is the object.
+ */
public void put(Object key, Object value)
{
- compensationData.put(key, value);
+ managedData.put(key, value);
}
/**
@@ -85,12 +97,22 @@
return arguments;
}
+ /**
+ * Retrieves the return object.
+ *
+ * @return the object.
+ */
public Object[] getReturnObject()
{
log.info("getReturnObject()");
return returnObject;
}
+ /**
+ * Stores the return object.
+ *
+ * @param returnObject is the return object.
+ */
public void putReturnObject(Object returnObject)
{
log.info("putReturnObject()");
Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,7 +21,7 @@
package org.jboss.txbridge.ba.datamgmt;
/**
- * Interface of the datamgmt manager.
+ * Interface of the Data Manager.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -24,11 +24,11 @@
import org.jboss.txbridge.ba.participant.Participant;
/**
- * Compensation Manager provides a lightweight API for the Business Programmer so that
- * it can store any additional data which may be required by the datamgmt action.
- * In low-level details it wraps a participant associated with the current service
+ * Data Manager provides a lightweight API for the Business Programmer so that
+ * it can store any additional data which may be required by the completion or compensation
+ * action. In low-level details it wraps a participant associated with the current service
* invocation.
- * Compensation Manager is automatically injected by the underlying middleware mechanisms.
+ * Data Manager is automatically injected by the underlying middleware mechanisms.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
@@ -72,7 +72,7 @@
/**
* This method retrieves an object with a given identifier. This method automatically
- * associates the task id this datamgmt manager was associated with.
+ * associates the task id this data manager was associated with.
*
* @param objectId is the ID of the object.
* @return the object.
Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -27,8 +27,8 @@
/**
* This component is responsible for ensuring that a proper Data Manager is provided
- * during execution of a service or a datamgmt action. It associates datamgmt managers
- * with proper threads of execution.
+ * during execution of a service or a completion or compensation action. It associates
+ * data managers with proper threads of execution.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
@@ -47,9 +47,9 @@
}
/**
- * Returns the instance fo a datamgmt manager provider.
+ * Returns the instance of a data manager provider.
*
- * @return the datamgmt manager.
+ * @return the data manager provider.
*/
public static DataManagerProvider getSingletonInstance()
{
@@ -69,46 +69,46 @@
}
/**
- * This method associates a datamgmt manager with a given thread of execution.
+ * This method associates a data manager with a given thread of execution.
*
- * @param thread is the thread for which the datamgmt manager should be associated.
- * @param cmp is the datamgmt manager, which should be associated.
+ * @param thread is the thread for which the data manager should be associated.
+ * @param cmp is the data manager, which should be associated.
*/
- public void associateCompensationManager(Long thread, DataManager cmp)
+ public void associateManager(Long thread, DataManager cmp)
{
- log.info("associateCompensationManager()");
+ log.info("associateManager()");
cmList.put(thread,cmp);
}
/**
- * This method returns the datamgmt manager object associated to a certain thread of execution.
- * If there is no datamgmt manager associated to a certain thread of execution then it means
- * the service is being executed outside the scope of the Business Activity and a dummy datamgmt
+ * This method returns the data manager object associated to a certain thread of execution.
+ * If there is no data manager associated to a certain thread of execution then it means
+ * the service is being executed outside the scope of the Business Activity and a dummy data
* manager is simply returned.
*
- * @param thread thread ID for which the datamgmt manager should be returned.
+ * @param thread thread ID for which the data manager should be returned.
* @return the DataManager object.
*/
- public DataManager getCompensationManager(Long thread)
+ public DataManager getManager(Long thread)
{
- log.info("getCompensationManager()");
+ log.info("getManager()");
DataManager cm = cmList.get(thread);
if (cm == null)
{
- log.info("Returning a dummy datamgmt manager");
+ log.info("Returning a dummy data manager");
cm = new DummyDataManager();
}
return cm;
}
/**
- * This method removes the association of a thread and a datamgmt manager.
+ * This method removes the association of a thread and a data manager.
*
* @param thread is the thread for which the associaction should be removed.
*/
- public void removeCompensationManager(Long thread)
+ public void removeManager(Long thread)
{
- log.info("removeCompensationManager()");
+ log.info("removeManager()");
cmList.remove(thread);
}
}
Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,9 +21,9 @@
package org.jboss.txbridge.ba.datamgmt;
/**
- * This class represents a dummy datamgmt manager. Such dummy datamgmt manager is used
+ * This class represents a dummy data manager. Such dummy data manager is used
* if a Web Service is invoked outside the scope of the Business Activity. It provides same
- * methods as a normal datamgmt manager but does not store any values and always returns null.
+ * methods as a normal data manager but does not store any values and always returns null.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
Modified: 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 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/ActionExecutionException.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,7 +21,7 @@
package org.jboss.txbridge.ba.exception;
/**
- * This exception is thrown if there was an error with executing a single datamgmt action.
+ * This exception is thrown if there was an error with executing a single 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)
Modified: 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 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodNotAccessibleException.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,9 +21,9 @@
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).
+ * This exception is thrown when the compensation or completion method 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
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ArgumentsProvider.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -29,7 +29,7 @@
/**
* 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 datamgmt action.
+ * an action (completion or compensation)
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
@@ -42,7 +42,7 @@
* This method
*
* @param md is the service description.
- * @param cdp is the datamgmt data provider.
+ * @param cdp is the managed data provider.
* @return array of objects.
* @throws ActionExecutionException
*/
@@ -56,10 +56,8 @@
Object[] parameterObjects = null;
Class[] parameterTypes = null;
- // Check the type of the service
- log.info("Compensation type: " + md.getDataMatch());
+ log.info("Data Match type: " + md.getDataMatch());
- // Depending on the datamgmt type try to cast the datamgmt data and proceed
if (md.getDataMatch() == DataMatch.PARAMETERS_MATCH)
{
// Get parameters
@@ -77,7 +75,7 @@
}
else
{
- throw new ActionExecutionException("Compensation data incorrect.");
+ throw new ActionExecutionException("Managed data incorrect.");
}
}
@@ -94,14 +92,14 @@
}
else
{
- throw new ActionExecutionException("Compensation data incorrect.");
+ throw new ActionExecutionException("Managed data incorrect.");
}
}
else if (md.getDataMatch() == DataMatch.CUSTOM)
{
// Get parameter annotations
- log.info("Getting datamgmt parameter annotations");
+ log.info("Getting parameter annotations");
Object[] parameterAnnotations = md.getParameterAnnotations();
if (parameterAnnotations != null)
{
@@ -159,47 +157,6 @@
}
- /**
- // Check if the number of parameters is correct
- log.info("Checking if number of parameters matches");
- int compensationParameters = sd.getCompensationParameterTypes().length;
- if (successfullMatches < compensationParameters)
- {
- log.info("Number of parameters is smaller");
- ParameterMatch parameterMatch = sd.getParameterMatch();
- log.info("ParameterMatch: " + parameterMatch);
- if ((parameterMatch == ParameterMatch.STRICT))
- {
- throw new ActionExecutionException("Original parameters do not match datamgmt parameters.");
- }
- else if (sd.getParameterMatch().equals(ParameterMatch.ALLOW_NULL))
- {
- 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 ( dataMatch == DataMatch.PARAMETERS_MATCH )
- {
- log.info("Parameter list extended with null values to match argument list");
- Object[] tempObjects = parameterObjects;
- parameterObjects = new Object[compensationParameters];
- System.arraycopy(tempObjects,0,parameterObjects,0,tempObjects.length);
- }
- else
- {
- // If the datamgmt type was CUSTOM we don't have to do anything.
- }
- }
- }
- else if (successfullMatches > compensationParameters)
- {
- log.info("Impossible!:)");
- }
- */
-
return parameterObjects;
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/CorbaExecution.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -23,7 +23,6 @@
import org.apache.log4j.Logger;
import org.jboss.txbridge.ba.data.TaskDescription;
import org.jboss.txbridge.ba.exception.ActionExecutionException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
import org.jboss.txbridge.ba.service.MethodDescription;
/**
@@ -32,13 +31,12 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class CorbaExecution implements ExecutionInterface
-{
+public class CorbaExecution implements Executable {
// Logger
private static Logger log = Logger.getLogger(CorbaExecution.class);
public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
- log.info("invokeService()");
+ log.info("invoke()");
// TODO: Implement
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/EJBExecution.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -34,7 +34,7 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class EJBExecution implements ExecutionInterface
+public class EJBExecution implements Executable
{
// Logger
private static Logger log = Logger.getLogger(EJBExecution.class);
@@ -47,11 +47,11 @@
* @param md describes the service.
* @param arguments is the list of arguments.
* @param argumentTypes is the list of argument types.
- * @throws ActionExecutionException if invoking datamgmt action was not successful.
+ * @throws ActionExecutionException if invoking completion or compensation action was not successful.
*/
public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes)
throws ActionExecutionException {
- log.info("invokeService()");
+ log.info("invoke()");
try
{
@@ -72,13 +72,13 @@
log.info("Bean looked up successfully: " + theBean.getClass());
// Invoke the method
- log.info("Getting datamgmt method");
+ log.info("Getting method");
Method compensationMethod = ejbInterface.getMethod(methodName,argumentTypes);
if (compensationMethod == null)
{
- throw new ActionExecutionException("Could not get access to the datamgmt method");
+ throw new ActionExecutionException("Could not get access to the method");
}
- log.info("Invoking datamgmt method");
+ log.info("Invoking method");
compensationMethod.invoke(theBean,arguments);
}
catch (Exception e)
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/Executable.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/Executable.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/Executable.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -0,0 +1,47 @@
+/*
+ * 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.execute;
+
+import org.jboss.txbridge.ba.data.TaskDescription;
+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
+ * completion or compensation.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public interface Executable
+{
+ /**
+ * This method invokes a service that is described by the service description with given arguments
+ * and argument types.
+ *
+ * @param taskDesc describes the task (needed to inject the proper participant).
+ * @param md describes the service.
+ * @param arguments is the list of arguments.
+ * @param argumentTypes is the list of argument types.
+ * @throws ActionExecutionException if invoking datamgmt action was not successful.
+ */
+ public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments,Class[] argumentTypes) throws ActionExecutionException;
+}
Deleted: 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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -1,47 +0,0 @@
-/*
- * 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.execute;
-
-import org.jboss.txbridge.ba.data.TaskDescription;
-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
- * datamgmt.
- *
- * @author Maciej P. Machulak (mmachulak at redhat.com)
- * @version 0.1
- */
-public interface ExecutionInterface
-{
- /**
- * This method invokes a service that is described by the service description with given arguments
- * and argument types.
- *
- * @param taskDesc describes the task (needed to inject the proper participant).
- * @param md describes the service.
- * @param arguments is the list of arguments.
- * @param argumentTypes is the list of argument types.
- * @throws ActionExecutionException if invoking datamgmt action was not successful.
- */
- 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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalExecution.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -35,8 +35,7 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class LocalExecution implements ExecutionInterface
-{
+public class LocalExecution implements Executable {
// Logger
private static Logger log = Logger.getLogger(LocalExecution.class);
@@ -48,27 +47,27 @@
* @param md describes the service.
* @param arguments is the list of arguments.
* @param argumentTypes is the list of argument types.
- * @throws ActionExecutionException if invoking datamgmt action was not successful.
+ * @throws ActionExecutionException if invoking service was not successful.
*/
public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes)
throws ActionExecutionException
{
- log.info("invokeService()");
+ log.info("invoke()");
try
{
- // 1) Get the class of the datamgmt method
+ // 1) Get the class of the method
Class clazz = md.getClazz();
log.info("Compensation class: " + clazz.getName());
- // 2) Get the name of the datamgmt method
+ // 2) Get the name of the method
String methodName = md.getMethodName();
log.info("Compensation method: " + methodName);
- // 3) Get the datamgmt method
+ // 3) Get the method
log.info("Getting reference to the method...");
Method compensationMethod = clazz.getMethod(methodName,argumentTypes);
if ( compensationMethod == null )
{
- throw new ActionExecutionException("Could not get access to the datamgmt method");
+ throw new ActionExecutionException("Could not get access to the method");
}
// 4) Invoke the service
log.info("Getting reference to the class constructor");
Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalServiceExecutor.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalServiceExecutor.java 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalServiceExecutor.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,6 +21,11 @@
package org.jboss.txbridge.ba.execute;
import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProvider;
+import org.jboss.txbridge.ba.datamgmt.DataManagerImpl;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.apache.log4j.Logger;
/**
* This class represents a local service executor. This executor uses the LocalExecution class
@@ -31,6 +36,10 @@
*/
public class LocalServiceExecutor extends ServiceExecutor
{
+
+ // Logger
+ private static Logger log = Logger.getLogger(LocalServiceExecutor.class);
+
public LocalServiceExecutor(TaskDescription taskDesc)
{
super(taskDesc);
@@ -38,4 +47,29 @@
dataProvider = new ArgumentsProvider();
}
+ public void invoke(MethodDescription md, ExecutionDataProvider edp)
+ throws ActionExecutionException
+ {
+ log.info("invoke()");
+ log.info("Getting list of arguments");
+ 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 data manager to thread: " + threadId);
+ cmp.associateManager(threadId,new DataManagerImpl(taskDescription.getTaskId(),taskDescription.getParticipant()));
+ try
+ {
+ execution.invokeService(taskDescription,md,arguments,argumentTypes);
+ log.info("Removing data manager association for thread: " + threadId);
+ cmp.removeManager(threadId);
+ }
+ catch (ActionExecutionException e)
+ {
+ log.info("Removing data manager association for thread: " + threadId);
+ cmp.removeManager(threadId);
+ throw new ActionExecutionException(e);
+ }
+ }
+
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RMIExecution.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -23,7 +23,6 @@
import org.apache.log4j.Logger;
import org.jboss.txbridge.ba.data.TaskDescription;
import org.jboss.txbridge.ba.exception.ActionExecutionException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
import org.jboss.txbridge.ba.service.MethodDescription;
/**
@@ -32,13 +31,12 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class RMIExecution implements ExecutionInterface
-{
+public class RMIExecution implements Executable {
// Logger
private static Logger log = Logger.getLogger(RMIExecution.class);
public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
- log.info("invokeService");
+ log.info("invoke");
// TODO: Implement
Modified: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RemoteServiceExecutor.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RemoteServiceExecutor.java 2007-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RemoteServiceExecutor.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -21,6 +21,11 @@
package org.jboss.txbridge.ba.execute;
import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProvider;
+import org.jboss.txbridge.ba.datamgmt.DataManagerImpl;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import org.apache.log4j.Logger;
/**
* This class represents a remote service executor. This executor uses the WSConfiguredDII
@@ -31,11 +36,33 @@
*/
public class RemoteServiceExecutor extends ServiceExecutor
{
+
+ // Logger
+ private static Logger log = Logger.getLogger(RemoteServiceExecutor.class);
+
public RemoteServiceExecutor(TaskDescription taskDesc)
{
super(taskDesc);
execution = new WSConfiguredDII();
dataProvider = new ArgumentsProvider();
}
-
+
+ public void invoke(MethodDescription md, ExecutionDataProvider edp)
+ throws ActionExecutionException
+ {
+ log.info("invoke()");
+ log.info("Getting list of arguments");
+ Object[] arguments = dataProvider.getArguments(md,edp);
+ log.info("Getting list of argument types");
+ Class[] argumentTypes = dataProvider.getArgumentTypes(arguments);
+ try
+ {
+ execution.invokeService(taskDescription,md,arguments,argumentTypes);
+ }
+ catch (ActionExecutionException e)
+ {
+ throw new ActionExecutionException(e);
+ }
+ }
+
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceExecutor.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -27,11 +27,10 @@
import org.jboss.txbridge.ba.data.TaskDescription;
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 datamgmt actions.
+ * executing completion or compensation actions.
*
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
@@ -42,13 +41,13 @@
private static Logger log = Logger.getLogger(ServiceExecutor.class);
// Compensation manager provider
- private static DataManagerProvider cmp = DataManagerProvider.getSingletonInstance();
+ protected static DataManagerProvider cmp = DataManagerProvider.getSingletonInstance();
// Task description
- private TaskDescription taskDescription;
+ protected TaskDescription taskDescription;
// Execution interface
- ExecutionInterface execution;
+ Executable execution;
// Data provider
org.jboss.txbridge.ba.execute.DataProvider dataProvider;
@@ -72,7 +71,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, org.jboss.txbridge.ba.execute.DataProvider dp)
+ public ServiceExecutor(TaskDescription taskDesc, Executable execution, org.jboss.txbridge.ba.execute.DataProvider dp)
{
log.info("constructor()");
this.taskDescription = taskDesc;
@@ -85,43 +84,22 @@
*
* @param execution is the execution type which should be set.
*/
- public void setExecutionType(ExecutionInterface execution)
+ public void setExecutionType(Executable execution)
{
log.info("setExecutionType()");
this.execution = execution;
}
/**
- * This method invokes the datamgmt task which is specified in the service description.
- * It uses datamgmt data which are passed as a parameter.
+ * This method invokes the completion or compensation task which is specified in the service description.
+ * It uses managed data which are passed as a parameter.
*
* @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(MethodDescription md, ExecutionDataProvider edp)
- throws ActionExecutionException {
- log.info("invokeService()");
- log.info("Getting list of arguments");
- 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 datamgmt manager to thread: " + threadId);
- cmp.associateCompensationManager(threadId,new DataManagerImpl(taskDescription.getTaskId(),taskDescription.getParticipant()));
- try
- {
- execution.invokeService(taskDescription,md,arguments,argumentTypes);
- log.info("Removing datamgmt manager association for thread: " + threadId);
- cmp.removeCompensationManager(threadId);
- }
- catch (ActionExecutionException e)
- {
- log.info("Removing datamgmt manager association for thread: " + threadId);
- cmp.removeCompensationManager(threadId);
- throw new ActionExecutionException(e);
- }
- }
+ public abstract void invoke(MethodDescription md, ExecutionDataProvider edp) throws ActionExecutionException;
+
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSConfiguredDII.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -23,7 +23,6 @@
import org.apache.log4j.Logger;
import org.jboss.txbridge.ba.data.TaskDescription;
import org.jboss.txbridge.ba.exception.ActionExecutionException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
import org.jboss.txbridge.ba.service.MethodDescription;
/**
@@ -32,13 +31,12 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class WSConfiguredDII implements ExecutionInterface
-{
+public class WSConfiguredDII implements Executable {
// Logger
private static Logger log = Logger.getLogger(WSConfiguredDII.class);
public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
- log.info("invokeService()");
+ log.info("invoke()");
}
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSUnconfiguredDII.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -23,7 +23,6 @@
import org.apache.log4j.Logger;
import org.jboss.txbridge.ba.data.TaskDescription;
import org.jboss.txbridge.ba.exception.ActionExecutionException;
-import org.jboss.txbridge.ba.service.ServiceDescription;
import org.jboss.txbridge.ba.service.MethodDescription;
/**
@@ -32,13 +31,12 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class WSUnconfiguredDII implements ExecutionInterface
-{
+public class WSUnconfiguredDII implements Executable {
// Logger
private static Logger log = Logger.getLogger(WSUnconfiguredDII.class);
public void invokeService(TaskDescription taskDesc, MethodDescription md, Object[] arguments, Class[] argumentTypes) throws ActionExecutionException {
- log.info("invokeService()");
+ log.info("invoke()");
// 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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -57,12 +57,16 @@
* @throws org.jboss.txbridge.ba.exception.MethodNotAccessibleException if the specified compensatiom method is not accessible.
*/
public static synchronized ServiceDescription processMethod(Method method)
- throws MethodIncorrectlyAnnotatedException, MethodNotAccessibleException {
+ throws MethodIncorrectlyAnnotatedException, MethodNotAccessibleException
+ {
log.info("processMethod()");
// Create new ServiceDescription
ServiceDescription serviceDescription = new ServiceDescriptionImpl();
+ // Create new MethodDescription for the original class
+ MethodDescription originalMethod = new MethodDescriptionImpl();
+
// Check what is the name of the method...
log.info("Method name: " + method.getName());
String methodName = method.getName();
@@ -71,7 +75,7 @@
// Set the class of the method
Class methodClass = method.getDeclaringClass();
- serviceDescription.setOriginalClass(methodClass);
+ originalMethod.setClazz(methodClass);
// Check if there is a business activity annotation
Class[] baClass = null;
@@ -114,14 +118,12 @@
}
// Remember names of the method
- serviceDescription.setOriginalMethodName(methodName);
- serviceDescription.setOriginalWebMethodName(webMethodName);
+ originalMethod.setMethodName(methodName);
+ originalMethod.setWebMethodName(webMethodName);
// Set the parameter types of the original method
- serviceDescription.setOriginalParameterTypes(method.getParameterTypes());
+ originalMethod.setParameterTypes(method.getParameterTypes());
-
-
// Check if this method is a BA service
BAMethod baMethod = method.getAnnotation(BAMethod.class);
MethodType methodType;
@@ -955,7 +957,7 @@
}
i++;
}
- serviceDescription.setOriginalParameterAnnotations(parameterAnnotation);
+ originalMethod.setParameterAnnotations(parameterAnnotation);
// Remember @BAResult annotation value
BAResult baResult = method.getAnnotation(BAResult.class);
@@ -963,6 +965,13 @@
if (baResult != null)
{
log.info("BAResult annotation present!");
+
+ // Check if the service really returns a value
+ Class returnType = method.getReturnType();
+ if (returnType == null)
+ {
+ throw new MethodIncorrectlyAnnotatedException("BAResult used on method with no return value!");
+ }
String returnName = baResult.value();
if (!returnName.equals(""))
{
@@ -971,12 +980,12 @@
{
returnId = new Integer(returnName);
log.info("Return identifier: " + returnId);
- serviceDescription.setOriginalReturnId(returnId);
+ originalMethod.setReturnId(returnId);
}
catch (NumberFormatException nfe)
{
log.info("Return identifier: " + returnName);
- serviceDescription.setOriginalReturnId(returnName);
+ originalMethod.setReturnId(returnName);
}
}
else
@@ -986,6 +995,9 @@
}
+ // Remember the original method description
+ serviceDescription.putMethod("original",originalMethod);
+
// Return the service description
return serviceDescription;
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CoordinatorCompletionParticipant.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -23,7 +23,20 @@
import com.arjuna.wst.*;
import org.apache.log4j.Logger;
import org.jboss.txbridge.ba.SingleTransactionManager;
+import org.jboss.txbridge.ba.datamgmt.ExecutionDataProviderImpl;
+import org.jboss.txbridge.ba.data.TaskDescription;
+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.annotation.ExecutionMode;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.service.MethodDescription;
+import org.jboss.txbridge.ba.exception.ActionExecutionException;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
/**
* Implementation of the Participant that is enlisted for the Business Agreement with Coordinator
* Completion protocol.
@@ -31,7 +44,7 @@
* @author Maciej P. Machulak (mmachulak at redhat.com)
* @version 0.1
*/
-public class CoordinatorCompletionParticipant extends org.jboss.txbridge.ba.participant.Participant implements BusinessAgreementWithCoordinatorCompletionParticipant
+public class CoordinatorCompletionParticipant extends ParticipantCompletionParticipant implements BusinessAgreementWithCoordinatorCompletionParticipant
{
// Logger
private static Logger log = Logger.getLogger(CoordinatorCompletionParticipant.class);
@@ -47,45 +60,81 @@
public CoordinatorCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm, ManagedDataFactory cdf)
{
super(txId, serviceId, stm, cdf);
+ completed = false;
log.info("constructor()");
}
- public void close() throws WrongStateException, SystemException
+ public void complete() throws WrongStateException, SystemException
{
- log.info("close()");
- closeTransaction();
+ log.info("complete()");
+ Thread completionNotifier = new Thread(new CompletionNotifier(txId,stm));
+ completionNotifier.start();
}
- public void cancel() throws WrongStateException, SystemException
+ /**
+ * Completeing the work, which is handled by the participant.
+ *
+ * @throws ActionExecutionException if execution of any action was not successful.
+ */
+ public void completeWork() throws ActionExecutionException
{
- log.info("cancel()");
- }
+ log.info("completeWork()");
+ log.info("Starting transaction");
+ completed = true;
+ 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);
- public void compensate() throws FaultedException, WrongStateException, SystemException
- {
- log.info("compensate()");
- compensateTransaction();
- }
+ // 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);
- public String status() throws SystemException
- {
- log.info("status()");
- return null;
+ // 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.getMethod("complete");
+ 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.invoke(completeMethod,new ExecutionDataProviderImpl(taskId,this));
+ }
+ log.info("Committing");
+ transaction.commit();
+ }
+ catch (Exception e)
+ {
+ throw new ActionExecutionException(e);
+ }
}
+}
- public void unknown() throws SystemException
- {
- log.info("unknown()");
- }
-
- public void error() throws SystemException
- {
- log.info("error()");
- }
-
- public void complete() throws WrongStateException, SystemException
- {
- log.info("completeTask()");
- completeTransaction();
- }
-}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/Participant.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -72,7 +72,7 @@
protected SingleTransactionManager stm = null;
// Transaction identifier
- private String txId = null;
+ protected String txId = null;
// Service identifier
protected String serviceId = null;
@@ -80,8 +80,8 @@
// List of all tasks
protected List<String> taskList = null;
- // List of compensated tasks
- private boolean compensated;
+ // State of the participant
+ protected boolean completed;
// Mapping (taskId,compensation_data)
private ConcurrentMap<String, ManagedData> compensationData = null;
@@ -116,8 +116,8 @@
// Initialise the list of tasks
taskList = new ArrayList<String>();
- // Not compensated
- compensated = false;
+ // State of the participant
+ completed = false;
// Initialise (taskId, datamgmt data) mapping
compensationData = new ConcurrentHashMap<String, ManagedData>();
@@ -229,17 +229,6 @@
}
/**
- * 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.
*/
@@ -261,68 +250,6 @@
closeNotifier.start();
}
-
- 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 datamgmt action.
* It uses the Executor class for executing a single method/service.
@@ -332,11 +259,16 @@
*/
public void compensateTask(String taskId) throws ActionExecutionException
{
+ // Return if work not completed!
+ if (!completed)
+ {
+ log.info("Work has not been completed yet! This task will not be compensated");
+ return;
+ }
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.getMethodType() == MethodType.READONLY)
@@ -346,7 +278,7 @@
// 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();
+ MethodDescription compensationMethod = sd.getMethod("compensate");
ExecutionMode executionMode = compensationMethod.getExecutionMode();
log.info("Execution mode: " + executionMode);
@@ -376,7 +308,7 @@
}
// Invoke the datamgmt action
log.info("Invoking the compensation action");
- se.invokeService(sd.getCompensationService(),new ExecutionDataProviderImpl(taskId,this));
+ se.invoke(sd.getMethod("compensate"),new ExecutionDataProviderImpl(taskId,this));
}
@@ -390,7 +322,7 @@
public void putArguments(String taskId, Object[] arguments)
{
log.info("putArguments()");
-// Get the correct datamgmt data
+// Get the correct managed data
ManagedData cd = compensationData.get(taskId);
if (cd == null)
{
@@ -410,7 +342,7 @@
public Object[] getArguments(String taskId)
{
log.info("getArguments()");
-// Get the correct datamgmt data
+// Get the correct managed data
ManagedData cd = compensationData.get(taskId);
if (cd == null)
{
@@ -430,7 +362,7 @@
public void putReturn(String taskId, Object returnObject)
{
log.info("putReturn()");
-// Get the correct datamgmt data
+// Get the correct managed data
ManagedData cd = compensationData.get(taskId);
if (cd == null)
{
@@ -450,7 +382,7 @@
public Object[] getReturn(String taskId)
{
log.info("getReturn()");
-// Get the correct datamgmt data
+// Get the correct managed data
ManagedData cd = compensationData.get(taskId);
if (cd == null)
{
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ParticipantCompletionParticipant.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -39,6 +39,7 @@
public ParticipantCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm, ManagedDataFactory cdf)
{
super(txId, serviceId, stm, cdf);
+ completed = true;
log.info("constructor()");
}
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescriptionImpl.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -47,8 +47,6 @@
private DataMatch dataMatch;
private ExecutionMode executionMode;
private ParameterMatch parameterMatch;
-
- // TODO: Put this into a new class!
private String jndiName;
private String providerURL;
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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescription.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -42,134 +42,4 @@
public MethodDescription getMethod(String methodName);
-
-
-
-
-
-
- DataMatch getDataMatch();
-
- void setDataMatch(DataMatch compensationType);
-
- public ExecutionMode getExecutionMode();
-
- public void setExecutionMode(ExecutionMode compensationMode);
-
- Class getOriginalClass();
-
- void setOriginalClass(Class originalClass);
-
- String getOriginalMethodName();
-
- void setOriginalMethodName(String originalMethodName);
-
- String getOriginalWebMethodName();
-
- void setOriginalWebMethodName(String originalWebMethodName);
-
- Class getOriginalReturnType();
-
- void setOriginalReturnType(Class originalReturnType);
-
- Class getCompensationClass();
-
- void setCompensationClass(Class compensationClass);
-
- String getCompensationMethodName();
-
- void setCompensationMethodName(String compensationMethodName);
-
- String getCompensationWebMethodName();
-
- void setCompensationWebMethodName(String compensationWebMethodName);
-
- Class getCompensationReturnType();
-
- void setCompensationReturnType(Class compensationReturnType);
-
- public Class[] getOriginalParameterTypes();
-
- public void setOriginalParameterTypes(Class[] originalParameterTypes);
-
- public Class[] getCompensationParameterTypes();
-
- public void setCompensationParameterTypes(Class[] compensationParameterTypes);
-
- public Object getOriginalReturnId();
-
- public void setOriginalReturnId(Object originalReturnId);
-
- public Object[] getOriginalParameterAnnotations();
-
- public void setOriginalParameterAnnotations(Object[] originalParameterAnnotations);
-
- public Object[] getCompensationParameterAnnotations();
-
- public void setCompensationParameterAnnotations(Object[] compensationParameterAnnotations);
-
- public ParameterMatch getParameterMatch();
-
- public void setParameterMatch(ParameterMatch parameterMatch);
-
- public String getCompensationJNDIName();
-
- public void setCompensationJNDIName(String jndiName);
-
- public String getCompensationProviderURL();
-
- public void setCompensationProviderURL(String providerURL);
-
- public boolean isCompensationSingle();
-
- public void setCompensationSingle(boolean value);
-
- public Class getCompensationEjbInterface();
-
- 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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescriptionImpl.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -43,36 +43,11 @@
*/
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 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 MethodType getMethodType()
@@ -105,333 +80,4 @@
return this.methods.get(methodName);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public DataMatch getDataMatch()
- {
- return dataMatch;
- }
-
- public void setDataMatch(DataMatch dataMatch)
- {
- this.dataMatch = dataMatch;
- }
-
- public ExecutionMode getExecutionMode()
- {
- return executionMode;
- }
-
- public void setExecutionMode(ExecutionMode executionMode)
- {
- this.executionMode = executionMode;
- }
-
- public ParameterMatch getParameterMatch()
- {
- return parameterMatch;
- }
-
- public void setParameterMatch(ParameterMatch parameterMatch)
- {
- this.parameterMatch = parameterMatch;
- }
-
- public Class getOriginalClass()
- {
- return originalMethod.getClazz();
- }
-
- public void setOriginalClass(Class originalClass)
- {
- originalMethod.setClazz(originalClass);
- }
-
- public String getOriginalMethodName()
- {
- return originalMethod.getMethodName();
- }
-
- public void setOriginalMethodName(String originalMethodName)
- {
- originalMethod.setMethodName(originalMethodName);
- }
-
- public String getOriginalWebMethodName()
- {
- return originalMethod.getWebMethodName();
- }
-
- public void setOriginalWebMethodName(String originalWebMethodName)
- {
- originalMethod.setWebMethodName(originalWebMethodName);
- }
-
- public Class getOriginalReturnType()
- {
- return originalMethod.getReturnType();
- }
-
- public void setOriginalReturnType(Class originalReturnType)
- {
- originalMethod.setReturnType(originalReturnType);
- }
-
- public Class[] getOriginalParameterTypes()
- {
- return originalMethod.getParameterTypes();
- }
-
- public void setOriginalParameterTypes(Class[] originalParameterTypes)
- {
- originalMethod.setParameterTypes(originalParameterTypes);
- }
-
- public Object getOriginalReturnId()
- {
- return originalMethod.getReturnId();
- }
-
- public void setOriginalReturnId(Object originalReturnId)
- {
- originalMethod.setReturnId(originalReturnId);
- }
-
- public Object[] getOriginalParameterAnnotations()
- {
- return originalMethod.getParameterAnnotations();
- }
-
- public void setOriginalParameterAnnotations(Object[] originalParameterAnnotation)
- {
- originalMethod.setParameterAnnotations(originalParameterAnnotation);
- }
-
- public Class getCompensationClass()
- {
- return compensationMethod.getClazz();
- }
-
- public void setCompensationClass(Class compensationClass)
- {
- compensationMethod.setClazz(compensationClass);
- }
-
- public String getCompensationMethodName()
- {
- return compensationMethod.getMethodName();
- }
-
- public void setCompensationMethodName(String compensationMethodName)
- {
- compensationMethod.setMethodName(compensationMethodName);
- }
-
- public String getCompensationWebMethodName()
- {
- return compensationMethod.getWebMethodName();
- }
-
- public void setCompensationWebMethodName(String compensationWebMethodName)
- {
- compensationMethod.setWebMethodName(compensationWebMethodName);
- }
-
- public Class getCompensationReturnType()
- {
- return compensationMethod.getReturnType();
- }
-
- public void setCompensationReturnType(Class compensationReturnType)
- {
- compensationMethod.setReturnType(compensationReturnType);
- }
-
- public Class[] getCompensationParameterTypes()
- {
- return compensationMethod.getParameterTypes();
- }
-
- public void setCompensationParameterTypes(Class[] compensationParameterTypes)
- {
- compensationMethod.setParameterTypes(compensationParameterTypes);
- }
-
- public Object[] getCompensationParameterAnnotations()
- {
- return compensationMethod.getParameterAnnotations();
- }
-
- public void setCompensationParameterAnnotations(Object[] compensationParameterAnnotations)
- {
- compensationMethod.setParameterAnnotations(compensationParameterAnnotations);
- }
-
- public String getCompensationJNDIName()
- {
- return compensationMethod.getJndiName();
- }
-
- public void setCompensationJNDIName(String jndiName)
- {
- compensationMethod.setJndiName(jndiName);
- }
-
- public String getCompensationProviderURL()
- {
- return compensationMethod.getProviderURL();
- }
-
- public void setCompensationProviderURL(String providerURL)
- {
- compensationMethod.setProviderURL(providerURL);
- }
-
- public boolean isCompensationSingle()
- {
- return methods.get("compensate").isSingle();
- }
-
- public void setCompensationSingle(boolean value)
- {
- compensationMethod.setSingle(value);
- }
-
- public Class getCompensationEjbInterface()
- {
- return compensationMethod.getEjbInterface();
- }
-
- public void setCompensationEjbInterface(Class ejbInterface)
- {
- 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-09-01 17:07:25 UTC (rev 14793)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceInformationManager.java 2007-09-01 18:14:55 UTC (rev 14794)
@@ -89,8 +89,8 @@
log.info("storeServiceDescription()");
String serviceId = idf.getIdentifier();
log.info("service id: " + serviceId);
- String className = serviceDescription.getOriginalClass().getName();
- String methodName = serviceDescription.getOriginalMethodName();
+ String className = serviceDescription.getMethod("original").getClazz().getName();
+ String methodName = serviceDescription.getMethod("original").getMethodName();
storeServiceDescription(serviceId,className+methodName,serviceDescription);
return serviceId;
}
More information about the jboss-svn-commits
mailing list