[jboss-svn-commits] JBL Code SVN: r13952 - in labs/jbosstm/workspace: baframework and 29 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Aug 2 06:19:29 EDT 2007
Author: jhalliday
Date: 2007-08-02 06:19:29 -0400 (Thu, 02 Aug 2007)
New Revision: 13952
Added:
labs/jbosstm/workspace/baframework/
labs/jbosstm/workspace/baframework/branches/
labs/jbosstm/workspace/baframework/tags/
labs/jbosstm/workspace/baframework/trunk/
labs/jbosstm/workspace/baframework/trunk/README.txt
labs/jbosstm/workspace/baframework/trunk/build.xml
labs/jbosstm/workspace/baframework/trunk/changelog.txt
labs/jbosstm/workspace/baframework/trunk/contributors.txt
labs/jbosstm/workspace/baframework/trunk/demo/
labs/jbosstm/workspace/baframework/trunk/demo/build.xml
labs/jbosstm/workspace/baframework/trunk/demo/resources/
labs/jbosstm/workspace/baframework/trunk/demo/resources/application.xml
labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-client.xml
labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-server.xml
labs/jbosstm/workspace/baframework/trunk/demo/resources/persistence.xml
labs/jbosstm/workspace/baframework/trunk/demo/resources/web.xml
labs/jbosstm/workspace/baframework/trunk/demo/resources/web/
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/green.css
labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp
labs/jbosstm/workspace/baframework/trunk/demo/resources/web/icon.jpg
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/jboss.jpg
labs/jbosstm/workspace/baframework/trunk/demo/resources/web/orderbar.jsp
labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp
labs/jbosstm/workspace/baframework/trunk/demo/src/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/
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/JaxWSClientHeaderContextProcessor.java
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/CustomerEntityImpl.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/HotelCustomException.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/MealOrder.java
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/RoomAlreadyOccupiedException.java
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomEntityImpl.java
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/CompensationView.java
labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/HotelView.java
labs/jbosstm/workspace/baframework/trunk/docs/
labs/jbosstm/workspace/baframework/trunk/docs/BAFrameworkAPI.docx
labs/jbosstm/workspace/baframework/trunk/docs/BAFrameworkMG.docx
labs/jbosstm/workspace/baframework/trunk/license.txt
labs/jbosstm/workspace/baframework/trunk/resources/
labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml
labs/jbosstm/workspace/baframework/trunk/src/
labs/jbosstm/workspace/baframework/trunk/src/org/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/JaxWSServerHeaderContextProcessor.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/
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/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAAgreementType.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/BACompensation.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationManagement.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationMode.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationOrder.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationType.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/BAParameterMatch.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/annotation/BAServiceType.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProvider.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProviderImpl.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManager.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerImpl.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerProvider.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/DummyCompensationManager.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationData.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataCustom.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataParam.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataReturn.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyCompensationData.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/TaskDescription.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationActionUnsuccessfulException.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationMethodNotAccessible.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodIncorrectlyAnnotatedException.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TaskAssociationFailedException.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TransactionProcessingException.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/
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/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/ServiceLocator.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocatorException.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/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/CompensationManagement.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/IdentifierFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomGetter.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomIdentifierFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidGetter.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidIdentifierFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UniqueValueGetter.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CloseNotifier.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataCustomFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataParamFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataReturnFactory.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationNotifier.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/DummyCompensationDataFactory.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/
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:
Added initial version of the BA Framework for XTS into its own sub repository.
Added: labs/jbosstm/workspace/baframework/trunk/README.txt
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/README.txt (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/README.txt 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,145 @@
+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.
+
+### Business Activity Framework & Demo Application
+### Version: 0.1
+### Date: July 31, 2007
+### Author: Maciej Machulak (mmachulak at redhat.com)
+### WWW: http://labs.jboss.com/jbosstm/baframework
+
+Contents:
+1. Introduction
+2. Building Business Activity Framework
+3. Building Business Activity Demo Application
+4. Other documentation
+
+
+### 1. Introduction
+
+The Business Activity Framework significantly facilitates development of transaction
+aware Web Services and releases programmers from mixing transaction related code with
+business logic of their applications. Developers do not need to write custom participants
+and managers and do not have to concern themselves with any of the low level details.
+They may use simple annotations to enrich Web Services with support for participating in
+Business Activities. No additional code needs to be written. Most annotations have
+intuitive and reasonable default values to release the developer from the necessity of
+specifying all required annotation member values explicitly. To address the problem of
+management of intermediary data that can be potentially used during compensation additional
+operations have been designed as well.
+
+IMPORTANT NOTICE:
+This is the first release of the framework and is aimed mainly for testing.
+
+It it assumed that demo application is tested locally - Coordinator has been set to
+following address: http://localhost:8080. This is set in the following file:
+ws-c.war (WEB-INF/web.xml)
+
+ <init-param>
+ <param-name>BaseHttpURI</param-name>
+ <param-value>http://localhost:8080/xts/soap/</param-value>
+ </init-param>
+
+The client application uses the http://localhost:8080 address to lookup Web Services
+by default as well. This can be changed in the following source file:
+com/jboss/ba/demo/client/HotelService.java
+
+JBoss Application Server on which the Business Activity Framework is to be used must be
+able to understand aspects (using JBoss AOP framework). By default JBoss AOP is bundled
+with the application server. For information how to enable this
+feature please refer to the JBoss AOP documentation.
+
+
+### 2. Building Business Activity framework
+
+Building the BA Framework requires following components:
+- JDK (version 1.5)
+ (available at http://java.sun.com/javase/downloads/index_jdk5.jsp)
+- Ant build tool (version 1.7.0)
+ (available at http://ant.apache.org/)
+- JBoss Application Server
+ (available at http://labs.jboss.com/jbossas/)
+- JBoss Transaction Service
+ (available at http://labs.jboss.com/jbosstm/)
+
+1) Edit 'build.xml' file and set following properties:
+ - jboss.home (i.e. "/home/mmachulak/dev/jboss-4.2.0.GA")
+ - xts.home" (i.e. "/home/mmachulak/dev/JBossTS/XTS/xts-install")
+
+2) Run 'ant'
+ This produces following files:
+ - build/baframework-client.jar
+ - build/baframework.aop
+
+ 'baframework-client.jar' file needs to be in the classpath of the application that wants
+ to use the framework.
+ 'baframework.aop' file must be deployed with the application as shown in the following
+ example of application.xml file:
+
+ <application>
+ <module>
+ <ejb>MyEJB.jar</ejb>
+ </module>
+
+ <module>
+ <java>baframework.aop</java>
+ </module>
+ </application>
+
+ For the use of the demo application it is not necessary to copy those files anywhere.
+
+
+### 3. Building Business Activity Demo Application
+
+Building the BA Framework Demo Application requires following components:
+- JDK (version 1.5)
+ (available at http://java.sun.com/javase/downloads/index_jdk5.jsp)
+- Ant build tool (version 1.7.0)
+ (available at http://ant.apache.org/)
+- JBoss Application Server
+ (available at http://labs.jboss.com/jbossas/)
+- JBoss Transaction Service
+ (available at http://labs.jboss.com/jbosstm/)
+
+1) Go to the demo/ directory (i.e. 'cd demo/')
+
+2) Edit 'build.xml' file and set following properties:
+ - jboss.home (i.e. "/home/mmachulak/dev/jboss-4.2.0.GA")
+ - xts.home" (i.e. "/home/mmachulak/dev/JBossTS/XTS/xts-install")
+
+3) Run 'ant'
+ This produces the following file:
+ - build/bademo.ear
+
+ This archive contains the demo application (hotel.jar), the framework's client library
+ (baframework-client.jar), the framework (baframework.aop) and the required infrastructure
+ for WS-BusinessActivity.
+
+4) Run 'ant deploy'
+ This copies the bademo.ear file to the deployment directory of the JBoss Application Server.
+
+Demo application is accessible through the following address: http://localhost:8080/bademo
+
+All necessary information related to using the demo application has been provided on web pages
+that are the part of the demo application.
+
+
+### 4. Other documentation
+
+All documentation directly related to the Business Activity framework can be found on the
+website of this framework.
Added: labs/jbosstm/workspace/baframework/trunk/build.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/build.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/build.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project name="BAFramework" default="dist" basedir=".">
+
+ <!-- You should modify the next two lines -->
+ <property name="jboss.home" location="C:/RedHat/JBossAS/build/output/jboss-4.2.0.GA"/>
+ <property name="xts.home" location="C:/RedHat/JBossTS/XTS/xts-install"/>
+
+ <!-- You should not need to modify anything below this point -->
+ <property name="jboss.profile" value="all"/>
+ <property name="jboss.server" value="${jboss.home}/server/${jboss.profile}"/>
+ <property name="jboss.aop.dir" location="${jboss.server}/deploy/jboss-aop-jdk50.deployer"/>
+ <property name="javaee.dir" location="${jboss.server}/lib"/>
+ <property name="src" location="src"/>
+ <property name="doc" location="docs"/>
+ <property name="lib" location="lib"/>
+ <property name="resources" location="resources"/>
+ <property name="build" location="build"/>
+
+ <path id="classpath">
+ <fileset dir="${jboss.server}/lib">
+ <include name="log4j.jar"/>
+ </fileset>
+ <fileset dir="${jboss.server}/deploy/jbossws.sar">
+ <include name="jboss-jaxws.jar"/>
+ <include name="jbossws-core.jar"/>
+ <include name="saaj-api.jar"/>
+ <include name="stax-api.jar"/>
+ </fileset>
+ <fileset dir="${xts.home}/lib">
+ <include name="*.jar"/>
+ <include name="ext/jbossjts.jar"/>
+ <include name="ext/jbossts-common.jar"/>
+ </fileset>
+ <fileset dir="${javaee.dir}">
+ <include name="jboss-ejb3x.jar"/>
+ <include name="ejb3-persistence.jar"/>
+ <include name="jboss-saaj.jar"/>
+ <include name="jboss-j2ee.jar"/>
+ </fileset>
+ <fileset dir="${jboss.aop.dir}">
+ <include name="jboss-aop-jdk50.jar"/>
+ </fileset>
+ </path>
+
+ <target name="clean" description="clean up">
+ <delete dir="${build}"/>
+ </target>
+
+ <target name="init" depends="clean">
+ <tstamp/>
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init" description="compile the source">
+ <mkdir dir="${build}/classes"/>
+ <javac srcdir="${src}" destdir="${build}/classes">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="docs" depends="compile" description="create documentation">
+ <javadoc destdir="${doc}/api" packagenames="*" private="true">
+ <sourcepath>
+ <pathelement location="${src}"/>
+ </sourcepath>
+ <classpath>
+ <path refid="classpath"/>
+ </classpath>
+ </javadoc>
+ </target>
+
+ <target name="dist" depends="compile" description="generate the distribution">
+ <jar jarfile="${build}/baframework.aop">
+ <metainf dir="${resources}">
+ <include name="jboss-aop.xml"/>
+ </metainf>
+ <fileset dir="${build}/classes">
+ <include name="org/jboss/txbridge/**/*"/>
+ </fileset>
+ </jar>
+ <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"/>
+ </fileset>
+ </jar>
+ </target>
+
+</project>
+
Added: labs/jbosstm/workspace/baframework/trunk/changelog.txt
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/changelog.txt (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/changelog.txt 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,4 @@
+Thu Aug 02 11:00:00 GMT 2007
+
+Release of the Business Activity Framework version 0.1
++---+
Added: labs/jbosstm/workspace/baframework/trunk/contributors.txt
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/contributors.txt (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/contributors.txt 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,4 @@
+Individual contributors list:
+
+- Maciej P. Machulak (mmachulak at redhat.com)
+- Jonathan J. Halliday (jhalliday at redhat.com)
Added: labs/jbosstm/workspace/baframework/trunk/demo/build.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/build.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/build.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project name="BADemo" default="ear" basedir=".">
+
+ <!-- You should modify the next two lines -->
+ <property name="jboss.home" value="C:\RedHat\JBossAS\build\output\jboss-4.2.0.GA"/>
+ <property name="xts.home" location="C:\RedHat\JBossTS\XTS\xts-install"/>
+
+ <!-- You should not need to modify anything below this point -->
+ <property name="jboss.profile" value="all"/>
+ <property name="jboss.server" value="${jboss.home}/server/${jboss.profile}"/>
+ <property name="baframework.dir" value="..\build"/>
+ <property name="build.dir" value="build"/>
+ <property name="build.config" value="${build.dir}/config"/>
+ <property name="src.dir" value="src"/>
+ <property name="doc.dir" value="doc"/>
+ <property name="dd.dir" value="dd"/>
+ <property name="lib.dir" value="lib"/>
+ <property name="resources.dir" value="resources"/>
+ <property name="ext.libs" value="jbossjts.jar"/>
+ <property name="ext.compile" value="${ext.libs} jaxrpc.jar servlet.jar"/>
+ <property name="ext.package" value="${ext.libs} jbossts-common.jar commons-logging.jar stax-api-1.0.jar wstx-asl-2.0.3.jar"/>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="init" depends="clean">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.dir}/classes"/>
+ <mkdir dir="${build.dir}/webapps"/>
+ <mkdir dir="${build.dir}/lib"/>
+ </target>
+
+ <target name="delete-JBoss-working-dirs" description="clean the execution environment">
+ <delete dir="${jboss.server}/data"/>
+ <delete dir="${jboss.server}/log"/>
+ <delete dir="${jboss.server}/tmp"/>
+ <delete dir="${jboss.server}/work"/>
+ </target>
+
+ <path id="classpath">
+ <fileset dir="${jboss.server}/lib" includes="*.jar"/>
+ <fileset dir="${jboss.home}/client" includes="*.jar"/>
+ <fileset dir="${xts.home}/lib">
+ <include name="*.jar"/>
+ <include name="ext/jbossjts.jar"/>
+ <include name="ext/jbossts-common.jar"/>
+ </fileset>
+ <fileset dir="${jboss.server}/deploy/jbossws.sar" includes="*.jar"/>
+ <fileset dir="${baframework.dir}" includes="baframework-client.jar"/>
+ </path>
+
+ <path id="build.classpath">
+ <pathelement location="${build.dir}/classes"/>
+ </path>
+
+ <target name="compile" depends="init" description="compile the source">
+ <mkdir dir="${build.dir}"/>
+ <javac destdir="${build.dir}/classes" classpathref="classpath">
+ <src path="${src.dir}"/>
+ </javac>
+ </target>
+
+ <target name="docs" depends="compile" description="create documentation">
+ <javadoc destdir="${doc.dir}/api" packagenames="*" private="true">
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <classpath>
+ <path refid="classpath"/>
+ </classpath>
+ </javadoc>
+ </target>
+
+ <target name="config" description="prepare the configuration">
+ <filter token="hostname" value="${hostname}"/>
+ <filter token="port" value="${port}"/>
+ <copy todir="${build.config}" filtering="true">
+ <fileset dir="${xts.home}/conf" includes="wscf.xml wstx.xml wst.xml"/>
+ </copy>
+ <jar destfile="${build.dir}/config.jar" basedir="${build.config}"/>
+ </target>
+
+ <target name="service" depends="compile, config" description="make the service distribution">
+ <copy file="${resources.dir}/jaxws-handlers-server.xml" todir="${build.dir}/classes/com/jboss/ba/demo/service/"/>
+ <jar destfile="${build.dir}/webapps/hotel.jar">
+ <metainf dir="${resources.dir}">
+ <include name="persistence.xml"/>
+ </metainf>
+ <manifest>
+ <attribute name="Class-Path" value="baframework-client.jar"/>
+ </manifest>
+ <fileset dir="${build.dir}/classes/">
+ <include name="com/jboss/ba/demo/service/**/*.class"/>
+ <include name="**/jaxws-handlers-server.xml"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="client" depends="service" description="make the client distribution">
+ <copy file="${resources.dir}/jaxws-handlers-client.xml" todir="${build.dir}/classes/com/jboss/ba/demo/client/"/>
+ <war destfile="${build.dir}/webapps/bademo.war">
+ <webinf dir="${resources.dir}">
+ <include name="web.xml"/>
+ </webinf>
+ <fileset dir="${build.dir}/classes/">
+ <include name="com/jboss/ba/demo/client/**/*.class"/>
+ <include name="**/jaxws-handlers-client.xml"/>
+ </fileset>
+ <fileset dir="${resources.dir}/web">
+ <include name="*.jsp"/>
+ <include name="*.css"/>
+ <include name="*.jpg"/>
+ </fileset>
+ </war>
+ </target>
+
+ <target name="ear" depends="client" description="make the distribiution">
+ <ear earfile="${build.dir}/bademo.ear" appxml="${resources.dir}/application.xml">
+ <fileset dir="${build.dir}" includes="config.jar"/>
+ <fileset dir="${build.dir}/webapps" includes="*.jar *.war"/>
+ <fileset dir="${baframework.dir}" includes="baframework.aop baframework-client.jar"/>
+ <fileset dir="${xts.home}/lib" includes="*.jar"/>
+ <fileset dir="${xts.home}/lib/ext" includes="${ext.package}"/>
+ <fileset dir="${xts.home}/webapps" includes="*.war"/>
+ </ear>
+ </target>
+
+ <target name="deploy" description="deploy the ear file">
+ <copy file="${build.dir}/bademo.ear" todir="${jboss.server}/deploy"/>
+ </target>
+
+ <target name="undeploy" description="delete the ear file from deployment directory">
+ <delete file="${jboss.server}/deploy/bademo.ear"/>
+ </target>
+</project>
\ No newline at end of file
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/application.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/application.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/application.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<application>
+
+ <display-name>Business Activity Framework Test Application</display-name>
+ <description>Business Activity Framework Test Application</description>
+
+ <module>
+ <web>
+ <web-uri>ws-c.war</web-uri>
+ <context-root>/xts</context-root>
+ </web>
+ </module>
+ <module>
+ <web>
+ <web-uri>ws-t.war</web-uri>
+ <context-root>/ws-t</context-root>
+ </web>
+ </module>
+ <module>
+ <web>
+ <web-uri>wscf.war</web-uri>
+ <context-root>/wscf</context-root>
+ </web>
+ </module>
+ <module>
+ <web>
+ <web-uri>wstx.war</web-uri>
+ <context-root>/wstx</context-root>
+ </web>
+ </module>
+
+ <module>
+ <ejb>hotel.jar</ejb>
+ </module>
+
+ <module>
+ <java>baframework.aop</java>
+ </module>
+
+ <module>
+ <web>
+ <web-uri>bademo.war</web-uri>
+ <context-root>/bademo</context-root>
+ </web>
+ </module>
+
+</application>
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-client.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-client.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-client.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+
+ <handler>
+ <handler-name>JaxWSHandler</handler-name>
+ <handler-class>com.jboss.ba.demo.clientxWSClientHeaderContextProcessor</handler-class>
+ </handler>
+
+ </handler-chain>
+
+</handler-chains>
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-server.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-server.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/jaxws-handlers-server.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+
+ <handler>
+ <handler-name>WebServicesTxContextHandler</handler-name>
+ <handler-class>org.jboss.txbridge.JaxWSServerHeaderContextProcessor</handler-class>
+ </handler>
+
+ </handler-chain>
+
+</handler-chains>
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/persistence.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/persistence.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/persistence.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<persistence>
+ <persistence-unit name="hotelPC">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/about.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,227 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+ <h1>Business Activity Framework Demo Application</h1>
+ <h2>Help page</h2>
+ <p align="left">
+ <b>Concept</b><br>
+ This is a simple Web-based demo application for the novel Business Activity framework. It helps with
+ understanding the basic concepts of using framework's API - metadata and additional operations which
+ 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>
+ <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], [2] and [3] are recommended.
+ </p>
+ <p align="left">
+ <b>Usage</b><br>
+ To start using the demo application it is necessary to perform following steps:
+ <ul>
+ <li>Initialise data on the server -> <a href="initialise.html">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.
+ </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.
+ </p>
+ <p>
+ <div id="code">
+<pre>
+//...<br>
+<span class="annotation">@BACompensation</span>(serviceClass=<span class="id">HotelImpl.class</span>,<br>
+	ejbInterface=<span class="id">Hotel.class</span>,<br>
+	jndiName="<span class="id">bademo/HotelImpl/remote</span>")<br>
+public class HotelBAImpl implements HotelBA<br>
+{
+	//...<br>
+}
+</pre>
+ </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.
+ </p>
+ <p>
+ <div id="code">
+
+<pre>
+//...<br>
+public class HotelBAImpl implements HotelBA<br>
+{
+	//...<br>
+	<span class="annotation">@BACompensationManagement</span><br>
+	<span class="id">CompensationManager</span> cm;<br>
+	//...<br>
+}
+</pre>
+ </div>
+
+ </p>
+ <p align="left">
+ Some services may be used only within a scope of a Business Activity (BA services). Others may be use outside the Business Activity (Normal services) - they are however defined as compensation actions of the BA services.. These
+ services may be used to test behaviour of compensation mechanisms in case Isolation of service execution is not preserved - i.e.
+ a order has been cancelled outside the scope of a transaction).
+ </p>
+
+ <p align="left">
+ Although description of each single method has been provided it is strongly adviced that users examine the source
+ code of Web Services when performing tests. Moreover, annotations on method descriptions have most of their member values
+ explicitly specified for learning purposes only. Because designed annotations have intuitive and reasonable default values already specified,
+ the actual code is less complex.
+ </p>
+
+ <p align="left">
+ <b>Web Services</b><br>
+ Business Activity Framework Demo Application consists of a set of Web Services that represents common
+ usage of the framework's API so that it is possible to gain knowledge about all designed annotations
+ and operations.<br>
+
+ </p>
+ <p align="left">
+ <b>References</b><br>
+ Following is the list of references which is worth considering when learning about Transactional Web Services (to be updated shortly):
+ <ul>
+ <li>[1] Little, M., J. Maron, and G. Pavlik, Java Transaction Processing: Design and Implementation, Prentice Hall PTR, New Jersey, USA, 2004.
+ <li>[2] WS-BusinessActivity Specification, version 1.0. August 2005. http://www.arjuna.com/library/specs/ws-tx/WS-BusinessActivity.pdf.
+
+ </ul>
+ </p>
+ <p align="left">
+ <b>Questions</b><br>
+ Any questions related to the test application or the framework can be directed to the author at
+<a href="mailto:mmachulak-at-redhat.com">mmachulak-at-redhat.com</a>. All constructive remarks are highly appreciated.
+ </p>
+
+ </p>
+
+
+</div>
+
+<div id="footer">
+ <p align=right>
+ © 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/author.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/author.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/author.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,132 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="left">
+ <b>Author</b><br>
+ <br>
+ Maciej Machulak<br>
+ <a href="mailto:mmachulak-at-redhat.com">mmachulak-at-redhat.com</a><br>
+ JBoss, a division of Red Hat, UK (Intern)<br>
+ University of Newcastle upon Tyne, UK (MSc student)<br>
+ Politechnika Wroclawska, Poland (MSc graduate)<br>
+ </p>
+
+
+</div>
+
+<div id="footer">
+ <p align=right>
+ © 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/bookcasino.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookcasino.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookcasino.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,217 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+<p align="center">
+
+ <form action="HotelService?method=getCasinoToken&baRequest=true&continue=bookcasino.jsp" method="post">
+ <fieldset class="medium">
+ <legend>getCasinoToken()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="room">Money amount</label>
+ <input type="text" name="parameters" value="3"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+</p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelCasinoToken</span>",<br>
+	type=BACompensationType.<span class="enum">RETURN_VALUE</span>,<br>
+	mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+public Integer getCasinoToken(String username, String password, Integer amount)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+</p>
+<p align="left">
+ <b>BA-related code</b>
+ <br>
+
+ <div id="code">
+
+<pre>
+{
+	//...<br>
+	cm.<span class="annotation">put</span>("<span class="id">refund</span>",amount/2);<br>
+	//...<br>
+}
+</pre>
+ </div>
+
+</p>
+<p>
+</p>
+
+<p align="left">
+ <b>Service description</b>
+ <br>
+ This service exchanges a given amount of money for a casino token. This token is a unique number meaningless
+ for the client but meaningful for the service (represents the exchanged money). It must be executed within a
+ Business Activity.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Amount of money to exchange for a casino token
+ </ul>
+</p>
+<p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Unique number of a casino token
+ </ul>
+</p>
+<p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+</p>
+<p align="left">
+ HotelCustomException is thrown if the user cannot log in (username, password or both are incorrect).
+</p>
+
+<p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=cancelcasino.jsp">cancelCasinoToken()</a>
+</p>
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/bookfitness.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookfitness.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookfitness.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,207 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=bookFitnessPass&baRequest=true&continue=bookfitness.jsp" method="post">
+ <fieldset class="medium">
+ <legend>bookFitnessPass()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="room">Reservation</label>
+ <input type="text" name="parameters"/>
+ <br>
+ <label for="room">Amount of Fitness Passes</label>
+ <input type="text" name="parameters" value="3"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelFitnessPass</span>",<br>
+	type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>,<br>
+	mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+public boolean bookFitnessPass(String username, String password,<br>
+				Integer reservationNumber, Integer amount)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <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>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ <li>Amount of required Fitness Passes
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Boolean value that specifies whether booking was successful or not
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+ </p>
+
+ <p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=cancelfitness.jsp">cancelFitnessPass()</a>
+ </p>
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/bookroom.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/bookroom.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,210 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+<p align="center">
+
+ <form action="HotelService?method=bookRoom&baRequest=true&continue=bookroom.jsp" method="post">
+ <fieldset class="medium">
+ <legend>bookRoom()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="room">Room number</label>
+ <input type="text" name="parameters" value="1"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+</p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelRoom</span>",<br>
+	type=BACompensationType.<span class="enum">CUSTOM</span>,<br>
+	mode=BACompensationMode.<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
+ class="id">password</span>")<br>
+String password, Integer roomNumber)<br>
+<br>
+throws HotelCustomException, RoomAlreadyOccupiedException
+</pre>
+
+ </div>
+
+</p>
+
+<p>
+</p>
+
+<p align="left">
+ <b>Service description</b>
+ <br>
+ This service books a single hotel room. It must be executed within a Business Activity. It also remembers a
+ refundValue so that if the booking is cancelled within a scope of a Business Activity then the customer does not
+ loose all the money.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Room Number
+ </ul>
+</p>
+<p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Reservation number
+ </ul>
+</p>
+<p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ <li>RoomAlreadyOccupiedException
+ </ul>
+</p>
+<p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the room number is incorrect (room does not exist). If the user wants to book a room that is already
+ occupied then RoomAlreadyOccupiedException is thrown.
+</p>
+
+<p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=cancelroom.jsp">cancelRoom()</a>
+</p>
+
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/cancelcasino.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelcasino.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelcasino.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,200 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=cancelCasinoToken&baRequest=false&continue=cancelcasino.jsp" method="post">
+ <fieldset class="medium">
+ <legend>cancelCasinoToken()</legend>
+
+ <p>
+ <label for="room">Token</label>
+ <input type="text" name="parameters" value="3"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+public boolean cancelCasinoToken(Integer casinoToken)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+ </p>
+<p align="left">
+ <b>BA-related code</b>
+ <br>
+
+ <div id="code">
+
+<pre>
+{
+	//...<br>
+	Integer refund = (Integer) cm.<span class="annotation">get</span>("<span class="id">refund</span>")<br>
+	if (refund != null)<br>
+	{
+		//...<br>
+	}
+	//...<br>
+}
+</pre>
+ </div>
+
+</p>
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This service cancels a given casino token so that it becomes invalid. It does not support execution within a Business Activity.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Casino token to be cancelled
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Boolean value that specifies whether cancelling was successful or not
+ </ul>
+ </p>
+ <p align="left">
+ This method does not throw any exceptions.
+ </p>
+
+
+</div>
+
+
+
+
+
+
+<div id="footer">
+ <p align=right>
+ © 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/cancelfitness.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelfitness.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelfitness.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,199 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=cancelFitnessPass&baRequest=false&continue=cancelfitness.jsp" method="post">
+ <fieldset class="medium">
+ <legend>cancelFitnessPass()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="reservation">Reservation</label>
+ <input type="text" name="parameters"/>
+ <br>
+ <label for="amount">Amount of Fitness Passes</label>
+ <input type="text" name="parameters" value="3"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+public boolean cancelFitnessPass(String username, String password,<br>
+			Integer reservationNumber, Integer amount)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This service cancels a given number of fitness passes for the given reservation. It does not support execution within a Business Activity.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ <li>Amount of Fitness Passes to be cancelled
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Boolean value that specifies whether cancelling was successful or not.
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+ </p>
+
+</div>
+
+
+
+
+
+
+<div id="footer">
+ <p align=right>
+ © 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/cancelmeal.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelmeal.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelmeal.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,198 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=cancelMeal&baRequest=false&continue=cancelmeal.jsp" method="post">
+ <fieldset class="medium">
+ <legend>cancelMeal()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="reservation">Reservation</label>
+ <input type="text" name="parameters"/>
+ <label for="mealorder">Meal order no</label>
+ <input type="text" name="parameters"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+public boolean cancelMeal(<span class="annotation">@BAParam</span>("<span class="id">user</span>")String username,<span class="annotation">@BAParam</span>("<span class="id">password</span>")<br>
+String password,<span class="annotation">@BAParam</span>("<span class="id">order</span>")Integer orderNumber)<br>
+<br>
+throws HotelCustomException;
+</pre>
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This service books a given number of fitness passes for the given reservation. It does not support execution within a Business Activity.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Boolean value that specifies whether cancelling was successful or not
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+ </p>
+
+
+</div>
+
+
+
+
+
+
+<div id="footer">
+ <p align=right>
+ © 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/cancelpackage.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelpackage.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelpackage.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,194 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=cancelComplimentaryPackageNumber&baRequest=false&continue=cancelpackage.jsp" method="post">
+ <fieldset class="medium">
+ <legend>cancelComplimentaryPackageNumber()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="room">Reservation number</label>
+ <input type="text" name="parameters"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+public boolean cancelComplimentaryPackageNumber(String username, String password,<br>
+Integer reservationNumber)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This service cancels a unique number of a complimentary package (which might be a bonus for booking a hotel room within a BA). It does not support execution within a Business Activity.<br>
+ This service takes following parameters:
+ <ul>
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Boolean value that specifies whether cancelling was successful or not
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+ </p>
+
+</div>
+
+
+
+
+
+
+<div id="footer">
+ <p align=right>
+ © 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/cancelroom.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelroom.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/cancelroom.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,195 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=cancelRoom&baRequest=false&continue=cancelroom.jsp" method="post">
+ <fieldset class="medium">
+ <legend>cancelRoom()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="reservation">Reservation number</label>
+ <input type="text" name="parameters"/>
+ </p>
+
+ <input type="submit" value="cancelRoom()"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+public boolean cancelRoom(<span class="annotation">@BAParam</span>("<span class="id">username</span>")String username,<span class="annotation">@BAParam</span>("<span class="id">password</span>")<br>
+String password,<span class="annotation">@BAParam</span>("<span class="id">reservationNumber</span>")Integer reservationNumber)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+ </p>
+
+ <p>
+
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This service cancels a hotel room. It does not support execution within a Business Activity. This method checks if it is being executed as a compensation action by trying to get the refundValue from the compensation manager. If this value is accessible than it may give a refund to the customer.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Boolean value that specifies whether cancelling was successful or not
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (it does not exist).
+ </p>
+
+
+</div>
+
+
+
+
+
+
+<div id="footer">
+ <p align=right>
+ © 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/data.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/data.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/data.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,118 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+<p align="center">
+${requestScope.DEBUG}
+</p>
+
+
+</div>
+
+<div id="footer">
+ <p align=right>
+ © 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/decreaserating.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/decreaserating.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/decreaserating.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,198 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+<p align="center">
+
+ <form action="HotelService?method=decreaseHotelRating&baRequest=true&continue=decreaserating.jsp" method="post">
+ <fieldset class="medium">
+ <legend>decreaseHotelRating()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="points">Points</label>
+ <input type="text" name="parameters" value="4"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+</p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">increaseHotelRating</span>",<br>
+	type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>)<br>
+public void decreaseHotelRating(String username,String password,Integer points)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+</p>
+
+<p>
+</p>
+
+<p align="left">
+ <b>Service description</b>
+ <br>
+ This service decreases the hotel's rating with the number of given points. The user may use this service only within a transaction (however, this
+ service may be also used as a compensation action).<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Number of points
+ </ul>
+</p>
+<p align="left">
+ This service does not return anything.
+</p>
+<p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+</p>
+<p align="left">
+ HotelCustomException is thrown if the user cannot log in (username, password or both are incorrect).
+</p>
+
+<p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=increaserating.jsp">increaseHotelRating()</a>
+</p>
+
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/getpackage.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/getpackage.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/getpackage.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,210 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=getComplimentaryPackageNumber&baRequest=true&continue=getpackage.jsp"
+ method="post">
+ <fieldset class="medium">
+ <legend>getComplimentaryPackageNumber()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="reservation">Reservation number</label>
+ <input type="text" name="parameters"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelComplimentaryPackageNumber</span>",<br>
+	single=<span class="id">true</span>,<br>
+	type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>)<br>
+	mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+public Integer getComplimentaryPackageNumber(String username, String password,<br>
+Integer reservationNumber)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This service asks for a unique number of a complimentary package (which might be a bonus for booking a hotel
+ room within a BA).
+ Only one bonus per business activity is available so that if this method is executed multiple times within the
+ same
+ business activity, exactly the same number of a complimentary package will be returned. Therefore - this method
+ is compensated only once (it does not matter how many times it has been executed within a transaction).
+ It must be executed within a Business Activity.<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ </ul>
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>A unique number of a complimentary package
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+ </p>
+
+ <p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=cancelpackage.jsp">cancelComplimentaryPackageNumber()</a>
+ </p>
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/green.css
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/green.css (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/green.css 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,496 @@
+<!--
+ 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.
+-->
+
+a:link
+{
+ text-decoration: none
+}
+
+a:link.normal
+{
+ text-decoration: underline;
+}
+
+a:visited
+{
+ text-decoration: none
+}
+
+a:active
+{
+ text-decoration: none
+}
+
+a:hover
+{
+ text-decoration: none;
+}
+
+a img
+{
+ border: none;
+}
+
+body
+{
+ text-align: center;
+ margin-top: 10px;
+ padding: 0;
+ background: #fff;
+ font-family: Verdana;
+ font-size: 10pt;
+ height: 100%;
+}
+
+div#main
+{
+ text-align: left;
+ width: 800px;
+ margin: 0 auto;
+ padding: 0;
+ background: #FFF;
+ border: 1px solid #347235;
+ height: 100%;
+ position: relative;
+}
+
+div#headerLeft
+{
+ height: 100px;
+ width: 621px;
+ float: left;
+ border-bottom: 1px solid #347235;
+ text-align: center;
+}
+
+div#headerLeft h1
+{
+ font: 150%/100px Verdana, Arial, sans-serif;
+ font-weight: bold;
+ color: #000;
+}
+
+div#body h1
+{
+ font: 130% Verdana, Arial, sans-serif;
+ color: #000;
+}
+
+div#body h2
+{
+ font: 115% Verdana, Arial, sans-serif;
+ color: #000;
+}
+
+div#headerRight
+{
+ height: 100px;
+ width: 179px;
+ float: right;
+ padding-top: 0px;
+ margin-top: 0px;
+ border-bottom: 1px solid #347235;
+}
+
+div#headerRight p
+{
+ padding-top: 0px;
+ margin-top: 0px;
+ border: 0px;
+}
+
+div#headerBottom
+{
+ height: 20px;
+ width: 800px;
+ font-weight: bold;
+ clear: both;
+}
+
+div#headerDebug
+{
+ height: 70px;
+ width: 800px;
+ clear: both;
+ border-bottom: 1px solid #347235;
+}
+
+div#headerActive
+{
+ height: 20px;
+ width: 800px;
+ clear: both;
+ border-bottom: 1px solid #347235;
+ font-family: bold;
+ background: #4AA02C;
+ color: white;
+ margin-top: 0px;
+ padding-top: 0px;
+ text-align: center;
+}
+
+div#header h1
+{
+ font: italic 150%/80px Verdana, Arial, sans-serif;
+ color: #FFF;
+ margin: 0 40px;
+}
+
+div#header2a
+{
+ height: 30px;
+ background: #4AA02C;
+ border-bottom: 1px solid #347235;
+ width: 784px;
+ float: left;
+}
+
+div#header2a h1
+{
+ font: italic 150%/20px Verdana, Arial, sans-serif;
+ color: #FFF;
+ margin: 0 40px;
+}
+
+div#header2b
+{
+ line-height: 30px;
+ height: 30px;
+ background: #4AA02C;
+ border-bottom: 1px solid #347235;
+ width: 240px;
+ float: right;
+ text-align: right;
+}
+
+div#header2b form
+{
+ vertical-align: middle;
+}
+
+div#header2b h1
+{
+ font: italic 150%/20px Verdana, Arial, sans-serif;
+ color: #FFF;
+ margin: 0 40px;
+}
+
+
+div#body
+{
+ width: 629px;
+ float: right;
+ margin-left: 5px;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ height:100%;
+ border-left: 1px solid #347235;
+}
+
+div#body p
+{
+ font: 80%/1.4 Verdana, Arial, sans-serif;
+ margin-left: 20px;
+}
+
+div#footer p
+{
+ font: 80%/3 Verdana, Arial, sans-serif;
+ margin-top: 0px;
+ margin-right: 5px;
+ color: #FFF;
+}
+
+div#menu p
+{
+ font: 80%/1.4 Verdana, Arial, sans-serif;
+ margin: 1px 1px;
+}
+
+div#menu hr
+{
+ font: 80%/1.4 Verdana, Arial, sans-serif;
+ margin: 1px 1px;
+}
+
+div#menu
+{
+ width: 160px;
+ float: left;
+ margin-left: 5px;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ height:100%;
+}
+
+div#footer
+{
+ height: 25px;
+ width: 800px;
+ clear: both;
+ background: #4AA02C;
+ border-top: 1px solid #347235;
+}
+
+div.entry
+{
+ border: 1px solid #347235;
+ padding: 5px 5px;
+ margin: 5px;
+}
+
+div.title
+{
+ margin-bottom: 5px;
+}
+
+div.content
+{
+ padding-top: 10px;
+ padding-bottom: 10px;
+ background: #CEEFBD;
+}
+
+div.fullcontent
+{
+ padding-top: 10px;
+ padding-bottom: 10px;
+}
+
+
+div.options
+{
+ margin-top: 5px;
+ border-top: 1px solid #000;
+}
+
+div.profile table
+{
+ font-family: Verdana;
+ font-size: 10pt;
+}
+
+div.profile td
+{
+ width: 150px;
+}
+
+div.core
+{
+ width: 600px;
+}
+
+
+div.profilemain
+{
+ float: left;
+}
+
+div.profilefoto
+{
+ width: 100px;
+ float: right;
+}
+
+div.profilegeo
+{
+ clear: both;
+}
+
+span.first
+{
+ font: bold 30px Rockwell, Arial, sans-serif;
+}
+
+span.annotation
+{
+ font-weight: bold;
+ color: #00BB00;
+}
+
+span.enum
+{
+ font-weight: bold;
+ font-style: oblique;
+ color: #660099;
+}
+
+span.id
+{
+ font-weight: bold;
+ color: #CC0033;
+}
+
+label
+{
+ width: 10em;
+ float: left;
+ text-align: right;
+ margin-right: 0.5em;
+ display: block
+}
+
+.submit input
+{
+ background: #CEEFBD;
+ margin-left: 4.5em;
+}
+
+input, textarea
+{
+ color: #000;
+ background: #FFF;
+ border: 1px solid #347235;
+}
+
+.submit input
+{
+ color: #ffffff;
+ background: #4AA02C;
+ border: 1px solid #347235;
+}
+
+select
+{
+ border: 1px solid #347235;
+ width: 120px;
+}
+
+select.wide
+{
+ width: 240px;
+}
+
+fieldset
+{
+ background: #FFFFFF;
+ border: 1px solid #347235;
+ width: 30em;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+fieldset.small
+{
+ border: 1px solid #347235;
+ width: 120px;
+}
+
+input.small
+{
+ width: 100px;
+}
+
+fieldset.little
+{
+ border: 1px solid #347235;
+ width: 11em;
+}
+
+fieldset.foto
+{
+ border: 1px solid #347235;
+ width: 8em;
+}
+
+fieldset.foto img
+{
+ border: 0px;
+ width: 8em;
+ height: 8em;
+}
+
+fieldset.medium
+{
+ border: 1px solid #347235;
+ width: 25em;
+}
+
+fieldset.info
+{
+ border: 1px solid #347235;
+ width: 35em;
+ float: center;
+}
+
+fieldset.error
+{
+ background: #FFFF99;
+ border: 1px solid #347235;
+ width: 35em;
+}
+
+
+fieldset.large
+{
+ border: 1px solid #347235;
+ width: 50em;
+}
+
+fieldset.full
+{
+ border: 1px solid #347235;
+ width: 95%;
+}
+
+legend
+{
+ color: #fff;
+ font-weight:bold;
+ background: #4AA02C;
+ border: 1px solid #347235;
+ padding: 2px 6px
+}
+
+hr
+{
+ color: #347235;
+ height: 1px;
+}
+
+ul
+{
+ font: 80%/1.4 Verdana, Arial, sans-serif;
+ text-transform: none;
+ text-decoration: none;
+ text-align: left;
+ padding-left: 20px;
+ list-style-position: outside;
+ list-style-type: square;
+ margin-top: 2px;
+ margin-left: 20px;
+}
+
+div#code
+{
+ font: 80%/0.7 Verdana, Arial, sans-serif;
+ background: #EEEEEE;
+ width: 93%;
+ text-align: left;
+}
+
+div#code pre
+{
+ margin-top: 5px;
+ margin-bottom: 5px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/hotelinfo.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,172 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=getHotelInfo&baRequest=true&continue=hotelinfo.jsp" method="post">
+ <fieldset class="medium">
+ <legend>getHotelInfo()</legend>
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">READONLY</span>,BAAgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>)<br>
+public String getHotelInfo()
+</pre>
+
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Service description</b>
+ <br>
+ This method simply returns a String object that contains information about the hotel. It may be executed within
+ or outside a Business Activity. This method is read-only and does not require any compensation to be specified.<br>
+ This service does not require any parameters.<br>
+ This service does not throw any exceptions.
+ </p>
+ <p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Service description
+ </ul>
+ </p>
+ <p align="left">
+ <b>Compensation action</b>
+ <br>
+ None
+ </p>
+
+</div>
+
+
+
+
+
+
+<div id="footer">
+ <p align=right>
+ © 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/icon.jpg
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/icon.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/increaserating.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,198 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+<p align="center">
+
+ <form action="HotelService?method=increaseHotelRating&baRequest=true&continue=increaserating.jsp" method="post">
+ <fieldset class="medium">
+ <legend>increaseHotelRating()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="points">Points</label>
+ <input type="text" name="parameters" value="4"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+</p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">decreaseHotelRating</span>",<br>
+	type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>)<br>
+public void increaseHotelRating(String username,String password,Integer points)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+</p>
+
+<p>
+</p>
+
+<p align="left">
+ <b>Service description</b>
+ <br>
+ This service increases the hotel's rating with the number of given points. The user may use this service only within a transaction (however, this
+ service may be also used as a compensation action).<br>
+ This service takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Number of points
+ </ul>
+</p>
+<p align="left">
+ This service does not return anything.
+</p>
+<p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+</p>
+<p align="left">
+ HotelCustomException is thrown if the user cannot log in (username, password or both are incorrect).
+</p>
+
+<p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=decreaserating.jsp">decreaseHotelRating()</a>
+</p>
+
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/index.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/index.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/index.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,183 @@
+<!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,
+ @author JBoss Inc.
+-->
+
+<%
+ String initialiseAttr = (String) request.getAttribute("INITIALISE");
+ if (initialiseAttr == null)
+ {
+ initialiseAttr = "";
+ }
+ String dropAttr = (String) request.getAttribute("DROP");
+ if (dropAttr == null)
+ {
+ dropAttr = "/><a";
+ }
+ String showAttr = (String) request.getAttribute("SHOW");
+ if (showAttr == null)
+ {
+ showAttr = "/><a";
+ }
+ String beginAttr = (String) request.getAttribute("BEGIN");
+ if (beginAttr == null)
+ {
+ beginAttr = "/><a";
+ }
+ String baServiceAttr = (String) request.getAttribute("BASERVICE");
+ if (baServiceAttr == null)
+ {
+ baServiceAttr = "/><a";
+ }
+ String closeAttr = (String) request.getAttribute("CLOSE");
+ if (closeAttr == null)
+ {
+ closeAttr = "/><a";
+ }
+ String cancelAttr = (String) request.getAttribute("CANCEL");
+ if (cancelAttr == null)
+ {
+ cancelAttr = "/><a";
+ }
+ String serviceAttr = (String) request.getAttribute("SERVICE");
+ if (serviceAttr == null)
+ {
+ serviceAttr = "/><a";
+ }
+
+%>
+
+
+<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" <%=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>
+ </p>
+ <hr>
+ <p>
+ <a href="HotelService?method=startBA&baRequest=true" <%=beginAttr%>>Begin Business Activity</a><br>
+ </p>
+ <hr>
+ <p>
+ <b>BA services:</b><br>
+ <a href="HotelService?page=hotelinfo.jsp" <%=baServiceAttr%>>Hotel Info</a><br>
+ <a href="HotelService?page=bookroom.jsp" <%=baServiceAttr%>>Book Room</a><br>
+ <a href="HotelService?page=getpackage.jsp" <%=baServiceAttr%>>Get Package</a><br>
+ <a href="HotelService?page=bookfitness.jsp" <%=baServiceAttr%>>Book Fitness</a><br>
+ <a href="HotelService?page=bookcasino.jsp" <%=baServiceAttr%>>Book Casino</a><br>
+ <a href="HotelService?page=ordermeal.jsp" <%=baServiceAttr%>>Order Meal</a><br>
+ <a href="HotelService?page=increaserating.jsp" <%=baServiceAttr%>>Increase Rating</a><br>
+ <a href="HotelService?page=decreaserating.jsp" <%=baServiceAttr%>>Decrease Rating</a><br>
+ </p>
+ <hr>
+ <p>
+ <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>
+ <hr>
+ <p>
+ <b>Normal services:</b><br>
+ <a href="HotelService?page=cancelroom.jsp" <%=serviceAttr%>>Cancel Room</a><br>
+ <a href="HotelService?page=cancelpackage.jsp" <%=serviceAttr%>>Cancel Package</a><br>
+ <a href="HotelService?page=cancelfitness.jsp" <%=serviceAttr%>>Cancel Fitness</a><br>
+ <a href="HotelService?page=cancelcasino.jsp" <%=serviceAttr%>>Cancel Casino</a><br>
+ <a href="HotelService?page=cancelmeal.jsp" <%=serviceAttr%>>Cancel Meal</a><br>
+ </p>
+ <hr>
+</div>
+
+
+
+
+
+
+
+
+
+<div id="body" align=center>
+
+
+
+ <h1>Business Activity Framework Demo Application</h1>
+ <p align="center">
+ This is a demo application for the novel Business Activity Framework.<br>
+ Please follow this <a href="about.html">link</a> to learn more about the application.<br>
+ <br>
+ <br>
+ <a href="http://labs.jboss.com/jbosstm/baframework">http://labs.jboss.com/jbosstm/baframework</a><br>
+ <br>
+ <br>
+ Maciej Machulak<br>
+ <a href="mailto:mmachulak-at-redhat.com">mmachulak-at-redhat.com</a><br>
+ July 27, 2007<br>
+ JBoss, a division of Red Hat.
+ </p>
+
+
+</div>
+
+<div id="footer">
+ <p align=right>
+ © 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/initialise.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/initialise.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/initialise.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,157 @@
+<!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,
+ @author JBoss Inc.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Business Activity Framework Test 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>
+ </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="body" align=center>
+
+<p align="center">
+
+<form action="HotelService?method=initialiseData&baRequest=false&continue=initialise.jsp" method="post">
+<fieldset class="medium">
+<legend>Initialise beans</legend>
+
+<p>
+ <label for="username1">Username #1</label>
+ <input type="text" name="username1" value="user1"/>
+ <br>
+ <label for="password1">Password #1</label>
+ <input type="text" name="password1" value="pass1"/>
+</p>
+
+<p>
+ <label for="username2">Username #2</label>
+ <input type="text" name="username2" value="user2"/>
+ <br>
+ <label for="password2">Password #2</label>
+ <input type="text" name="password2" value="pass2"/>
+</p>
+
+<p>
+ <label for="username3">Username #3</label>
+ <input type="text" name="username3" value="user3"/>
+ <br>
+ <label for="password3">Password #3</label>
+ <input type="text" name="password3" value="pass3"/>
+</p>
+
+<p>
+</p>
+<p>
+ <label for="numberOfRooms"># of Rooms</label>
+ <input type="text" name="numberOfRooms" value="5"/>
+</p>
+
+<input type="submit" value="Initialise"/>
+
+</fieldset>
+</form>
+
+</p>
+
+
+</div>
+
+<div id="footer">
+<p align=right>
+© 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/jboss.jpg
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/jboss.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/workspace/baframework/trunk/demo/resources/web/orderbar.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/orderbar.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/orderbar.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,191 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+ <p align="center">
+
+ <form action="HotelService?method=orderExtraMiniBar&baRequest=true&continue=orderbar.jsp" method="post">
+ <fieldset class="medium">
+ <legend>bookFitnessPass()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="room">Reservation number</label>
+ <input type="text" name="parameters"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+ </p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="cancelExtraMiniBar",<br>
+ 	methodClass="wstest.servicehotel.HotelImpl",<br>
+ 	remoteInterface="com.jboss.ba.demo.service.servicervice.Hotel",<br>
+	jndiName="wstest/HotelBAImpl/remote",<br>
+	type=BACompensationType.<span class="enum">PARAMETERS_MATCH</span>,<br>
+ 	mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+public boolean orderExtraMiniBar(String username, String password, Integer reservationNumber)<br>
+<br>
+throws HotelCustomException
+</pre>
+
+ </div>
+
+ </p>
+
+ <p>
+ </p>
+
+ <p align="left">
+ <b>Method description</b>
+ <br>
+ This method books a given number of fitness passes for the given reservation. It takes following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ </ul>
+ </p>
+ <p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+ </p>
+ <p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+ </p>
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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/ordermeal.jsp
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web/ordermeal.jsp 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,220 @@
+<!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,
+ @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>
+ </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="body" align=center>
+
+<p align="center">
+
+ <form action="HotelService?method=orderMeal&baRequest=true&continue=ordermeal.jsp" method="post">
+ <fieldset class="medium">
+ <legend>orderMeal()</legend>
+
+ <p>
+ <label for="username">Username</label>
+ <input type="text" name="parameters" value="user1"/>
+ <br>
+ <label for="password">Password</label>
+ <input type="text" name="parameters" value="pass1"/>
+ <br>
+ <label for="reservation">Reservation number</label>
+ <input type="text" name="parameters"/>
+ </p>
+
+ <input type="submit" value="Invoke Web Service"/>
+
+ </fieldset>
+ </form>
+
+</p>
+
+<p align="left">
+ <b>Method's class</b><br>
+ com.jboss.ba.demo.service.HotelImpl
+</p>
+
+<p align="left">
+ <b>Method's signature</b><br>
+
+ <div id="code">
+
+<pre>
+ at WebMethod<br>
+<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
+ class="enum">PARTICIPANT_COMPLETION</span>)<br>
+<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelMeal</span>",<br>
+	type=BACompensationType.<span class="enum">CUSTOM</span>,<br>
+	mode=BACompensationMode.<span class="enum">EJB</span>)<br>
+public MealOrder orderMeal(<span class="annotation">@BAParam</span>("<span class="id">user</span>")String username,<br>
+	<span class="annotation">@BAParam</span>("<span class="id">password</span>")String password, Integer reservationNumber)<br>
+<br>
+throws HotelCustomException
+</pre>
+ </div>
+
+</p>
+
+<p align="left">
+ <b>BA-related code</b>
+ <br>
+
+ <div id="code">
+
+<pre>
+{
+	//...<br>
+	cm.<span class="annotation">put</span>("<span class="id">order</span>",orderId);<br>
+	//...<br>
+}
+</pre>
+ </div>
+
+</p>
+
+
+<p>
+</p>
+
+<p align="left">
+ <b>Service description</b>
+ <br>
+ This service books a given number of Fitness Passes for the given reservation. It must be executed within a Business
+ Activity.<br>
+ This service requires following parameters:
+ <ul align="left">
+ <li>Username
+ <li>Password
+ <li>Reservation Number
+ </ul>
+</p>
+<p align="left">
+ It throws following exceptions:
+ <ul align="left">
+ <li>HotelCustomException
+ </ul>
+</p>
+<p align="left">
+ HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
+ or the reservation number is incorrect (reservation does not exist).
+</p>
+
+<p align="left">
+ This service returns:
+ <ul align="left">
+ <li>Complex object representing a meal order
+ </ul>
+</p>
+<p align="left">
+ <b>Compensation action</b>
+ <br>
+ <a href="HotelService?page=cancelmeal.jsp">cancelMeal()</a>
+</p>
+
+</div>
+
+
+<div id="footer">
+ <p align=right>
+ © 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.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/resources/web.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/resources/web.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <servlet>
+ <servlet-name>HotelService</servlet-name>
+ <servlet-class>com.jboss.ba.demo.client.HotelService</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>HotelService</servlet-name>
+ <url-pattern>/HotelService</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
+
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/HotelService.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,666 @@
+/*
+ * 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 com.jboss.ba.demo.client;
+
+import com.arjuna.mw.wst.UserBusinessActivity;
+import com.arjuna.mw.wst.UserBusinessActivityFactory;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.TransactionRolledBackException;
+import org.apache.log4j.Logger;
+import com.jboss.ba.demo.service.Hotel;
+import com.jboss.ba.demo.service.RoomAlreadyOccupiedException;
+import com.jboss.ba.demo.service.HotelCustomException;
+import com.jboss.ba.demo.service.MealOrder;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This is the client of the Hotel Web Service.
+ */
+public class HotelService extends HttpServlet
+{
+
+ // Logger
+ private static Logger log = Logger.getLogger(HotelService.class);
+
+ // Hotel BA
+ private static Hotel hotel;
+
+ private ServletContext context;
+
+ public void init(final ServletConfig config) throws ServletException
+ {
+ hotel = this.getPortHotel();
+ context = config.getServletContext();
+ }
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ processRequest(request,response);
+ }
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ processRequest(request,response);
+ }
+
+ private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ log.info("processRequest()");
+
+ // Get session
+ HttpSession theSession = request.getSession(true);
+
+ // Get current state
+ Integer state = (Integer) theSession.getAttribute("state");
+ if ( state == null)
+ {
+ state = 0;
+ }
+ log.info("Current state: " + state);
+
+ String address = "/index.jsp";
+
+ String continuePage = request.getParameter("continue");
+ if (continuePage != null)
+ {
+ address = "/" + continuePage;
+ }
+
+ // Get business activity
+ String activeResponse = "";
+ UserBusinessActivity uba = (UserBusinessActivity) theSession.getAttribute("uba");
+ if (uba != null)
+ {
+ activeResponse = "<div id=\"headerActive\"><p align=\"center\">Business Activity is ACTIVE (";
+ activeResponse += uba.toString();
+ activeResponse += ")</p></div>";
+ }
+
+ // Check if this is access to the jsp page
+ String requestType = request.getParameter("page");
+ if (requestType != null)
+ {
+ request.setAttribute("ACTIVE",activeResponse);
+ address = "/" + requestType;
+ }
+ else
+ {
+ // Check if BA is request
+ String baRequest = request.getParameter("baRequest");
+ log.info("Business Activity request: " + baRequest);
+
+ if (baRequest == null)
+ {
+ baRequest = "false";
+ }
+
+ // Get method
+ String methodName = request.getParameter("method");
+ log.info("Method name: " + methodName);
+
+ if (methodName == null)
+ {
+ methodName = "init";
+ }
+
+ // Get parameters
+ String[] parameters = request.getParameterValues("parameters");
+ log.info("Parameters: " + parameters);
+
+ // If there is not business activity then
+ String methodResponse = "";
+ try
+ {
+ if (baRequest.equals("true"))
+ {
+ if (state == 0)
+ {
+ log.info("Data not initialised");
+ methodResponse = "You need to initialise data first.";
+ }
+ else
+ {
+ if (uba == null || uba.toString().equals("Unknown"))
+ {
+ if (methodName.equals("startBA"))
+ {
+ log.info("Starting Business Activity");
+ UserBusinessActivity businessActivity = UserBusinessActivityFactory.userBusinessActivity();
+ startBusinessActivity(businessActivity);
+ theSession.setAttribute("uba",businessActivity);
+ methodResponse = "Business Activity started: " + businessActivity.toString();
+ log.info("Business Activity started: " + businessActivity.toString());
+ activeResponse = "<div id=\"headerActive\"><p align=\"center\">Business Activity is ACTIVE (";
+ activeResponse += businessActivity.toString();
+ activeResponse += ")</p></div>";
+ state = 2;
+ }
+ else
+ {
+ log.info("Business Activity not started");
+ methodResponse = "You need to start the Business Activity first.";
+ }
+ }
+ else
+ {
+ if (methodName.equals("getHotelInfo"))
+ {
+ methodResponse = getHotelInfo();
+ }
+ else if (methodName.equals("increaseHotelRating"))
+ {
+ if (increaseHotelRating(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("decreaseHotelRating"))
+ {
+ if (decreaseHotelRating(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("bookRoom"))
+ {
+ methodResponse = bookRoom(parameters).toString();
+ }
+ else if (methodName.equals("bookFitnessPass"))
+ {
+ if (bookFitnessPass(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("getComplimentaryPackageNumber"))
+ {
+ methodResponse = getComplimentaryPackageNumber(parameters).toString();
+ }
+ else if (methodName.equals("getCasinoToken"))
+ {
+ methodResponse = getCasinoToken(parameters).toString();
+ }
+ else if (methodName.equals("orderMeal"))
+ {
+ methodResponse = orderMeal(parameters).toString();
+ }
+ else if (methodName.equals("orderExtraMiniBar"))
+ {
+ if (orderExtraMiniBar(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("closeBA"))
+ {
+ closeBusinessActivity(uba);
+ theSession.removeAttribute("uba");
+ activeResponse = "";
+ methodResponse = "Transaction closed successfully.";
+ state = 1;
+ resetCompensationList();
+ }
+ else if (methodName.equals("cancelBA"))
+ {
+ cancelBusinessActivity(uba);
+ theSession.removeAttribute("uba");
+ activeResponse = "";
+ methodResponse = "Transaction cancelled successfully.";
+ state = 1;
+ resetCompensationList();
+ }
+ else
+ {
+ methodResponse = "Incorrect method";
+ }
+
+ }
+ }
+ }
+ else
+ {
+ if (methodName.equals("initialiseData"))
+ {
+ if (state == 0)
+ {
+ String[][] users = new String[3][2];
+ users[0][0] = request.getParameter("username1");
+ users[0][1] = request.getParameter("password1");
+ users[1][0] = request.getParameter("username2");
+ users[1][1] = request.getParameter("password2");
+ users[2][0] = request.getParameter("username3");
+ users[2][1] = request.getParameter("password3");
+ String numberOfRoomsString = request.getParameter("numberOfRooms");
+ initialiseData(users,new Integer(numberOfRoomsString));
+ methodResponse = getData();
+ state = 1;
+ }
+ else
+ {
+ methodResponse = "Data has been already initialised.";
+ }
+
+ }
+ else if (methodName.equals("startBA"))
+ {
+ log.info("Business Activity is already started");
+ methodResponse = "Business Activity is already started.";
+ }
+ else if (methodName.equals("dropHotelData"))
+ {
+ if (state != 0)
+ {
+ dropHotelData();
+ state = 0;
+ }
+ else
+ {
+ methodResponse = "Data has not been initialised.";
+ }
+ }
+ else if (methodName.equals("getHotelData"))
+ {
+ if (state != 0)
+ {
+ methodResponse = getData();
+ }
+ else
+ {
+ methodResponse = "Data has not been initialised.";
+ }
+ }
+ else if (methodName.equals("cancelRoom"))
+ {
+ if (cancelRoom(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("cancelFitnessPass"))
+ {
+ if (cancelFitnessPass(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("cancelComplimentaryPackageNumber"))
+ {
+ if (cancelComplimentaryPackageNumber(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("cancelCasinoToken"))
+ {
+ if (cancelCasinoToken(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("cancelMeal"))
+ {
+ if (cancelMeal(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("cancelExtraMiniBar"))
+ {
+ if (cancelExtraMiniBar(parameters))
+ {
+ methodResponse = "true";
+ }
+ else
+ {
+ methodResponse = "false";
+ }
+ }
+ else if (methodName.equals("init"))
+ {
+ address = "/index.jsp";
+ }
+ else
+ {
+ methodResponse = "Incorrect method";
+ }
+ }
+ }
+ catch (TransactionRolledBackException trbe)
+ {
+ trbe.printStackTrace();
+ methodResponse = "Transaction Rolled Back Exception thrown:<br>";
+ methodResponse = methodResponse + trbe.getMessage();
+ activeResponse = "";
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ methodResponse = "Exception thrown:<br>";
+ methodResponse = methodResponse + e.getMessage();
+ }
+
+ request.setAttribute("DEBUG",methodResponse);
+ request.setAttribute("ACTIVE",activeResponse);
+ }
+ // Activate appropriate links
+ String initialiseResponse = "";
+ String dropResponse = "";
+ String showResponse = "";
+ String beginResponse = "";
+ String baserviceResponse = "";
+ String closeResponse = "";
+ String cancelResponse = "";
+ String serviceResponse = "";
+ if ( state == 0 )
+ {
+ // Application just started
+ initialiseResponse = "";
+ dropResponse = "/><a";
+ showResponse = "/><a";
+ beginResponse = "/><a";
+ baserviceResponse = "/><a";
+ closeResponse = "/><a";
+ cancelResponse = "/><a";
+ serviceResponse = "/><a";
+ }
+ else if ( state == 1 )
+ {
+ // Data has been initialised
+ initialiseResponse = "/><a";
+ dropResponse = "";
+ showResponse = "";
+ beginResponse = "";
+ baserviceResponse = "/><a";
+ closeResponse = "/><a";
+ cancelResponse = "/><a";
+ serviceResponse = "";
+ }
+ else if ( state == 2 )
+ {
+ // Business activity has been started
+ initialiseResponse = "/><a";
+ dropResponse = "/><a";
+ showResponse = "";
+ beginResponse = "/><a";
+ baserviceResponse = "";
+ closeResponse = "";
+ cancelResponse = "";
+ serviceResponse = "/><a";
+ }
+
+ theSession.setAttribute("state",state);
+ request.setAttribute("INITIALISE",initialiseResponse);
+ request.setAttribute("DROP",dropResponse);
+ request.setAttribute("SHOW",showResponse);
+ request.setAttribute("BEGIN",beginResponse);
+ request.setAttribute("BASERVICE",baserviceResponse);
+ request.setAttribute("CLOSE",closeResponse);
+ request.setAttribute("CANCEL",cancelResponse);
+ request.setAttribute("SERVICE",serviceResponse);
+
+ context.getRequestDispatcher(address).forward(request, response);
+ }
+
+ private void initialiseData(String[][] users, Integer numberOfRooms)
+ {
+ hotel.initialiseHotel(users,numberOfRooms);
+ }
+
+ private String getData()
+ {
+ return hotel.getHotelData();
+ }
+
+ private void dropHotelData()
+ {
+ hotel.dropHotelData();
+ }
+
+ private void resetCompensationList()
+ {
+ hotel.resetCompensationList();
+ }
+
+ private UserBusinessActivity startBusinessActivity(UserBusinessActivity uba)
+ throws SystemException, WrongStateException
+ {
+ // Starting the transaction
+ uba.begin();
+ return uba;
+ }
+
+ private void closeBusinessActivity(UserBusinessActivity uba)
+ throws SystemException, WrongStateException, UnknownTransactionException, TransactionRolledBackException
+ {
+ // Closing the transaction
+ uba.close();
+ }
+
+ private void cancelBusinessActivity(UserBusinessActivity uba)
+ throws SystemException, WrongStateException, UnknownTransactionException
+ {
+ uba.cancel();
+ }
+
+ private String getHotelInfo()
+ {
+ log.info("getHotelInfo()");
+ return hotel.getHotelInfo();
+ }
+
+ private boolean increaseHotelRating(String[] parameters)
+ {
+ log.info("increaseHotelRating()");
+ Integer points = new Integer(parameters[2]);
+ return hotel.increaseHotelRating(parameters[0],parameters[1],points);
+ }
+
+ private boolean decreaseHotelRating(String[] parameters)
+ {
+ log.info("decreaseHotelRating()");
+ Integer points = new Integer(parameters[2]);
+ return hotel.decreaseHotelRating(parameters[0],parameters[1],points);
+ }
+
+ private Integer bookRoom(String[] parameters)
+ throws RoomAlreadyOccupiedException, HotelCustomException, NumberFormatException
+ {
+ log.info("bookRoom()");
+ Integer roomNumber = new Integer(parameters[2]);
+ return hotel.bookRoom(parameters[0],parameters[1],roomNumber);
+ }
+
+ private boolean cancelRoom(String[] parameters)
+ throws RoomAlreadyOccupiedException, HotelCustomException, NumberFormatException
+ {
+ log.info("cancelRoom()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ return hotel.cancelRoom(parameters[0],parameters[1],reservationNumber);
+ }
+
+ private Integer getComplimentaryPackageNumber(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("getComplimentaryPackageNumber()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ return hotel.getComplimentaryPackageNumber(parameters[0],parameters[1],reservationNumber);
+
+ }
+
+ private boolean cancelComplimentaryPackageNumber(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("cancelComplimentaryPackageNumber()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ return hotel.cancelComplimentaryPackageNumber(parameters[0],parameters[1],reservationNumber);
+ }
+
+ private boolean bookFitnessPass(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("bookFitnessPass()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ Integer amount = new Integer(parameters[3]);
+ return hotel.bookFitnessPass(parameters[0],parameters[1],reservationNumber,amount);
+ }
+
+ private boolean cancelFitnessPass(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("cancelFitnessPass()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ Integer amount = new Integer(parameters[3]);
+ return hotel.cancelFitnessPass(parameters[0],parameters[1],reservationNumber,amount);
+ }
+
+ private Integer getCasinoToken(String[] parameters)
+ throws HotelCustomException
+ {
+ log.info("getCasinoToken()");
+ Integer amount = new Integer(parameters[2]);
+ return hotel.getCasinoToken(parameters[0],parameters[1],amount);
+ }
+
+ private boolean cancelCasinoToken(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("cancelCasinoToken()");
+ Integer amount = new Integer(parameters[0]);
+ return hotel.cancelCasinoToken(amount);
+ }
+
+ private MealOrder orderMeal(String[] parameters)
+ throws HotelCustomException {
+ log.info("orderMeal()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ return hotel.orderMeal(parameters[0],parameters[1],reservationNumber);
+ }
+
+ private boolean cancelMeal(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("cancelMeal()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ Integer orderNumber = new Integer(parameters[3]);
+ return hotel.cancelMeal(parameters[0],parameters[1],reservationNumber,orderNumber);
+ }
+
+ private boolean orderExtraMiniBar(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("orderExtraMiniBar()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ return hotel.orderExtraMiniBar(parameters[0],parameters[1],reservationNumber);
+ }
+
+ private boolean cancelExtraMiniBar(String[] parameters)
+ throws HotelCustomException, NumberFormatException
+ {
+ log.info("cancelExtraMiniBar()");
+ Integer reservationNumber = new Integer(parameters[2]);
+ return hotel.orderExtraMiniBar(parameters[0],parameters[1],reservationNumber);
+ }
+
+ private Hotel getPortHotel()
+ {
+ // Connect to the Web Service
+ URL wsdlLocation = null;
+ try
+ {
+ wsdlLocation = new URL("http://localhost:8080/HotelImplService/HotelImpl?wsdl");
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace();
+ }
+ QName serviceName = new QName("http://service.demo.ba.jboss.com/","HotelService");
+ Service service = Service.create(wsdlLocation, serviceName);
+ Hotel port = service.getPort(Hotel.class);
+
+ // Insert client handler
+ BindingProvider bindingProvider = (BindingProvider)port;
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.add(new JaxWSClientHeaderContextProcessor());
+ bindingProvider.getBinding().setHandlerChain(handlerChain);
+
+ return port;
+ }
+
+}
+
+
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/JaxWSClientHeaderContextProcessor.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/JaxWSClientHeaderContextProcessor.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/client/JaxWSClientHeaderContextProcessor.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,291 @@
+/*
+ * 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 com.jboss.ba.demo.client;
+
+import org.apache.log4j.Logger;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.*;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import com.arjuna.mw.wsc.context.Context;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
+import com.arjuna.webservices.wscoor.CoordinationContextType;
+import com.arjuna.webservices.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices.wsba.BusinessActivityConstants;
+import com.arjuna.mw.wst.common.CoordinationContextHelper;
+import com.arjuna.mw.wst.common.SOAPUtil;
+import com.arjuna.mw.wst.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jhalli
+ * Date: Apr 20, 2007
+ * Time: 1:06:28 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class JaxWSClientHeaderContextProcessor implements SOAPHandler
+{
+ private static Logger log = Logger.getLogger(JaxWSClientHeaderContextProcessor.class);
+
+ private String handlerName;
+
+ public String getHandlerName()
+ {
+ return handlerName;
+ }
+
+ public void setHandlerName(String handlerName)
+ {
+ this.handlerName = handlerName;
+ }
+
+ public boolean handleMessage(MessageContext msgContext)
+ {
+ Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (outbound == null)
+ throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
+ }
+
+
+ public boolean handleFault(MessageContext messagecontext)
+ {
+ resumeTransaction(messagecontext) ;
+ return true;
+ }
+
+ public void close(MessageContext messageContext)
+ {
+ }
+
+ public String toString()
+ {
+ return (handlerName != null ? handlerName : super.toString());
+ }
+
+
+
+ // The header blocks that can be processed by this Handler instance
+ private Set<QName> headers = new HashSet<QName>();
+
+ /** Gets the header blocks that can be processed by this Handler instance.
+ */
+ public Set<QName> getHeaders()
+ {
+ log.info("getHeaders");
+
+ Set<QName> headerSet = new HashSet<QName>();
+ headerSet.add(new QName(CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT));
+
+ return headerSet;
+ }
+
+ /** Sets the header blocks that can be processed by this Handler instance.
+ */
+ public void setHeaders(Set<QName> headers)
+ {
+ this.headers = headers;
+ }
+
+
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+ resumeTransaction(msgContext) ;
+
+
+ return true ;
+ }
+
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ final SOAPMessageContext soapMessageContext = (SOAPMessageContext)msgContext ;
+ final SOAPMessage soapMessage = soapMessageContext.getMessage() ;
+
+ if (soapMessage == null)
+ {
+ return true ;
+ }
+
+ try
+ {
+ /*
+ * There should either be an Atomic Transaction *or* a Business Activity
+ * associated with the thread.
+ */
+ final TransactionManager transactionManager = TransactionManagerFactory.transactionManager() ;
+ final BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager() ;
+
+ final Context atContext ;
+ if (transactionManager != null)
+ {
+ final com.arjuna.mwlabs.wst.at.context.TxContextImple txContext =
+ (com.arjuna.mwlabs.wst.at.context.TxContextImple)transactionManager.currentTransaction() ;
+ atContext = (txContext == null ? null : txContext.context()) ;
+ }
+ else
+ {
+ atContext = null ;
+ }
+
+ final Context baContext ;
+ if (businessActivityManager != null)
+ {
+ final com.arjuna.mwlabs.wst.ba.context.TxContextImple txContext =
+ (com.arjuna.mwlabs.wst.ba.context.TxContextImple)businessActivityManager.currentTransaction() ;
+ baContext = (txContext == null ? null : txContext.context()) ;
+ }
+ else
+ {
+ baContext = null ;
+ }
+
+ final CoordinationContextType coordinationContext ;
+ if (atContext != null)
+ {
+ coordinationContext = atContext.getCoordinationContext() ;
+ }
+ else if (baContext != null)
+ {
+ coordinationContext = baContext.getCoordinationContext() ;
+ }
+ else
+ {
+ coordinationContext = null ;
+ }
+
+ if (coordinationContext != null)
+ {
+ final SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope() ;
+ SOAPHeader header = env.getHeader() ;
+ if (header == null)
+ {
+ header = env.addHeader() ;
+ }
+ final Name name = env.createName(CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT, CoordinationConstants.WSCOOR_PREFIX, CoordinationConstants.WSCOOR_NAMESPACE) ;
+ final SOAPHeaderElement headerElement = header.addHeaderElement(name) ;
+ headerElement.addNamespaceDeclaration(CoordinationConstants.WSCOOR_PREFIX, CoordinationConstants.WSCOOR_NAMESPACE) ;
+ headerElement.setMustUnderstand(true) ;
+ CoordinationContextHelper.serialise(env, headerElement, coordinationContext) ;
+ }
+ }
+ catch (final Throwable th)
+ {
+ log.warn("handleOutbound: ", th);
+ }
+
+ return true;
+ }
+
+ private void resumeTransaction(final MessageContext messageContext)
+ {
+ final SOAPMessageContext soapMessageContext = (SOAPMessageContext)messageContext ;
+ final SOAPMessage soapMessage = soapMessageContext.getMessage() ;
+
+ if (soapMessage != null)
+ {
+ try
+ {
+ final SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope() ;
+ final SOAPHeaderElement soapHeaderElement = getHeaderElement(soapEnvelope, CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT) ;
+
+ if (soapHeaderElement != null)
+ {
+ final CoordinationContextType cc = CoordinationContextHelper.deserialise(soapEnvelope, soapHeaderElement) ;
+ if (cc != null)
+ {
+ final String coordinationType = cc.getCoordinationType().getValue() ;
+ if (AtomicTransactionConstants.WSAT_PROTOCOL.equals(coordinationType))
+ {
+ final TxContext txContext = new com.arjuna.mwlabs.wst.at.context.TxContextImple(cc) ;
+ TransactionManagerFactory.transactionManager().resume(txContext) ;
+ }
+ else if (BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME.equals(coordinationType))
+ {
+ final TxContext txContext = new com.arjuna.mwlabs.wst.ba.context.TxContextImple(cc);
+ BusinessActivityManagerFactory.businessActivityManager().resume(txContext) ;
+ }
+ else
+ {
+ log.warn("resumeTransaction: unknown Coordtype");
+ }
+ }
+ }
+ }
+ catch (final Throwable th)
+ {
+ log.warn("resumeTransaction: ", th);
+ }
+ }
+ }
+
+ private SOAPHeaderElement getHeaderElement(final SOAPEnvelope soapEnvelope, final String uri, final String name)
+ throws SOAPException
+ {
+ final SOAPHeader soapHeader = soapEnvelope.getHeader() ;
+ if (soapHeader != null)
+ {
+ final Iterator headerIter = SOAPUtil.getChildElements(soapHeader) ;
+ while(headerIter.hasNext())
+ {
+ final SOAPHeaderElement current = (SOAPHeaderElement)headerIter.next() ;
+ final Name currentName = current.getElementName() ;
+ if ((currentName != null) &&
+ match(name, currentName.getLocalName()) &&
+ match(uri, currentName.getURI()))
+ {
+ return current ;
+ }
+ }
+ }
+ return null ;
+ }
+
+ /**
+ * Do the two references match?
+ * @param lhs The first reference.
+ * @param rhs The second reference.
+ * @return true if the references are both null or if they are equal.
+ */
+ private boolean match(final Object lhs, final Object rhs)
+ {
+ if (lhs == null)
+ {
+ return (rhs == null) ;
+ }
+ else
+ {
+ return lhs.equals(rhs) ;
+ }
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/CustomerEntityImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/CustomerEntityImpl.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/CustomerEntityImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,101 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ */
+ at Entity
+ at Table(name = "customer")
+public class CustomerEntityImpl implements Serializable
+{
+ private int id;
+ private String username;
+ private String password;
+ private Collection<OrderEntityImpl> orders = new ArrayList<OrderEntityImpl>();
+
+ public CustomerEntityImpl()
+ {
+ }
+
+ @Id
+ @GeneratedValue
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ @Column(name="bookings")
+ @OneToMany(mappedBy="customer",
+ cascade={CascadeType.REMOVE})
+ public Collection<OrderEntityImpl> getOrders()
+ {
+ return orders;
+ }
+
+ public void setOrders(Collection<OrderEntityImpl> orders)
+ {
+ this.orders = orders;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("ID: ").append(id);
+ sb.append(" Username: ").append(username);
+ sb.append(" Password: ").append(password);
+ return sb.toString();
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/Hotel.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,65 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+import javax.jws.WebService;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * Interface of the stateless session bean.
+ */
+ at WebService
+public interface Hotel
+{
+ // Control methods
+ public void initialiseHotel(String[][] users,Integer rooms);
+ public void dropHotelData();
+ public void resetCompensationList();
+ public String getHotelData();
+
+ // - READ_ONLY
+ public String getHotelInfo();
+ // - MODIFY - parameters match (BA service as a compensation method)
+ public boolean increaseHotelRating(String username,String password,Integer points);
+ public boolean decreaseHotelRating(String username,String password,Integer points);
+ // - MODIFY - SINGLETON
+ public Integer getComplimentaryPackageNumber(String username,String password,Integer reservationNumber) throws HotelCustomException;
+ public boolean cancelComplimentaryPackageNumber(String username,String password,Integer reservationNumber) throws HotelCustomException;
+ // - MODIFY - NORMAL
+ // * custom
+ public Integer bookRoom(String username, String password, Integer roomNumber) throws HotelCustomException, RoomAlreadyOccupiedException;
+ public boolean cancelRoom(String username,String password,Integer reservationNumber) throws HotelCustomException;
+ // * 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;
+ // * return value
+ public Integer getCasinoToken(String username,String password, Integer amount) throws HotelCustomException;
+ public boolean cancelCasinoToken(Integer token) throws HotelCustomException;
+ // * compensation manager used
+ public MealOrder orderMeal(String username,String password, Integer reservationNumber) throws HotelCustomException;
+ public boolean cancelMeal(String username,String password,Integer reservationNumber,Integer orderNumber) throws HotelCustomException;
+ // * compensation manager used for additional objects
+ public boolean orderExtraMiniBar(String username, String password, Integer reservationNumber) throws HotelCustomException;
+ public boolean cancelExtraMiniBar(String username, String password, Integer reservationNumber) throws HotelCustomException;
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelCustomException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelCustomException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelCustomException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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 com.jboss.ba.demo.service;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 9, 2007
+ */
+public class HotelCustomException extends Exception
+{
+
+ public HotelCustomException()
+ {
+ super();
+ }
+
+ public HotelCustomException(String message)
+ {
+ super(message);
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/HotelImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,675 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.annotation.*;
+import org.jboss.txbridge.ba.compensation.CompensationManager;
+
+import javax.persistence.PersistenceContext;
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+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 java.util.*;
+
+import com.jboss.ba.demo.service.helper.HotelView;
+import com.jboss.ba.demo.service.helper.CompensationView;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This is the implementation of a stateless session bean with all the business logic used
+ * by the demo application. Some methods have not been fully implemented but they provide
+ * information (through logging or simple output) about the sequence of events that occur
+ * within a single Business Activity.
+ */
+ at Stateless
+ at Remote(Hotel.class)
+ at WebService(name="Hotel") // (name = "Bistro2", targetNamespace = "http://www.jboss.org/txbridgedemoejb", serviceName = "BistroService")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at HandlerChain(file = "jaxws-handlers-server.xml")
+ at BACompensation(serviceClass=HotelImpl.class,ejbInterface=Hotel.class,jndiName="bademo/HotelImpl/remote")
+public class HotelImpl implements Hotel
+{
+ // Logger
+ private static Logger log = Logger.getLogger(HotelImpl.class);
+
+ // Random Generator
+ Random randomGenerator = new Random();
+
+ // View for debug messages
+ HotelView hotelView = HotelView.getSingletonInstance();
+
+ // View for compensation actions order
+ CompensationView compensationView = CompensationView.getSingletonInstance();
+
+ @PersistenceContext(unitName="hotelPC")
+ protected EntityManager em;
+
+ @BACompensationManagement
+ private CompensationManager cm;
+
+ public HotelImpl()
+ {
+ }
+
+ @WebMethod
+ public void initialiseHotel(String[][] users, Integer rooms)
+ {
+ log.info("initialiseHotel()");
+
+ hotelView.newMethod("initialiseHotel()");
+
+ // Create customers
+ log.info("Creating customer entities");
+ for (int i = 0; i < users.length; i++)
+ {
+ log.info(i);
+ CustomerEntityImpl customer = new CustomerEntityImpl();
+ customer.setUsername(users[i][0]);
+ customer.setPassword(users[i][1]);
+ em.persist(customer);
+ }
+
+ // Create rooms
+ log.info("Creating room entities");
+ for (int i = 0; i < rooms; i++)
+ {
+ log.info(i);
+ RoomEntityImpl room = new RoomEntityImpl();
+ room.setRoomName("Room " + (i+1));
+ em.persist(room);
+ }
+
+ // Display customers
+ hotelView.addMessage("Customers:");
+ List<CustomerEntityImpl> customers = getCustomers();
+ for (CustomerEntityImpl customer: customers)
+ {
+ hotelView.addMessage(customer.toString());
+ }
+
+ // Display rooms
+ hotelView.addMessage("Rooms:");
+ List<RoomEntityImpl> roomEntities = getRooms();
+ for (RoomEntityImpl room : roomEntities)
+ {
+ hotelView.addMessage(room.toString());
+ }
+ hotelView.endMethod();
+ }
+
+ @WebMethod
+ public void dropHotelData()
+ {
+ log.info("dropHotelData()");
+
+ hotelView.newMethod("dropHotelData()");
+ hotelView.addMessage("Deleting all data:");
+
+ // Delete all data
+ // - Customers
+ em.createQuery("delete from OrderEntityImpl").executeUpdate();
+ hotelView.addMessage("- orders");
+ // - Rooms
+ em.createQuery("delete from RoomEntityImpl").executeUpdate();
+ hotelView.addMessage("- rooms");
+ // - Orders
+ em.createQuery("delete from CustomerEntityImpl").executeUpdate();
+ hotelView.addMessage("- customers");
+ hotelView.endMethod();
+ }
+
+ @WebMethod
+ public void resetCompensationList()
+ {
+ log.info("resetCompensationList()");
+ compensationView.resetCompensationList();
+ }
+
+ @WebMethod
+ public String getHotelData()
+ {
+ log.info("getHotelData()");
+
+ hotelView.newMethod("getHotelData()");
+ // Display customers
+ StringBuffer sb = new StringBuffer();
+ List<CustomerEntityImpl> customers = getCustomers();
+ for (CustomerEntityImpl customer: customers)
+ {
+ sb.append("(");
+ sb.append(customer.toString());
+ sb.append(") ");
+ }
+
+ // Display rooms
+ List<RoomEntityImpl> roomEntities = getRooms();
+ for (RoomEntityImpl room : roomEntities)
+ {
+ sb.append("(");
+ sb.append(room.toString());
+ sb.append(") ");
+ }
+ hotelView.endMethod();
+ return sb.toString();
+ }
+
+ @WebMethod
+ @BAService(type= BAServiceType.READONLY)
+ public String getHotelInfo()
+ {
+ log.info("getHotelInfo()");
+ hotelView.newMethod("getHotelInfo()");
+ String returnValue = "Some hotel information...";
+ log.info("Returning: " + returnValue);
+ hotelView.addMessage("Returning: " + returnValue);
+ hotelView.endMethod();
+ return returnValue;
+ }
+
+ @WebMethod
+ @BAService(agreement=BAAgreementType.PARTICIPANT_COMPLETION)
+ @BACompensatedBy(value="decreaseHotelRating",type=BACompensationType.PARAMETERS_MATCH)
+ public boolean increaseHotelRating(String username,String password, Integer points)
+ {
+ log.info("increaseHotelRating()");
+ hotelView.newMethod("increaseHotelRating()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Points: " + points);
+
+ // TODO: Implementation...
+
+ hotelView.endMethod();
+ compensationView.compensationMethod("decreaseHotelRating()");
+ return true;
+ }
+
+ @WebMethod
+ @BAService(agreement=BAAgreementType.PARTICIPANT_COMPLETION)
+ @BACompensatedBy(value="increaseHotelRating",type=BACompensationType.PARAMETERS_MATCH)
+ public boolean decreaseHotelRating(String username,String password, Integer points)
+ {
+ log.info("decreaseHotelRating()");
+ hotelView.newMethod("decreaseHotelRating()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Points: " + points);
+
+ // TODO: Implementation...
+
+ hotelView.endMethod();
+ compensationView.compensationMethod("increaseHotelRating()");
+ return true;
+ }
+
+ @WebMethod
+ @BAService
+ @BACompensatedBy(value="cancelRoom",type=BACompensationType.CUSTOM)
+ @BAResult("reservationNumber")
+ public Integer bookRoom(@BAParam("username")String username, at BAParam("password")String password, Integer roomNumber)
+ throws HotelCustomException, RoomAlreadyOccupiedException
+ {
+ log.info("bookRoom()");
+ hotelView.newMethod("bookRoom()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Room no: " + roomNumber);
+ hotelView.addMessage("Checking password");
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Login incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ hotelView.addMessage("Getting room");
+ RoomEntityImpl room = getRoom(roomNumber);
+ if (room == null)
+ {
+ hotelView.addMessage("Room incorrect - throwing exception");
+ throw new HotelCustomException("Room incorrect");
+ }
+ OrderEntityImpl oe = room.getOrder();
+ if (oe != null)
+ {
+ hotelView.addMessage("Room occupied - throwing exception");
+ throw new HotelCustomException("Room occupied");
+ }
+ hotelView.addMessage("Creating order");
+ OrderEntityImpl order = new OrderEntityImpl(customer,room);
+ hotelView.addMessage("Persisting order");
+ em.persist(order);
+ Integer reservationNumber = order.getId();
+ hotelView.addMessage(order.toString());
+ hotelView.addMessage("Returning: " + reservationNumber);
+ log.info("Returning");
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelRoom()");
+ return reservationNumber;
+ }
+
+ @WebMethod
+ public boolean cancelRoom(@BAParam("username")String username, at BAParam("password")String password, at BAParam("reservationNumber")Integer reservationNumber)
+ throws HotelCustomException
+ {
+ log.info("cancelRoom()");
+ hotelView.newMethod("cancelRoom()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ hotelView.addMessage("Checking password");
+ if (customer == null)
+ {
+ hotelView.addMessage("Login incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ hotelView.addMessage("Getting reservation");
+ OrderEntityImpl oe = getReservation(reservationNumber);
+ if (oe == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ hotelView.addMessage("Removing reservation");
+ em.remove(oe);
+ hotelView.endMethod();
+ return true;
+ }
+
+ @WebMethod
+ @BAService
+ @BACompensatedBy(value="cancelComplimentaryPackageNumber",single=true,type=BACompensationType.PARAMETERS_MATCH)
+ public Integer getComplimentaryPackageNumber(String username, String password, Integer reservationNumber)
+ throws HotelCustomException
+ {
+ log.info("getComplimentaryPackageNumber()");
+ hotelView.newMethod("getComplimentaryPackageNumber()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ Integer freePack = order.getFreePack();
+ if (freePack == null)
+ {
+ freePack = Math.abs(randomGenerator.nextInt());
+ }
+ em.merge(order);
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelComplimentaryPackageNumber()");
+ return freePack;
+
+ }
+
+ @WebMethod
+ public boolean cancelComplimentaryPackageNumber(String username, String password,Integer reservationNumber)
+ throws HotelCustomException
+ {
+ log.info("cancelComplimentaryPackageNumber()");
+ hotelView.newMethod("cancelComplimentaryPackageNumber()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ order.setFreePack(null);
+ em.merge(order);
+ hotelView.endMethod();
+ return true;
+ }
+
+ @WebMethod
+ @BAService
+ @BACompensatedBy(value="cancelFitnessPass",type=BACompensationType.PARAMETERS_MATCH)
+ public boolean bookFitnessPass(String username, String password, Integer reservationNumber, Integer amount)
+ throws HotelCustomException
+ {
+ log.info("bookFitnessPass()");
+ hotelView.newMethod("bookFitnessPack()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ hotelView.addMessage("Amount: " + amount);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ Integer fitnessPass = order.getFitnessPass();
+ hotelView.addMessage("Current number of fitness passes: " + fitnessPass);
+ fitnessPass = fitnessPass + amount;
+ hotelView.addMessage("New number of fitness passes: " + fitnessPass);
+ order.setFitnessPass(fitnessPass);
+ em.merge(order);
+ hotelView.addMessage("Returning true");
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelFitnessPass()");
+ return true;
+ }
+
+ @WebMethod
+ public boolean cancelFitnessPass(String username, String password, Integer reservationNumber, Integer amount)
+ throws HotelCustomException
+ {
+ log.info("cancelFitnessPass()");
+ hotelView.newMethod("cancelFitnessPass()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ hotelView.addMessage("Amount: " + amount);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ Integer fitnessPass = order.getFitnessPass();
+ hotelView.addMessage("Current number of fitness passes: " + fitnessPass);
+ fitnessPass = fitnessPass - amount;
+ hotelView.addMessage("New number of fitness passes: " + fitnessPass);
+ order.setFitnessPass(fitnessPass);
+ em.merge(order);
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelFitnessPass()");
+ return true;
+ }
+
+ @WebMethod
+ @BAService
+ @BACompensatedBy("cancelCasinoToken")
+ public Integer getCasinoToken(String username, String password, Integer amount)
+ throws HotelCustomException
+ {
+ log.info("getCasinoToken()");
+ hotelView.newMethod("getCasinoToken()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Amount: " + amount);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ Integer token = Math.abs(randomGenerator.nextInt());
+
+ // Remember token in the DB
+ // TODO: Implement
+ //
+
+ cm.put("refund",amount/2);
+
+ hotelView.addMessage("Returning token: " + token);
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelCasinoToken()");
+ return token;
+ }
+
+ @WebMethod
+ public boolean cancelCasinoToken(Integer token)
+ throws HotelCustomException
+ {
+ log.info("cancelCasinoToken()");
+ hotelView.newMethod("cancelCasinoToken()");
+ hotelView.addMessage("Token: " + token);
+
+ // Check if the token is in the DB
+ // TODO: Implement
+ // ... if not - throw an exception
+ // ... if yes - invalidate it
+
+ Integer refund = (Integer) cm.get("refund");
+ if (refund != null)
+ {
+ hotelView.addMessage("Refund given: " + refund);
+ }
+
+ hotelView.endMethod();
+ return true;
+ }
+
+ @WebMethod
+ @BAService
+ @BACompensatedBy(value="cancelMeal",type=BACompensationType.CUSTOM)
+ public MealOrder orderMeal(@BAParam("user")String username, at BAParam("password")String password, at BAParam("reservation")Integer reservationNumber)
+ throws HotelCustomException
+ {
+ log.info("orderMeal()");
+ hotelView.newMethod("orderMeal()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Login incorrect - throwing exception");
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ hotelView.addMessage("Reservation incorrect - throwing exception");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+
+ Integer orderNumber = Math.abs(randomGenerator.nextInt());
+ hotelView.addMessage("Meal order no: " + orderNumber);
+ MealOrder mealOrder = new MealOrder();
+ mealOrder.setMealId(orderNumber);
+ mealOrder.setName("Some name");
+
+ // BA-related code - BEGIN
+ cm.put("order",orderNumber);
+ // BA-related code - END
+
+ order.addMealOrder(mealOrder);
+ em.merge(order);
+
+ hotelView.addMessage("Returning complex object: " + mealOrder);
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelMeal()");
+ return mealOrder;
+ }
+
+ @WebMethod
+ public boolean cancelMeal(@BAParam("user")String username, at BAParam("password")String password, at BAParam("reservation")Integer reservationNumber, at BAParam("order")Integer orderNumber)
+ throws HotelCustomException
+ {
+ log.info("cancelMeal()");
+ hotelView.newMethod("cancelMeal()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Order no: " + orderNumber);
+
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ hotelView.addMessage("Login incorrect");
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ hotelView.addMessage("Reservation incorrect");
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ if (order.removeMealOrder(orderNumber))
+ {
+ hotelView.addMessage("Order removed successfully: " + orderNumber);
+ return true;
+ }
+ hotelView.addMessage("Order " + orderNumber + " could not be removed.");
+ hotelView.endMethod();
+ return false;
+ }
+
+ @WebMethod
+ @BAService
+ @BACompensatedBy(value="cancelExtraMiniBar",type=BACompensationType.PARAMETERS_MATCH)
+ public boolean orderExtraMiniBar(String username, String password, Integer reservationNumber)
+ throws HotelCustomException
+ {
+ log.info("orderExtraMiniBar()");
+ hotelView.newMethod("orderExtraMiniBar()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ order.setExtraMiniBar(true);
+ em.merge(order);
+ hotelView.endMethod();
+ compensationView.compensationMethod("cancelExtraMiniBar()");
+ return true;
+
+ }
+
+ @WebMethod
+ public boolean cancelExtraMiniBar(String username, String password, Integer reservationNumber)
+ throws HotelCustomException
+ {
+ log.info("cancelExtraMiniBar()");
+ hotelView.newMethod("cancelExtraMiniBar()");
+ hotelView.addMessage("Username: " + username);
+ hotelView.addMessage("Password: " + password);
+ hotelView.addMessage("Reservation no: " + reservationNumber);
+ CustomerEntityImpl customer = getCustomer(username,password);
+ if (customer == null)
+ {
+ throw new HotelCustomException("Login incorrect");
+ }
+ OrderEntityImpl order = getReservation(reservationNumber);
+ if (order == null)
+ {
+ throw new HotelCustomException("Reservation incorrect");
+ }
+ order.setExtraMiniBar(false);
+ em.merge(order);
+ hotelView.endMethod();
+ return true;
+ }
+
+
+ private List<CustomerEntityImpl> getCustomers()
+ {
+ return em.createQuery("select C from CustomerEntityImpl C").getResultList();
+ }
+
+ private List<RoomEntityImpl> getRooms()
+ {
+ return em.createQuery("select C from RoomEntityImpl C").getResultList();
+ }
+
+ private CustomerEntityImpl getCustomer(String username, String password)
+ {
+ try
+ {
+ return (CustomerEntityImpl) em.createQuery("select C from CustomerEntityImpl C where C.username like :username and C.password like :password")
+ .setParameter("username", username)
+ .setParameter("password",password)
+ .getSingleResult();
+ }
+ catch ( NoResultException ne )
+ {
+ return null;
+ }
+ }
+
+ private OrderEntityImpl getReservation(Integer reservationNumber)
+ {
+ try
+ {
+ return (OrderEntityImpl) em.createQuery("select C from OrderEntityImpl C where C.id like :id")
+ .setParameter("id",reservationNumber)
+ .getSingleResult();
+ }
+ catch ( NoResultException ne )
+ {
+ return null;
+ }
+ }
+
+ private RoomEntityImpl getRoom(Integer roomNumber)
+ {
+ try
+ {
+ return (RoomEntityImpl) em.createQuery("select C from RoomEntityImpl C where C.id like :id")
+ .setParameter("id",roomNumber)
+ .getSingleResult();
+ }
+ catch ( NoResultException ne )
+ {
+ return null;
+ }
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/MealOrder.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/MealOrder.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/MealOrder.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,76 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 9, 2007
+ */
+public class MealOrder
+{
+ private int mealId;
+ private String name;
+
+
+ public MealOrder()
+ {
+ }
+
+ public MealOrder(int mealId,String name)
+ {
+ this();
+ this.mealId = mealId;
+ this.name = name;
+ }
+
+ public int getMealId()
+ {
+ return mealId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+
+ public void setMealId(int mealId)
+ {
+ this.mealId = mealId;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Meal Order:");
+ sb.append("\n1) ID: ");
+ sb.append(mealId);
+ sb.append("\n2) Name: ");
+ sb.append(name);
+ return sb.toString();
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/OrderEntityImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,157 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 9, 2007
+ */
+ at Entity
+ at Table(name="orders")
+public class OrderEntityImpl implements Serializable
+{
+ private int id;
+ private CustomerEntityImpl customer;
+ private RoomEntityImpl room;
+ private Integer fitnessPass = 0;
+ private Integer freePack;
+ private List<Integer> casinoTokens;
+ private boolean extraMiniBar = false;
+ private Map<Integer,MealOrder> mealOrders;
+
+ public OrderEntityImpl()
+ {
+ casinoTokens = new ArrayList<Integer>();
+ mealOrders = new HashMap<Integer,MealOrder>();
+ }
+
+
+ public OrderEntityImpl(CustomerEntityImpl customer, RoomEntityImpl room)
+ {
+ this.customer = customer;
+ this.room = room;
+ }
+
+ @Id
+ @GeneratedValue
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ @ManyToOne
+ @JoinColumn(name="customer")
+ public CustomerEntityImpl getCustomer()
+ {
+ return customer;
+ }
+
+ public void setCustomer(CustomerEntityImpl customer)
+ {
+ this.customer = customer;
+ }
+
+ @OneToOne
+ @JoinColumn(name="room")
+ public RoomEntityImpl getRoom()
+ {
+ return room;
+ }
+
+ public void setRoom(RoomEntityImpl room)
+ {
+ this.room = room;
+ }
+
+ public Integer getFitnessPass()
+ {
+ return fitnessPass;
+ }
+
+ public void setFitnessPass(Integer fitnessPass)
+ {
+ this.fitnessPass = fitnessPass;
+ }
+
+ public Integer getFreePack()
+ {
+ return freePack;
+ }
+
+ public void setFreePack(Integer freePack)
+ {
+ this.freePack = freePack;
+ }
+
+ public void addCasinoToken(Integer token)
+ {
+ casinoTokens.add(token);
+ }
+
+ public boolean removeCasinoToken(Integer casinoToken)
+ {
+ return casinoTokens.remove(casinoToken);
+ }
+
+ public boolean isExtraMiniBar()
+ {
+ return extraMiniBar;
+ }
+
+ public void setExtraMiniBar(boolean extraMiniBar)
+ {
+ this.extraMiniBar = extraMiniBar;
+ }
+
+ public void addMealOrder(MealOrder mealOrder)
+ {
+ mealOrders.put(mealOrder.getMealId(),mealOrder);
+ }
+
+ public boolean removeMealOrder(Integer mealId)
+ {
+ MealOrder mealOrder = mealOrders.remove(mealId);
+ return mealOrder == null;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("ID: ").append(id);
+ sb.append(" Customer: ").append(customer.getUsername());
+ sb.append(" Room: ").append(room.getRoomName());
+ sb.append(" Free pack: ").append(freePack);
+ sb.append(" Casino Tokens: ").append(casinoTokens);
+ sb.append(" Extra mini bar: ").append(extraMiniBar);
+ return sb.toString();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomAlreadyOccupiedException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomAlreadyOccupiedException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomAlreadyOccupiedException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,38 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ */
+public class RoomAlreadyOccupiedException extends Exception
+{
+
+ public RoomAlreadyOccupiedException() {
+ super();
+ }
+
+ public RoomAlreadyOccupiedException(String message)
+ {
+ super(message); //To change body of overridden methods use File | Settings | File Templates.
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomEntityImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomEntityImpl.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/RoomEntityImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,86 @@
+/*
+ * 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 com.jboss.ba.demo.service;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ */
+ at Entity
+ at Table(name = "room")
+public class RoomEntityImpl implements Serializable
+{
+ private int id;
+ private String roomName;
+ private OrderEntityImpl order;
+
+ public RoomEntityImpl()
+ {
+ }
+
+ @Id
+ @GeneratedValue
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+
+ public String getRoomName()
+ {
+ return roomName;
+ }
+
+ public void setRoomName(String roomName)
+ {
+ this.roomName = roomName;
+ }
+
+ @OneToOne(mappedBy="room")
+ public OrderEntityImpl getOrder()
+ {
+ return order;
+ }
+
+ public void setOrder(OrderEntityImpl order)
+ {
+ this.order = order;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("ID: ").append(id);
+ sb.append(" Name: ").append(roomName);
+ return sb.toString();
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/CompensationView.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/CompensationView.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/CompensationView.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,103 @@
+/*
+ * 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 com.jboss.ba.demo.service.helper;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.awt.*;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 31, 2007
+ */
+public class CompensationView extends JFrame
+{
+ private volatile static CompensationView compensationView;
+
+ private JTextArea textArea;
+ private JScrollPane scrollPane;
+
+ private List<String> compensationList;
+
+ public CompensationView()
+ {
+ setLayout(new BorderLayout());
+ setSize(600,600);
+
+ setTitle("BA Framework Test Application - Compensation Order");
+
+ textArea = new JTextArea(240,20);
+ scrollPane = new JScrollPane();
+
+ scrollPane.setAutoscrolls(true);
+ textArea.setEditable(false);
+ textArea.setRows(10);
+ textArea.setMargin(new java.awt.Insets(5, 5, 5, 5));
+ scrollPane.setViewportView(textArea);
+
+ getContentPane().add(scrollPane,BorderLayout.CENTER);
+ setVisible(true);
+ repaint();
+
+ compensationList = new ArrayList<String>();
+ }
+
+ public static CompensationView getSingletonInstance()
+ {
+ if (compensationView == null)
+ {
+ synchronized(CompensationView.class)
+ {
+ if (compensationView == null)
+ {
+ compensationView = new CompensationView();
+ }
+ }
+ }
+ return compensationView;
+ }
+
+ public void resetCompensationList()
+ {
+ compensationList.clear();
+ }
+
+ public void compensationMethod(String compensationMethod)
+ {
+ compensationList.add(compensationMethod);
+ showCompensation(compensationList);
+ }
+
+ private void showCompensation(List<String> compensationList)
+ {
+ textArea.setText("");
+ textArea.append("Compensation order:\n");
+ int counter = 0;
+ for (int i = compensationList.size(); i > 0 ; i--)
+ {
+ textArea.append((counter+1) + ") " + compensationList.get(i-1) + "\n");
+ counter++;
+ }
+ textArea.append("---");
+ textArea.append("\nTotal number of compensation actions: " + counter);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/HotelView.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/HotelView.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/demo/src/com/jboss/ba/demo/service/helper/HotelView.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,89 @@
+/*
+ * 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 com.jboss.ba.demo.service.helper;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ */
+public class HotelView extends JFrame
+{
+ private volatile static HotelView hotelView;
+
+ private JTextArea textArea;
+ private JScrollPane scrollPane;
+
+ private HotelView()
+ {
+ setLayout(new BorderLayout());
+ setSize(600,900);
+
+ setTitle("BA Framework Test Application - DEBUG Window");
+
+ textArea = new JTextArea(40,20);
+ scrollPane = new JScrollPane();
+
+ scrollPane.setAutoscrolls(true);
+ textArea.setEditable(false);
+ textArea.setRows(10);
+ textArea.setMargin(new java.awt.Insets(5, 5, 5, 5));
+ scrollPane.setViewportView(textArea);
+
+ getContentPane().add(scrollPane,BorderLayout.CENTER);
+ setVisible(true);
+ repaint();
+
+ }
+
+ public static HotelView getSingletonInstance()
+ {
+ if (hotelView == null)
+ {
+ synchronized(HotelView.class)
+ {
+ if (hotelView == null)
+ {
+ hotelView = new HotelView();
+ }
+ }
+ }
+ return hotelView;
+ }
+
+ public void newMethod(String methodName)
+ {
+ textArea.append("######## " + methodName + " ########\n");
+ }
+
+ public void addMessage(String message)
+ {
+ textArea.append(message + "\n");
+ }
+
+ public void endMethod()
+ {
+ textArea.append("--- end ---\n");
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/docs/BAFrameworkAPI.docx
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/workspace/baframework/trunk/docs/BAFrameworkAPI.docx
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/workspace/baframework/trunk/docs/BAFrameworkMG.docx
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/workspace/baframework/trunk/docs/BAFrameworkMG.docx
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/workspace/baframework/trunk/license.txt
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/license.txt (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/license.txt 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,280 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
Added: labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/resources/jboss-aop.xml 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<aop>
+
+ <!-- Specification of Typedefs -->
+ <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="baCompensationManagement" expr="field(org.jboss.txbridge.ba.compensation.CompensationManager *->@org.jboss.txbridge.ba.annotation.BACompensationManagement)"/>
+
+ <!-- BA Processing Aspect -->
+ <aspect class="org.jboss.txbridge.ba.aspect.JaxWSBAProcessingAspect" scope="PER_INSTANCE"/>
+
+ <bind pointcut="baServiceAnnotation">
+ <advice name="process" aspect="org.jboss.txbridge.ba.aspect.JaxWSBAProcessingAspect"/>
+ </bind>
+
+
+ <bind pointcut="baCompensationManagement">
+ <advice name="access" aspect="org.jboss.txbridge.ba.aspect.JaxWSBAProcessingAspect"/>
+ </bind>
+
+</aop>
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/JaxWSServerHeaderContextProcessor.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/JaxWSServerHeaderContextProcessor.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/JaxWSServerHeaderContextProcessor.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,293 @@
+/*
+ * 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;
+
+import org.apache.log4j.Logger;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.*;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import com.arjuna.webservices.wscoor.CoordinationConstants;
+import com.arjuna.webservices.wscoor.CoordinationContextType;
+import com.arjuna.webservices.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices.wsba.BusinessActivityConstants;
+import com.arjuna.mw.wst.common.CoordinationContextHelper;
+import com.arjuna.mw.wst.common.SOAPUtil;
+import com.arjuna.mw.wst.*;
+
+
+/**
+ * TODO: make this play nice alongside com.arjuna.mw.wst.service.JaxRPCHeaderContextProcessor
+ * - factor out common base class or suchlike
+ */
+public class JaxWSServerHeaderContextProcessor implements SOAPHandler
+{
+ private static Logger log = Logger.getLogger(JaxWSServerHeaderContextProcessor.class);
+
+ private String handlerName;
+
+ public String getHandlerName()
+ {
+ return handlerName;
+ }
+
+ public void setHandlerName(String handlerName)
+ {
+ this.handlerName = handlerName;
+ }
+
+ public boolean handleMessage(MessageContext msgContext)
+ {
+ Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (outbound == null)
+ throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
+ }
+
+
+ public boolean handleFault(MessageContext messagecontext)
+ {
+ suspendTransaction() ;
+ return true;
+ }
+
+ public void close(MessageContext messageContext)
+ {
+ }
+
+ public String toString()
+ {
+ return (handlerName != null ? handlerName : super.toString());
+ }
+
+
+
+ // The header blocks that can be processed by this Handler instance
+ private Set<QName> headers = new HashSet<QName>();
+
+ /** Gets the header blocks that can be processed by this Handler instance.
+ */
+ public Set<QName> getHeaders()
+ {
+ log.info("getHeaders");
+
+ Set<QName> headerSet = new HashSet<QName>();
+ headerSet.add(new QName(CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT));
+
+ return headerSet;
+ }
+
+ /** Sets the header blocks that can be processed by this Handler instance.
+ */
+ public void setHeaders(Set<QName> headers)
+ {
+ this.headers = headers;
+ }
+
+
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+/*
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPFactory soapFactory = SOAPFactory.newInstance();
+ Name headerName = soapFactory.createName("LogHandlerInbound", "ns1", "http://somens");
+ SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+ she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|LogIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+*/
+
+ final SOAPMessageContext soapMessageContext = (SOAPMessageContext)msgContext ;
+ final SOAPMessage soapMessage = soapMessageContext.getMessage() ;
+
+ if (soapMessage != null)
+ {
+ try
+ {
+ final SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope() ;
+ final SOAPHeader soapHeader = soapEnvelope.getHeader() ;
+ final SOAPHeaderElement soapHeaderElement = getHeaderElement(soapHeader, CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT) ;
+
+ if (soapHeaderElement != null)
+ {
+ final CoordinationContextType cc = CoordinationContextHelper.deserialise(soapEnvelope, soapHeaderElement) ;
+ final String coordinationType = cc.getCoordinationType().getValue() ;
+ if (AtomicTransactionConstants.WSAT_PROTOCOL.equals(coordinationType))
+ {
+ final TxContext txContext = new com.arjuna.mwlabs.wst.at.context.TxContextImple(cc) ;
+ TransactionManagerFactory.transactionManager().resume(txContext) ;
+ clearMustUnderstand(soapHeader, soapHeaderElement) ;
+ }
+ else if (BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME.equals(coordinationType))
+ {
+ final TxContext txContext = new com.arjuna.mwlabs.wst.ba.context.TxContextImple(cc);
+ BusinessActivityManagerFactory.businessActivityManager().resume(txContext) ;
+ clearMustUnderstand(soapHeader, soapHeaderElement) ;
+ }
+ else
+ {
+ log.warn("handleInbound: unknown type="+coordinationType);
+ }
+ }
+ }
+ catch (final Throwable th)
+ {
+ log.warn("handleInbound: ", th);
+ }
+ }
+ return true ;
+ }
+
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+ suspendTransaction() ;
+/*
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPFactory soapFactory = SOAPFactory.newInstance();
+ Name headerName = soapFactory.createName("LogHandlerOutbound", "ns1", "http://somens");
+ SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+ she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|LogOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+*/
+ return true;
+ }
+
+ private void suspendTransaction()
+ {
+ try
+ {
+ /*
+ * There should either be an Atomic Transaction *or* a Business Activity
+ * associated with the thread.
+ */
+ final TransactionManager transactionManager = TransactionManagerFactory.transactionManager() ;
+ final BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager() ;
+
+ if (transactionManager != null)
+ {
+ transactionManager.suspend() ;
+ }
+
+ if (businessActivityManager != null)
+ {
+ businessActivityManager.suspend() ;
+ }
+ }
+ catch (final Throwable th)
+ {
+ log.warn("suspendTransaction", th);
+ }
+ }
+
+ private SOAPHeaderElement getHeaderElement(final SOAPHeader soapHeader, final String uri, final String name)
+ throws SOAPException
+ {
+ if (soapHeader != null)
+ {
+ final Iterator headerIter = SOAPUtil.getChildElements(soapHeader) ;
+ while(headerIter.hasNext())
+ {
+ final SOAPHeaderElement current = (SOAPHeaderElement)headerIter.next() ;
+ final Name currentName = current.getElementName() ;
+ if ((currentName != null) &&
+ match(name, currentName.getLocalName()) &&
+ match(uri, currentName.getURI()))
+ {
+ return current ;
+ }
+ }
+ }
+ return null ;
+ }
+
+ /**
+ * Do the two references match?
+ * @param lhs The first reference.
+ * @param rhs The second reference.
+ * @return true if the references are both null or if they are equal.
+ */
+ private boolean match(final Object lhs, final Object rhs)
+ {
+ if (lhs == null)
+ {
+ return (rhs == null) ;
+ }
+ else
+ {
+ return lhs.equals(rhs) ;
+ }
+ }
+
+ /**
+ * Clear the soap MustUnderstand.
+ * @param soapHeader The SOAP header.
+ * @param soapHeaderElement The SOAP header element.
+ */
+ private void clearMustUnderstand(final SOAPHeader soapHeader, final SOAPHeaderElement soapHeaderElement)
+ throws SOAPException
+ {
+ final Name headerName = soapHeader.getElementName() ;
+
+ final SOAPFactory factory = SOAPFactory.newInstance() ;
+ final Name attributeName = factory.createName("mustUnderstand", headerName.getPrefix(), headerName.getURI()) ;
+
+ soapHeaderElement.removeAttribute(attributeName) ;
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/BATransactionManager.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,328 @@
+/*
+ * 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;
+
+import com.arjuna.mw.wst.BusinessActivityManager;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.SystemException;
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.exception.TransactionProcessingException;
+import org.jboss.txbridge.ba.helper.BAServiceVisitor;
+import org.jboss.txbridge.ba.id.IdentifierFactory;
+import org.jboss.txbridge.ba.id.UidIdentifierFactory;
+import org.jboss.txbridge.ba.participant.Participant;
+import org.jboss.txbridge.ba.service.ServiceInformationManager;
+
+import java.lang.reflect.Method;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This is the main component - the Business Activity Transaction Manager. It is responsible
+ * for associating fully unique task identifiers to different invocations. It also knows about
+ * all existing components responsible for single transactions.
+ */
+public class BATransactionManager
+{
+ // Logger
+ private static Logger log = Logger.getLogger(BATransactionManager.class);
+
+ // BA Transaction Manager instance
+ private volatile static BATransactionManager baTransactionManager = null;
+
+ // Business Activity manager
+ private BusinessActivityManager businessActivityManager;
+
+ // Service information manager
+ private ServiceInformationManager serviceManager;
+
+ // Mappings:
+ // Business Activity ID <-> Transaction Manager
+ private ConcurrentMap<String, SingleTransactionManager> singleTransactionManagers;
+
+
+ // Constructor
+ private BATransactionManager()
+ {
+ log.info("constructor()");
+
+ // Get reference to the business activity manager
+ businessActivityManager = BusinessActivityManager.getBusinessActivityManager();
+
+ // Get reference to the service manager
+ serviceManager = ServiceInformationManager.getSingletonInstance();
+
+ // Initialise mappings
+ singleTransactionManagers = new ConcurrentHashMap<String, SingleTransactionManager>();
+
+ }
+
+ /**
+ * Returns the instance of the BATRansactionManager object.
+ *
+ * @return the instance of the BATransactionManager.
+ */
+ public static BATransactionManager getSingletonInstance()
+ {
+ log.info("getSingletonInstance()");
+ if (baTransactionManager == null)
+ {
+ synchronized (BATransactionManager.class)
+ {
+ if (baTransactionManager == null)
+ {
+ log.info("Creating new instance...");
+ baTransactionManager = new BATransactionManager();
+ }
+ }
+ }
+ return baTransactionManager;
+ }
+
+ /**
+ * This method returns true if there is currently a Business Activity.
+ *
+ * @return the boolean value.
+ * @throws SystemException if it is not possible to get current transaction.
+ */
+ public synchronized boolean isBAPresent() throws SystemException
+ {
+ return businessActivityManager.currentTransaction() != null;
+ }
+
+ /**
+ * This method handles a transaction for this invocation of a method.
+ *
+ * @param method is the method which is being invoked.
+ * @return the task identifier for this method.
+ * @throws org.jboss.txbridge.ba.exception.TransactionProcessingException if there is a problem with processing a transaction
+ */
+ public synchronized TaskDescription handleInvocation(Method method) throws TransactionProcessingException
+ {
+ log.info("handleInvocation()");
+ String txId; // Transaction identifier
+ try
+ {
+ // Get the transaction identifier
+ // May throw:
+ // - WrongStateException
+ // - SystemException
+ log.info("Getting transaction identifier");
+ TxContext txContext = businessActivityManager.currentTransaction();
+ if (txContext == null)
+ {
+ log.info("No transaction context!");
+ throw new TransactionProcessingException("No transaction context");
+ }
+ txId = txContext.toString();
+ log.info(txId);
+
+ // If there was a transaction then we can proceed...
+
+ // Process this service if necessary
+ String methodName = method.getName();
+ String className = method.getDeclaringClass().getName();
+ log.info("Class: " + className);
+ log.info("Method: " + methodName);
+ log.info("Checking if the service is known");
+ if (!serviceManager.knowsAboutByName(className+methodName))
+ {
+ // If service is unknown - process it
+ // May throw:
+ // - MethodIncorrectlyAnnotatedException
+ // - CompensationMethodNotAccessible
+ // TODO: Processing services and checking should be done during deployment time
+ log.info("Service unknown - processing");
+ serviceManager.storeServiceDescription(BAServiceVisitor.processMethod(method));
+ }
+ else
+ {
+ log.info("Service already known...");
+ }
+
+ // Get the service identifier
+ log.info("Getting service ID");
+ String serviceId = serviceManager.getServiceId(className+methodName);
+ log.info("Service ID: " + serviceId);
+
+ // Get a new task identifier - has to be done in the main component to ensure uniqueness
+ log.info("Getting new task identifier");
+ IdentifierFactory idf = new UidIdentifierFactory();
+ String taskId = idf.getIdentifier();
+ log.info("Task ID: " + taskId);
+
+ // Get a reference to a single transaction manager. If there is none - create a new one.
+ log.info("Getting reference to a single transaction manager for: " + txId);
+ SingleTransactionManager stm = singleTransactionManagers.get(txId);
+ if (stm == null)
+ {
+ log.info("No manager associated - creating new one");
+
+ // Create a new single transaction manager for this transaction
+ stm = new SingleTransactionManager(txId);
+
+ // Remember it
+ log.info("Remembering association (txId,singleManager)");
+ singleTransactionManagers.put(txId,stm);
+ }
+ else
+ {
+ log.info("Transaction already known - single transaction manager retrieved");
+ }
+
+ // Delegate transaction management to the single transaction manager
+ log.info("Delegating transaction management to the single transaction manager");
+ Participant participant = stm.processInvocation(taskId,serviceId);
+ if (participant == null)
+ {
+ throw new TransactionProcessingException("Could not create participant");
+ }
+ log.info("Returning new task description");
+ return new TaskDescription(txId,taskId,serviceId,participant);
+
+ }
+ catch (Exception se)
+ {
+ se.printStackTrace();
+ throw new TransactionProcessingException(se.getMessage());
+ }
+ }
+
+ /**
+ * This method compensates a transaction with a given ID. It delegates the compensation management
+ * to an appropriate single transaction manager.
+ *
+ * @param txId is the ID of the transaction which should be compensated.
+ */
+ public void compensateTransaction(String txId)
+ {
+ log.info("compensateTransaction()");
+ // Get the single transaction manager for this transaction and remove it from the list
+ SingleTransactionManager singleTransactionManager = null;
+ log.info("Getting reference to the Single Transaction Manager");
+ singleTransactionManager = singleTransactionManagers.remove(txId);
+ if (singleTransactionManager == null)
+ {
+ log.info("Compensation already delegated to the Single Transaction Manager");
+ return;
+ }
+
+ // Execute compensation
+ log.info("Compensating tasks");
+ singleTransactionManager.compensate();
+ log.info("Compensation completed.");
+ }
+
+ /**
+ * This method cleans data associated with a given transaction. It removes a single transaction
+ * manager from the list.
+ *
+ * @param txId is the ID of the transaction which should be finished.
+ */
+ public void closeTransaction(String txId)
+ {
+ log.info("closeTransaction()");
+
+ // Remove the single transaction manager from the list
+ SingleTransactionManager stm = singleTransactionManagers.remove(txId);
+ if (stm != null)
+ {
+ log.info("Transaction has been removed from the list");
+ }
+ else
+ {
+ log.info("Transaction has been already removed from the list");
+ }
+ }
+
+ /**
+ * 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).
+ *
+ * @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.
+ */
+ public synchronized void completeInvocation(TaskDescription taskDesc, Object[] arguments, Object returnObject)
+ throws TransactionProcessingException
+ {
+ log.info("completeInvocation()");
+ // Get reference to the single transaction manager
+ SingleTransactionManager stm = singleTransactionManagers.get(taskDesc.getTxId());
+ if (stm == null)
+ {
+ return;
+ }
+
+ // TODO: Reconsider this
+ // Complete the invocation
+ try
+ {
+ stm.completeInvocation(taskDesc,arguments,returnObject);
+ }
+ catch (Exception e)
+ {
+ // If there was an error pass the exception
+ e.printStackTrace();
+ throw new TransactionProcessingException(e);
+ }
+
+ }
+
+ /**
+ * This method is invoked if the business logic could not complete and the fault
+ * is to be propagated to the client. It removes information about this task.
+ *
+ * @param taskDesc is the description of the task.
+ * @throws org.jboss.txbridge.ba.exception.TransactionProcessingException if cleaning the invocation was not successful.
+ */
+ public synchronized void cleanInvocation(TaskDescription taskDesc)
+ throws TransactionProcessingException
+ {
+ log.info("cleanInvocation()");
+ // Get reference to the single transaction manager
+ SingleTransactionManager stm = singleTransactionManagers.get(taskDesc.getTxId());
+ if (stm == null)
+ {
+ return;
+ }
+
+ // TODO: Reconsider this
+ // Clean the invocation
+ try
+ {
+ stm.cleanInvocation(taskDesc);
+ }
+ catch (Exception e)
+ {
+ // If there was an error pass it
+ e.printStackTrace();
+ throw new TransactionProcessingException(e);
+ }
+ }
+
+}
\ No newline at end of file
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/SingleTransactionManager.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,590 @@
+/*
+ * 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;
+
+import com.arjuna.wst.*;
+import com.arjuna.mw.wst.BusinessActivityManager;
+import com.arjuna.ats.arjuna.common.Uid;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.io.Serializable;
+
+
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+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.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.apache.log4j.Logger;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * The Single Transaction Manager component is responsible for maintaining information about
+ * a single Business Activity. It knows about the exact order of tasks that have been executed
+ * within the Business Activity, the participants that have been instantiated for this specific
+ * Business Activity and about participant managers responsible for those participants.
+ */
+public class SingleTransactionManager implements Serializable
+{
+ // Logger
+ private static Logger log = Logger.getLogger(SingleTransactionManager.class);
+
+ // Business activity manager
+ private static BusinessActivityManager businessActivityManager;
+
+ // Service information manager
+ private static ServiceInformationManager serviceInformationManager;
+
+ // Transaction identifier
+ private String txId;
+
+ // List of tasks for this transaction
+ private List<String> taskList;
+
+ // List of tasks for this transaction that should be compensated first
+ // TODO: Implement this
+ private List<String> taskListFirst;
+
+ // List of tasks for this transaction that should be compensated last
+ // TODO: Implement this
+ private List<String> taskListLast;
+
+
+ // List of already executed single service list
+ private List<String> singleServiceList;
+
+ // (task id , service id) mapping
+ private ConcurrentMap<String,String> taskServiceMapping;
+
+ // (service id , participant) mapping
+ private ConcurrentMap<String,Participant> serviceParticipantMapping;
+
+ // (task id (participant) , participant manager) mapping - for participant completion
+ private ConcurrentMap<String,BAParticipantManager> taskBAManagerMapping;
+
+ // (participant , participant manager) mapping - for coordinator completion
+ private ConcurrentMap<Participant,BAParticipantManager> participantManagerMapping;
+
+ public SingleTransactionManager(String txId)
+ {
+ log.info("constructor()");
+
+ // Remember the transaction identifier
+ this.txId = txId;
+
+ // Get reference to the business activity manager
+ businessActivityManager = BusinessActivityManager.getBusinessActivityManager();
+
+ // Get reference to the service information manager
+ serviceInformationManager = ServiceInformationManager.getSingletonInstance();
+
+ // Initialise the list of tasks for this transaction
+ taskList = new Stack<String>();
+
+ // Initialise the list of tasks for this transaction
+ taskListFirst = new Stack<String>();
+
+ // Initialise the list of tasks for this transaction
+ taskListLast = new Stack<String>();
+
+ // Initialise the list of already executed single services
+ singleServiceList = new ArrayList<String>();
+
+ // Initialise (task id , service id) mapping
+ taskServiceMapping = new ConcurrentHashMap<String,String>();
+
+ // Initialise (service id , participant) mapping
+ serviceParticipantMapping = new ConcurrentHashMap<String,Participant>();
+
+ // Initialise (task id (participant) , participant manager mapping)
+ taskBAManagerMapping = new ConcurrentHashMap<String,BAParticipantManager>();
+
+ // Initialise (participant, participant manager mapping)
+ participantManagerMapping = new ConcurrentHashMap<Participant,BAParticipantManager>();
+
+ }
+
+ /**
+ * This method processes a single invocation within a scope of a transaction this single transaction
+ * manager is responsible for. It either creates a new participant for the service that is being invoked
+ * or associates this invocation with an existing participant.
+ *
+ * @param taskId is the task identifier.
+ * @param serviceId is the service identifier.
+ * @return the participant associated with the invocation.
+ * @throws org.jboss.txbridge.ba.exception.TransactionProcessingException if an error occurs
+ */
+ public Participant processInvocation(String taskId, String serviceId) throws TransactionProcessingException
+ {
+ log.info("processInvocation()");
+
+ // If the manager is aware of this task than there must be an error
+ if (taskList.contains(taskId) || taskServiceMapping.containsKey(taskId))
+ {
+ log.info("Task is already known");
+ throw new TransactionProcessingException("Task identifier already known");
+ }
+
+ try
+ {
+ // Remember the task and its service
+ log.info("Remembering the task and the service.");
+ taskList.add(taskId);
+ taskServiceMapping.put(taskId,serviceId);
+
+ // Check if there is an existing participant associated with this service and transaction
+ // If not - then create a new one basing upon the required agreement protocol
+ // 1) Get information about the service
+ ServiceDescription sd = serviceInformationManager.getServiceById(serviceId);
+ if (sd == null)
+ {
+ throw new TransactionProcessingException("Service unknown");
+ }
+ // 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);
+ 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)
+ {
+ cdf = new CompensationDataCustomFactory();
+ }
+ 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)
+ {
+ log.info("Agreement protocol type: " + BAAgreementType.PARTICIPANT_COMPLETION);
+ participant = new ParticipantCompletionParticipant(txId,serviceId,this,cdf);
+ }
+ else if (agreementType == BAAgreementType.COORDINATOR_COMPLETION)
+ {
+ log.info("Agreement protocol type: " + BAAgreementType.COORDINATOR_COMPLETION);
+ participant = new CoordinatorCompletionParticipant(txId,serviceId,this,cdf);
+ }
+ else
+ {
+ throw new TransactionProcessingException("Unsupported agreement type: " + compensationType);
+ }
+
+ // Remember the participant
+ log.info("Storing reference to the participant");
+ serviceParticipantMapping.put(serviceId,participant);
+ }
+
+ // Check the required agreement protocol and enlist the participant
+ log.info("Enlisting participant if necessary");
+ BAParticipantManager participantManager;
+ if (sd.getAgreementType() == BAAgreementType.PARTICIPANT_COMPLETION)
+ {
+ log.info("Protocol: " + BAAgreementType.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)
+ {
+ log.info("Protocol: " + BAAgreementType.COORDINATOR_COMPLETION);
+ if (!participantCreated)
+ {
+ participantManager = businessActivityManager.enlistForBusinessAgreementWithCoordinatorCompletion((BusinessAgreementWithCoordinatorCompletionParticipant)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);
+ participantManagerMapping.put(participant,participantManager);
+ }
+ else
+ {
+ participantManager = participantManagerMapping.get(participant);
+ if ( participantManager == null)
+ {
+ throw new TransactionProcessingException("Cannot obtain reference to the BA Participant Manager");
+ }
+ log.info("Storing reference to the participant manager for task: " + taskId);
+ taskBAManagerMapping.put(taskId,participantManager);
+ }
+ }
+ else
+ {
+ throw new TransactionProcessingException("Unsupported agreement type: " + sd.getAgreementType());
+ }
+
+ // As now we have the reference to the participant and we have enlisted it to play role in a business
+ // activity we can associate a task with it.
+ log.info("Associating task with the participant: " + taskId);
+ participant.associateTask(taskId);
+
+ // We return the reference to the participant.
+ return participant;
+ }
+ catch (Exception e)
+ {
+ log.info("Removing task identifier");
+ taskList.remove(taskId);
+ log.info("Removing (task,service) mapping");
+ taskServiceMapping.remove(taskId,serviceId);
+ log.info("Removing (task,participant manager) mapping");
+ taskBAManagerMapping.remove(taskId);
+ throw new TransactionProcessingException(e.getMessage());
+ }
+
+
+
+ }
+
+ /**
+ * This method handles transaction management for a certain invocation of a method when
+ * this invocation has already completed.
+ *
+ * @param taskDesc is the task description.
+ * @param arguments is the list of original arguments.
+ * @param returnObject is the return object.
+ * @throws SystemException if there was an error.
+ * @throws UnknownTransactionException if there was an error.
+ * @throws WrongStateException if there was an error.
+ * @throws TransactionProcessingException if there was an error.
+ */
+ public void completeInvocation(TaskDescription taskDesc, Object[] arguments, Object returnObject)
+ throws SystemException, UnknownTransactionException, WrongStateException, TransactionProcessingException
+ {
+ log.info("completeInvocation()");
+
+ // Get the service description
+ ServiceDescription sd = serviceInformationManager.getServiceById(taskDesc.getServiceId());
+ if (sd == null)
+ {
+ // If there is no servive than we throw an exception
+ log.info("No service description.");
+ throw new TransactionProcessingException("No service description");
+ }
+
+ // 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)
+ {
+ if (sd.getCompensationType() == BACompensationType.CUSTOM)
+ {
+
+ // 2) Get the annotation values
+ log.info("Getting annotation values");
+ Object[] annotations = sd.getOriginalParameterAnnotations();
+
+ // 3) Remember parameters
+ log.info("Remembering parameters");
+ for (int i = 0; i < annotations.length ; i++)
+ {
+ if (annotations[i] != null)
+ {
+ log.info("Annotation: " + annotations[i]);
+ log.info("Object: " + arguments[i]);
+ participant.put(taskId,annotations[i],arguments[i]);
+ }
+ }
+
+ // 4) Remember the return object if necessary
+ log.info("Remembering return object if necessary");
+ Object returnId = sd.getOriginalReturnId();
+ if (returnId != null)
+ {
+ log.info("Return ID: " + returnId);
+ participant.put(taskId,returnId,returnObject);
+ }
+ }
+ else if (sd.getCompensationType() == BACompensationType.PARAMETERS_MATCH)
+ {
+ log.info("Remembering arguments");
+ participant.putArguments(taskId,arguments);
+ }
+ else if (sd.getCompensationType() == BACompensationType.RETURN_VALUE)
+ {
+ log.info("Remembering return value");
+ participant.putReturn(taskId,returnObject);
+ }
+
+ }
+
+ if (sd.getAgreementType() == BAAgreementType.PARTICIPANT_COMPLETION)
+ {
+ log.info("Completeing work");
+ complete(taskId,serviceType);
+ }
+ else
+ {
+ log.info("Work might be completed later");
+ }
+ }
+
+ /**
+ * 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 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)
+ throws TransactionProcessingException, SystemException, UnknownTransactionException, WrongStateException
+ {
+ log.info("complete()");
+ log.info("Getting reference to the BA Participant Manager for task: " + taskId);
+ BAParticipantManager baParticipantManager = taskBAManagerMapping.get(taskId);
+ if ( baParticipantManager != null )
+ {
+ if (serviceType == BAServiceType.MODIFY)
+ {
+ log.info("Informing coordinator that work has completed");
+ baParticipantManager.completed();
+ }
+ else if (serviceType == BAServiceType.READONLY)
+ {
+ log.info("Exiting from BA");
+ baParticipantManager.exit();
+ }
+ else
+ {
+ throw new TransactionProcessingException("Unsupported service type: " + serviceType);
+ }
+ }
+ else
+ {
+ throw new TransactionProcessingException("This task does not have a Participant Manager associated with it");
+ }
+ }
+
+ /**
+ * This method cleans invocation - if there was an error with invoking the required service
+ * then transaction-related information is removed.
+ *
+ * @param taskDesc is the description of a certain task.
+ * @throws TransactionProcessingException an internal error.
+ */
+ public void cleanInvocation(TaskDescription taskDesc)
+ throws TransactionProcessingException
+ {
+ log.info("cleanInvocation()");
+
+ // Remove task from the list
+ log.info("Removing task from the list");
+ taskList.remove(taskDesc.getTaskId());
+
+ // Remove (task,service) mapping
+ log.info("Removing (task,service) mapping");
+ taskServiceMapping.remove(taskDesc.getTaskId(),taskDesc.getServiceId());
+
+ // Get reference to the participant
+ log.info("Getting reference to the participant");
+ Participant participant = taskDesc.getParticipant();
+
+ // Ask the participant to remove the task
+ participant.removeTask(taskDesc.getTaskId());
+
+ // Get reference to the BA Participant Manager
+ log.info("Checking for BA Participant Manager");
+ BAParticipantManager baParticipantManager = taskBAManagerMapping.get(taskDesc.getTaskId());
+ if ( baParticipantManager != null )
+ {
+ log.info("BA Participant Manager found.");
+ // TODO: Communicate an error?
+ }
+ else
+ {
+ throw new TransactionProcessingException("This task does not have a Participant Manager associated with it");
+ }
+ }
+
+ /**
+ * This method executes compensation for all tasks that are associated with this transaction.
+ * It executes a compensationList() method on all lists that have been defined.
+ */
+ public void compensate()
+ {
+ log.info("compensate()");
+
+ // Compensate tasks that should be compensated first
+ // compensateList((Stack)taskListFirst);
+
+ // Compensate normal tasks
+ compensateList((Stack<String>)taskList);
+
+ // Compensate tasks that should be compensated last
+ // compensateList((Stack)taskListLast);
+
+ }
+
+ /**
+ * This method executes a compensation 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.
+ *
+ * @param taskList is the list of tasks which should be compensated.
+ */
+ private void compensateList(Stack<String> taskList)
+ {
+ log.info("compensateList()");
+
+ // Loop through all the tasks and compensate each task separately
+ while (!taskList.isEmpty())
+ {
+ // Get the task from the top
+ log.info("Getting task from the top");
+ String taskId = taskList.pop();
+ log.info("Task ID: " + taskId);
+
+ // Get reference to the required participant
+ log.info("Getting service ID for this task");
+ String serviceId = taskServiceMapping.get(taskId);
+ log.info("Service ID: " + serviceId);
+
+ if (serviceId == null)
+ {
+ // TODO: Reconsider this
+ log.info("Incorrect service!");
+ continue;
+ }
+
+ // 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)
+ {
+ log.info("Service was read-only. There is nothing to compensate.");
+ continue;
+ }
+ else
+ {
+ log.info("Service might need to be compensated");
+ }
+
+ // Check if the service should be compensated only once
+ log.info("Checking if the service should be compensated only once");
+ if (sd.isCompensationSingle())
+ {
+ log.info("Service should be compensated only once");
+ // If it has been already executed then take another task
+ if (singleServiceList.contains(serviceId))
+ {
+ log.info("Service has been already compensated");
+ continue;
+ }
+ else
+ {
+ // Remember this service
+ log.info("Service has not been yet compensated");
+ singleServiceList.add(serviceId);
+ }
+ }
+
+ 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());
+ if ( participant != null )
+ {
+ // Order the participant to compensate a given single task
+ // TODO: Reconsider this invocation
+ log.info("Participant found for this service - trying to compensate");
+ try
+ {
+ participant.compensateTask(taskId);
+ }
+ catch (CompensationActionUnsuccessfulException e)
+ {
+ e.printStackTrace();
+ log.info("Could not compensate a task - informing the coordinator about an error");
+
+ // Get reference to the BA Participant manager
+ log.info("Getting reference to the BA Participant Manager for task: " + taskId);
+ BAParticipantManager participantManager = taskBAManagerMapping.get(taskId);
+ if (participantManager != null)
+ {
+ try
+ {
+ // Communicate an error to the coordinator
+ participantManager.fault();
+ log.info("Fault communicated to the coordinator.");
+ }
+ catch (SystemException e1)
+ {
+ e1.printStackTrace();
+ log.info("Could not communicate error to the coordinator: " + e1.getMessage());
+ }
+ }
+ else
+ {
+ // ...this should never occur...
+ log.info("BA Participant Manager for this participant has not been found.");
+ }
+
+ }
+ }
+ else
+ {
+ // ...this should never occur...
+ log.info("Participant for this service has not been found");
+ }
+ }
+
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAAgreementType.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAAgreementType.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAAgreementType.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * Agreement protocols the BA Service may enlist for.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum BAAgreementType
+{
+ PARTICIPANT_COMPLETION,
+ COORDINATOR_COMPLETION
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensatedBy.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,52 @@
+/*
+ * 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 compensation action and a type of compensation for a single service (method).
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BACompensatedBy
+{
+ 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 String specifier() default "";
+ public Class[] executionClass() 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;
+}
\ No newline at end of file
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensation.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensation.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensation.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,45 @@
+/*
+ * 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 compensation action and a type of compensation for a group of services (class).
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BACompensation
+{
+ 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 Class[] executionInterface() default {};
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationManagement.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationManagement.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationManagement.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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 CompensationManager 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 BACompensationManagement
+{
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationMode.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationMode.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationMode.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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;
+
+/**
+ * List of supported compensation modes.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum BACompensationMode
+{
+ POJO,
+ EJB,
+ UDII,
+ CDII,
+ RMI,
+ CORBA
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationOrder.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationOrder.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationOrder.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,34 @@
+/*
+ * 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 compensation order types.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum BACompensationOrder
+{
+ NORMAL,
+ FIRST,
+ LAST
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationType.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationType.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BACompensationType.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,34 @@
+/*
+ * 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 compensation types.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum BACompensationType
+{
+ RETURN_VALUE,
+ PARAMETERS_MATCH,
+ CUSTOM
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParam.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.*;
+
+/**
+ * Annotates the services parameter so that it can be processed by the compensation mechanism.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.PARAMETER)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BAParam
+{
+ String value();
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParameterMatch.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParameterMatch.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAParameterMatch.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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 compensation 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 BAParameterMatch
+{
+ STRICT,
+ ALLOW_NULL
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAResult.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.*;
+
+/**
+ * Annotates the services return value to be processed by the compensation mechanism;
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BAResult
+{
+ String value();
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAService.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,38 @@
+/*
+ * 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
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+public @interface BAService
+{
+ public BAServiceType type() default BAServiceType.MODIFY;
+ public BAAgreementType agreement() default BAAgreementType.PARTICIPANT_COMPLETION;
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAServiceType.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAServiceType.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/annotation/BAServiceType.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public enum BAServiceType
+{
+ READONLY,
+ MODIFY
+}
+
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/aspect/JaxWSBAProcessingAspect.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,154 @@
+/*
+ * 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.aspect;
+
+import org.apache.log4j.Logger;
+import org.jboss.aop.joinpoint.FieldReadInvocation;
+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.data.TaskDescription;
+
+import java.lang.reflect.Method;
+
+/**
+ * This aspect intercepts a call to a Business Activity service and applies necessary transaction-related
+ * mechanisms.
+ *
+ * @author Maciej P. Machulak
+ * @version 0.1
+ */
+public class JaxWSBAProcessingAspect
+{
+ // Logger
+ private static Logger log = Logger.getLogger(JaxWSBAProcessingAspect.class);
+
+ // BA Transaction Manager
+ private static BATransactionManager baTransactionManager = BATransactionManager.getSingletonInstance();
+
+ // Compensation Manager Provider
+ private static CompensationManagerProvider cmp = CompensationManagerProvider.getSingletonInstance();
+
+ /**
+ * Advice that processes methods execution according to the BA management.
+ *
+ * @param invocation is the method's invocation.
+ * @return the object returned by the method.
+ * @throws Throwable ...
+ */
+ public Object process(MethodInvocation invocation) throws Throwable
+ {
+
+ log.info("process()");
+
+ // Check if this invocation is within the scope of a Business Activity
+ log.info("Checking if there is a BA");
+ if (!baTransactionManager.isBAPresent())
+ {
+ log.info("No Business Activity - proceeding with normal invocation");
+ return internalProcess(invocation);
+ }
+ else
+ {
+ log.info("Business Activity present - proceeding");
+
+ // #### IMPLEMENTATION SPECIFIC PART - BEGIN
+ Method method = invocation.getMethod();
+ log.info("Method: " + method.getName());
+ Object[] arguments = invocation.getArguments();
+ if (arguments == null)
+ {
+ log.info("Method without any arguments.");
+ }
+ else
+ {
+ log.info("No of arguments: " + arguments.length);
+ }
+ // #### IMPLEMENTATION SPECIFIC PART - END
+
+
+
+ // Handle the invocation
+ log.info("Handling invocation");
+ TaskDescription taskDesc = baTransactionManager.handleInvocation(method);
+
+ // Associate compensation 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()));
+
+ try
+ {
+ // #### IMPLEMENTATION SPECIFIC PART - BEGIN
+ // Invoke the service
+ log.info("Invoking the service");
+ Object returnObject = invocation.invokeNext();
+ // #### IMPLEMENTATION SPECIFIC PART - END
+
+ // Dissassociate the thread
+ log.info("Disassociating compensation manager for thread: " + threadId);
+ cmp.removeCompensationManager(threadId);
+
+ log.info("No exception - proceeding");
+
+ // Complete the execution within this transaction
+ log.info("Complete the invocation");
+ baTransactionManager.completeInvocation(taskDesc,arguments,returnObject);
+
+ return returnObject;
+ }
+ catch (Exception e)
+ {
+ // Dissassociate the thread
+ log.info("Disassociating compensation manager for thread: " + threadId);
+ cmp.removeCompensationManager(threadId);
+
+ // Clean the transaction
+ log.info("Cleaning information about the transaction");
+ baTransactionManager.cleanInvocation(taskDesc);
+
+ // Pass the exception
+ throw new Exception(e);
+ }
+ }
+ }
+
+ private Object internalProcess(MethodInvocation invocation) throws Throwable
+ {
+ log.info("internalProcess()");
+ return invocation.invokeNext();
+ }
+
+ public Object access(FieldReadInvocation invocation) throws Throwable
+ {
+ log.info("Returning compensation manager for thread: " + Thread.currentThread().getId());
+ return cmp.getCompensationManager(Thread.currentThread().getId());
+ }
+
+ public Object access(FieldWriteInvocation invocation) throws Throwable
+ {
+ throw new RuntimeException("Setting a @BACompensationManagement variable is illegal.");
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProvider.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProvider.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,38 @@
+/*
+ * 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.compensation;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 17, 2007
+ */
+public interface CompensationDataProvider extends CompensationManager
+{
+
+ public void putArguments(Object[] parameterList);
+
+ public Object[] getArguments();
+
+ public void putReturn(Object returnObject);
+
+ public Object[] getReturn();
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProviderImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProviderImpl.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationDataProviderImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,90 @@
+/*
+ * 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.compensation;
+
+import org.jboss.txbridge.ba.participant.Participant;
+import org.apache.log4j.Logger;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 17, 2007
+ */
+public class CompensationDataProviderImpl extends CompensationManagerImpl implements CompensationDataProvider
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CompensationManagerImpl.class);
+
+ /**
+ * Constructor
+ *
+ * @param taskId is the task identifier.
+ * @param participant is the reference to the participant.
+ */
+ public CompensationDataProviderImpl(String taskId, Participant participant)
+ {
+ super(taskId,participant);
+ }
+
+ /**
+ *
+ *
+ * @param arguments is the list of parameters.
+ */
+ public void putArguments(Object[] arguments)
+ {
+ log.info("putArguments()");
+ participant.putArguments(taskId,arguments);
+ }
+
+ /**
+ *
+ *
+ * @return the list of parameters.
+ */
+ public Object[] getArguments()
+ {
+ log.info("getArguments()");
+ return participant.getArguments(taskId);
+ }
+
+ /**
+ *
+ *
+ * @param returnObject the return object that should be remembered.
+ */
+ public void putReturn(Object returnObject)
+ {
+ log.info("putReturn()");
+ participant.putReturn(taskId,returnObject);
+ }
+
+ /**
+ *
+ *
+ * @return the return object associated with a given task.
+ */
+ public Object[] getReturn()
+ {
+ log.info("getReturn()");
+ return participant.getReturn(taskId);
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManager.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManager.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,34 @@
+/*
+ * 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.compensation;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * Interface of the compensation manager.
+ */
+public interface CompensationManager
+{
+ public void put(Object objectId, Object object);
+
+ public Object get(Object objectId);
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerImpl.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,84 @@
+/*
+ * 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.compensation;
+
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.participant.Participant;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * This class wraps the participant and provides a lightweight API for the business programmer
+ * to store and retrieve objects. It automatically associates the required task id so that correct
+ * data is stored and retrieved. An object of this class is injected into the business logic so
+ * that the programmer does not have to worry about anything.
+ */
+public class CompensationManagerImpl implements CompensationManager
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CompensationManagerImpl.class);
+
+ // Task identifier
+ String taskId;
+
+ // Participant
+ Participant participant;
+
+ /**
+ * Constructor
+ *
+ * @param taskId is the task identifier.
+ * @param participant is the reference to the participant.
+ */
+ public CompensationManagerImpl(String taskId, Participant participant)
+ {
+ log.info("constructor()");
+ this.taskId = taskId;
+ this.participant = participant;
+ }
+
+ /**
+ * This method stores an object with a given ID. It uses the participant it is aware of and
+ * the task identifier.
+ *
+ * @param objectId is the ID of the object.
+ * @param object is the object itself :)
+ */
+ public void put(Object objectId, Object object)
+ {
+ log.info("put()");
+ participant.put(taskId,objectId,object);
+ }
+
+ /**
+ * This method retrieves an object with a given identifier. This method automatically
+ * associates the task id this compensation manager was associated with.
+ *
+ * @param objectId is the ID of the object.
+ * @return the object.
+ */
+ public Object get(Object objectId)
+ {
+ log.info("get()");
+ return participant.get(taskId,objectId);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerProvider.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/CompensationManagerProvider.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,113 @@
+/*
+ * 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.compensation;
+
+import org.apache.log4j.Logger;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 24, 2007
+ *
+ * This component is responsible for ensuring that a proper Compensation Manager is provided
+ * during execution of a service or a compensation action.
+ */
+public class CompensationManagerProvider
+{
+ private static Logger log = Logger.getLogger(CompensationManagerProvider.class);
+
+ private static volatile CompensationManagerProvider cmp = null;
+
+ private static ConcurrentMap<Long,CompensationManager> cmList;
+
+ private CompensationManagerProvider()
+ {
+ cmList = new ConcurrentHashMap<Long,CompensationManager>();
+ }
+
+ /**
+ * Returns the instance fo a compensation manager provider.
+ *
+ * @return the compensation manager.
+ */
+ public static CompensationManagerProvider getSingletonInstance()
+ {
+ log.info("getSingletonInstance()");
+ if (cmp == null)
+ {
+ synchronized (CompensationManagerProvider.class)
+ {
+ if (cmp == null)
+ {
+ log.info("Creating a new instance");
+ cmp = new CompensationManagerProvider();
+ }
+ }
+ }
+ return cmp;
+ }
+
+ /**
+ * This method associates a compensation manager with a given thread of execution.
+ *
+ * @param thread is the thread for which the compensation manager should be associated.
+ * @param cmp is the compensation manager, which should be associated.
+ */
+ public void associateCompensationManager(Long thread, CompensationManager cmp)
+ {
+ log.info("associateCompensationManager()");
+ cmList.put(thread,cmp);
+ }
+
+ /**
+ * This method returns the compensation manager object associated to a certain thread of execution.
+ * If there is no compensation 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 compensation
+ * manager is simply returned.
+ *
+ * @param thread thread ID for which the compensation manager should be returned.
+ * @return the CompensationManager object.
+ */
+ public CompensationManager getCompensationManager(Long thread)
+ {
+ log.info("getCompensationManager()");
+ CompensationManager cm = cmList.get(thread);
+ if (cm == null)
+ {
+ log.info("Returning a dummy compensation manager");
+ cm = new DummyCompensationManager();
+ }
+ return cm;
+ }
+
+ /**
+ * This method removes the association of a thread and a compensation manager.
+ *
+ * @param thread is the thread for which the associaction should be removed.
+ */
+ public void removeCompensationManager(Long thread)
+ {
+ log.info("removeCompensationManager()");
+ cmList.remove(thread);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/DummyCompensationManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/DummyCompensationManager.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/compensation/DummyCompensationManager.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,52 @@
+/*
+ * 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.compensation;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 5, 2007
+ *
+ * This class represents a dummy compensation manager. Such dummy compensation manager is used
+ * if a Web Service is invoked outside the scope of the Business Activity.
+ */
+public class DummyCompensationManager implements CompensationManager
+{
+ /**
+ * This is a dummy method that... does nothing.
+ *
+ * @param objectId is the ID of the object.
+ * @param object is the object itself.
+ */
+ public void put(Object objectId, Object object)
+ {
+ }
+
+ /**
+ * This method does nothing - simply returns null.
+ *
+ * @param objectId is the object id.
+ * @return returns always null.
+ */
+ public Object get(Object objectId)
+ {
+ return null;
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationData.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationData.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationData.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,52 @@
+/*
+ * 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 java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.io.Serializable;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class represents the basic compensation data that is used for custom
+ * compensation. It simply contains a map that links objects to their identifiers.
+ */
+public abstract class CompensationData implements Serializable
+{
+ private ConcurrentMap<Object,Object> compensationData;
+
+ protected CompensationData()
+ {
+ 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);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataCustom.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataCustom.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataCustom.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.data;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ *
+ * This class represents the compensation data used for compensation with custom compensation
+ * type. Objects are stored within a map - each object is identified by a unique identifier.
+ */
+public class CompensationDataCustom extends CompensationData
+{
+
+ public CompensationDataCustom()
+ {
+ super();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataParam.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataParam.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataParam.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class represents the compensation data used for compensation where parameters
+ * simply match. We can just store all the parameters and then use them in exactly the
+ * same order to invoke the compensation service.
+ */
+public class CompensationDataParam extends CompensationData
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CompensationDataReturn.class);
+
+ // Array of parameters
+ private Object[] arguments;
+
+ /**
+ * Constructor
+ */
+ public CompensationDataParam()
+ {
+ super();
+ log.info("constructor()");
+ }
+
+ /**
+ * 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;
+ }
+
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataReturn.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataReturn.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/CompensationDataReturn.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class represents compensation data that stores information about the return object
+ * which is used as the only parameter of the compensation action.
+ */
+public class CompensationDataReturn extends CompensationData
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CompensationDataReturn.class);
+
+ // The return object
+ private Object[] returnObject;
+
+ public CompensationDataReturn()
+ {
+ super();
+ returnObject = new Object[1];
+ log.info("constructor()");
+ }
+
+ 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/data/DummyCompensationData.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyCompensationData.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/DummyCompensationData.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.data;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 9, 2007
+ *
+ * This class represents a dummy compensation object which is used when services are
+ * executed outside the scope of a Business Activity and no data should be remembered.
+ */
+public class DummyCompensationData extends CompensationData
+{
+
+ public DummyCompensationData()
+ {
+ super();
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/IdentificationType.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 5, 2007
+ */
+public enum IdentificationType
+{
+ BY_NUMBER,
+ BY_NAME
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/TaskDescription.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/TaskDescription.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/data/TaskDescription.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,114 @@
+/*
+ * 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.jboss.txbridge.ba.participant.Participant;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 4, 2007
+ *
+ * Task Description contains all information related to a single service invocation (task).
+ * - the transaction identifier
+ * - the unique task identifier
+ * - the service which the task relates to
+ * - participant responsible for this task
+ */
+public class TaskDescription
+{
+ private String txId;
+ private String taskId;
+ private String serviceId;
+ private Participant participant;
+
+
+ public TaskDescription(String txId, String taskId, String serviceId, Participant participant)
+ {
+ this.txId = txId;
+ this.taskId = taskId;
+ this.serviceId = serviceId;
+ this.participant = participant;
+ }
+
+
+ public String getTxId()
+ {
+ return txId;
+ }
+
+ public String getTaskId()
+ {
+ return taskId;
+ }
+
+ public String getServiceId()
+ {
+ return serviceId;
+ }
+
+ public Participant getParticipant()
+ {
+ return participant;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("TxID: ");
+ sb.append(txId);
+ sb.append(" TaskID: ");
+ sb.append(taskId);
+ sb.append(" ServiceID: ");
+ sb.append(serviceId);
+ sb.append(" Participant ref: ");
+ sb.append(participant);
+ return sb.toString();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ TaskDescription that = (TaskDescription) o;
+
+ return participant.equals(that.participant) && serviceId.equals(that.serviceId) && taskId.equals(that.taskId) && txId.equals(that.txId);
+
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = txId.hashCode();
+ result = 31 * result + taskId.hashCode();
+ result = 31 * result + serviceId.hashCode();
+ result = 31 * result + participant.hashCode();
+ return result;
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationActionUnsuccessfulException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationActionUnsuccessfulException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationActionUnsuccessfulException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This exception is thrown if there was an error with executing a single compensation action.
+ * It is an internal exception and is not passed back to the client of the Business Activity.
+ */
+public class CompensationActionUnsuccessfulException extends Exception
+{
+
+ public CompensationActionUnsuccessfulException()
+ {
+ super();
+ }
+
+ public CompensationActionUnsuccessfulException(String message)
+ {
+ super(message);
+ }
+
+
+ public CompensationActionUnsuccessfulException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationMethodNotAccessible.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationMethodNotAccessible.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/CompensationMethodNotAccessible.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This exception is thrown when the compensation 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).
+ */
+public class CompensationMethodNotAccessible extends Exception
+{
+
+ public CompensationMethodNotAccessible()
+ {
+ super();
+ }
+
+ public CompensationMethodNotAccessible(String message)
+ {
+ super(message);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodIncorrectlyAnnotatedException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodIncorrectlyAnnotatedException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/MethodIncorrectlyAnnotatedException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This exception is thrown when we want to process a method which does not contain
+ * all necessary annotations related to Business Activity.
+ */
+public class MethodIncorrectlyAnnotatedException extends Exception
+{
+ public MethodIncorrectlyAnnotatedException()
+ {
+ super();
+ }
+
+ public MethodIncorrectlyAnnotatedException(String message)
+ {
+ super(message);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TaskAssociationFailedException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TaskAssociationFailedException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TaskAssociationFailedException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * This is an internal exception which is thrown if it was not possible to associate a new task
+ * with a participant.
+ */
+public class TaskAssociationFailedException extends Exception
+{
+
+ public TaskAssociationFailedException()
+ {
+ super();
+ }
+
+ public TaskAssociationFailedException(String message)
+ {
+ super(message);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TransactionProcessingException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TransactionProcessingException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/exception/TransactionProcessingException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 7, 2007
+ *
+ * This exception is thrown if there was an error with processing a single invocation within
+ * a Business Activity. If this exception is thrown then the invocation is not remembered
+ * as one that participates in a transaction.
+ */
+public class TransactionProcessingException extends Exception
+{
+
+ public TransactionProcessingException()
+ {
+ super();
+ }
+
+ public TransactionProcessingException(String message)
+ {
+ super(message);
+ }
+
+ public TransactionProcessingException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ArgumentsProvider.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,243 @@
+/*
+ * 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.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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 17, 2007
+ *
+ * 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.
+ */
+public class ArgumentsProvider implements 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.
+ * @return array of objects.
+ * @throws CompensationActionUnsuccessfulException
+ */
+ public Object[] getArguments(ServiceDescription sd, CompensationDataProvider cdp)
+ throws CompensationActionUnsuccessfulException
+ {
+ log.info("getArguments()");
+ int successfullMatches = 0;
+
+ // Parameter objects and their types
+ Object[] parameterObjects = null;
+ Class[] parameterTypes = null;
+
+ // Check the type of the service
+ BACompensationType baCompensationType = sd.getCompensationType();
+ log.info("Compensation type: " + baCompensationType);
+
+ // Depending on the compensation type try to cast the compensation data and proceed
+ if (baCompensationType == BACompensationType.PARAMETERS_MATCH)
+ {
+ // Get parameters
+ log.info("Getting parameters");
+ parameterObjects = cdp.getArguments();
+ if (parameterObjects != null)
+ {
+ parameterTypes = new Class[parameterObjects.length];
+ for (int i = 0; i < parameterObjects.length; i++)
+ {
+ parameterTypes[i] = parameterObjects[i].getClass();
+ }
+ successfullMatches = parameterObjects.length;
+ log.info("Number of successfull matches: " + successfullMatches);
+ }
+ else
+ {
+ throw new CompensationActionUnsuccessfulException("Compensation data incorrect.");
+ }
+
+ }
+ else if (baCompensationType == BACompensationType.RETURN_VALUE)
+ {
+ // Get parameter
+ log.info("Getting return value");
+ parameterObjects = cdp.getReturn();
+ if (parameterObjects != null)
+ {
+ parameterTypes = new Class[1];
+ parameterTypes[0] = parameterObjects[0].getClass();
+ successfullMatches = 1;
+ }
+ else
+ {
+ throw new CompensationActionUnsuccessfulException("Compensation data incorrect.");
+ }
+ }
+ else if (baCompensationType == BACompensationType.CUSTOM)
+ {
+
+ // Get parameter annotations
+ log.info("Getting compensation parameter annotations");
+ Object[] parameterAnnotations = sd.getCompensationParameterAnnotations();
+ if (parameterAnnotations != null)
+ {
+ parameterObjects = new Object[parameterAnnotations.length];
+ parameterTypes = new Class[parameterObjects.length];
+
+ // For parameter annotations get objects
+ log.info("Looping through annotations");
+ for (int i=0; i< parameterAnnotations.length; i++)
+ {
+ log.info("### Parameter " + i);
+ if (parameterAnnotations[i] != null)
+ {
+ log.info("Annotation found: " + parameterAnnotations[i]);
+ // Get object for this identifier
+ Object singleObject = cdp.get(parameterAnnotations[i]);
+ if (singleObject != null)
+ {
+ log.info("Object found: " + singleObject);
+
+ // Remember the object
+ parameterObjects[i] = singleObject;
+ parameterTypes[i] = singleObject.getClass();
+
+ // Increase the number of successfull matches
+ successfullMatches++;
+ }
+ else
+ {
+ log.info("Object not found");
+ }
+ }
+ }
+ }
+ else
+ {
+ log.info("No annotations present - adding parameters by order.");
+ parameterTypes = sd.getCompensationParameterTypes();
+ if (parameterTypes != null)
+ {
+ log.info("Number of required objects: " + parameterTypes.length);
+ parameterObjects = new Object[parameterTypes.length];
+ for (int i=0; i<parameterObjects.length; i++)
+ {
+ Object singleArgument = cdp.get(i);
+ parameterObjects[i] = singleArgument;
+ if (singleArgument == null)
+ {
+ log.info("Object no. " + i + " not found.");
+ }
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ // 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");
+ BAParameterMatch parameterMatch = sd.getParameterMatch();
+ log.info("ParameterMatch: " + parameterMatch);
+ if ((parameterMatch == BAParameterMatch.STRICT))
+ {
+ throw new CompensationActionUnsuccessfulException("Original parameters do not match compensation parameters.");
+ }
+ else if (sd.getParameterMatch().equals(BAParameterMatch.ALLOW_NULL))
+ {
+ if ( baCompensationType == BACompensationType.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 )
+ {
+ 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 compensation type was CUSTOM we don't have to do anything.
+ }
+ }
+ }
+ else if (successfullMatches > compensationParameters)
+ {
+ log.info("Impossible!:)");
+ }
+ */
+
+ return parameterObjects;
+ }
+
+ /**
+ * This method takes an array of objects as an argument. It returns an array of types of
+ * those objects.
+ *
+ * @param arguments is the array containing objects, that will be used as arguments.
+ * @return array containing types of those objects.
+ */
+ public Class[] getArgumentTypes(Object[] arguments)
+ {
+ log.info("getArgumentTypes()");
+
+ Class[] argumentTypes = null;
+ if (arguments != null)
+ {
+ argumentTypes = new Class[arguments.length];
+ }
+ else
+ {
+ return argumentTypes;
+ }
+
+ log.info("Looping through all arguments: " + arguments.length);
+ int i = 0;
+ for (Object argument: arguments)
+ {
+ if (argument != null)
+ {
+ log.info("Argument " + i + " not null");
+ argumentTypes[i] = argument.getClass();
+ log.info("Argument class: " + argument.getClass());
+ }
+ i++;
+ }
+ return argumentTypes;
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/CorbaExecution.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,45 @@
+/*
+ * 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.apache.log4j.Logger;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * This class provides implementation of the CORBA execution.
+ */
+public class CorbaExecution implements ExecutionInterface
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CorbaExecution.class);
+
+ public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService()");
+
+ // TODO: Implement
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/DataProvider.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.execute;
+
+import org.jboss.txbridge.ba.compensation.CompensationDataProvider;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 5, 2007
+ *
+ *
+ */
+public interface DataProvider
+{
+ public Object[] getArguments(ServiceDescription sd, CompensationDataProvider cdp) throws CompensationActionUnsuccessfulException;
+ public Class[] getArgumentTypes(Object[] arguments);
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/EJBExecution.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,90 @@
+/*
+ * 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.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 java.lang.reflect.Method;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 19, 2007
+ *
+ * This class provides implementation of the EJB execution. It uses the Service Locator component
+ * to get reference to the required EJB.
+ */
+public class EJBExecution implements ExecutionInterface
+{
+ // Logger
+ private static Logger log = Logger.getLogger(EJBExecution.class);
+
+ /**
+ * 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 sd 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.
+ */
+ public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes)
+ throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService()");
+ try
+ {
+
+ // Get necessary data
+ log.info("Getting necessary data");
+ String providerURL = sd.getCompensationProviderURL();
+ log.info("Provider URL: " + providerURL);
+ String ejbName = sd.getCompensationJNDIName();
+ log.info("EJB name: " + ejbName);
+ Class ejbInterface = sd.getCompensationEjbInterface();
+ log.info("EJB interface: " + ejbInterface);
+ String methodName = sd.getCompensationMethodName();
+
+ // Lookup the bean
+ log.info("Getting the Service Locator");
+ ServiceLocator serviceLocator = ServiceLocator.getInstance(providerURL);
+ Object theBean = serviceLocator.getInterface(ejbName,ejbInterface);
+ log.info("Bean looked up successfully: " + theBean.getClass());
+
+ // Invoke the method
+ log.info("Getting compensation method");
+ Method compensationMethod = ejbInterface.getMethod(methodName,argumentTypes);
+ if (compensationMethod == null)
+ {
+ throw new CompensationActionUnsuccessfulException("Could not get access to the compensation method");
+ }
+ log.info("Invoking compensation method");
+ compensationMethod.invoke(theBean,arguments);
+ }
+ catch (Exception e)
+ {
+ throw new CompensationActionUnsuccessfulException(e);
+ }
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ExecutionInterface.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej Machulak
+ * @date: Jul 1, 2007
+ *
+ * The interface for any class that provides execution mechanism, which can be used during
+ * compensation.
+ */
+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 sd 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.
+ */
+ public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments,Class[] argumentTypes) throws CompensationActionUnsuccessfulException;
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalExecution.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,84 @@
+/*
+ * 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.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 java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class provides implementation of the local execution. Local execution is used on POJOs.
+ */
+public class LocalExecution implements ExecutionInterface
+{
+ // Logger
+ private static Logger log = Logger.getLogger(LocalExecution.class);
+
+ /**
+ * 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 sd 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.
+ */
+ public void invokeService(TaskDescription taskDesc,ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService()");
+
+ try
+ {
+ // 1) Get the class of the compensation method
+ Class clazz = sd.getCompensationClass();
+ log.info("Compensation class: " + clazz.getName());
+ // 2) Get the name of the compensation method
+ String methodName = sd.getCompensationMethodName();
+ log.info("Compensation method: " + methodName);
+ // 3) Get the compensation 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");
+ }
+ // 4) Invoke the service
+ log.info("Getting reference to the class constructor");
+ Constructor classConstructor = clazz.getConstructor();
+ log.info("Constructor: " + classConstructor.toString());
+ Object classObject = classConstructor.newInstance();
+ log.info("Invoking a service");
+ compensationMethod.invoke(classObject,arguments);
+ }
+ catch (Exception e)
+ {
+ throw new CompensationActionUnsuccessfulException(e.getMessage());
+ }
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/LocalServiceExecutor.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class represents a local service executor. This executor uses the LocalExecution class
+ * as the execution mechanism by default.
+ */
+public class LocalServiceExecutor extends ServiceExecutor
+{
+ public LocalServiceExecutor(TaskDescription taskDesc)
+ {
+ super(taskDesc);
+ execution = new LocalExecution();
+ dataProvider = new ArgumentsProvider();
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RMIExecution.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,46 @@
+/*
+ * 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.apache.log4j.Logger;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * This class provides implementation of the RMI execution.
+ */
+public class RMIExecution implements ExecutionInterface
+{
+ // Logger
+ private static Logger log = Logger.getLogger(RMIExecution.class);
+
+ public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService");
+
+ // TODO: Implement
+
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/RemoteServiceExecutor.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class represents a remote service executor. This executor uses the WSConfiguredDII
+ * as the execution mechanism by default.
+ */
+public class RemoteServiceExecutor extends ServiceExecutor
+{
+ public RemoteServiceExecutor(TaskDescription taskDesc)
+ {
+ super(taskDesc);
+ execution = new WSConfiguredDII();
+ dataProvider = new ArgumentsProvider();
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceExecutor.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,128 @@
+/*
+ * 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.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.data.TaskDescription;
+import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This is an abstract class that describes a basic ServiceExecutor. Service Executors are used for
+ * executing compensation actions.
+ *
+ */
+public abstract class ServiceExecutor
+{
+ // Logger
+ private static Logger log = Logger.getLogger(ServiceExecutor.class);
+
+ // Compensation manager provider
+ private static CompensationManagerProvider cmp = CompensationManagerProvider.getSingletonInstance();
+
+ // Task description
+ private TaskDescription taskDescription;
+
+ // Execution interface
+ ExecutionInterface execution;
+
+ // Data provider
+ DataProvider dataProvider;
+
+
+ /**
+ * Main constructor.
+ *
+ * @param taskDesc is the task's description.
+ */
+ ServiceExecutor(TaskDescription taskDesc)
+ {
+ log.info("constructor()");
+ this.taskDescription = taskDesc;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param taskDesc is the task's description.
+ * @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)
+ {
+ log.info("constructor()");
+ this.taskDescription = taskDesc;
+ this.execution = execution;
+ this.dataProvider = dp;
+ }
+
+ /**
+ * This method sets a new execution type.
+ *
+ * @param execution is the execution type which should be set.
+ */
+ public void setExecutionType(ExecutionInterface execution)
+ {
+ log.info("setExecutionType()");
+ this.execution = execution;
+ }
+
+ /**
+ * This method invokes the compensation task which is specified in the service description.
+ * It uses compensation 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.
+ */
+ public void invokeService(ServiceDescription sd, CompensationDataProvider cdp)
+ throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService()");
+ log.info("Getting list of arguments");
+ Object[] arguments = dataProvider.getArguments(sd,cdp);
+ 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()));
+ try
+ {
+ execution.invokeService(taskDescription,sd,arguments,argumentTypes);
+ log.info("Removing compensation manager association for thread: " + threadId);
+ cmp.removeCompensationManager(threadId);
+ }
+ catch (CompensationActionUnsuccessfulException e)
+ {
+ log.info("Removing compensation manager association for thread: " + threadId);
+ cmp.removeCompensationManager(threadId);
+ throw new CompensationActionUnsuccessfulException(e);
+ }
+ }
+
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocator.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocator.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocator.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,193 @@
+/*
+ * 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.apache.log4j.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.Context;
+import javax.rmi.PortableRemoteObject;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.Properties;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 19, 2007
+ *
+ * The Service Locator component is responsible for locating EJBs. It uses a caching mechanism
+ * so that if an EJB has been previously searched for a cached reference can be returned.
+ *
+ * Based on: http://java.sun.com/blueprints/patterns/ServiceLocator.html
+ */
+public class ServiceLocator
+{
+ // Logger
+ private static Logger log = Logger.getLogger(ServiceLocator.class);
+
+ // Initial context
+ private InitialContext initialContext;
+
+ // Cache
+ private ConcurrentMap<String,Object> beanCache;
+
+ // Local service locator instance
+ private static ServiceLocator localServiceLocator;
+
+ // Service locator instances
+ private static ConcurrentMap<String,ServiceLocator> serviceLocators = new ConcurrentHashMap<String,ServiceLocator>();
+
+ /**
+ * Returns the instance of the Service Locator object.
+ *
+ * @param providerURL is the Provider URL
+ * @return the instance of the Service Locator object.
+ * @throws ServiceLocatorException if it was not possible to create the service locator.
+ */
+ public static ServiceLocator getInstance(String providerURL)
+ throws ServiceLocatorException
+ {
+ log.info("getSingletonInstance()");
+ if (providerURL == null || providerURL.equals(""))
+ {
+ if (localServiceLocator == null)
+ {
+ synchronized (ServiceLocator.class)
+ {
+ if (localServiceLocator == null)
+ {
+ log.info("Creating new instance...");
+ try
+ {
+ localServiceLocator = new ServiceLocator();
+ }
+ catch (Exception e)
+ {
+ log.info("Could not create service locator instance");
+ throw new ServiceLocatorException(e);
+ }
+ }
+ }
+ }
+ return localServiceLocator;
+ }
+ else
+ {
+ ServiceLocator serviceLocator = serviceLocators.get(providerURL);
+ if (serviceLocator == null)
+ {
+ synchronized (ServiceLocator.class)
+ {
+ if (serviceLocator == null)
+ {
+ log.info("Creating new instance...");
+ try
+ {
+ serviceLocator = new ServiceLocator(providerURL);
+ serviceLocators.put(providerURL,serviceLocator);
+ }
+ catch (Exception e)
+ {
+ log.info("Could not create service locator instance");
+ throw new ServiceLocatorException(e);
+ }
+ }
+ }
+ }
+ return serviceLocator;
+ }
+ }
+
+ /**
+ * Constructor
+ *
+ * @throws NamingException if there was a naming error.
+ */
+ private ServiceLocator() throws NamingException
+ {
+ log.info("constructor()");
+ beanCache = new ConcurrentHashMap<String,Object>();
+ Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
+ p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
+ initialContext = new InitialContext(p);
+
+ }
+
+ /**
+ * Constructor
+ *
+ * @param providerURL is the URL of the provider.
+ * @throws NamingException if there was a naming error.
+ */
+ private ServiceLocator(String providerURL) throws NamingException
+ {
+ log.info("constructor()");
+ log.info("Provider URL: " + providerURL);
+ beanCache = new ConcurrentHashMap<String,Object>();
+ Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
+ p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
+ p.put(Context.PROVIDER_URL,providerURL);
+ initialContext = new InitialContext(p);
+
+ }
+
+ /**
+ * This method returns a reference to the interface of an EJB.
+ *
+ * @param jndiName is the name of the bean.
+ * @param interfaceName is the class of the remote interface.
+ * @return an object representing an interface of a bean.
+ * @throws ServiceLocatorException if there was an error with the lookup.
+ */
+ public Object getInterface(String jndiName, Class interfaceName)
+ throws ServiceLocatorException
+ {
+ log.info("getInterface()");
+
+ // Check if the bean is cached
+ log.info("Checking if the bean is cached");
+ if (beanCache.containsKey(jndiName))
+ {
+ log.info("Bean cached - returning");
+ return beanCache.get(jndiName);
+ }
+
+ // If not - perform the lookup, remember the reference
+ log.info("Bean is not cached - performing the lookup");
+ try
+ {
+ Object ejbInterface = initialContext.lookup(jndiName);
+ Object theBean = PortableRemoteObject.narrow(ejbInterface,interfaceName);
+ log.info("Lookup successful - caching reference");
+ beanCache.put(jndiName,theBean);
+ return theBean;
+ }
+ catch (Exception e)
+ {
+ throw new ServiceLocatorException(e);
+ }
+ }
+
+}
+
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocatorException.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocatorException.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/ServiceLocatorException.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 19, 2007
+ *
+ * This exception is thrown if there was an error with getting reference to an EJB.
+ */
+public class ServiceLocatorException extends Exception
+{
+
+ public ServiceLocatorException()
+ {
+ super();
+ }
+
+ public ServiceLocatorException(String message)
+ {
+ super(message);
+ }
+
+ public ServiceLocatorException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSConfiguredDII.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,44 @@
+/*
+ * 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.apache.log4j.Logger;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class provides implementation of the Web Services Configured DII execution.
+ */
+public class WSConfiguredDII implements ExecutionInterface
+{
+ // Logger
+ private static Logger log = Logger.getLogger(WSConfiguredDII.class);
+
+ public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService()");
+
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/execute/WSUnconfiguredDII.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,46 @@
+/*
+ * 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.apache.log4j.Logger;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.jboss.txbridge.ba.exception.CompensationActionUnsuccessfulException;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * This class provides implementation of the Web Services Unconfigured DII execution.
+ */
+public class WSUnconfiguredDII implements ExecutionInterface
+{
+ // Logger
+ private static Logger log = Logger.getLogger(WSUnconfiguredDII.class);
+
+ public void invokeService(TaskDescription taskDesc, ServiceDescription sd, Object[] arguments, Class[] argumentTypes) throws CompensationActionUnsuccessfulException
+ {
+ log.info("invokeService()");
+
+ // TODO: Implement
+
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/BAServiceVisitor.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,596 @@
+/*
+ * 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.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.service.ServiceDescription;
+import org.jboss.txbridge.ba.service.ServiceDescriptionImpl;
+
+import javax.jws.WebMethod;
+import java.lang.reflect.Method;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This component visits the service and describes it in terms of its requirements related to
+ * participating in Business Activities.
+ *
+ * TODO: Redesign this class - it would be better to have multiple small and exchangeable classes than a big one.
+ */
+public class BAServiceVisitor
+{
+ // Logger
+ private static Logger log = Logger.getLogger(BAServiceVisitor.class);
+
+ /**
+ * This method processes a single method that
+ *
+ * @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.
+ */
+ public static synchronized ServiceDescription processMethod(Method method)
+ throws MethodIncorrectlyAnnotatedException, CompensationMethodNotAccessible
+ {
+ log.info("processMethod()");
+
+ // Create new ServiceDescription
+ ServiceDescription serviceDescription = new ServiceDescriptionImpl();
+
+ // Check what is the name of the method...
+ log.info("Method name: " + method.getName());
+ String methodName = method.getName();
+ // ...by default the web method name is the same as the method's name.
+ String webMethodName = methodName;
+
+ // Set the class of the method
+ Class methodClass = method.getDeclaringClass();
+ serviceDescription.setOriginalClass(methodClass);
+
+ // Check if there is a business activity annotation
+ Class[] baClass = null;
+ Class[] baInterface = null;
+ String baJndiName = null;
+ String baProviderURL = null;
+ BACompensation BACompensationAnnotation = (BACompensation) methodClass.getAnnotation(BACompensation.class);
+ if (BACompensationAnnotation != null)
+ {
+ log.info("BACompensation annotation found.");
+ baClass = BACompensationAnnotation.serviceClass();
+ log.info("Compensation class: " + baClass);
+ baInterface = BACompensationAnnotation.ejbInterface();
+ log.info("EJB Interface: " + baInterface);
+ baJndiName = BACompensationAnnotation.jndiName();
+ log.info("JNDI name: " + baJndiName);
+ baProviderURL = BACompensationAnnotation.providerURL();
+ log.info("Provider URL: " + baProviderURL);
+
+ }
+
+ // Check if there is a WebMethod annotation
+ WebMethod webMethodAnnotation = method.getAnnotation(WebMethod.class);
+ if (webMethodAnnotation != null)
+ {
+ log.info("WebMethod annotation present!");
+
+ // Check if the operation name has been specified
+ String name = webMethodAnnotation.operationName();
+ if (name != null && !name.equals(""))
+ {
+ log.info("WebMethod operationName: " + name);
+ // If yes... change the name of the web method
+ webMethodName = name;
+ }
+ }
+ else
+ {
+ throw new MethodIncorrectlyAnnotatedException("Method does not have @WebMethod annotation.");
+ }
+
+ // Remember names of the method
+ serviceDescription.setOriginalMethodName(methodName);
+ serviceDescription.setOriginalWebMethodName(webMethodName);
+
+ // Set the parameter types of the original method
+ serviceDescription.setOriginalParameterTypes(method.getParameterTypes());
+
+
+
+ // Check if this method is a BA service
+ BAService baService = method.getAnnotation(BAService.class);
+ BAServiceType baServiceType;
+ if (baService != 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);
+
+ // Get the agreement type
+ BAAgreementType baAgreeementType = baService.agreement();
+ log.info("BAAgreementType: " + baAgreeementType);
+ serviceDescription.setAgreementType(baAgreeementType);
+ }
+ else
+ {
+ throw new MethodIncorrectlyAnnotatedException("Method does not have @BAService annotation.");
+ }
+
+ // Check the compensation method
+ BACompensatedBy baComp = method.getAnnotation(BACompensatedBy.class);
+ if (baComp != null)
+ {
+ log.info("BACompensatedBy annotation present!");
+
+ String compensationMethodName = baComp.value();
+ log.info("Compensation method: " + compensationMethodName);
+ serviceDescription.setCompensationMethodName(compensationMethodName);
+
+ // Check the compensation type
+ log.info("Compensation type: " + baComp.type());
+ serviceDescription.setCompensationType(baComp.type());
+
+ // Set parameter match
+ log.info("Parameters match: " + baComp.match());
+ serviceDescription.setParameterMatch(baComp.match());
+
+ // Check if this is a single compensation
+ log.info("Compensation single: " + baComp.single());
+ serviceDescription.setCompensationSingle(baComp.single());
+
+ // Get compensation mode
+ BACompensationMode compensationMode = baComp.mode();
+ serviceDescription.setCompensationMode(baComp.mode());
+ log.info("Compensation mode: " + compensationMode);
+
+ // Get information according to the required compensation
+ if (compensationMode == BACompensationMode.POJO)
+ {
+ // We need following information
+ // 1) Method name (already obtained)
+ // 2) Method's class
+
+ // Getting method's class
+ Class compensationMethodClass = baComp.serviceClass()[0];
+ if (compensationMethodClass == null)
+ {
+ // It can be either local class or a class specified in BACompensation annotation
+ if (baClass != null)
+ {
+ log.info("Compensation method class specified in BA");
+ compensationMethodClass = baClass[0];
+ }
+ else
+ {
+ log.info("Compensation method is in the same class: ");
+ compensationMethodClass = method.getDeclaringClass();
+ }
+ }
+ else
+ {
+ log.info("Compensation class: " + compensationMethodClass);
+ }
+ serviceDescription.setCompensationClass(compensationMethodClass);
+
+ // Checking if the compensation method exists
+ log.info("Checking if compensation method exists");
+ Method[] methodList = compensationMethodClass.getMethods();
+ boolean methodFound = false;
+ for (Method singleMethod : methodList)
+ {
+ log.info("Comparing " + compensationMethodName + " against " + singleMethod.getName() + ".");
+ if (singleMethod.getName().equals(compensationMethodName))
+ {
+ // Remember types of parameters
+ log.info("Getting parameter types");
+ Class[] parameterTypes = singleMethod.getParameterTypes();
+
+ if (parameterTypes != null)
+ {
+ log.info("Compensation method has parameters");
+
+ log.info("Setting compensation type");
+ serviceDescription.setCompensationParameterTypes(singleMethod.getParameterTypes());
+
+ // Remember annotations of the parameters of the compensation 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++;
+ }
+ serviceDescription.setCompensationParameterAnnotations(parameterAnnotation);
+ }
+ else
+ {
+ log.info("Compensation method does not take any parameters");
+ }
+ methodFound = true;
+ break;
+ }
+ }
+ if (!methodFound)
+ {
+ throw new CompensationMethodNotAccessible("Compensation method not found.");
+ }
+
+ }
+ else if (compensationMode == BACompensationMode.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[] compensationMethodClass = baComp.serviceClass();
+ boolean baParamAnnotationFound = true;
+ if (compensationMethodClass.length == 0)
+ {
+ 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");
+ if (baClass != null && baClass.length > 0 && baClass[0] != null)
+ {
+ log.info("Compensation class specified in the BACompensation annotation");
+ compensationMethodClass = new Class[1];
+ compensationMethodClass[0] = baClass[0];
+ }
+ else
+ {
+ log.info("Compensation class not specified - remote compensation.");
+ }
+ }
+ else
+ {
+ log.info("Method's class specified");
+ }
+
+ if (compensationMethodClass.length > 0)
+ {
+ // Compensation class specified
+ log.info("Compensation class: " + compensationMethodClass[0]);
+
+ // Checking if the compensation method exists
+ log.info("Checking if compensation method exists");
+ Method[] methodList = compensationMethodClass[0].getMethods();
+ boolean methodFound = false;
+ for (Method singleMethod : methodList)
+ {
+ log.info("Comparing " + compensationMethodName + " against " + singleMethod.getName() + ".");
+ if (singleMethod.getName().equals(compensationMethodName))
+ {
+ log.info("Method found!");
+
+ // Remember types of parameters
+ log.info("Getting parameter types");
+ Class[] parameterTypes = singleMethod.getParameterTypes();
+
+ if (parameterTypes != null)
+ {
+ log.info("Compensation method has parameters");
+
+ log.info("Setting compensation type");
+ serviceDescription.setCompensationParameterTypes(singleMethod.getParameterTypes());
+
+ // Remember annotations of the parameters of the compensation 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++;
+ }
+ serviceDescription.setCompensationParameterAnnotations(parameterAnnotation);
+ }
+ else
+ {
+ log.info("Compensation method does not take any parameters");
+ }
+ methodFound = true;
+ break;
+ }
+ }
+ if (!methodFound)
+ {
+ throw new CompensationMethodNotAccessible("Compensation method not found.");
+ }
+
+ }
+ serviceDescription.setCompensationClass(compensationMethodClass[0]);
+
+ // Get the interface
+ Class[] ejbInterface = baComp.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 BACompensation - 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 compensation method exists
+ log.info("Checking if compensation method exists");
+ Method[] methodList = ejbInterface[0].getMethods();
+ boolean methodFound = false;
+ for (Method singleMethod : methodList)
+ {
+ log.info("Comparing " + compensationMethodName + " against " + singleMethod.getName() + ".");
+ if (singleMethod.getName().equals(compensationMethodName))
+ {
+ log.info("Method found!");
+
+ // Remember types of parameters
+ log.info("Getting parameter types");
+ Class[] parameterTypes = singleMethod.getParameterTypes();
+
+ if (parameterTypes != null)
+ {
+ log.info("Compensation method has parameters");
+
+ log.info("Setting compensation type");
+ serviceDescription.setCompensationParameterTypes(singleMethod.getParameterTypes());
+
+ // Remember annotations of the parameters of the compensation 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++;
+ }
+ serviceDescription.setCompensationParameterAnnotations(parameterAnnotation);
+ }
+ }
+ else
+ {
+ log.info("Compensation method does not take any parameters");
+ }
+ methodFound = true;
+ break;
+ }
+ }
+ if (!methodFound)
+ {
+ throw new CompensationMethodNotAccessible("Compensation method not found.");
+ }
+
+ }
+ serviceDescription.setCompensationEjbInterface(ejbInterface[0]);
+
+ // Get the JNDI name of the EJB
+ log.info("Getting JNDI name of the EJB");
+ String jndiName = baComp.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");
+ }
+ }
+ serviceDescription.setCompensationJNDIName(jndiName);
+
+ // Check if the URL provider has been specified
+ String providerURL = baComp.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;
+ }
+ }
+ serviceDescription.setCompensationProviderURL(providerURL);
+ }
+
+ }
+ else
+ {
+ log.info("BACompensatedBy annotation missing.");
+ log.info("Checking the type of the service.");
+ if (baServiceType == BAServiceType.READONLY)
+ {
+ log.info("Service is read only. BACompensatedBy is not necessary.");
+ }
+ else
+ {
+ throw new MethodIncorrectlyAnnotatedException("BACompensatedBy annotation missing.");
+ }
+ }
+
+
+ // Remember @BAParam annotation values
+ Object[] parameterAnnotation = new Object[method.getParameterTypes().length];
+ Annotation[][] parameterAnnotations = method.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;
+ }
+ }
+ }
+ i++;
+ }
+ serviceDescription.setOriginalParameterAnnotations(parameterAnnotation);
+
+ // Remember @BAResult annotation value
+ BAResult baResult = method.getAnnotation(BAResult.class);
+ Integer returnId;
+ if (baResult != null)
+ {
+ log.info("BAResult annotation present!");
+ String returnName = baResult.value();
+ if (!returnName.equals(""))
+ {
+ // Check if this is a numerical identifier or not
+ try
+ {
+ returnId = new Integer(returnName);
+ log.info("Return identifier: " + returnId);
+ serviceDescription.setOriginalReturnId(returnId);
+ }
+ catch (NumberFormatException nfe)
+ {
+ log.info("Return identifier: " + returnName);
+ serviceDescription.setOriginalReturnId(returnName);
+ }
+ }
+ else
+ {
+ throw new MethodIncorrectlyAnnotatedException("BAResult annotation has a wrong identifier.");
+ }
+
+ }
+
+ // Return the service description
+ return serviceDescription;
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/CompensationManagement.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/CompensationManagement.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/helper/CompensationManagement.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.BACompensationManagement;
+import org.jboss.txbridge.ba.compensation.CompensationManagerImpl;
+import org.jboss.txbridge.ba.compensation.CompensationManager;
+import org.jboss.txbridge.ba.data.TaskDescription;
+import org.apache.log4j.Logger;
+
+import java.lang.reflect.Field;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 4, 2007
+ *
+ * This component provides a method that can be used to inject a compensation manager to an object on
+ * which a compensation action is to be executed. Such compensation manager can be used to retrieve
+ * and additional data, which may be required by the compensation action.
+ */
+public class CompensationManagement
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CompensationManagement.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 compensation manager");
+ Field[] fields = clazz.getDeclaredFields();
+ for (Field singleField : fields)
+ {
+ BACompensationManagement cm = singleField.getAnnotation(BACompensationManagement.class);
+ if (cm != null)
+ {
+ if (singleField.getType().equals(CompensationManager.class))
+ {
+ log.info("CompensationManager object found...");
+ log.info("Setting field...");
+ singleField.setAccessible(true);
+ log.info("Injecting...");
+ singleField.set(targetObject,new CompensationManagerImpl(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/id/IdentifierFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/IdentifierFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/IdentifierFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.id;
+
+/**
+ * @author: Maciej Machulak
+ * @date: Jul 1, 2007
+ *
+ * This is an abstract class for the identifier factory. It is used in different places throughout
+ * the code where unique identifiers are needed (i.e. task identifiers).
+ */
+public abstract class IdentifierFactory
+{
+ UniqueValueGetter uvg;
+
+ protected IdentifierFactory()
+ {
+ }
+
+ public String getIdentifier()
+ {
+ return uvg.getUniqueValue();
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomGetter.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomGetter.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomGetter.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.id;
+
+import java.util.Random;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * Returns a unique String object of a given precision.
+ */
+public class RandomGetter implements UniqueValueGetter
+{
+ // Identifier uniqueness
+ private static int IDENTIFIER_PRECISION = 24;
+
+ // Random generator
+ private static Random rg = new Random();
+
+ // Randomly generated bytes
+ private byte[] id = new byte[IDENTIFIER_PRECISION];
+
+ public String getUniqueValue()
+ {
+ rg.nextBytes(id);
+ return new String(id);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomIdentifierFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomIdentifierFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/RandomIdentifierFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.id;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * Factory for unique identifiers based on the Random Getter class.
+ */
+class RandomIdentifierFactory extends IdentifierFactory
+{
+
+ public RandomIdentifierFactory()
+ {
+ this.uvg = new RandomGetter();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidGetter.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidGetter.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidGetter.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.id;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * Returns a unique String object using the Uid() method.
+ */
+public class UidGetter implements UniqueValueGetter
+{
+ public String getUniqueValue()
+ {
+ return new Uid().toString();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidIdentifierFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidIdentifierFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UidIdentifierFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.id;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * Factory for Uid-based unique identifiers.
+ */
+public class UidIdentifierFactory extends IdentifierFactory
+{
+
+ public UidIdentifierFactory()
+ {
+ this.uvg = new UidGetter();
+ }
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UniqueValueGetter.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UniqueValueGetter.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/id/UniqueValueGetter.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.id;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 2, 2007
+ *
+ * Interface for the unique value getter.
+ */
+public interface UniqueValueGetter
+{
+ public String getUniqueValue();
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CloseNotifier.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CloseNotifier.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CloseNotifier.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.participant;
+
+import org.jboss.txbridge.ba.BATransactionManager;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 25, 2007
+ *
+ * CloseNotifier is started by the participant. Its purpose is to inform the
+ * BA Transaction Manager that a given transaction can be closed.
+ */
+public class CloseNotifier implements Runnable
+{
+ private String txId;
+ private BATransactionManager btm;
+
+ public CloseNotifier(String txId, BATransactionManager btm)
+ {
+ this.txId = txId;
+ this.btm = btm;
+ }
+
+ public void run()
+ {
+ btm.closeTransaction(txId);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataCustomFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataCustomFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataCustomFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,38 @@
+/*
+ * 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.CompensationData;
+import org.jboss.txbridge.ba.data.CompensationDataCustom;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ *
+ * Responsible for instantiating compensation data object required for custom compensation.
+ */
+public class CompensationDataCustomFactory implements CompensationDataFactory
+{
+ public CompensationData createCompensationData()
+ {
+ return new CompensationDataCustom();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.CompensationData;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ */
+public interface CompensationDataFactory
+{
+ public CompensationData createCompensationData();
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataParamFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataParamFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataParamFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.CompensationData;
+import org.jboss.txbridge.ba.data.CompensationDataParam;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ *
+ * Responsible for instantiating compensation data object required for compensation
+ * where parameters of the original service and the compensation service match.
+ */
+public class CompensationDataParamFactory implements CompensationDataFactory
+{
+ public CompensationData createCompensationData()
+ {
+ return new CompensationDataParam();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataReturnFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataReturnFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationDataReturnFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.CompensationData;
+import org.jboss.txbridge.ba.data.CompensationDataReturn;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ *
+ * Responsible for instantiating compensation data object required for compensation where the
+ * return value is used as an argument for the compensation action.
+ */
+public class CompensationDataReturnFactory implements CompensationDataFactory
+{
+ public CompensationData createCompensationData()
+ {
+ return new CompensationDataReturn();
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationNotifier.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationNotifier.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CompensationNotifier.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.participant;
+
+import org.jboss.txbridge.ba.BATransactionManager;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 26, 2007
+ *
+ * CompensationNotifier is started by the participant. Its purpose is to inform the
+ * BA Transaction Manager that a given transaction needs to be compensated.
+ */
+public class CompensationNotifier implements Runnable
+{
+ private String txId;
+ private BATransactionManager btm;
+
+ public CompensationNotifier(String txId, BATransactionManager btm)
+ {
+ this.txId = txId;
+ this.btm = btm;
+ }
+
+ public void run()
+ {
+ btm.compensateTransaction(txId);
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/CoordinatorCompletionParticipant.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,100 @@
+/*
+ * 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 com.arjuna.wst.*;
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.SingleTransactionManager;
+import org.jboss.txbridge.ba.service.ServiceDescription;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ *
+ * Implementation of the Participant that is enlisted for the Business Agreement with Coordinator
+ * Completion protocol.
+ */
+public class CoordinatorCompletionParticipant extends org.jboss.txbridge.ba.participant.Participant implements BusinessAgreementWithCoordinatorCompletionParticipant
+{
+ // Logger
+ private static Logger log = Logger.getLogger(CoordinatorCompletionParticipant.class);
+
+ /**
+ * Constructor.
+ *
+ * @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
+ */
+ public CoordinatorCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm, CompensationDataFactory cdf)
+ {
+ super(txId, serviceId, stm, cdf);
+ log.info("constructor()");
+ }
+
+ public void close() throws WrongStateException, SystemException
+ {
+ log.info("close()");
+ closeTransaction();
+ }
+
+ public void cancel() throws WrongStateException, SystemException
+ {
+ log.info("cancel()");
+ }
+
+ public void compensate() throws FaultedException, WrongStateException, SystemException
+ {
+ log.info("compensate()");
+ compensateTransaction();
+ }
+
+ public String status() throws SystemException
+ {
+ log.info("status()");
+ return null;
+ }
+
+ public void unknown() throws SystemException
+ {
+ log.info("unknown()");
+ }
+
+ public void error() throws SystemException
+ {
+ log.info("error()");
+ }
+
+ 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();
+ }
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyCompensationDataFactory.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyCompensationDataFactory.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/DummyCompensationDataFactory.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -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.CompensationData;
+import org.jboss.txbridge.ba.data.DummyCompensationData;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 9, 2007
+ *
+ * Responsible for instantiating dummy compensation object. This factory is used if a certain
+ * service is executed outside the scope of a Business Activity.
+ */
+public class DummyCompensationDataFactory implements CompensationDataFactory
+{
+ public CompensationData createCompensationData()
+ {
+ return new DummyCompensationData();
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/Participant.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,386 @@
+/*
+ * 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.CompensationData;
+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.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.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.apache.log4j.Logger;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * 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:
+ * - Coordinator Completion Participant
+ * - Participant Completion Participant
+ */
+public abstract class Participant
+{
+ // Logger
+ private static Logger log = Logger.getLogger(Participant.class);
+
+ // Service Information Manager
+ protected ServiceInformationManager sim = null;
+
+ // BA Manager
+ private static BATransactionManager baTransactionManager = null;
+
+ // CompensationDataFactory
+ private CompensationDataFactory cdf = null;
+
+ // Single transaction manager
+ protected SingleTransactionManager stm = null;
+
+ // Transaction identifier
+ private String txId = null;
+
+ // Service identifier
+ protected String serviceId = null;
+
+ // List of all tasks
+ protected List<String> taskList = null;
+
+ // Mapping (taskId,compensation_data)
+ private ConcurrentMap<String,CompensationData> 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 stm is the single transaction manager.
+ */
+ public Participant(String txId,String serviceId, SingleTransactionManager stm,CompensationDataFactory cdf)
+ {
+ log.info("constructor()");
+
+ // Remember the Single Transaction Manager
+ this.stm = stm;
+
+ // Remember transaction identifier
+ this.txId = txId;
+
+ // Remember the service identifier
+ this.serviceId = serviceId;
+
+ // Remember the compensation data factory
+ this.cdf = cdf;
+
+ // Get reference to the service information manager
+ sim = ServiceInformationManager.getSingletonInstance();
+
+ // Initialise the list of tasks
+ taskList = new ArrayList<String>();
+
+ // Initialise (taskId, compensation data) mapping
+ compensationData = new ConcurrentHashMap<String,CompensationData>();
+
+ // Get reference to the BA Transaction Manager
+ baTransactionManager = BATransactionManager.getSingletonInstance();
+
+ }
+
+ /**
+ * This method stores an object withing the compensation data for a given task.
+ * The object is assigned an ID.
+ *
+ * @param taskId is the ID of the task.
+ * @param objectId is the ID of the object.
+ * @param object is the object to be stored.
+ */
+ public void put(String taskId,Object objectId,Object object)
+ {
+ log.info("put(" + objectId + ")");
+ // Get the correct compensation data
+ CompensationData cd = compensationData.get(taskId);
+ if (cd == null)
+ {
+ return;
+ }
+ // Put the data
+ if (objectId instanceof Integer || objectId instanceof String)
+ {
+ cd.put(objectId,object);
+ }
+ }
+
+ /**
+ * This method retrieves an object with a given identifier from the compensation data
+ * that is stored for a given task id.
+ *
+ * @param taskId is the ID of the task.
+ * @param objectId is the ID of the object.
+ * @return the object with a given ID.
+ */
+ public Object get(String taskId,Object objectId)
+ {
+ log.info("get(" + objectId + ")");
+ // Get the correct compensation data
+ CompensationData cd = compensationData.get(taskId);
+ if (cd == null)
+ {
+ return null;
+ }
+ if (objectId instanceof Integer || objectId instanceof String)
+ {
+ return cd.get(objectId);
+ }
+ return null;
+ }
+
+ /**
+ * This method associates a new task with the existing participant.
+ *
+ * @param taskId is the task identifier.
+ * @throws org.jboss.txbridge.ba.exception.TaskAssociationFailedException if task association fails.
+ */
+ public void associateTask(String taskId) throws TaskAssociationFailedException
+ {
+
+ log.info("associateTask()");
+
+ // Check correctness of parameters
+ if (taskList.contains(taskId))
+ {
+ throw new TaskAssociationFailedException("Task already associated");
+ }
+
+ // Remember the task
+ log.info("Remember task ID: " + taskId);
+ taskList.add(taskId);
+
+ // Create a new compensation object
+ log.info("Creating new compensation object");
+ CompensationData cd = cdf.createCompensationData();
+
+ // Remember the (taskid,compensationdata) association
+ log.info("Remembering compensation data");
+ compensationData.put(taskId,cd);
+
+ }
+
+ /**
+ *
+ * @param taskId is the ID of a task that should be removed from the list.
+ */
+ public void removeTask(String taskId)
+ {
+ log.info("removeTask()");
+
+ // Remove the task
+ if (taskList.remove(taskId))
+ {
+ log.info("Task " + taskId + " remove successfully.");
+ }
+ else
+ {
+ log.info("Task could not be removed.");
+ }
+
+ // Remove the (task,compensation_data) mapping
+ compensationData.remove(taskId);
+ }
+
+ /**
+ * This method is invoked by the participant object if a transaction should compensate.
+ * It asks the BA Transaction Manager to compensate the transaction.
+ */
+ void compensateTransaction()
+ {
+ log.info("compensateTransaction()");
+ Thread compensationNotifier = new Thread(new CompensationNotifier(txId,baTransactionManager));
+ compensationNotifier.start();
+ }
+
+ /**
+ * This method is invoked by the participant object if a transaction is finished.
+ * It asks the BA Transaction Manager to forget about the transaction.
+ */
+ void closeTransaction()
+ {
+ log.info("closeTransaction()");
+ Thread closeNotifier = new Thread(new CloseNotifier(txId,baTransactionManager));
+ closeNotifier.start();
+ }
+
+
+ /**
+ * This method provides the implementation for executing the compensation 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.
+ */
+ public void compensateTask(String taskId) throws CompensationActionUnsuccessfulException
+ {
+ log.info("compensateTask()");
+
+ log.info("Compensating task ID: " + taskId);
+
+ // TODO: Redesign this !!!
+ ServiceDescription sd = sim.getServiceById(serviceId);
+ if (sd.getServiceType() == BAServiceType.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 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);
+ ServiceExecutor se;
+ if (compensationMode == BACompensationMode.UDII)
+ {
+ // Use the remote executor.
+ log.info("Using remote executor");
+ se = new RemoteServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
+ }
+ else if (compensationMode == BACompensationMode.POJO)
+ {
+ // Use the local executor.
+ log.info("Using local executor");
+ se = new LocalServiceExecutor(new TaskDescription(txId,taskId,serviceId,this));
+ }
+ else if (compensationMode == BACompensationMode.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 CompensationActionUnsuccessfulException("Incorrect compensation mode");
+ }
+ // Invoke the compensation action
+ log.info("Invoking the compensation action");
+ se.invokeService(serviceDescription,new CompensationDataProviderImpl(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.
+ *
+ * @param taskId is the ID of the task.
+ * @param arguments is the list of arguments.
+ */
+ 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))
+ {
+ return;
+ }
+ // Put the data
+ ((CompensationDataParam)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.
+ *
+ * @param taskId is the task ID.
+ * @return the list of arguments.
+ */
+ public Object[] getArguments(String taskId)
+ {
+ log.info("getArguments()");
+ // Get the correct compensation data
+ CompensationData cd = compensationData.get(taskId);
+ if (cd == null || !(cd instanceof CompensationDataParam))
+ {
+ return null;
+ }
+ // Get the data
+ return ((CompensationDataParam)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)
+ *
+ * @param taskId is the task identifier.
+ * @param returnObject is the return object.
+ */
+ 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))
+ {
+ return;
+ }
+ // Put the data
+ ((CompensationDataReturn)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)
+ *
+ * @param taskId is the task ID.
+ * @return the return object.
+ */
+ public Object[] getReturn(String taskId)
+ {
+ log.info("getReturn()");
+ // Get the correct compensation data
+ CompensationData cd = compensationData.get(taskId);
+ if (cd == null || !(cd instanceof CompensationDataReturn))
+ {
+ return null;
+ }
+ // Get the data
+ return ((CompensationDataReturn)cd).getReturnObject();
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/participant/ParticipantCompletionParticipant.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,77 @@
+/*
+ * 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 com.arjuna.wst.*;
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.SingleTransactionManager;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 8, 2007
+ *
+ * Implementation of the Participant that is enlisted for the Business Agreement with Participant
+ * Completion protocol.
+ */
+public class ParticipantCompletionParticipant extends org.jboss.txbridge.ba.participant.Participant implements BusinessAgreementWithParticipantCompletionParticipant
+{
+ // Logger
+ private static Logger log = Logger.getLogger(ParticipantCompletionParticipant.class);
+
+ public ParticipantCompletionParticipant(String txId, String serviceId, SingleTransactionManager stm,CompensationDataFactory cdf)
+ {
+ super(txId, serviceId, stm, cdf);
+ log.info("constructor()");
+ }
+
+ public void close() throws WrongStateException, SystemException
+ {
+ log.info("close()");
+ closeTransaction();
+ }
+
+ public void cancel() throws WrongStateException, SystemException
+ {
+ log.info("cancel()");
+ }
+
+ public void compensate() throws FaultedException, WrongStateException, SystemException
+ {
+ log.info("compensate()");
+ compensateTransaction();
+ }
+
+ public String status() throws SystemException
+ {
+ log.info("status()");
+ return null;
+ }
+
+ public void unknown() throws SystemException
+ {
+ log.info("unknown()");
+ }
+
+ public void error() throws SystemException
+ {
+ log.info("error()");
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescription.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,75 @@
+/*
+ * 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.service;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * // TODO: Redesign that!
+ */
+public interface MethodDescription
+{
+ Class getClazz();
+
+ void setClazz(Class clazz);
+
+ String getMethodName();
+
+ void setMethodName(String methodName);
+
+ String getWebMethodName();
+
+ void setWebMethodName(String webMethodName);
+
+ Class[] getParameterTypes();
+
+ void setParameterTypes(Class[] parameterTypes);
+
+ Object[] getParameterAnnotations();
+
+ void setParameterAnnotations(Object[] parameterAnnotations);
+
+ Object getReturnId();
+
+ void setReturnId(Object returnId);
+
+ Class getReturnType();
+
+ void setReturnType(Class returnType);
+
+ String getJndiName();
+
+ void setJndiName(String jndiName);
+
+ Class getEjbInterface();
+
+ void setEjbInterface(Class ejbInterface);
+
+ String getProviderURL();
+
+ void setProviderURL(String providerURL);
+
+ boolean isSingle();
+
+ void setSingle(boolean value);
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/MethodDescriptionImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,158 @@
+/*
+ * 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.service;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 17, 2007
+ *
+ * This class describes a single method with all information related to participation
+ * in Business Activities.
+ *
+ * TODO: Redesign this - it should be a simple map to hold all those values.
+ */
+public class MethodDescriptionImpl implements MethodDescription
+{
+ private Class clazz;
+ private Class ejbInterface;
+ private String methodName;
+ private String webMethodName;
+ private Class[] parameterTypes;
+ private Object[] parameterAnnotations;
+ private Object returnId;
+ private Class returnType;
+ private boolean isSingle;
+
+ // TODO: Put this into a new class!
+ private String jndiName;
+ private String providerURL;
+
+ public Class getClazz()
+ {
+ return clazz;
+ }
+
+ public void setClazz(Class clazz)
+ {
+ this.clazz = clazz;
+ }
+
+ public String getMethodName()
+ {
+ return methodName;
+ }
+
+ public void setMethodName(String methodName)
+ {
+ this.methodName = methodName;
+ }
+
+ public String getWebMethodName()
+ {
+ return webMethodName;
+ }
+
+ public void setWebMethodName(String webMethodName)
+ {
+ this.webMethodName = webMethodName;
+ }
+
+ public Class[] getParameterTypes()
+ {
+ return parameterTypes;
+ }
+
+ public void setParameterTypes(Class[] parameterTypes)
+ {
+ this.parameterTypes = parameterTypes;
+ }
+
+ public Object[] getParameterAnnotations()
+ {
+ return parameterAnnotations;
+ }
+
+ public void setParameterAnnotations(Object[] parameterAnnotations)
+ {
+ this.parameterAnnotations = parameterAnnotations;
+ }
+
+ public Object getReturnId()
+ {
+ return returnId;
+ }
+
+ public void setReturnId(Object returnId)
+ {
+ this.returnId = returnId;
+ }
+
+ public Class getReturnType()
+ {
+ return returnType;
+ }
+
+ public void setReturnType(Class returnType)
+ {
+ this.returnType = returnType;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public String getProviderURL()
+ {
+ return providerURL;
+ }
+
+ public void setProviderURL(String providerURL)
+ {
+ this.providerURL = providerURL;
+ }
+
+ public boolean isSingle()
+ {
+ return isSingle;
+ }
+
+ public void setSingle(boolean value)
+ {
+ this.isSingle = value;
+ }
+
+
+ public Class getEjbInterface()
+ {
+ return ejbInterface;
+ }
+
+ public void setEjbInterface(Class ejbInterface)
+ {
+ this.ejbInterface = ejbInterface;
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescription.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,121 @@
+/*
+ * 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.service;
+
+import org.jboss.txbridge.ba.annotation.*;
+
+import java.io.Serializable;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ */
+public interface ServiceDescription extends Serializable
+{
+ BAServiceType getServiceType();
+
+ void setServiceType(BAServiceType serviceType);
+
+ BAAgreementType getAgreementType();
+
+ void setAgreementType(BAAgreementType agreementType);
+
+ BACompensationType getCompensationType();
+
+ void setCompensationType(BACompensationType compensationType);
+
+ public BACompensationMode getCompensationMode();
+
+ public void setCompensationMode(BACompensationMode 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 BAParameterMatch getParameterMatch();
+
+ public void setParameterMatch(BAParameterMatch 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);
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceDescriptionImpl.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,282 @@
+/*
+ * 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.service;
+
+import org.jboss.txbridge.ba.annotation.*;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 17, 2007
+ *
+ * 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
+ */
+public class ServiceDescriptionImpl implements ServiceDescription
+{
+
+ /**
+ * BA-related information.
+ */
+ private BAServiceType serviceType;
+ private BAAgreementType agreementType;
+ private BACompensationType compensationType;
+ private BACompensationMode compensationMode;
+ private BAParameterMatch parameterMatch;
+
+ /**
+ * Information about the original method.
+ */
+ private MethodDescription originalMethod;
+
+ /**
+ * Information about the compensation method.
+ */
+ private MethodDescription compensationMethod;
+
+ public ServiceDescriptionImpl()
+ {
+ originalMethod = new MethodDescriptionImpl();
+ compensationMethod = new MethodDescriptionImpl();
+ }
+
+ public BAServiceType getServiceType()
+ {
+ return serviceType;
+ }
+
+ public void setServiceType(BAServiceType serviceType)
+ {
+ this.serviceType = serviceType;
+ }
+
+ public BAAgreementType getAgreementType()
+ {
+ return agreementType;
+ }
+
+ public void setAgreementType(BAAgreementType agreementType)
+ {
+ this.agreementType = agreementType;
+ }
+
+ public BACompensationType getCompensationType()
+ {
+ return compensationType;
+ }
+
+ public void setCompensationType(BACompensationType compensationType)
+ {
+ this.compensationType = compensationType;
+ }
+
+ public BACompensationMode getCompensationMode()
+ {
+ return compensationMode;
+ }
+
+ public void setCompensationMode(BACompensationMode compensationMode)
+ {
+ this.compensationMode = compensationMode;
+ }
+
+ public BAParameterMatch getParameterMatch()
+ {
+ return parameterMatch;
+ }
+
+ public void setParameterMatch(BAParameterMatch 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 compensationMethod.isSingle();
+ }
+
+ public void setCompensationSingle(boolean value)
+ {
+ compensationMethod.setSingle(value);
+ }
+
+ public Class getCompensationEjbInterface()
+ {
+ return compensationMethod.getEjbInterface();
+ }
+
+ public void setCompensationEjbInterface(Class ejbInterface)
+ {
+ compensationMethod.setEjbInterface(ejbInterface);
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/service/ServiceInformationManager.java 2007-08-02 10:19:29 UTC (rev 13952)
@@ -0,0 +1,180 @@
+/*
+ * 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.service;
+
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.id.IdentifierFactory;
+import org.jboss.txbridge.ba.id.UidIdentifierFactory;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author: Maciej P. Machulak
+ * @date: Jul 1, 2007
+ *
+ * This class is responsible for caching information about service descriptions. It associates
+ * its description with a unique identifier of a service.
+ */
+public class ServiceInformationManager
+{
+ // Logger
+ private static Logger log = Logger.getLogger(ServiceInformationManager.class);
+
+ // Service information manager instance
+ private volatile static ServiceInformationManager cim = null;
+
+ // Identifier factory
+ private IdentifierFactory idf = null;
+
+ // Mappings
+ // - (class name + method name, service id)
+ private ConcurrentMap<String,String> methodServiceIdMapping;
+ // - (service id, service_description)
+ private ConcurrentMap<String,ServiceDescription> serviceDescriptions;
+
+ // Constructor
+ private ServiceInformationManager()
+ {
+ log.info("constructor()");
+ idf = new UidIdentifierFactory();
+ methodServiceIdMapping = new ConcurrentHashMap<String,String>();
+ serviceDescriptions = new ConcurrentHashMap<String,ServiceDescription>();
+ }
+
+ // Get instance of the class information manager
+ public static ServiceInformationManager getSingletonInstance()
+ {
+ log.info("getSingletonInstance()");
+ if (cim == null)
+ {
+ synchronized(ServiceInformationManager.class)
+ {
+ if (cim == null)
+ {
+ log.info("Creating new instance");
+ cim = new ServiceInformationManager();
+ }
+ }
+ }
+ return cim;
+ }
+
+ /**
+ * This method stores a service description. It returns a unique associates service ID.
+ *
+ * @param serviceDescription is the service description that needs to be stored.
+ * @return is the unique service ID.
+ */
+ public String storeServiceDescription(ServiceDescription serviceDescription)
+ {
+ log.info("storeServiceDescription()");
+ String serviceId = idf.getIdentifier();
+ log.info("service id: " + serviceId);
+ String className = serviceDescription.getOriginalClass().getName();
+ String methodName = serviceDescription.getOriginalMethodName();
+ storeServiceDescription(serviceId,className+methodName,serviceDescription);
+ return serviceId;
+ }
+
+ /**
+ * This method stores a service description for a service with a given complete name and
+ * returns a unique associated service ID.
+ *
+ * @param serviceId is the unique service Id.
+ * @param completeMethodName is the complete method's name.
+ * @param serviceDescription is the service description.
+ */
+ private void storeServiceDescription(String serviceId, String completeMethodName,ServiceDescription serviceDescription)
+ {
+ log.info("storeServiceDescription()");
+ methodServiceIdMapping.putIfAbsent(completeMethodName,serviceId);
+ serviceDescriptions.putIfAbsent(serviceId,serviceDescription);
+ }
+
+ /**
+ * This method returns the service description for a service with a given identifier.
+ *
+ * @param completeMethodName is the complete method name (classname+methodname)
+ * @return service description.
+ */
+ public ServiceDescription getServiceByName(String completeMethodName)
+ {
+ log.info("getServiceByName()");
+ String serviceId = methodServiceIdMapping.get(completeMethodName);
+ if (serviceId == null)
+ {
+ return null;
+ }
+ return serviceDescriptions.get(serviceId);
+ }
+
+ /**
+ * This method returns the service description for a service with a given identifier.
+ *
+ * @param serviceId is the ID of the service.
+ * @return service description.
+ */
+ public ServiceDescription getServiceById(String serviceId)
+ {
+ log.info("getServiceById");
+ return serviceDescriptions.get(serviceId);
+ }
+
+ /**
+ * 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)
+ * @return the service ID.
+ */
+ public String getServiceId(String completeMethodName)
+ {
+ log.info("getServiceId()");
+ return methodServiceIdMapping.get(completeMethodName);
+ }
+
+ /**
+ * This method checks if the service information manager already knows of a service
+ * with a given identifier.
+ *
+ * @param serviceId is the service identifier.
+ * @return true if the service is know, false if not.
+ */
+ public boolean knowsAboutById(String serviceId)
+ {
+ log.info("knowsAboutById()");
+ return serviceDescriptions.containsKey(serviceId);
+ }
+
+ /**
+ * This method checks if the service information manager already knows of a service
+ * with a given identifier.
+ *
+ * @param serviceName is the full name of the service (class name + method name)
+ * @return true if the service is know, false if not.
+ */
+ public boolean knowsAboutByName(String serviceName)
+ {
+ log.info("knowsAboutByName()");
+ return methodServiceIdMapping.containsKey(serviceName);
+ }
+
+}
More information about the jboss-svn-commits
mailing list