[jboss-svn-commits] JBL Code SVN: r34461 - in labs/jbosstm/trunk/XTS: bridge and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Aug 2 09:23:01 EDT 2010
Author: adinn
Date: 2010-08-02 09:23:00 -0400 (Mon, 02 Aug 2010)
New Revision: 34461
Added:
labs/jbosstm/trunk/XTS/bridge/
labs/jbosstm/trunk/XTS/bridge/build.xml
labs/jbosstm/trunk/XTS/bridge/src/
labs/jbosstm/trunk/XTS/bridge/src/org/
labs/jbosstm/trunk/XTS/bridge/src/org/jboss/
labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/
labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/
labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/bridge/
labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/bridge/at/
labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/bridge/at/BridgeWrapper.java
Removed:
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/bridge/
Modified:
labs/jbosstm/trunk/XTS/build.xml
labs/jbosstm/trunk/XTS/sar/build.xml
Log:
factored bridge code out from sar directory into separate tree so that AS dependent code is not mixed with AS independent code
Copied: labs/jbosstm/trunk/XTS/bridge/build.xml (from rev 34407, labs/jbosstm/trunk/XTS/sar/build.xml)
===================================================================
--- labs/jbosstm/trunk/XTS/bridge/build.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/bridge/build.xml 2010-08-02 13:23:00 UTC (rev 34461)
@@ -0,0 +1,131 @@
+<!--
+ 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 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,
+ @author JBoss Inc.
+-->
+
+<project name="bridge" default="jars" basedir=".">
+
+ <!-- ================================================================== -->
+ <!-- build and install the XTS bridge implementation and api jars -->
+ <!-- ================================================================== -->
+
+ <property name="root.dir" location=".."/>
+
+ <import file="../sharedbuild.xml"/>
+
+ <!-- Set module name -->
+ <property name="modulename" value="recovery"/>
+
+ <!-- the directory in which XTS resides -->
+ <property name="xts.home" value="../xts-install"/>
+
+ <!-- use $JBOSS_HOME to locate directory for deploy and undeploy -->
+ <property environment="env"/>
+ <property name="jboss.home" value="${env.JBOSS_HOME}"/>
+ <property name="jboss.server" value="default"/>
+ <property name="deploy.dir" value="${jboss.home}/derver/${jboss.server}/deploy}"/>
+
+ <property name="src.dir" location="src"/>
+
+ <property name="metainf.dir" value="META-INF"/>
+ <property name="build.dir" value="build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="build.lib.dir" location="${build.dir}/lib"/>
+
+ <!--sibling lib directories -->
+
+ <property name="wsas.build.lib.dir" value="${wsas.dir}/build/lib"/>
+ <property name="wsc.build.lib.dir" value="${ws-c.dir}/build/lib"/>
+ <property name="wscf.build.lib.dir" value="${wscf.dir}/build/lib"/>
+ <property name="wst.build.lib.dir" value="${ws-t.dir}/build/lib"/>
+ <property name="wstx.build.lib.dir" value="${wstx.dir}/build/lib"/>
+ <property name="recovery.build.lib.dir" value="${recovery.dir}/build/lib"/>
+
+ <!--sibling module directories and jars -->
+
+ <property name="wsas.libs" value="wsas.jar"/>
+
+ <property name="wsc.libs" value="ws-c.jar"/>
+ <property name="wsc-api.libs" value="ws-c-api.jar"/>
+ <property name="wsc11.libs" value="ws-c11.jar"/>
+ <property name="wsc.all.libs" value="${wsc.libs} ${wsc11.libs}"/>
+
+ <property name="wscf.libs" value="wscf.jar"/>
+ <property name="wscf11.libs" value="wscf11.jar"/>
+ <property name="wscf.all.libs" value="${wscf.libs} ${wscf11.libs}"/>
+
+ <property name="wst.libs" value="ws-t.jar"/>
+ <property name="wst-api.libs" value="ws-t-api.jar"/>
+ <property name="wst11.libs" value="ws-t11.jar"/>
+ <property name="wst11-api.libs" value="ws-t11-api.jar"/>
+ <property name="wst.all.libs" value="${wst.libs} ${wst-api.libs} ${wst11.libs} ${wst11-api.libs} "/>
+
+ <property name="wstx.libs" value="wstx.jar"/>
+ <property name="wstx-api.libs" value="wstx-api.jar"/>
+ <property name="wstx11.libs" value="wstx11.jar"/>
+ <property name="wstx11-api.libs" value="wstx11-api.jar"/>
+ <property name="wstx.all.libs" value="${wstx.libs} ${wstx-api.libs} ${wstx11.libs} ${wstx11-api.libs} "/>
+
+ <property name="recovery.libs" value="xts.recovery.jar"/>
+ <!-- enable debugging of XTS service code -->
+
+ <property name="javac.debug" value="on"/>
+
+ <property name="bridge.api.class.files" value="org/jboss/jbossts/xts/bridge/at/BridgeWrapper.class"/>
+
+ <target name="init">
+ <delete dir="${build.dir}"/>
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${build.lib.dir}"/>
+ </target>
+
+ <!-- compile the 1.1 specific classes in the sar source which support WS-AT 1.1. bridging -->
+ <target name="compile" depends="init">
+ <compile.macro included.classes="org/jboss/jbossts/xts/bridge/**/*">
+ <additional.classpath>
+ <fileset dir="${wsas.build.lib.dir}" includes="${wsas.libs}"/>
+ <fileset dir="${wsc.build.lib.dir}" includes="${wsc.all.libs}"/>
+ <fileset dir="${wscf.build.lib.dir}" includes="${wscf.all.libs}"/>
+ <fileset dir="${wst.build.lib.dir}" includes="${wst.all.libs}"/>
+ <fileset dir="${wstx.build.lib.dir}" includes="${wstx.all.libs}"/>
+ <fileset dir="${recovery.build.lib.dir}" includes="${recovery.libs}"/>
+ </additional.classpath>
+ </compile.macro>
+ </target>
+
+ <!-- build the api jar -->
+ <target name="api-jar" depends="compile">
+ <!-- include bridge api class -->
+ <jar jarfile="${build.lib.dir}/bridge-api.jar">
+ <fileset dir="${build.classes.dir}" includes="${bridge.api.class.files}"/>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete file="${build.lib.dir}/jbossxts-api.jar"/>
+ </target>
+
+ <!-- the bridge code only builds a 1.1 version and only exports an api jar -->
+
+ <target name="jars" depends="api-jar"/>
+
+</project>
Copied: labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/bridge/at/BridgeWrapper.java (from rev 34407, labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/bridge/at/BridgeWrapper.java)
===================================================================
--- labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/bridge/at/BridgeWrapper.java (rev 0)
+++ labs/jbosstm/trunk/XTS/bridge/src/org/jboss/jbossts/xts/bridge/at/BridgeWrapper.java 2010-08-02 13:23:00 UTC (rev 34461)
@@ -0,0 +1,255 @@
+package org.jboss.jbossts.xts.bridge.at;
+
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator;
+import com.arjuna.mwlabs.wst11.at.ContextFactoryImple;
+import com.arjuna.mwlabs.wst11.at.context.TxContextImple;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wsc11.ContextFactoryMapper;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.wst.SystemException;
+import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager;
+
+/**
+ * An API class for use by the JTA ==> AT bridge manager providing a wrapper around a subordinate transaction.
+ * Static methods are provided to create and register a WS-AT subordinate transaction or to locate a recovered
+ * transaction. The returned wrapper allows a client to drive the coordinator through prepare, (phase 2) commit
+ * and/or rollback, to access the transaction id under which the coordinator is registered and, if the transaction
+ * has not been recovered, to obtain a resumable tx context for the transaction.
+ *
+ * n.b. this class only supports bridging to WS-AT 1.1 transactions.
+ */
+public class BridgeWrapper
+{
+ /**
+ * cached reference to the WS-AT 1.1. context factory - we only support bridging to WS-AT 1.1 subordinate
+ * transactions
+ */
+ private static ContextFactoryImple contextFactory =
+ (ContextFactoryImple)ContextFactoryMapper.getFactory().getContextFactory(AtomicTransactionConstants.WSAT_PROTOCOL);
+
+ /**
+ * this class handles all creation of bridged transactions
+ */
+
+ private BridgeWrapper()
+ {
+ }
+
+ /**
+ * the standard type string used to identify AT AT subordinate transactions. bridge clients
+ * must ensure that they do not employ this type for their subordinates.
+ */
+
+ public static final String SUBORDINATE_TX_TYPE_AT_AT = SubordinateATCoordinator.SUBORDINATE_TX_TYPE_AT_AT;
+
+
+ /**
+ * create an AT 1.1 subordinate transaction, associate it with the AT 1.1. registry then return a
+ * BridgedTransaction wrapper allowing the transaction to be driven through prepare, commit
+ * and/or rollback and providing access to the transaction id and a context which can be used to
+ * resume the transaction.
+ * @param subordinateType a unique string which groups subordinates for the benefit of their parent
+ * tx/app and allows them to be identified and retrieved as a group during recovery. this must differ
+ * from the string {@link SUBORDINATE_TX_TYPE_AT_AT}
+ * @param expires the timeout for the bridged-to transaction or 0 if no timeout is required
+ * @param isSecure true if AT 1.1. protocol messages for the bridged-to transaction should employ
+ * secure communications, otherwise false
+ * @return a wrapper for the bridged-to transaction
+ * @throws SystemException
+ */
+ public static BridgeWrapper create(String subordinateType, long expires, boolean isSecure)
+ {
+ // the AT 1.1 context factory provides us with a means to create the required data.
+
+ ContextFactoryImple.BridgeTxData bridgeTxData = contextFactory.createBridgedTransaction(subordinateType, expires, isSecure);
+ if (bridgeTxData != null) {
+ BridgeWrapper bridgeWrapper = new BridgeWrapper();
+
+ bridgeWrapper.context = new TxContextImple(bridgeTxData.context);
+ bridgeWrapper.coordinator = bridgeTxData.coordinator;
+ bridgeWrapper.id = bridgeTxData.identifier;
+ bridgeWrapper.subordinateType = subordinateType;
+ return bridgeWrapper;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * recreate a wrapper for a bridged-to WS-AT 1.1 transaction recovered from the log
+ * @param identifier the identifier of a previously created bridged-to transaction
+ * @return a wrapper for the bridged-to transaction or null if it may still be awaiting recovery
+ * @throws UnknownTransactionException if recovery has been performed and no transaction with the
+ * given identifier has been found in the log
+ */
+ public static BridgeWrapper recover(String identifier) throws UnknownTransactionException
+ {
+ SubordinateATCoordinator coordinator = SubordinateATCoordinator.getRecoveredCoordinator(identifier);
+ if (coordinator != null) {
+ BridgeWrapper bridgeWrapper = new BridgeWrapper();
+ bridgeWrapper.context = null;
+ bridgeWrapper.coordinator =coordinator;
+ bridgeWrapper.id = identifier;
+ bridgeWrapper.subordinateType = coordinator.getSubordinateType();
+ return bridgeWrapper;
+ } else {
+ XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
+ if (recoveryManager != null && recoveryManager.isCoordinatorRecoveryStarted()) {
+ throw new UnknownTransactionException();
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * return a list of bridge wrappers for all recovered subordinate transactions with a given
+ * subordinate type
+ * @param subordinateType the subordinate type supplied in the original bridge wrapper create call
+ * which created the subordinate transaction.
+ * @return a possibly zero-length array of bridge wrappers for all recovered subordinate AT transactions
+ * with the given subordinate type or null if a subordinate coordinator recovery scan has not yet occurred
+ */
+ public static BridgeWrapper[] scan(String subordinateType)
+ {
+ // return null if not yet ready
+
+ XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
+ if (!recoveryManager.isCoordinatorRecoveryStarted()) {
+ return null;
+ }
+
+ // refuse to expose the internal AT - AT subordinates
+
+ if (subordinateType == null || subordinateType.equals(SUBORDINATE_TX_TYPE_AT_AT)) {
+ return EMPTY_SCAN;
+ }
+
+ SubordinateATCoordinator[] coordinators = SubordinateATCoordinator.listRecoveredCoordinators();
+ int count = 0;
+
+ for (int i = 0; i < coordinators.length; i++) {
+ if (coordinators[i].getSubordinateType().equals(subordinateType)) {
+ count++;
+ }
+ }
+
+ if (count == 0) {
+ return EMPTY_SCAN;
+ }
+
+ BridgeWrapper[] result = new BridgeWrapper[count];
+ count = 0;
+
+ for (int i = 0; i < coordinators.length; i++) {
+ SubordinateATCoordinator coordinator = coordinators[i];
+ if (coordinator.getSubordinateType().equals(subordinateType)) {
+ BridgeWrapper bridgeWrapper = new BridgeWrapper();
+ bridgeWrapper.context = null;
+ bridgeWrapper.coordinator = coordinator;
+ bridgeWrapper.id = coordinator.get_uid().stringForm();
+ bridgeWrapper.subordinateType = coordinator.getSubordinateType();
+ result[count++] = bridgeWrapper;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * obtain the identifier for the bridged-to transaction
+ * @return the identifier for the bridged-to transaction
+ */
+ public String getIdentifier()
+ {
+ return id;
+ }
+
+ /**
+ * obtain a resumable transaction context for the bridged-to transaction
+ * @return a resumable transaction context
+ * @throws UnknownTransactionException if this transaction has been recovered from the log and hence
+ * has no associated transaction context.
+ */
+ public TxContext getContext() throws UnknownTransactionException
+ {
+ if (context != null) {
+ return context;
+ } else {
+ throw new UnknownTransactionException();
+ }
+ }
+
+ /**
+ * obtain the subordinate type for the bridged-to transaction
+ * @return the subordinate type for the bridged-to transaction
+ */
+ public String getSubordinateType()
+ {
+ return subordinateType;
+ }
+
+ /**
+ * initiate synchronization beforeCompletion processing for the bridged-to transaction
+ *
+ * @return true if the beforeCompletion succeeds otherwise false.
+ */
+ public boolean prepareVolatile()
+ {
+ return coordinator.prepareVolatile();
+ }
+
+ /**
+ * prepare the bridged-to transaction
+ * @return the result of preparing the transaction
+ */
+
+ public int prepare ()
+ {
+ return coordinator.prepare();
+ }
+
+
+ /**
+ * initiate synchronization afterCompletion processing for the bridged-to transaction following a
+ * successful commit
+ */
+ public void commitVolatile()
+ {
+ coordinator.commitVolatile();
+ }
+
+ /**
+ * perform a phase 2 commit for the bridged-to transaction
+ */
+
+ public void commit ()
+ {
+ coordinator.commit();
+ }
+
+ /**
+ * initiate synchronization afterCompletion processing for the bridged-to transaction following a
+ * rollback
+ */
+ public void rollbackVolatile()
+ {
+ coordinator.rollbackVolatile();
+ }
+
+ /**
+ * rollback the bridged-to transaction
+ */
+ public void rollback ()
+ {
+ coordinator.rollback();
+ }
+
+ private SubordinateATCoordinator coordinator;
+ private TxContext context;
+ private String id;
+ private String subordinateType;
+
+ private final static BridgeWrapper[] EMPTY_SCAN = new BridgeWrapper[0];
+}
Modified: labs/jbosstm/trunk/XTS/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/build.xml 2010-08-02 13:14:09 UTC (rev 34460)
+++ labs/jbosstm/trunk/XTS/build.xml 2010-08-02 13:23:00 UTC (rev 34461)
@@ -66,7 +66,7 @@
init.emma.report.dir, wsas.build,
ws-c.build, wscf.build,
ws-t.build, wstx.build,
- recovery.build, htdocs">
+ recovery.build, bridge.build, htdocs">
</target>
@@ -134,6 +134,7 @@
<fileset dir="WS-T/build/lib" includes="*.jar"/>
<fileset dir="WSTX/build/lib" includes="*.jar"/>
<fileset dir="recovery/build/lib" includes="*.jar"/>
+ <fileset dir="bridge/build/lib" includes="*.jar"/>
</copy>
<echo message="Installing webapps"/>
@@ -293,6 +294,13 @@
</ant>
</target>
+ <target name="bridge.build">
+ <ant dir="bridge">
+ <property name="sartype" value="${sartype}"/>
+ <property name="emma.enabled" value="${emma.enabled}"/>
+ </ant>
+ </target>
+
<target name="sar.build">
<ant dir="${sar.dir}">
<property name="sartype" value="${sartype}"/>
Modified: labs/jbosstm/trunk/XTS/sar/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/build.xml 2010-08-02 13:14:09 UTC (rev 34460)
+++ labs/jbosstm/trunk/XTS/sar/build.xml 2010-08-02 13:23:00 UTC (rev 34461)
@@ -38,7 +38,7 @@
<import file="../sharedbuild.xml"/>
<!-- Set module name -->
- <property name="modulename" value="recovery"/>
+ <property name="modulename" value="sar"/>
<!-- the directory in which XTS resides -->
<property name="xts.home" value="../xts-install"/>
@@ -78,8 +78,6 @@
<property name="javac.debug" value="on"/>
- <property name="bridge.api.class.files" value="org/jboss/jbossts/xts/bridge/at/BridgeWrapper.class"/>
-
<!-- by default we build 1.0 and 1.1 for ease of testing,
but release bundles should use -Dsartype=sar-11 so that
they contain only the supported version. -->
@@ -109,22 +107,13 @@
<!-- compile the generic classes in the sar source -->
<target name="compile" depends="init">
- <compile.macro excluded.classes="org/jboss/jbossts/xts/bridge/**/*">
+ <compile.macro>
<additional.classpath>
<fileset dir="${lib.dir}" includes="*.jar"/>
</additional.classpath>
</compile.macro>
</target>
- <!-- compile the 1.1 specific classes in the sar source which support WS-AT 1.1. bridging -->
- <target name="compile.bridge" depends="compile">
- <compile.macro included.classes="org/jboss/jbossts/xts/bridge/**/*">
- <additional.classpath>
- <fileset dir="${lib.dir}" includes="*.jar"/>
- </additional.classpath>
- </compile.macro>
- </target>
-
<!-- build the full api jar -->
<target name="api-both-jar" if="build10">
<mkdir dir="${build.dir}/tmp/api"/>
@@ -136,10 +125,7 @@
<unjar src="${lib.dir}/wstx-api.jar" dest="${build.dir}/tmp/api"/>
<unjar src="${lib.dir}/wstx10-api.jar" dest="${build.dir}/tmp/api"/>
<unjar src="${lib.dir}/wstx11-api.jar" dest="${build.dir}/tmp/api"/>
- <!-- include bridge api class -->
- <copy todir="${build.dir}/tmp/api">
- <fileset dir="${build.classes.dir}" includes="${bridge.api.class.files}"/>
- </copy>
+ <unjar src="${lib.dir}/bridge-api.jar" dest="${build.dir}/tmp/api"/>
<jar file="${build.dir}/jbossxts-api.jar" basedir="${build.dir}/tmp/api"/>
<copy file="${build.dir}/jbossxts-api.jar" tofile="${lib.dir}/jbossxts-api.jar"/>
<delete dir="${build.dir}/tmp/api"/>
@@ -153,16 +139,13 @@
<unjar src="${lib.dir}/ws-t11-api.jar" dest="${build.dir}/tmp/api"/>
<unjar src="${lib.dir}/wstx-api.jar" dest="${build.dir}/tmp/api"/>
<unjar src="${lib.dir}/wstx11-api.jar" dest="${build.dir}/tmp/api"/>
- <!-- include bridge api class -->
- <copy todir="${build.dir}/tmp/api">
- <fileset dir="${build.classes.dir}" includes="${bridge.api.class.files}"/>
- </copy>
+ <unjar src="${lib.dir}/bridge-api.jar" dest="${build.dir}/tmp/api"/>
<jar file="${build.dir}/jbossxts-api.jar" basedir="${build.dir}/tmp/api"/>
<copy file="${build.dir}/jbossxts-api.jar" tofile="${lib.dir}/jbossxts-api.jar"/>
<delete dir="${build.dir}/tmp/api"/>
</target>
- <target name="api-jar" depends="api-both-jar, api11-jar"/>
+ <target name="api-jar" depends="compile, api-both-jar, api11-jar"/>
<!-- build XTS service archive supporting both 1.0 and 1.1 WS-C/T protocols -->
<target name="sar-both" if="build10">
@@ -204,8 +187,8 @@
<!-- include web service config -->
<fileset dir="${build.dir}" includes="META-INF/application.xml"/>
- <!-- include sar boot and shutdown code and 1.1 bridge code *but* exclude the bridge API class -->
- <fileset dir="${build.classes.dir}" includes="**/*" excludes="${bridge.api.class.files}"/>
+ <!-- include sar boot and shutdown codes -->
+ <fileset dir="${build.classes.dir}" includes="**/*"/>
</jar>
</target>
@@ -246,12 +229,12 @@
<!-- include web service config -->
<fileset dir="${build.dir}" includes="META-INF/application.xml"/>
- <!-- include sar boot and shutdown code and 1.1 bridge code *but* exclude the bridge API class -->
- <fileset dir="${build.classes.dir}" includes="**/*" excludes="${bridge.api.class.files}"/>
+ <!-- include sar boot and shutdown code -->
+ <fileset dir="${build.classes.dir}" includes="**/*" />
</jar>
</target>
- <target name="sar" depends="compile.bridge, api-jar, sar-both, sar-11"/>
+ <target name="sar" depends="api-jar, sar-both, sar-11"/>
<target name="clean">
<delete dir="${build.dir}"/>
More information about the jboss-svn-commits
mailing list