[jboss-svn-commits] JBL Code SVN: r26071 - in labs/jbosstm/trunk: txbridge and 18 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Apr 16 12:36:29 EDT 2009
Author: jhalliday
Date: 2009-04-16 12:36:29 -0400 (Thu, 16 Apr 2009)
New Revision: 26071
Added:
labs/jbosstm/trunk/txbridge/
labs/jbosstm/trunk/txbridge/META-INF/
labs/jbosstm/trunk/txbridge/META-INF/jboss-beans.xml
labs/jbosstm/trunk/txbridge/README.txt
labs/jbosstm/trunk/txbridge/build.xml
labs/jbosstm/trunk/txbridge/demo/
labs/jbosstm/trunk/txbridge/demo/build.xml
labs/jbosstm/trunk/txbridge/demo/dd/
labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-client.xml
labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-server.xml
labs/jbosstm/trunk/txbridge/demo/dd/persistence.xml
labs/jbosstm/trunk/txbridge/demo/dd/web.xml
labs/jbosstm/trunk/txbridge/demo/src/
labs/jbosstm/trunk/txbridge/demo/src/org/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/Bistro.java
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroEntityImpl.java
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroImpl.java
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/BasicClient.java
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Bistro.java
labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Restaurant.java
labs/jbosstm/trunk/txbridge/demo/web/
labs/jbosstm/trunk/txbridge/demo/web/index.jsp
labs/jbosstm/trunk/txbridge/docs/
labs/jbosstm/trunk/txbridge/docs/TransactionBridgingGuide.odt
labs/jbosstm/trunk/txbridge/docs/TransactionBridgingGuide.pdf
labs/jbosstm/trunk/txbridge/src/
labs/jbosstm/trunk/txbridge/src/org/
labs/jbosstm/trunk/txbridge/src/org/jboss/
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeParticipantAT.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeRecoveryManager.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeXAResource.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridge.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridgeManager.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxInboundBridgeHandler.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxOutboundBridgeHandler.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridge.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridgeManager.java
Log:
Added prototype transaction bridge code to trunk. JBTM-44
Added: labs/jbosstm/trunk/txbridge/META-INF/jboss-beans.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/META-INF/jboss-beans.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/META-INF/jboss-beans.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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 Lesser General Public License, v. 2.1.
+ * 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 Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009
+ * @author JBoss Inc.
+-->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="TxBridge" class="org.jboss.jbossts.txbridge.BridgeRecoveryManager">
+
+ <demand state="PreInstall">jboss.xts:service=XTSService</demand>
+
+ <depends>jboss.xts:service=XTSService</depends>
+
+ <depends>jboss:service=TransactionManager</depends>
+
+ </bean>
+
+</deployment>
+
Added: labs/jbosstm/trunk/txbridge/README.txt
===================================================================
--- labs/jbosstm/trunk/txbridge/README.txt (rev 0)
+++ labs/jbosstm/trunk/txbridge/README.txt 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,41 @@
+
+This is the prototype transaction bridge module.
+
+Usage:
+------
+
+see docs/TransactionBridgingGuide
+
+A word on quality:
+------------------
+
+It's still a work in progress and should be regarded as beta code at best,
+regardless of the designation of the JBossTS release in whose scope it is released.
+API stability between releases is not guaranteed. Don't use it in production.
+
+A word on version compatibility:
+--------------------------------
+
+This version, like the JBossTS it is bundled with, targets JBossAS 5.1 It will not work on earlier releases.
+Ideally the txbridge should be used in conjunction with the JBossTS release it is included in, although it may
+work with JBossTS 4.6.1 or later. This version won't work on any earlier release of JBossTS. Try the original
+prototype from http://anonsvn.jboss.org/repos/labs/labs/jbosstm/workspace/jhalliday/ if you need it to work
+on earlier versions.
+
+Building:
+---------
+
+set jbossas.home and jbossas.server in build.xml
+ensure XTS is deployed into the chosen server (see JBossAS docs/examples/transactions)
+ant dist
+ant deploy
+
+for the demo app, assuming the above steps are complete first:
+
+cd demo
+set jbossas.home and jbossas.server in build.xml
+ant dist
+ant deploy-service
+ant deploy-client
+
+See docs/TransactionBridgingGuide for further details on the demo app.
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/build.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/build.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/build.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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 Lesser General Public License, v. 2.1.
+ * 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 Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 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, 2009
+ * @author JBoss Inc.
+-->
+
+<project name="TxBridge" default="dist" basedir=".">
+ <description>
+ JBossTS Transaction Bridge
+ </description>
+
+ <property name="jbossas.home" location="/home/jhalli/IdeaProjects/jboss/jbossas_branch5x/build/output/jboss-5.1.0.CR1"/>
+ <property name="jbossas.server" value="default"/>
+
+ <property name="jbossts.home" location=".."/>
+
+ <property name="src" location="src"/>
+ <property name="lib" location="lib"/>
+ <property name="resources" location="resources"/>
+ <property name="build" location="build"/>
+
+ <path id="build-prereqs">
+ <fileset dir="${jbossts.home}/install/lib">
+ <include name="jbossjts.jar"/>
+ <include name="ext/jbossts-common.jar"/>
+ <include name="ext/log4j-1.2.14.jar"/>
+ <include name="ext/jta-1_1-classes.zip"/>
+ <include name="ext/connector-api.jar"/>
+ </fileset>
+
+ <fileset dir="${jbossts.home}/XTS/sar/build">
+ <include name="jbossxts-api.jar"/>
+ </fileset>
+
+ <fileset dir="${jbossas.home}/common/lib">
+ <include name="jbossws-native-jaxws.jar"/>
+ </fileset>
+ </path>
+
+ <target name="clean" description="clean up">
+ <delete dir="${build}"/>
+ </target>
+
+ <target name="init">
+ <tstamp/>
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="compile the source ">
+ <mkdir dir="${build}/classes"/>
+ <javac srcdir="${src}" destdir="${build}/classes" debug="true">
+ <classpath refid="build-prereqs"/>
+ </javac>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="generate the distribution">
+ <jar jarfile="${build}/txbridge.jar">
+ <fileset dir="${build}/classes">
+ <include name="org/jboss/**"/>
+ </fileset>
+ <fileset dir=".">
+ <include name="META-INF/*"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="deploy" depends="dist" description="deploy to JBossAS">
+ <copy file="${build}/txbridge.jar" todir="${jbossas.home}/server/${jbossas.server}/deploy/"/>
+ </target>
+
+ <!-- ##################################################################################### -->
+
+ <!-- the following targets are utility functions for the JBossTS dev team.
+ You probably don't need to worry about them. -->
+
+ <target name="install-jts">
+ <copy todir="${jbossas.home}/common/lib">
+ <fileset dir="${jbossts.home}/install/lib" includes="*.jar"/>
+ <fileset dir="${jbossts.home}/install/lib/ext/" includes="jbossts-common.jar"/>
+ </copy>
+ </target>
+
+ <target name="copy-xts">
+ <copy todir="${jbossas.home}/docs/examples/transactions">
+ <fileset dir="${jbossts.home}/XTS/xts-install/sar" includes="jbossxts.sar"/>
+ </copy>
+ </target>
+
+ <target name="install-xts">
+ <delete dir="${jbossas.home}/server/${jbossas.server}/deploy/jbossxts.sar"/>
+ <mkdir dir="${jbossas.home}/server/${jbossas.server}/deploy/jbossxts.sar"/>
+ <unzip src="${jbossas.home}/docs/examples/transactions/jbossxts.sar"
+ dest="${jbossas.home}/server/${jbossas.server}/deploy/jbossxts.sar"/>
+ </target>
+
+</project>
+
Added: labs/jbosstm/trunk/txbridge/demo/build.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/build.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/build.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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 Lesser General Public License, v. 2.1.
+ * 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 Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009
+ * @author JBoss Inc.
+-->
+
+<project name="TxBridgeDemo" default="dist" basedir=".">
+ <description>
+ JBossTS Transaction Bridge Demo App
+ </description>
+
+ <property name="jbossas.home" location="/home/jhalli/IdeaProjects/jboss/jbossas_branch5x/build/output/jboss-5.1.0.CR1"/>
+ <property name="jbossas.server" value="default"/>
+
+ <property name="src" location="src"/>
+ <property name="dd" location="dd"/>
+ <property name="web" location="web"/>
+ <property name="build" location="build"/>
+
+ <path id="build-prereqs">
+ <fileset dir="${jbossas.home}/common/lib">
+ <include name="jboss-javaee.jar"/>
+ <include name="ejb3-persistence.jar"/>
+ <include name="servlet-api.jar"/>
+ <include name="jbossws-native-jaxws.jar"/>
+ <include name="log4j.jar"/>
+
+ <include name="jbossjts.jar"/>
+ <include name="jbossts-common.jar"/>
+
+ </fileset>
+
+ <fileset dir="${jbossas.home}/server/${jbossas.server}/deploy/jbossxts.sar">
+ <include name="jbossxts-api.jar"/>
+ </fileset>
+
+ <!-- TODO get from deployed loc instead -->
+ <fileset dir="../build/">
+ <include name="txbridge.jar"/>
+ </fileset>
+
+ </path>
+
+ <target name="clean" description="clean up">
+ <delete dir="${build}"/>
+ </target>
+
+ <target name="init">
+ <tstamp/>
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="compile the source ">
+ <mkdir dir="${build}/classes"/>
+ <javac srcdir="${src}" destdir="${build}/classes" debug="true">
+ <classpath refid="build-prereqs"/>
+ </javac>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="generate the distribution">
+
+ <copy file="${dd}/jaxws-handlers-server.xml" todir="${build}/classes/org/jboss/jbossts/txbridge/demo/bistro"/>
+ <jar destfile="${build}/txbridge-demo-service.jar">
+ <metainf dir="${dd}" includes="persistence.xml"/>
+ <fileset dir="${build}/classes">
+ <include name="org/jboss/jbossts/txbridge/demo/bistro/*"/>
+ </fileset>
+ </jar>
+
+ <copy file="${dd}/jaxws-handlers-client.xml" todir="${build}/classes/org/jboss/jbossts/txbridge/demo/client"/>
+ <war warfile="${build}/txbridge-demo-client.war" webxml="${dd}/web.xml">
+ <classes dir="${build}/classes">
+ <include name="org/jboss/jbossts/txbridge/demo/client/*"/>
+ </classes>
+ <!-- jsp files -->
+ <fileset dir="${web}" includes="*.jsp"/>
+ </war>
+
+ </target>
+
+ <target name="deploy-service" depends="dist" description="deploy EJB to JBossAS">
+ <copy file="${build}/txbridge-demo-service.jar" todir="${jbossas.home}/server/${jbossas.server}/deploy"/>
+ </target>
+
+ <target name="deploy-client" depends="dist" description="deploy Servlet to JBossAS">
+ <copy file="${build}/txbridge-demo-client.war" todir="${jbossas.home}/server/${jbossas.server}/deploy"/>
+ </target>
+
+</project>
+
Added: labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-client.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-client.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-client.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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 Lesser General Public License, v. 2.1.
+ * 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 Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 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, 2009
+ * @author JBoss Inc.
+-->
+
+<!-- Client side config file for outbound bridging -->
+<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>
+
+ <!-- JSR 181 does not seem to directly define how the handler chain is constructed from this xml,
+ although JSR 109 6.2.2.3 seems to indicate the parser is required to maintain the declared ordering.
+
+ Since we need the OutboundBridgeHandler to be invoked before the HeaderContextProcessor,
+ we list them in that order -->
+
+ <handler>
+ <handler-name>TransactionBridgeHandler</handler-name>
+ <handler-class>org.jboss.jbossts.txbridge.JaxWSTxOutboundBridgeHandler</handler-class>
+ </handler>
+
+ <handler>
+ <handler-name>WebServicesTxContextHandler</handler-name>
+ <handler-class>com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor</handler-class>
+ </handler>
+
+ </handler-chain>
+</handler-chains>
Added: labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-server.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-server.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/dd/jaxws-handlers-server.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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 Lesser General Public License, v. 2.1.
+ * 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 Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 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, 2009
+ * @author JBoss Inc.
+-->
+
+<!-- Server side config file for inbound bridging -->
+<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>
+
+ <!-- JSR 181 does not seem to directly define how the handler chain is constructed from this xml,
+ although JSR 109 6.2.2.3 seems to indicate the parser is required to maintain the declared ordering.
+ JSR 224 9.3.2 says the constructed chain is then invoked in reverse order for inbound requests.
+ Since we need the HeaderContextProcessor to be invoked before the InboundBridgeHandler,
+ we therefore list the InboundBridgeHandler first -->
+
+ <handler>
+ <handler-name>TransactionBridgeHandler</handler-name>
+ <handler-class>org.jboss.jbossts.txbridge.JaxWSTxInboundBridgeHandler</handler-class>
+ </handler>
+
+ <handler>
+ <handler-name>WebServicesTxContextHandler</handler-name>
+ <handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class>
+ </handler>
+
+ </handler-chain>
+</handler-chains>
Added: labs/jbosstm/trunk/txbridge/demo/dd/persistence.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/dd/persistence.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/dd/persistence.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,14 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="bistro">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto"
+ value="create-drop"/>
+ </properties>
+ </persistence-unit>
+
+</persistence>
Added: labs/jbosstm/trunk/txbridge/demo/dd/web.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/dd/web.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/dd/web.xml 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,40 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2009, 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 Lesser General Public License, v. 2.1.
+ 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 Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+
+ (C) 2005-2009,
+ @author JBoss Inc.
+-->
+<web-app 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"
+ version="2.4">
+ <display-name>XML Transaction Bridge Demo Client</display-name>
+
+ <description>XML Transaction Bridge Demo Client</description>
+
+ <servlet>
+ <servlet-name>Basic Client Servlet</servlet-name>
+ <servlet-class>org.jboss.jbossts.txbridge.demo.client.BasicClient</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Basic Client Servlet</servlet-name>
+ <url-pattern>/basicclient</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/Bistro.java
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/Bistro.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/Bistro.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge.demo.bistro;
+
+/**
+ * Server side version of the business logic API.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+public interface Bistro
+{
+ public void bookSeats(int how_many);
+
+ public int getBookingCount();
+}
Added: labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroEntityImpl.java
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroEntityImpl.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroEntityImpl.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge.demo.bistro;
+
+import org.apache.log4j.Logger;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+
+/**
+ * EJB3 Entity Bean implementation of the business app state.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+ at Entity
+ at Table(name = "bistros")
+public class BistroEntityImpl implements Serializable
+{
+ private static Logger log = Logger.getLogger(BistroEntityImpl.class);
+
+ private int id;
+ private int bookingCount;
+
+ public BistroEntityImpl () { }
+
+ @Id
+ @GeneratedValue
+ public int getId ()
+ {
+ return id;
+ }
+
+ public void setId (int id)
+ {
+ this.id = id;
+ }
+
+ public int getBookingCount()
+ {
+ return bookingCount;
+ }
+
+ public void setBookingCount(int bookingCount)
+ {
+ this.bookingCount = bookingCount;
+ }
+
+ public void increaseBookingCount(int how_many)
+ {
+ setBookingCount( getBookingCount() + how_many );
+ }
+}
Added: labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroImpl.java
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroImpl.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/bistro/BistroImpl.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge.demo.bistro;
+
+import org.apache.log4j.Logger;
+
+import javax.ejb.*;
+import javax.persistence.*;
+import javax.jws.WebService;
+import javax.jws.WebMethod;
+import javax.jws.HandlerChain;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * A Bistro implementation that is exposed as a Web Service using JSR-181 annotations
+ * and uses an EJB3 Entity Bean (i.e. JPA) backend.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+ at Stateless
+ at Remote(Bistro.class)
+ at WebService()
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at HandlerChain(file = "jaxws-handlers-server.xml") // relative path from the class file
+ at TransactionAttribute(TransactionAttributeType.MANDATORY) // default is REQUIRED
+public class BistroImpl implements Bistro
+{
+ private static Logger log = Logger.getLogger(BistroImpl.class);
+
+ private static final int BISTRO_ID = 1;
+
+ @PersistenceContext
+ protected EntityManager em;
+
+ @WebMethod
+ public void bookSeats(int how_many)
+ {
+ log.debug("bookSeats(how_many="+how_many+")");
+
+ BistroEntityImpl entity = getBistroEntity();
+
+ entity.increaseBookingCount(how_many);
+ }
+
+ @WebMethod
+ public int getBookingCount()
+ {
+ log.debug("getBookedSeatCount()");
+
+ return getBistroEntity().getBookingCount();
+ }
+
+ private BistroEntityImpl getBistroEntity()
+ {
+ BistroEntityImpl entity = em.find(BistroEntityImpl.class, BISTRO_ID);
+ if(entity == null) {
+ entity = new BistroEntityImpl();
+ em.persist(entity);
+ }
+
+ return entity;
+ }
+}
Added: labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/BasicClient.java
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/BasicClient.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/BasicClient.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,233 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 Lesser General Public License, v. 2.1.
+ * 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 Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2009,
+ * @author JBoss Inc.
+ */
+/*
+ * BasicClient.java
+ *
+ * Copyright (c) 2003, 2004 Arjuna Technologies Ltd.
+ *
+ * $Id: BasicClient.java,v 1.10 2004/12/02 16:52:58 kconner Exp $
+ *
+ */
+package org.jboss.jbossts.txbridge.demo.client;
+
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor;
+import com.arjuna.wst.TransactionRolledBackException;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * A very basic client application that drives the tx bridge demo.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+public class BasicClient extends HttpServlet
+{
+ private ServletContext context;
+
+ private Bistro bistro;
+
+ /**
+ * Initialise the servlet.
+ * @param config The servlet configuration.
+ */
+ public void init(final ServletConfig config)
+ throws ServletException
+ {
+ try
+ {
+ URL wsdlLocation = new URL("http://localhost:8080/txbridge-demo-service/BistroImpl?wsdl");
+ QName serviceName = new QName("http://bistro.demo.txbridge.jbossts.jboss.org/", "BistroImplService");
+
+ Service service = Service.create(wsdlLocation, serviceName);
+ bistro = service.getPort(Bistro.class);
+
+ // we could have used @HandlerChain but it's nice to show a bit of variety...
+ BindingProvider bindingProvider = (BindingProvider)bistro;
+ List<Handler> handlers = new ArrayList<Handler>(1);
+ handlers.add(new JaxWSHeaderContextProcessor());
+ bindingProvider.getBinding().setHandlerChain(handlers);
+
+ context = config.getServletContext();
+
+ }
+ catch(Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+
+ /**
+ * Simple wrapper to allow our test method to be invoked when
+ * running in a servlet container, taking parameters from the
+ * request URL and displaying the outcome on the resulting html page.
+ *
+ * @param request
+ * @param response
+ * @throws ServletException
+ * @throws java.io.IOException
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ // get business logic params from the form submission.
+ int numberOfSeats = Integer.parseInt(request.getParameter("seats"));
+ String txType = request.getParameter("txType");
+
+ String result = "Transaction finished OK.";
+
+ try
+ {
+ if("AtomicTransaction".equals(txType))
+ {
+ testAtomicTransaction(numberOfSeats);
+ }
+ else if("JTA".equals(txType))
+ {
+ testJTATransaction(numberOfSeats);
+ }
+ else
+ {
+ result = "Unknown transaction type " + txType;
+ }
+ }
+ catch (final TransactionRolledBackException tre)
+ {
+ result = "Transaction rolled back." ;
+ System.out.println("Transaction rolled back") ;
+ }
+ catch (Exception e)
+ {
+ result = "Transaction failed! Cause: " + e.toString();
+ System.out.println("CLIENT: problem: ");
+ e.printStackTrace(System.out);
+ }
+
+ request.setAttribute("result", result);
+ context.getRequestDispatcher("/index.jsp").forward(request, response);
+ }
+
+ /**
+ * Run a simple WS-AT transaction involving a transactional Web Service
+ * that is configured with the inbound bridge. This client uses WS-AT type
+ * transaction handling, whilst the service understands JTA (XA) type.
+ * <p/>
+ * Note: due to the implementation of the transaction infrastructure,
+ * this method must be invoked with a web application container. It will
+ * not run correctly in a standalone java application.
+ *
+ * @param numberOfSeats the required number of seats
+ * @throws Exception for any unexpected errors, such as a failure to commit.
+ */
+ private void testAtomicTransaction(int numberOfSeats) throws Exception
+ {
+ System.out.println("CLIENT: obtaining userTransaction...");
+
+ com.arjuna.mw.wst11.UserTransaction ut = UserTransactionFactory.userTransaction();
+
+ System.out.println("CLIENT: starting the transaction...");
+
+ ut.begin();
+
+ System.out.println("CLIENT: transaction ID= " + ut.toString());
+
+ System.out.println("CLIENT: calling business Web Services...");
+
+ //////////////////////
+
+ System.out.println("CLIENT: bookingCount: "+bistro.getBookingCount());
+
+ bistro.bookSeats(numberOfSeats);
+
+ System.out.println("CLIENT: bookingCount: "+bistro.getBookingCount());
+
+ //////////////////////
+
+ System.out.println("CLIENT: calling commit on the transaction...");
+
+ ut.commit();
+
+ System.out.println("done.");
+ System.out.flush();
+ }
+
+ /**
+ * Run a simple JTA transaction involving a transactional Web Service,
+ * with communication passing though the outbound bridge. This client
+ * uses JTA (XA) type transaction handling, whilst the service understands
+ * WS-AT type only.
+ * <p/>
+ * Note: due to the implementation of the transaction infrastructure,
+ * this method must be invoked with a web application container. It will
+ * not run correctly in a standalone java application.
+ *
+ * @param numberOfSeats the required number of seats
+ * @throws Exception for any unexpected errors, such as a failure to commit.
+ */
+ private void testJTATransaction(int numberOfSeats) throws Exception
+ {
+ System.out.println("CLIENT: Obtaining userTransaction...");
+
+ Context initialContext = new InitialContext();
+ javax.transaction.UserTransaction ut = (javax.transaction.UserTransaction)initialContext.lookup("java:comp/UserTransaction");
+
+ System.out.println("CLIENT: starting the transaction...");
+
+ ut.begin();
+
+ System.out.println("CLIENT: transaction ID= "+ ut);
+
+ // we reuse the existing WS-AT aware service from the XTS demo app
+ URL wsdlLocation = new URL("http://localhost:8080/xtsdemowebservices/RestaurantServiceAT?wsdl");
+ QName serviceName = new QName("http://www.jboss.com/jbosstm/xts/demo/Restaurant", "RestaurantServiceATService");
+ Service service = Service.create(wsdlLocation, serviceName);
+
+ // use a modified client interface with @HandlerChain configured on it.
+ Restaurant restaurant = service.getPort(Restaurant.class);
+
+ System.out.println("CLIENT: calling business Web Services...");
+
+ restaurant.bookSeats(numberOfSeats);
+
+ System.out.println("CLIENT: calling commit on the transaciton...");
+
+ ut.commit();
+
+ System.out.println("done");
+ System.out.flush();
+ }
+}
Added: labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Bistro.java
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Bistro.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Bistro.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge.demo.client;
+
+import javax.jws.WebService;
+import javax.jws.HandlerChain;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Client side version of the business logic API.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+ at WebService
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Bistro
+{
+ public void bookSeats(int how_many);
+
+ public int getBookingCount();
+}
Added: labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Restaurant.java
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Restaurant.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/src/org/jboss/jbossts/txbridge/demo/client/Restaurant.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,14 @@
+package org.jboss.jbossts.txbridge.demo.client;
+
+import javax.jws.WebService;
+import javax.jws.HandlerChain;
+import javax.jws.WebParam;
+import javax.jws.soap.SOAPBinding;
+
+ at WebService
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at HandlerChain(file = "jaxws-handlers-client.xml") // relative path from the class file
+public interface Restaurant
+{
+ public void bookSeats(@WebParam(name = "how_many", partName = "how_many")int how_many);
+}
Added: labs/jbosstm/trunk/txbridge/demo/web/index.jsp
===================================================================
--- labs/jbosstm/trunk/txbridge/demo/web/index.jsp (rev 0)
+++ labs/jbosstm/trunk/txbridge/demo/web/index.jsp 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ -->
+
+<head>
+ <title>JBossTS Transaction Bridge Demo</title>
+</head>
+
+<body style="margin-left: 10pt">
+
+ <h1>JBossTS Transaction Bridge Demo</h1>
+
+ <form method="GET" action="basicclient">
+
+ <% if(null != request.getAttribute("result")) { %>
+ <!-- tx result panel -->
+ <p>Transaction Result: <%= request.getAttribute("result") %></p>
+ <% } // end if %>
+
+ <p>Number of seats to book:
+ <select name="seats">
+ <option>1</option>
+ <option>2</option>
+ <option>3</option>
+ <option>4</option>
+ <option>5</option>
+ <option>6</option>
+ <option>7</option>
+ <option>8</option>
+ <option>9</option>
+ <option>10</option>
+ </select>
+ </p>
+
+ <p>Parent Transaction Type:
+ <select name="txType">
+ <option value="AtomicTransaction">WS-AT</option>
+ <option value="JTA">JTA (requires XTS demo services)</option>
+ </select>
+ </p>
+
+ <p>
+ <input type="submit" name="submit" value="Submit Booking" />
+ </p>
+
+ </form>
+
+</body>
+
+</html>
+
Property changes on: labs/jbosstm/trunk/txbridge/demo/web/index.jsp
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/trunk/txbridge/docs/TransactionBridgingGuide.odt
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/trunk/txbridge/docs/TransactionBridgingGuide.odt
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/trunk/txbridge/docs/TransactionBridgingGuide.pdf
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/trunk/txbridge/docs/TransactionBridgingGuide.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeParticipantAT.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeParticipantAT.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeParticipantAT.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge;
+
+import com.arjuna.wst.*;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinationManager;
+import org.apache.log4j.Logger;
+
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+
+import javax.resource.spi.XATerminator;
+
+import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * Provides method call mapping between WS-AT Participant interface
+ * and an underlying JTA subtransaction coordinator.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+public class BridgeParticipantAT implements Durable2PCParticipant, Serializable
+{
+ private static Logger log = Logger.getLogger(BridgeParticipantAT.class);
+
+ /*
+ * Uniq String used to prefix ids at participant registration,
+ * so that the recovery module can identify relevant instances.
+ */
+ public static String TYPE_IDENTIFIER = "BridgeParticipantAT_";
+
+ private transient XATerminator xaTerminator;
+
+ private transient String externalTxId;
+
+ static final long serialVersionUID = -5739871936627778072L;
+
+ // Xid not guarateed Serializable by spec, but our XidImple happens to be
+ private Xid xid;
+
+ // Id needed for recovery of the subordinate tx. Uids are likewise Serializable.
+ private Uid subordinateTransactionId;
+
+ /**
+ * Create a new WS-AT Participant which wraps the subordinate XA tx terminator.
+ *
+ * @param externalTxId the WS-AT Tx identifier
+ * @param xid the Xid to use when driving the subordinate XA transaction.
+ */
+ BridgeParticipantAT(String externalTxId, Xid xid)
+ {
+ log.trace("BridgeParticipantAT(TxId="+externalTxId+", Xid="+xid+")");
+
+ this.xid = xid;
+ this.externalTxId = externalTxId;
+ xaTerminator = SubordinationManager.getXATerminator();
+ }
+
+ /**
+ * Serialization hook. Gathers and writes information needed for transaction recovery.
+ *
+ * @param out the strean to which the object state is serialized.
+ * @throws IOException if serialization fails.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException
+ {
+ log.trace("writeObject() for Xid="+xid);
+
+ // we need to preserve the Uid of the underlying SubordinateTx, as it's required
+ // to get a handle on it again during recovery, Using the xid wont work,
+ // although we do need to serialize that too for use after recovery.
+ try
+ {
+ subordinateTransactionId = SubordinationManager.getTransactionImporter().getImportedTransaction(xid).get_uid();
+ }
+ catch(XAException xaException)
+ {
+ log.error("Unable to get subordinate transaction id", xaException);
+ IOException ioException = new IOException("Unable to serialize");
+ ioException.initCause(xaException);
+ throw ioException;
+ }
+
+ out.defaultWriteObject();
+ }
+
+ /**
+ * Deserialization hook. Unpacks transaction recovery information and uses it to
+ * recover the subordinate transaction.
+ *
+ * @param in the strean from which to unpack the object state.
+ * @throws IOException if deserialzation and recovery fail.
+ * @throws ClassNotFoundException if deserialzation fails.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ log.trace("readObject()");
+
+ in.defaultReadObject();
+ xaTerminator = SubordinationManager.getXATerminator();
+
+ try
+ {
+ SubordinationManager.getTransactionImporter().recoverTransaction(subordinateTransactionId);
+ }
+ catch(XAException xaException)
+ {
+ log.error("Unable to recover subordinate transaction id="+subordinateTransactionId, xaException);
+ IOException ioException = new IOException("unable to deserialize");
+ ioException.initCause(xaException);
+ throw ioException;
+ }
+ }
+
+ /**
+ * Perform any work necessary to allow it to either commit or rollback
+ * the work performed by the Web service under the scope of the
+ * transaction. The implementation is free to do whatever it needs to in
+ * order to fulfill the implicit contract between it and the coordinator.
+ *
+ * @return an indication of whether it can prepare or not.
+ * @see com.arjuna.wst.Vote
+ */
+ public Vote prepare() throws WrongStateException, SystemException
+ {
+ log.trace("prepare(Xid="+xid+")");
+
+ try
+ {
+ // XAResource.XA_OK, XAResource.XA_RDONLY or exception. if RDONLY, don't call commit
+ int result = xaTerminator.prepare(xid);
+ if(result == XAResource.XA_OK)
+ {
+ log.debug("prepare on Xid="+xid+" returning Prepared");
+ return new Prepared();
+ }
+ else
+ {
+ InboundBridgeManager.removeMapping(externalTxId);
+ log.debug("prepare on Xid="+xid+" returning ReadOnly");
+ return new ReadOnly();
+ }
+
+ }
+ catch(XAException e)
+ {
+ InboundBridgeManager.removeMapping(externalTxId);
+ log.warn("prepare on Xid="+xid+" returning Aborted", e);
+ return new Aborted();
+ }
+ }
+
+ /**
+ * The participant should make permanent the work that it controls.
+ *
+ * @throws WrongStateException
+ * @throws SystemException
+ */
+ public void commit() throws WrongStateException, SystemException
+ {
+ log.trace("commit(Xid="+xid+")");
+
+ try
+ {
+ xaTerminator.commit(xid, false);
+ log.debug("commit on Xid="+xid+" OK");
+ }
+ catch (XAException e)
+ {
+ log.error("commit on Xid="+xid+" failed", e);
+ }
+ finally
+ {
+ InboundBridgeManager.removeMapping(externalTxId);
+ }
+ }
+
+ /**
+ * The participant should undo the work that it controls. The participant
+ * will then return an indication of whether or not it succeeded..
+ *
+ * @throws WrongStateException
+ * @throws SystemException
+ */
+ public void rollback() throws WrongStateException, SystemException
+ {
+ log.trace("rollback(Xid="+xid+")");
+
+ try
+ {
+ xaTerminator.rollback(xid);
+ log.debug("rollback on Xid="+xid+" OK");
+ }
+ catch (XAException e)
+ {
+ log.error("rollback on Xid="+xid+" failed", e);
+ }
+ finally
+ {
+ InboundBridgeManager.removeMapping(externalTxId);
+ }
+ }
+
+ /**
+ * During recovery the participant can enquire as to the status of the
+ * transaction it was registered with. If that transaction is no longer
+ * available (has rolled back) then this operation will be invoked by the
+ * coordination service.
+ */
+ public void unknown() throws SystemException
+ {
+ log.trace("unknown(Xid="+xid+"): NOT IMPLEMENTED");
+ }
+
+ /**
+ * During recovery the participant can enquire as to the status of the
+ * transaction it was registered with. If an error occurs (e.g., the
+ * transaction service is unavailable) then this operation will be invoked.
+ */
+ public void error() throws SystemException
+ {
+ log.trace("error(Xid="+xid+"): NOT IMPLEMENTED");
+ }
+}
+
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeRecoveryManager.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeRecoveryManager.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeRecoveryManager.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2009 @author Red Hat Middleware LLC
+ */
+package org.jboss.jbossts.txbridge;
+
+import org.apache.log4j.Logger;
+import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryModule;
+import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager;
+import com.arjuna.wst.Durable2PCParticipant;
+
+import java.io.ObjectInputStream;
+
+/**
+ * Integrates with JBossAS 5 MC lifecycle to provide recovery services.
+ *
+ * @author jonathan.halliday at redhat.com, 2009-02-10
+ */
+public class BridgeRecoveryManager implements XTSATRecoveryModule
+{
+ private static Logger log = Logger.getLogger(BridgeRecoveryManager.class);
+
+ /**
+ * MC lifecycle callback, used to register the recovery module with the transaction manager.
+ */
+ public void start()
+ {
+ log.info("BridgeRecoveryManager starting");
+
+ XTSATRecoveryManager.getRecoveryManager().registerRecoveryModule(this);
+ }
+
+ /**
+ * MC lifecycle callback, used to unregister the recovery module from the transaction manager.
+ */
+ public void stop()
+ {
+ log.info("BridgeRecoveryManager stopping");
+
+ XTSATRecoveryManager.getRecoveryManager().unregisterRecoveryModule(this);
+ }
+
+ /**
+ * Called during recovery processing to allow an application to identify a participant id
+ * belonging to one of its participants and recreate the participant by deserializing
+ * it from the supplied object input stream. n.b. this is only appropriate in case the
+ * participant was originally saved using serialization.
+ *
+ * @param id the id used when the participant was created
+ * @param objectInputStream a stream from which the application should deserialise the participant
+ * if it recognises that the id belongs to the module's application
+ * @return the deserialized Participant object
+ * @throws Exception if an error occurs deserializing the durable participant
+ */
+ public Durable2PCParticipant deserialize(String id, ObjectInputStream objectInputStream) throws Exception
+ {
+ log.trace("deserialize(id="+id+")");
+
+ if(id.startsWith(BridgeParticipantAT.TYPE_IDENTIFIER))
+ {
+ Object participant = objectInputStream.readObject();
+ return (BridgeParticipantAT)participant;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Unused recovery callback. We use serialization instead, so this method will always throw an exception if called.
+ */
+ public Durable2PCParticipant recreate(String s, byte[] bytes) throws Exception
+ {
+ throw new Exception("recreation not supported - should use deserialization instead.");
+ }
+}
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeXAResource.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeXAResource.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/BridgeXAResource.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,233 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2009 @author Red Hat Middleware LLC
+ */
+package org.jboss.jbossts.txbridge;
+
+import org.apache.log4j.Logger;
+import org.jboss.jbossts.xts.bridge.at.BridgeWrapper;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.coordinator.TwoPhaseOutcome;
+
+/**
+ * Provides method call mapping between JTA parent coordinator and WS-AT subordinate transaction.
+ *
+ * @author jonathan.halliday at redhat.com, 2009-02-10
+ */
+public class BridgeXAResource implements XAResource
+{
+ // Design note: Given the way JBossTS is designed, we could subclass AbstractRecord rather than
+ // implementing XAResource, but this design is more standards friendly and thus portable.
+
+ private static Logger log = Logger.getLogger(BridgeXAResource.class);
+
+ private transient BridgeWrapper bridgeWrapper;
+
+ private transient Uid externalTxId;
+
+ /**
+ * Create a new XAResource which wraps the subordinate WS-AT transaction.
+ *
+ * @param externalTxId the parent JTA transaction identifier.
+ * @param bridgeWrapper the control for the subordinate WS-AT transaction.
+ */
+ public BridgeXAResource(Uid externalTxId, BridgeWrapper bridgeWrapper)
+ {
+ log.trace("BridgeXARresource(TxId="+externalTxId+", BridgeWrapper="+bridgeWrapper+")");
+
+ this.externalTxId = externalTxId;
+ this.bridgeWrapper = bridgeWrapper;
+ }
+
+ /**
+ * Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
+ *
+ * @param xid A global transaction identifier
+ * @return A value indicating the resource manager's vote on the outcome of the transaction
+ * @throws XAException
+ */
+ public int prepare(Xid xid) throws XAException
+ {
+ log.trace("prepare(Xid="+xid+")");
+
+ // TwoPhaseOutcome needs converting to XAResource rtn type.
+ int twoPhaseOutcome = bridgeWrapper.prepare();
+
+ log.trace("prepare TwoPhaseOutcome is "+twoPhaseOutcome+"/"+TwoPhaseOutcome.stringForm(twoPhaseOutcome));
+
+ switch(twoPhaseOutcome)
+ {
+ case TwoPhaseOutcome.PREPARE_OK:
+ log.trace("prepare returning XAResource.XA_OK");
+ return XAResource.XA_OK;
+ case TwoPhaseOutcome.PREPARE_READONLY:
+ OutboundBridgeManager.removeMapping(externalTxId);
+ log.trace("prepare returning XAResource.XA_RDONLY");
+ return XAResource.XA_RDONLY;
+ default:
+ // TODO more find-grained error type handling
+ log.trace("prepare TwoPhaseOutcome is "+twoPhaseOutcome+"/"+
+ TwoPhaseOutcome.stringForm(twoPhaseOutcome)+", throwing XAException...");
+ XAException xaException = new XAException("unexpected oucome: "+TwoPhaseOutcome.stringForm(twoPhaseOutcome));
+ xaException.errorCode = XAException.XA_RBROLLBACK;
+ throw xaException;
+ }
+ }
+
+ /**
+ * Informs the resource manager to roll back work done on behalf of a transaction branch.
+ *
+ * @param xid A global transaction identifier
+ * @throws XAException
+ */
+ public void rollback(Xid xid) throws XAException
+ {
+ log.trace("rollback(Xid="+xid+")");
+
+ try
+ {
+ bridgeWrapper.rollback();
+ }
+ finally
+ {
+ OutboundBridgeManager.removeMapping(externalTxId);
+ }
+ }
+
+ /**
+ * Commits the global transaction specified by xid.
+ *
+ * @param xid A global transaction identifier
+ * @param onePhase
+ * @throws XAException
+ */
+ public void commit(Xid xid, boolean onePhase) throws XAException
+ {
+ log.trace("commit(Xid="+xid+", onePhase="+onePhase+")");
+
+ try
+ {
+ if(onePhase)
+ {
+ // no shortcuts, we have to do prepare anyhow
+ if(prepare(xid) == XAResource.XA_RDONLY)
+ {
+ return;
+ }
+ }
+
+ bridgeWrapper.commit();
+ }
+ finally
+ {
+ OutboundBridgeManager.removeMapping(externalTxId);
+ }
+ }
+
+ /**
+ * Starts work on behalf of a transaction branch specified in xid.
+ *
+ * @param xid A global transaction identifier
+ * @param flags
+ * @throws XAException
+ */
+ public void start(Xid xid, int flags) throws XAException
+ {
+ log.trace("start(Xid="+xid+", flags="+flags+")");
+
+ // do nothing
+ }
+
+ /**
+ * Ends the work performed on behalf of a transaction branch.
+ *
+ * @param xid A global transaction identifier
+ * @param flags
+ * @throws XAException
+ */
+ public void end(Xid xid, int flags) throws XAException
+ {
+ log.trace("end(Xid="+xid+", flags="+flags+")");
+
+ // do nothing
+ }
+
+ public boolean isSameRM(XAResource xaResource) throws XAException
+ {
+ log.trace("isSameRM(XAResource="+xaResource+")");
+
+ return false; // TODO
+ }
+
+ public void forget(Xid xid) throws XAException
+ {
+ log.trace("forget(Xid="+xid+")");
+
+ // TODO
+ }
+
+ /**
+ * Obtains a list of prepared transaction branches from a resource manager.
+ *
+ * @param flag
+ * @return
+ * @throws XAException
+ */
+ public Xid[] recover(int flag) throws XAException
+ {
+ log.trace("recover(flag="+flag+")");
+
+ return new Xid[0]; // TODO
+ }
+
+ /**
+ * Sets the current transaction timeout value for this XAResource instance.
+ *
+ * @param seconds - The transaction timeout value in seconds.
+ * @return true if the transaction timeout value is set successfully; otherwise false.
+ * @throws XAException
+ */
+ public boolean setTransactionTimeout(int seconds) throws XAException
+ {
+ log.trace("setTransactionTimeout(seconds="+seconds+")");
+
+ return false; // TODO
+ }
+
+ /**
+ * Obtains the current transaction timeout value set for this XAResource instance.
+ *
+ * @return the transaction timeout value in seconds.
+ * @throws XAException
+ */
+ public int getTransactionTimeout() throws XAException
+ {
+ log.trace("getTransactionTimeout()");
+
+ return 0; // TODO
+ }
+}
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridge.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridge.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridge.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge;
+
+import com.arjuna.ats.jta.TransactionManager;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinationManager;
+
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.Transaction;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Manages Thread association of the interposed coordinator.
+ * Typically called from handlers in the WS stack.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+public class InboundBridge
+{
+ private static Logger log = Logger.getLogger(InboundBridge.class);
+
+ /**
+ * Identifier for the subordinate transaction.
+ */
+ private Xid xid;
+
+ /**
+ * Create a new InboundBridge to manage the given subordinate JTA transaction.
+ *
+ * @param xid the subordinate transaction id
+ * @throws XAException
+ * @throws SystemException
+ */
+ InboundBridge(Xid xid) throws XAException, SystemException
+ {
+ log.trace("InboundBridge(Xid="+xid+")");
+
+ this.xid = xid;
+
+ getTransaction(); // ensures transaction is initialized
+ }
+
+ /**
+ * Associate the JTA transaction to the current Thread.
+ * Typically used by a server side inbound handler.
+ *
+ * @throws XAException
+ * @throws SystemException
+ * @throws InvalidTransactionException
+ */
+ public void start() throws XAException, SystemException, InvalidTransactionException
+ {
+ log.trace("start(Xid="+xid+")");
+
+ Transaction tx = getTransaction();
+
+ TransactionManager.transactionManager().resume(tx);
+ }
+
+ /**
+ * Disassociate the JTA transaction from the current Thread.
+ * Typically used by a server side outbound handler.
+ *
+ * @throws XAException
+ * @throws SystemException
+ * @throws InvalidTransactionException
+ */
+ public void stop() throws XAException, SystemException, InvalidTransactionException
+ {
+ log.trace("stop("+xid+")");
+
+ TransactionManager.transactionManager().suspend();
+ }
+
+ /**
+ * Get the JTA Transaction which corresponds to the Xid of the instance.
+ *
+ * @return
+ * @throws XAException
+ * @throws SystemException
+ */
+ private Transaction getTransaction()
+ throws XAException, SystemException
+ {
+ Transaction tx = SubordinationManager.getTransactionImporter().importTransaction(xid);
+
+ switch (tx.getStatus())
+ {
+ // TODO: other cases?
+
+ case Status.STATUS_ACTIVE:
+ case Status.STATUS_MARKED_ROLLBACK:
+ break;
+ default:
+ throw new IllegalStateException("Transaction not in state ACTIVE");
+ }
+ return tx;
+ }
+}
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridgeManager.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridgeManager.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/InboundBridgeManager.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge;
+
+import com.arjuna.ats.jta.xa.XidImple;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+
+import com.arjuna.mw.wst11.TransactionManagerFactory;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wsc.AlreadyRegisteredException;
+
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Maintains the mapping data that relates WS-AT transactions to JTA subordinate transactions and related objects.
+ *
+ * The mappings are scoped to the singleton instance of this class and its lifetime.
+ * This poses problems where you have more than one instances (classloading, clusters)
+ * or where you need crash recovery. It short, it's rather limited.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+public class InboundBridgeManager
+{
+ private static Logger log = Logger.getLogger(InboundBridgeManager.class);
+
+ // maps WS-AT Tx Id to InboundBridge instance.
+ private static ConcurrentMap<String, InboundBridge> inboundBridgeMappings = new ConcurrentHashMap<String, InboundBridge>();
+
+ /**
+ * Return an InboundBridge instance that maps the current Thread's WS transaction context
+ * to a JTA context. Control of the latter is provided by the returned instance.
+ *
+ * @return an InboundBridge corresponding to the calling Thread's current WS-AT transaction context.
+ * @throws WrongStateException
+ * @throws UnknownTransactionException
+ * @throws com.arjuna.wst.SystemException
+ * @throws AlreadyRegisteredException
+ */
+ public static InboundBridge getInboundBridge()
+ throws XAException, WrongStateException, UnknownTransactionException,
+ com.arjuna.wst.SystemException, javax.transaction.SystemException, AlreadyRegisteredException
+ {
+ log.trace("getInboundBridge()");
+
+ String externalTxId = UserTransactionFactory.userTransaction().toString();
+
+ if(!inboundBridgeMappings.containsKey(externalTxId)) {
+ createMapping(externalTxId);
+ }
+
+ return inboundBridgeMappings.get(externalTxId);
+ }
+
+ /**
+ * Remove the mapping for the given externalTxId. This should be called for gc when the tx is finished.
+ *
+ * @param externalTxId The WS-AT tx identifier.
+ */
+ public static synchronized void removeMapping(String externalTxId)
+ {
+ log.trace("removeMapping(externalTxId="+externalTxId+")");
+
+ if(externalTxId != null) {
+ inboundBridgeMappings.remove(externalTxId);
+ }
+ }
+
+ /**
+ * Create the JTA transaction mapping and support objects for a given WS transaction context.
+ *
+ * @param externalTxId The WS-AT tx identifier.
+ * @throws WrongStateException
+ * @throws UnknownTransactionException
+ * @throws com.arjuna.wst.SystemException
+ * @throws AlreadyRegisteredException
+ */
+ private static synchronized void createMapping(String externalTxId)
+ throws XAException, WrongStateException, UnknownTransactionException,
+ com.arjuna.wst.SystemException, javax.transaction.SystemException, AlreadyRegisteredException
+ {
+ log.trace("createMapping(externalTxId="+externalTxId+")");
+
+ if(inboundBridgeMappings.containsKey(externalTxId)) {
+ return;
+ }
+
+ // Xid for driving the subordinate,
+ // shared by the bridge (thread assoc) and Participant (termination via XATerminator)
+ Xid xid = new XidImple(new Uid());
+
+ BridgeParticipantAT bridgeParticipantAT = new BridgeParticipantAT(externalTxId, xid);
+
+ // construct the participantId in such as way as we can recognise it at recovery time:
+ String participantId = BridgeParticipantAT.TYPE_IDENTIFIER+new Uid().toString();
+ TransactionManagerFactory.transactionManager().enlistForDurableTwoPhase(bridgeParticipantAT, participantId);
+
+ inboundBridgeMappings.put(externalTxId, new InboundBridge(xid));
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxInboundBridgeHandler.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxInboundBridgeHandler.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxInboundBridgeHandler.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2007, 2009 @author JBoss Inc
+ */
+package org.jboss.jbossts.txbridge;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A handler that sits in the server side JAX-WS processing pipeline between the XTS header
+ * context processor and the web service. Takes the WS transaction context provided by the
+ * former and maps it to a JTA transaction context for use by the latter. Handles Thread
+ * association of the JTA context.
+ *
+ * Note: we assume that there is a web services transaction context present and
+ * that the service needs a JTA context. The handler should not be registered on
+ * methods unless both these conditions hold.
+ *
+ * @author jonathan.halliday at redhat.com, 2007-04-30
+ */
+public class JaxWSTxInboundBridgeHandler implements Handler
+{
+ private static Logger log = Logger.getLogger(JaxWSTxInboundBridgeHandler.class);
+
+ /**
+ * Process a message. Determines if it is inbound or outbound and dispatches accordingly.
+ *
+ * @param msgContext the context to process
+ * @return true on success, false on error
+ */
+ public boolean handleMessage(MessageContext msgContext)
+ {
+ log.trace("handleMessage()");
+
+ 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);
+ }
+
+ /**
+ * Tidy up the Transaction/Thread association before faults are thrown back to the client.
+ *
+ * @param messageContext unused
+ * @return true on success, false on error
+ */
+ public boolean handleFault(MessageContext messageContext)
+ {
+ log.trace("handleFault()");
+
+ return suspendTransaction();
+ }
+
+ public void close(MessageContext messageContext)
+ {
+ log.trace("close()");
+ }
+
+ /**
+ * Process inbound messages by mapping the WS transaction context
+ * to a JTA one and associating the latter to the current Thread.
+ *
+ * @param msgContext unused
+ * @return true on success, false on error
+ */
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.trace("handleInbound()");
+
+ try
+ {
+ InboundBridge inboundBridge = InboundBridgeManager.getInboundBridge();
+ inboundBridge.start();
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Tidy up the Transaction/Thread association before returning a message to the client.
+ *
+ * @param msgContext unused
+ * @return true on success, false on error
+ */
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.trace("handleOutbound()");
+
+ return suspendTransaction();
+ }
+
+ /**
+ * Break the association between the JTA transaction context and the calling Thread.
+ *
+ * @return true on success, false on error
+ */
+ private boolean suspendTransaction()
+ {
+ log.trace("suspendTransaction()");
+
+ try
+ {
+ InboundBridge inboundBridge = InboundBridgeManager.getInboundBridge();
+ inboundBridge.stop();
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxOutboundBridgeHandler.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxOutboundBridgeHandler.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/JaxWSTxOutboundBridgeHandler.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2009 @author Red Hat Middleware LLC
+ */
+package org.jboss.jbossts.txbridge;
+
+import org.apache.log4j.Logger;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * A handler that sits in the client side JAX-WS processing pipeline between the application
+ * and the XTS header context processor. Takes the JTA transaction context provided by the
+ * former and maps it to a WS-AT transaction context for use by the latter. Handles Thread
+ * association of the WS-AT context.
+ *
+ * Note: we assume that there is a JTA transaction context present and
+ * that the service needs a WS-AT context. The handler should not be registered on
+ * methods unless both these conditions hold.
+ *
+ * @author jonathan.halliday at redhat.com, 2009-02-10
+ */
+public class JaxWSTxOutboundBridgeHandler implements Handler
+{
+ private static Logger log = Logger.getLogger(JaxWSTxOutboundBridgeHandler.class);
+
+ /**
+ * Process a message. Determines if it is inbound or outbound and dispatches accordingly.
+ *
+ * @param msgContext the context to process
+ * @return true on success, false on error
+ */
+ public boolean handleMessage(MessageContext msgContext)
+ {
+ log.trace("handleMessage()");
+
+ 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);
+ }
+
+ /**
+ * Tidy up the Transaction/Thread association before faults are thrown back to the client.
+ *
+ * @param messageContext unused
+ * @return true on success, false on error
+ */
+ public boolean handleFault(MessageContext messageContext)
+ {
+ log.trace("handleFault()");
+
+ return suspendTransaction();
+ }
+
+ public void close(MessageContext messageContext)
+ {
+ log.trace("close()");
+ }
+
+ /**
+ * Tidy up the Transaction/Thread association before returning a message to the client.
+ *
+ * @param msgContext unused
+ * @return true on success, false on error
+ */
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.trace("handleInbound()");
+
+ return suspendTransaction();
+ }
+
+ /**
+ * Process outbound messages by mapping the JTA transaction context
+ * to a WS-AT one and associating the latter to the current Thread.
+ *
+ * @param msgContext unused
+ * @return true on success, false on error
+ */
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.trace("handleOutbound()");
+
+ try
+ {
+ OutboundBridge outboundBridge = OutboundBridgeManager.getOutboundBridge();
+ outboundBridge.start();
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Break the association between the WS-AT transaction context and the calling Thread.
+ *
+ * @return true on success, false on error
+ */
+ private boolean suspendTransaction()
+ {
+ log.trace("suspendTransaction()");
+
+ try
+ {
+ OutboundBridge outboundBridge = OutboundBridgeManager.getOutboundBridge();
+ outboundBridge.stop();
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridge.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridge.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridge.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2009 @author Red Hat Middleware LLC
+ */
+package org.jboss.jbossts.txbridge;
+
+import org.apache.log4j.Logger;
+import org.jboss.jbossts.xts.bridge.at.BridgeWrapper;
+import com.arjuna.mw.wst11.TransactionManagerFactory;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.UnknownTransactionException;
+
+/**
+ * Manages Thread association of the interposed coordinator.
+ * Typically called from handlers in the WS stack.
+ *
+ * @author jonathan.halliday at redhat.com, 2009-02-10
+ */
+public class OutboundBridge
+{
+ private static Logger log = Logger.getLogger(OutboundBridge.class);
+
+ /**
+ * Management object for the subordinate transaction
+ */
+ private BridgeWrapper bridgeWrapper;
+
+ /**
+ * Create a new OutboundBridge to manage the given subordinate WS-AT transaction.
+ *
+ * @param bridgeWrapper the subordinate transaction controller
+ */
+ public OutboundBridge(BridgeWrapper bridgeWrapper)
+ {
+ log.trace("OutboundBridge(BridgeWrapper="+bridgeWrapper+")");
+
+ this.bridgeWrapper = bridgeWrapper;
+ }
+
+ /**
+ * Associate the WS-AT transaction to the current Thread.
+ * Typically used by the client side outbound handler.
+ *
+ * @throws UnknownTransactionException
+ * @throws SystemException
+ */
+ public void start() throws UnknownTransactionException, SystemException
+ {
+ log.trace("start(BridgeWrapper="+bridgeWrapper+")");
+
+ TxContext txContext = bridgeWrapper.getContext();
+
+ TransactionManagerFactory.transactionManager().resume(txContext);
+ }
+
+ /**
+ * Disassociate the WS-AT transaction from the current Thread.
+ * Typically used by the client side inbound handler.
+ *
+ * @throws SystemException
+ */
+ public void stop() throws SystemException
+ {
+ log.trace("stop(BridgeWrapper="+bridgeWrapper+")");
+
+ TransactionManagerFactory.transactionManager().suspend();
+ }
+}
Added: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridgeManager.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridgeManager.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/OutboundBridgeManager.java 2009-04-16 16:36:29 UTC (rev 26071)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * (C) 2009 @author Red Hat Middleware LLC
+ */
+package org.jboss.jbossts.txbridge;
+
+import com.arjuna.ats.jta.TransactionManager;
+import com.arjuna.ats.jta.transaction.Transaction;
+import com.arjuna.ats.arjuna.common.Uid;
+
+import javax.transaction.SystemException;
+import javax.transaction.RollbackException;
+import javax.transaction.xa.XAResource;
+
+import org.apache.log4j.Logger;
+import org.jboss.jbossts.xts.bridge.at.BridgeWrapper;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Maintains the mapping data that relates JTA transactions to WS-AT subordinate transactions and related objects.
+ *
+ * The mappings are scoped to the singleton instance of this class and its lifetime.
+ * This poses problems where you have more than one instances (classloading, clusters)
+ * or where you need crash recovery. It short, it's rather limited.
+ *
+ * @author jonathan.halliday at redhat.com, 2009-02-10
+ */
+public class OutboundBridgeManager
+{
+ private static Logger log = Logger.getLogger(OutboundBridgeManager.class);
+
+ // maps JTA Tx Id to OutboundBridge instance.
+ private static ConcurrentMap<Uid, OutboundBridge> outboundBridgeMappings = new ConcurrentHashMap<Uid, OutboundBridge>();
+
+ /**
+ * Return an OutboundBridge instance that maps the current Thread's JTA transaction context
+ * to a WS-AT transaction context. Control of the latter is provided by the returned instance.
+ *
+ * @return as OutboundBridge corresponding to the calling Thread's current JTA transaction context.
+ */
+ public static OutboundBridge getOutboundBridge()
+ {
+ log.trace("getOutboundBridge()");
+
+ try {
+ Transaction transaction = (Transaction)TransactionManager.transactionManager().getTransaction();
+
+ Uid externalTxId = transaction.get_uid();
+
+ if(!outboundBridgeMappings.containsKey(externalTxId)) {
+ createMapping(transaction, externalTxId);
+ }
+
+ return outboundBridgeMappings.get(externalTxId);
+
+ } catch(SystemException e) {
+ log.error("problem", e);
+ }
+
+ return null;
+ }
+
+ /**
+ * Remove the mapping for the given externalTxId. This should be called for gc when the tx is finished.
+ *
+ * @param externalTxId The JTA transaction identifier.
+ */
+ public static synchronized void removeMapping(Uid externalTxId)
+ {
+ log.trace("removeMapping(externalTxId="+externalTxId+")");
+
+ if(externalTxId != null) {
+ outboundBridgeMappings.remove(externalTxId);
+ }
+ }
+
+ /**
+ * Create a WS-AT transaction mapping and support objects for a given JTA transaction context.
+ *
+ * @param externalTxId The JTA transaction identifier.
+ * @throws SystemException
+ */
+ private static synchronized void createMapping(Transaction transaction, Uid externalTxId) throws SystemException
+ {
+ log.trace("createmapping(externalTxId="+externalTxId+")");
+
+ if(outboundBridgeMappings.containsKey(externalTxId)) {
+ return;
+ }
+
+ // TODO: allow params to be configurable, or at least pass timeout down.
+ BridgeWrapper bridgeWrapper = BridgeWrapper.create(0, false);
+
+ OutboundBridge outboundBridge = new OutboundBridge(bridgeWrapper);
+ XAResource xaResource = new BridgeXAResource(externalTxId, bridgeWrapper);
+
+ try
+ {
+ transaction.enlistResource(xaResource);
+ } catch(RollbackException e)
+ {
+ log.error("Unable to enlist BridgeXAResource: ", e);
+ throw new SystemException(e.toString());
+ }
+
+ outboundBridgeMappings.put(externalTxId, outboundBridge);
+ }
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list