You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2003/10/15 04:53:27 UTC
cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction TransactionManagerProxy.java TransactionProxy.java
jboynes 2003/10/14 19:53:27
Modified: modules/core/src/java/org/apache/geronimo/client
AppClientContainer.java Launcher.java
modules/core/src/java/org/apache/geronimo/naming/java
ComponentContextBuilder.java
modules/core/src/test/org/apache/geronimo/naming/java
ContextBuilderTest.java
modules/core/src/java/org/apache/geronimo/transaction/manager
TransactionManagerImpl.java
Added: modules/core/src/java/org/apache/geronimo/transaction/manager
UserTransactionImpl.java
modules/core/src/java/org/apache/geronimo/transaction
TransactionManagerProxy.java TransactionProxy.java
Log:
Added support for UserTransaction and integrated it with AppClient
Revision Changes Path
1.6 +15 -10 incubator-geronimo/modules/core/src/java/org/apache/geronimo/client/AppClientContainer.java
Index: AppClientContainer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/client/AppClientContainer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AppClientContainer.java 8 Sep 2003 04:19:54 -0000 1.5
+++ AppClientContainer.java 15 Oct 2003 02:53:26 -0000 1.6
@@ -58,7 +58,6 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
-import javax.naming.Context;
import org.apache.geronimo.core.service.AbstractRPCContainer;
import org.apache.geronimo.kernel.deployment.DeploymentException;
@@ -67,7 +66,7 @@
/**
*
- * @jmx:mbean
+ * @jmx.mbean
* extends="org.apache.geronimo.core.service.RPCContainer,org.apache.geronimo.kernel.management.StateManageable"
*
* @version $Revision$ $Date$
@@ -79,46 +78,52 @@
private URL clientURL;
private ReadOnlyContext compContext;
- public AppClientContainer() throws DeploymentException {
+ public AppClientContainer() {
+ }
+
+ public AppClientContainer(URL clientURL, String mainClassName, ReadOnlyContext compContext) {
+ this.clientURL = clientURL;
+ this.mainClassName = mainClassName;
+ this.compContext = compContext;
}
/**
- * @jmx:managed-attribute
+ * @jmx.managed-attribute
*/
public void setMainClassName(String className) {
mainClassName = className;
}
/**
- * @jmx:managed-attribute
+ * @jmx.managed-attribute
*/
public String getMainClassName() {
return mainClassName;
}
/**
- * @jmx:managed-attribute
+ * @jmx.managed-attribute
*/
public URL getClientURL() {
return clientURL;
}
/**
- * @jmx:managed-attribute
+ * @jmx.managed-attribute
*/
public void setClientURL(URL clientURL) {
this.clientURL = clientURL;
}
/**
- * @jmx:managed-attribute
+ * @jmx.managed-attribute
*/
public ReadOnlyContext getComponentContext() {
return compContext;
}
/**
- * @jmx:managed-attribute
+ * @jmx.managed-attribute
*/
public void setComponentContext(ReadOnlyContext compContext) {
this.compContext = compContext;
1.7 +15 -21 incubator-geronimo/modules/core/src/java/org/apache/geronimo/client/Launcher.java
Index: Launcher.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/client/Launcher.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Launcher.java 22 Sep 2003 21:09:35 -0000 1.6
+++ Launcher.java 15 Oct 2003 02:53:26 -0000 1.7
@@ -68,8 +68,6 @@
import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
-import javax.management.Attribute;
-import javax.management.AttributeList;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
@@ -80,7 +78,8 @@
import javax.management.ObjectName;
import javax.management.ReflectionException;
import javax.management.ServiceNotFoundException;
-import javax.naming.Context;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -91,7 +90,10 @@
import org.apache.geronimo.kernel.jmx.JMXKernel;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.naming.java.ComponentContextBuilder;
+import org.apache.geronimo.naming.java.ReadOnlyContext;
import org.apache.geronimo.proxy.ProxyInvocation;
+import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.apache.geronimo.transaction.manager.UserTransactionImpl;
import org.apache.geronimo.xml.deployment.GeronimoAppClientLoader;
import org.apache.geronimo.xml.deployment.LoaderUtil;
@@ -186,6 +188,8 @@
throw new DeploymentException("Boot mlet did not load a DeploymentPlanner for type=Service");
}
+ TransactionManager txnManager = new TransactionManagerImpl();
+
log.info("Deploying Application Client from " + clientURL);
// @todo use the deployer to create the app client rather than doing it by hand
// try {
@@ -198,7 +202,13 @@
// throw new DeploymentException(e);
// }
- AppClientContainer clientMBean = new AppClientContainer();
+ String mainClassName = getMainClassName();
+
+ UserTransaction userTransaction = txnManager == null ? null : new UserTransactionImpl(txnManager);
+ ApplicationClient appClient = loadAppClientDescriptor();
+ ReadOnlyContext compContext = new ComponentContextBuilder(userTransaction).buildContext(appClient);
+
+ AppClientContainer clientMBean = new AppClientContainer(clientURL, mainClassName, compContext);
clientName = JMXUtil.getObjectName("geronimo.client:url=" + ObjectName.quote(clientURL.toString()));
try {
mbServer.registerMBean(clientMBean, clientName);
@@ -211,22 +221,6 @@
} catch (InstanceAlreadyExistsException e) {
throw new DeploymentException(e);
} catch (NotCompliantMBeanException e) {
- throw new DeploymentException(e);
- }
-
- String mainClassName = getMainClassName();
- ApplicationClient appClient = loadAppClientDescriptor();
-
- Context compContext = ComponentContextBuilder.buildContext(appClient);
-
- try {
- AttributeList attrs = new AttributeList(3);
- attrs.add(new Attribute("MainClassName", mainClassName));
- attrs.add(new Attribute("ClientURL", clientURL));
- attrs.add(new Attribute("ComponentContext", compContext));
- AttributeList setAttrs = mbServer.setAttributes(clientName, attrs);
- assert (attrs.size() == setAttrs.size());
- } catch (Exception e) {
throw new DeploymentException(e);
}
1.8 +16 -3 incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
Index: ComponentContextBuilder.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ComponentContextBuilder.java 17 Sep 2003 01:47:15 -0000 1.7
+++ ComponentContextBuilder.java 15 Oct 2003 02:53:26 -0000 1.8
@@ -59,8 +59,8 @@
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import javax.naming.Context;
import javax.naming.LinkRef;
+import javax.transaction.UserTransaction;
import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
import org.apache.geronimo.deployment.model.geronimo.j2ee.JNDIEnvironmentRefs;
@@ -74,13 +74,23 @@
* @version $Revision$ $Date$
*/
public class ComponentContextBuilder {
+ private final UserTransaction userTransaction;
+
+ public ComponentContextBuilder() {
+ userTransaction = null;
+ }
+
+ public ComponentContextBuilder(UserTransaction userTransaction) {
+ this.userTransaction = userTransaction;
+ }
+
/**
* Build a component context from definitions contained in POJOs read from
* a deployment descriptor.
* @param refs the source reference definitions
* @return a Context that can be bound to java:comp
*/
- public static Context buildContext(JNDIEnvironmentRefs refs) throws DeploymentException {
+ public ReadOnlyContext buildContext(JNDIEnvironmentRefs refs) throws DeploymentException {
Map envMap = new HashMap();
buildEnvEntries(envMap, refs.getEnvEntry());
buildEJBRefs(envMap, refs.getGeronimoEJBRef());
@@ -88,6 +98,9 @@
Map compMap = new HashMap();
compMap.put("env", new ReadOnlyContext(envMap));
+ if (userTransaction != null) {
+ compMap.put("UserTransaction", userTransaction);
+ }
return new ReadOnlyContext(compMap);
}
1.6 +20 -2 incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
Index: ContextBuilderTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ContextBuilderTest.java 9 Sep 2003 03:47:10 -0000 1.5
+++ ContextBuilderTest.java 15 Oct 2003 02:53:26 -0000 1.6
@@ -57,12 +57,15 @@
import java.net.URL;
import javax.naming.Context;
+import javax.naming.NameNotFoundException;
+import javax.transaction.UserTransaction;
import junit.framework.TestCase;
import org.apache.geronimo.deployment.model.geronimo.appclient.ApplicationClient;
import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceRef;
+import org.apache.geronimo.transaction.manager.UserTransactionImpl;
/**
*
@@ -71,6 +74,7 @@
*/
public class ContextBuilderTest extends TestCase {
private ApplicationClient client;
+ private Context compCtx;
protected void setUp() throws Exception {
client = new ApplicationClient();
@@ -93,9 +97,23 @@
}
public void testEnvEntries() throws Exception {
- Context compCtx = ComponentContextBuilder.buildContext(client);
+ compCtx = new ComponentContextBuilder().buildContext(client);
assertEquals("Hello World", compCtx.lookup("env/string"));
assertEquals(new Integer(12345), compCtx.lookup("env/int"));
assertEquals(new URL("http://localhost/path"), compCtx.lookup("env/url/testURL"));
+ }
+
+ public void testUserTransaction() throws Exception {
+ compCtx = new ComponentContextBuilder().buildContext(client);
+ try {
+ compCtx.lookup("UserTransaction");
+ fail("Expected NameNotFoundException");
+ } catch (NameNotFoundException e) {
+ // OK
+ }
+
+ UserTransaction userTransaction = new UserTransactionImpl(null);
+ compCtx = new ComponentContextBuilder(userTransaction).buildContext(client);
+ assertEquals(userTransaction, compCtx.lookup("UserTransaction"));
}
}
1.3 +2 -2 incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
Index: TransactionManagerImpl.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TransactionManagerImpl.java 11 Oct 2003 10:59:17 -0000 1.2
+++ TransactionManagerImpl.java 15 Oct 2003 02:53:27 -0000 1.3
@@ -76,7 +76,7 @@
private final TransactionLog txnLog;
private final XidFactory xidFactory = new XidFactory();
private volatile int timeout;
- private ThreadLocal threadTx = new ThreadLocal();
+ private final ThreadLocal threadTx = new ThreadLocal();
public TransactionManagerImpl() {
txnLog = new UnrecoverableLog();
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/manager/UserTransactionImpl.java
Index: UserTransactionImpl.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.transaction.manager;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
/**
*
*
*
* @version $Revision: 1.1 $ $Date: 2003/10/15 02:53:27 $
*/
public class UserTransactionImpl implements UserTransaction {
private final TransactionManager manager;
public UserTransactionImpl(TransactionManager manager) {
this.manager = manager;
}
public void begin() throws NotSupportedException, SystemException {
manager.begin();
}
public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
manager.commit();
}
public int getStatus() throws SystemException {
return manager.getStatus();
}
public void rollback() throws IllegalStateException, SecurityException, SystemException {
manager.rollback();
}
public void setRollbackOnly() throws IllegalStateException, SystemException {
manager.setRollbackOnly();
}
public void setTransactionTimeout(int timeout) throws SystemException {
manager.setTransactionTimeout(timeout);
}
}
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java
Index: TransactionManagerProxy.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.transaction;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.InvalidTransactionException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
/**
* A wrapper for a TransactionManager that wraps all Transactions in a TransactionProxy
* so that we can add addition metadata to the Transaction. Only begin (and setTransactionTimeout)
* are delegated to the wrapped TransactionManager; all other operations are delegated to the
* wrapped Transaction.
*
* @version $Revision: 1.1 $ $Date: 2003/10/15 02:53:27 $
*/
public class TransactionManagerProxy implements TransactionManager {
private final TransactionManager delegate;
private final ThreadLocal threadTx = new ThreadLocal();
/**
* Constructor taking the TransactionManager to wrap.
* @param delegate the TransactionManager that should be wrapped
*/
public TransactionManagerProxy(TransactionManager delegate) {
this.delegate = delegate;
}
public void setTransactionTimeout(int timeout) throws SystemException {
delegate.setTransactionTimeout(timeout);
}
public void begin() throws NotSupportedException, SystemException {
delegate.begin();
threadTx.set(new TransactionProxy(delegate.getTransaction()));
}
public int getStatus() throws SystemException {
Transaction tx = getTransaction();
return (tx != null) ? tx.getStatus() : Status.STATUS_NO_TRANSACTION;
}
public Transaction getTransaction() throws SystemException {
return (Transaction) threadTx.get();
}
public Transaction suspend() throws SystemException {
Transaction tx = getTransaction();
threadTx.set(null);
return tx;
}
public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException {
if (threadTx.get() != null) {
throw new IllegalStateException("Transaction already associated with current thread");
}
if (tx instanceof TransactionProxy == false) {
throw new InvalidTransactionException("Cannot resume foreign transaction: " + tx);
}
threadTx.set(tx);
}
public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
Transaction tx = getTransaction();
if (tx == null) {
throw new IllegalStateException("No transaction associated with current thread");
}
try {
tx.commit();
} finally {
threadTx.set(null);
}
}
public void rollback() throws IllegalStateException, SecurityException, SystemException {
Transaction tx = getTransaction();
if (tx == null) {
throw new IllegalStateException("No transaction associated with current thread");
}
try {
tx.rollback();
} finally {
threadTx.set(null);
}
}
public void setRollbackOnly() throws IllegalStateException, SystemException {
Transaction tx = getTransaction();
if (tx == null) {
throw new IllegalStateException("No transaction associated with current thread");
}
tx.setRollbackOnly();
}
}
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/TransactionProxy.java
Index: TransactionProxy.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.transaction;
import javax.transaction.Transaction;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.Synchronization;
import javax.transaction.xa.XAResource;
/**
* Our version of a JTA Transaction which also carries metadata such as isolation level
* and write-intent. Delegates all Transaction methods to a real Transaction obtained from
* the vendor's TransactionManager.
*
*
* @version $Revision: 1.1 $ $Date: 2003/10/15 02:53:27 $
*/
public class TransactionProxy implements Transaction {
private final Transaction delegate;
public TransactionProxy(Transaction delegate) {
this.delegate = delegate;
}
public void commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException, SystemException {
delegate.commit();
}
public boolean delistResource(XAResource xaResource, int i) throws IllegalStateException, SystemException {
return delegate.delistResource(xaResource, i);
}
public boolean enlistResource(XAResource xaResource) throws IllegalStateException, RollbackException, SystemException {
return delegate.enlistResource(xaResource);
}
public int getStatus() throws SystemException {
return delegate.getStatus();
}
public void registerSynchronization(Synchronization synchronization) throws IllegalStateException, RollbackException, SystemException {
delegate.registerSynchronization(synchronization);
}
public void rollback() throws IllegalStateException, SystemException {
delegate.rollback();
}
public void setRollbackOnly() throws IllegalStateException, SystemException {
delegate.setRollbackOnly();
}
}