[jboss-cvs] JBossAS SVN: r111408 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/tx/noopts and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 19 13:24:47 EDT 2011


Author: jesper.pedersen
Date: 2011-05-19 13:24:47 -0400 (Thu, 19 May 2011)
New Revision: 111408

Added:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/RealTransactionManagerImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionIntegrationImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionManagerImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionSynchronizationRegistryImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TxRegistry.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionRegistryImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceRecoveryImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceWrapperImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XATerminatorImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/package.html
   projects/jboss-jca/trunk/embedded/src/main/resources/noop-transaction.xml
Removed:
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/
   projects/jboss-jca/trunk/core/src/test/resources/noop-transaction.xml
Log:
Move NoopTS to core-impl

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/LocalXAResourceImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
+import org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener;
+import org.jboss.jca.core.spi.transaction.local.LocalXAException;
+import org.jboss.jca.core.spi.transaction.local.LocalXAResource;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+/**
+ * Local XA resource implementation.
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class LocalXAResourceImpl implements LocalXAResource
+{
+   /**
+    * Creates a new instance.
+    */
+   public LocalXAResourceImpl()
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setConnectionManager(ConnectionManager connectionManager)
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setConnectionListener(ConnectionListener cl)
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void start(Xid xid, int flags) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void end(Xid xid, int flags) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void commit(Xid xid, boolean onePhase) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void forget(Xid xid) throws XAException
+   {
+      throw new LocalXAException("Forget not supported in local tx", XAException.XAER_RMERR);
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public int getTransactionTimeout() throws XAException
+   {
+      return 0;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean isSameRM(XAResource xaResource) throws XAException
+   {
+      return xaResource == this;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int prepare(Xid xid) throws XAException
+   {
+      return XAResource.XA_OK;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Xid[] recover(int flag) throws XAException
+   {
+      throw new LocalXAException("No recover with local-tx only resource managers", XAException.XAER_RMERR);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void rollback(Xid xid) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean setTransactionTimeout(int seconds) throws XAException
+   {
+      return false;
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/RealTransactionManagerImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/RealTransactionManagerImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/RealTransactionManagerImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/RealTransactionManagerImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import java.io.Serializable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * A transaction manager implementation
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class RealTransactionManagerImpl extends TransactionManagerImpl implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+   private static final String JNDI_NAME = "java:/TransactionManager";
+
+   /**
+    * Constructor
+    */
+   public RealTransactionManagerImpl()
+   {
+   }
+
+   /**
+    * Start
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void start() throws Throwable
+   {
+      Context context = new InitialContext();
+
+      context.bind(JNDI_NAME, this);
+
+      context.close();
+   }
+
+   /**
+    * Stop
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void stop() throws Throwable
+   {
+      Context context = new InitialContext();
+
+      context.unbind(JNDI_NAME);
+
+      context.close();
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/TransactionImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.xa.XAResource;
+
+/**
+ * A transaction implementation
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TransactionImpl implements Transaction, Serializable
+{
+   private static final long serialVersionUID = 1L;
+   private int status;
+   private Set<Synchronization> syncs;
+   private Set<XAResource> xas;
+
+   /**
+    * Constructor
+    */
+   public TransactionImpl()
+   {
+      this.status = Status.STATUS_ACTIVE;
+      this.syncs = null;
+      this.xas = null;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void commit() throws RollbackException,
+                               HeuristicMixedException,
+                               HeuristicRollbackException,
+                               SecurityException,
+                               IllegalStateException,
+                               SystemException
+   {
+      finish(Status.STATUS_COMMITTED);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException,
+                                                                    SystemException
+   {
+      if (xas == null)
+         return false;
+
+      return xas.remove(xaRes);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean enlistResource(XAResource xaRes) throws RollbackException,
+                                                          IllegalStateException,
+                                                          SystemException
+   {
+      if (xas == null)
+         xas = new HashSet<XAResource>(1);
+
+      return xas.add(xaRes);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int getStatus() throws SystemException
+   {
+      return status;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void registerSynchronization(Synchronization sync) throws RollbackException,
+                                                                    IllegalStateException,
+                                                                    SystemException
+   {
+      if (syncs == null)
+         syncs = new HashSet<Synchronization>(1);
+
+      syncs.add(sync);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void rollback() throws IllegalStateException,
+                                 SystemException
+   {
+      finish(Status.STATUS_ROLLEDBACK);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setRollbackOnly() throws IllegalStateException,
+                                        SystemException
+   {
+      status = Status.STATUS_MARKED_ROLLBACK;
+   }
+
+   /**
+    * Get rollback only
+    * @return The value
+    */
+   boolean getRollbackOnly()
+   {
+      return status == Status.STATUS_MARKED_ROLLBACK;
+   }
+
+   /**
+    * Finish transaction
+    * @param st The status
+    */
+   private void finish(int st)
+   {
+      if (syncs != null)
+      {
+         for (Synchronization s : syncs)
+         {
+            s.beforeCompletion();
+         }
+      }
+
+      status = st;
+
+      if (syncs != null)
+      {
+         for (Synchronization s : syncs)
+         {
+            s.afterCompletion(status);
+         }
+      }
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionIntegrationImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/TransactionIntegrationImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionIntegrationImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionIntegrationImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
+import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
+import org.jboss.jca.core.spi.transaction.TransactionIntegration;
+import org.jboss.jca.core.spi.transaction.local.LocalXAResource;
+import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecovery;
+import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecoveryRegistry;
+import org.jboss.jca.core.spi.transaction.usertx.UserTransactionRegistry;
+import org.jboss.jca.core.spi.transaction.xa.XAResourceWrapper;
+import org.jboss.jca.core.spi.transaction.xa.XATerminator;
+
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.transaction.TransactionManager;
+import javax.transaction.TransactionSynchronizationRegistry;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SubjectFactory;
+
+/**
+ * This class provide an implementation of the transaction integration for
+ * the IronJacamar container using NoopTS.
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TransactionIntegrationImpl implements TransactionIntegration
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(TransactionIntegrationImpl.class);
+
+   /** The transaction manager */
+   private TransactionManager tm;
+
+   /** The transaction synchronization registry */
+   private TransactionSynchronizationRegistry tsr;
+
+   /** User transaction registry */
+   private UserTransactionRegistry utr;
+
+   /** XATerminator */
+   private XATerminator terminator;
+
+   /** Recovery registry */
+   private XAResourceRecoveryRegistry rr;
+
+   /**
+    * Constructor
+    * @param tm The transaction manager
+    * @param tsr The transaction synchronization registry
+    * @param utr The user transaction registry
+    * @param terminator The XA terminator
+    * @param rr The recovery registry
+    */
+   public TransactionIntegrationImpl(TransactionManager tm,
+                                     TransactionSynchronizationRegistry tsr,
+                                     UserTransactionRegistry utr,
+                                     XATerminator terminator,
+                                     XAResourceRecoveryRegistry rr)
+   {
+      this.tm = tm;
+      this.tsr = tsr;
+      this.utr = utr;
+      this.terminator = terminator;
+      this.rr = rr;
+   }
+
+   /**
+    * Get the transaction manager
+    * @return The value
+    */
+   public TransactionManager getTransactionManager()
+   {
+      return tm;
+   }
+
+   /**
+    * Get the transaction synchronization registry
+    * @return The value
+    */
+   public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry()
+   {
+      return tsr;
+   }
+
+   /**
+    * Get the user transaction registry
+    * @return The value
+    */
+   public UserTransactionRegistry getUserTransactionRegistry()
+   {
+      return utr;
+   }
+
+   /**
+    * Get the recovery registry
+    * @return The value
+    */
+   public XAResourceRecoveryRegistry getRecoveryRegistry()
+   {
+      return rr;
+   }
+
+   /**
+    * Get the XATerminator
+    * @return The value
+    */
+   public XATerminator getXATerminator()
+   {
+      return terminator;
+   }
+
+   /**
+    * Create an XAResourceRecovery instance
+    *
+    * @param mcf The managed connection factory
+    * @param pad Should the branch qualifier for Xid's be padded
+    * @param override Should the isSameRM value be overriden; <code>null</code> for instance equally check
+    * @param wrapXAResource Should the XAResource be wrapped
+    * @param recoverUserName The user name for recovery
+    * @param recoverPassword The password for recovery
+    * @param recoverSecurityDomain The security domain for recovery
+    * @param subjectFactory The subject factory
+    * @param plugin The recovery plugin
+    * @return The value
+    */
+   public XAResourceRecovery createXAResourceRecovery(ManagedConnectionFactory mcf,
+                                                      Boolean pad, Boolean override, 
+                                                      Boolean wrapXAResource,
+                                                      String recoverUserName, String recoverPassword, 
+                                                      String recoverSecurityDomain,
+                                                      SubjectFactory subjectFactory,
+                                                      RecoveryPlugin plugin)
+   {
+      return new XAResourceRecoveryImpl();
+   }
+
+   /**
+    * Create a LocalXAResource instance
+    * @param cm The connection manager
+    * @return The value
+    */
+   public LocalXAResource createLocalXAResource(ConnectionManager cm)
+   {
+      return new LocalXAResourceImpl();
+   }
+
+   /**
+    * Create an XAResource wrapper instance
+    * @param xares The XAResource instance
+    * @param pad Should the branch qualifier for Xid's be padded
+    * @param override Should the isSameRM value be overriden; <code>null</code> for instance equally check
+    * @param productName The product name
+    * @param productVersion The product version
+    * @param jndiName The JNDI name for the resource
+    * @return The value
+    */
+   public XAResourceWrapper createXAResourceWrapper(XAResource xares,
+                                                    boolean pad, Boolean override, 
+                                                    String productName, String productVersion,
+                                                    String jndiName)
+   {
+      return new XAResourceWrapperImpl(xares, override, productName, productVersion, jndiName);
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionManagerImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/TransactionManagerImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionManagerImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionManagerImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.spi.transaction.xa.XATerminator;
+
+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 transaction manager implementation
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TransactionManagerImpl implements TransactionManager
+{
+   private TxRegistry registry;
+   private XATerminator terminator;
+
+   /**
+    * Constructor
+    */
+   public TransactionManagerImpl()
+   {
+   }
+
+   /**
+    * Set the registry
+    * @param v The value
+    */
+   public void setRegistry(TxRegistry v)
+   {
+      registry = v;
+   }
+
+   /**
+    * Get the terminator
+    * @return The value
+    */
+   public XATerminator getXATerminator()
+   {
+      return terminator;
+   }
+
+   /**
+    * Set the terminator
+    * @param v The value
+    */
+   public void setXATerminator(XATerminator v)
+   {
+      terminator = v;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void begin() throws NotSupportedException,
+                              SystemException
+   {
+      Transaction tx = registry.getTransaction();
+      
+      if (tx != null)
+         throw new NotSupportedException();
+
+      registry.startTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void commit() throws RollbackException,
+                               HeuristicMixedException,
+                               HeuristicRollbackException,
+                               SecurityException,
+                               IllegalStateException,
+                               SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new SystemException();
+
+      if (tx.getStatus() == Status.STATUS_ROLLEDBACK ||
+          tx.getStatus() == Status.STATUS_MARKED_ROLLBACK)
+         throw new RollbackException();
+
+      registry.endTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int getStatus() throws SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         return Status.STATUS_NO_TRANSACTION;
+
+      return tx.getStatus();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Transaction getTransaction() throws SystemException
+   {
+      return registry.getTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void resume(Transaction tobj) throws InvalidTransactionException,
+                                               IllegalStateException,
+                                               SystemException
+   {
+      if (!(tobj instanceof TransactionImpl))
+         throw new SystemException();
+
+      registry.assignTransaction((TransactionImpl)tobj);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void rollback() throws IllegalStateException,
+                                 SecurityException,
+                                 SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      registry.endTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setRollbackOnly() throws IllegalStateException,
+                                        SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      tx.setRollbackOnly();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setTransactionTimeout(int seconds) throws SystemException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Transaction suspend() throws SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      registry.assignTransaction(null);
+
+      return tx;
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionSynchronizationRegistryImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/TransactionSynchronizationRegistryImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionSynchronizationRegistryImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TransactionSynchronizationRegistryImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.TransactionSynchronizationRegistry;
+
+/**
+ * A transaction synchronization registry implementation
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TransactionSynchronizationRegistryImpl implements TransactionSynchronizationRegistry, Serializable
+{
+   private static final long serialVersionUID = 1L;
+   private static final String JNDI_NAME = "java:/TransactionSynchronizationRegistry";
+   private TxRegistry registry;
+   private ConcurrentMap<Long, TxEnv> txe;
+
+   /**
+    * Constructor
+    */
+   public TransactionSynchronizationRegistryImpl()
+   {
+      this.registry = null;
+      this.txe = new ConcurrentHashMap<Long, TxEnv>();
+   }
+
+   /**
+    * Set the registry
+    * @param v The value
+    */
+   public void setRegistry(TxRegistry v)
+   {
+      registry = v;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Object getTransactionKey()
+   {
+      return getKey();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void putResource(Object key, Object value)
+   {
+      TxEnv env = getTxEnv();
+      env.getEnvironment().put(key, value);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Object getResource(Object key)
+   {
+      TxEnv env = getTxEnv();
+      return env.getEnvironment().get(key);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void registerInterposedSynchronization(Synchronization sync)
+   {
+      TransactionImpl tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      try
+      {
+         tx.registerSynchronization(sync);
+      }
+      catch (Throwable t)
+      {
+         // Nothing to do
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int getTransactionStatus()
+   {
+      TransactionImpl tx = registry.getTransaction();
+
+      if (tx == null)
+         return Status.STATUS_NO_TRANSACTION;
+
+      try
+      {
+         return tx.getStatus();
+      }
+      catch (Throwable t)
+      {
+         return Status.STATUS_UNKNOWN;
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setRollbackOnly()
+   {
+      TransactionImpl tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      try
+      {
+         tx.setRollbackOnly();
+      }
+      catch (Throwable t)
+      {
+         // Nothing to do
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean getRollbackOnly()
+   {
+      TransactionImpl tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      return tx.getRollbackOnly();
+   }
+
+   /**
+    * Start
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void start() throws Throwable
+   {
+      Context context = new InitialContext();
+
+      context.bind(JNDI_NAME, this);
+
+      context.close();
+   }
+
+   /**
+    * Stop
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void stop() throws Throwable
+   {
+      Context context = new InitialContext();
+
+      context.unbind(JNDI_NAME);
+
+      context.close();
+   }
+
+   /**
+    * Get the key
+    * @return The value
+    */
+   private Long getKey()
+   {
+      return Long.valueOf(Thread.currentThread().getId());
+   }
+
+   /**
+    * Get the TxEnv
+    * @return The value
+    */
+   private TxEnv getTxEnv()
+   {
+      Long key = getKey();
+      TxEnv env = txe.get(key);
+      if (env == null)
+      {
+         TxEnv newTxEnv = new TxEnv();
+         env = txe.putIfAbsent(key, newTxEnv);
+         if (env == null)
+         {
+            env = newTxEnv;
+         }
+      }
+
+      return env;
+   }
+
+   /**
+    * Transaction environment
+    */
+   static class TxEnv implements Serializable
+   {
+      private static final long serialVersionUID = 1L;
+      private Map<Object, Object> envs;
+
+      /**
+       * Constructor
+       */
+      TxEnv()
+      {
+         this.envs = new HashMap<Object, Object>(1);
+      }
+
+      /**
+       * Get the environment
+       * @return The value
+       */
+      Map<Object, Object> getEnvironment()
+      {
+         return envs;
+      }
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TxRegistry.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/TxRegistry.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TxRegistry.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/TxRegistry.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import java.io.Serializable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * The transaction registry
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TxRegistry implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+   private ConcurrentMap<Long, TransactionImpl> txs;
+
+   /**
+    * Constructor
+    */
+   public TxRegistry()
+   {
+      this.txs = new ConcurrentHashMap<Long, TransactionImpl>();
+   }
+
+   /**
+    * Get the transaction for the current thread
+    * @return The value
+    */
+   public TransactionImpl getTransaction()
+   {
+      return txs.get(Long.valueOf(Thread.currentThread().getId()));
+   }
+
+   /**
+    * Start a transaction
+    */
+   public void startTransaction()
+   {
+      txs.put(Long.valueOf(Thread.currentThread().getId()), new TransactionImpl());
+   }
+
+   /**
+    * End a transaction
+    */
+   public void endTransaction()
+   {
+      txs.remove(Long.valueOf(Thread.currentThread().getId()));
+   }
+
+   /**
+    * Assign a transaction
+    * @param v The value
+    */
+   public void assignTransaction(TransactionImpl v)
+   {
+      txs.put(Long.valueOf(Thread.currentThread().getId()), v);
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/UserTransactionImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import java.io.Serializable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.UserTransaction;
+
+/**
+ * A transaction manager implementation
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class UserTransactionImpl implements UserTransaction, Serializable
+{
+   private static final long serialVersionUID = 1L;
+   private static final String JNDI_NAME = "java:/UserTransaction";
+   private TxRegistry registry;
+
+   /**
+    * Constructor
+    */
+   public UserTransactionImpl()
+   {
+      this.registry = null;
+   }
+
+   /**
+    * Set the registry
+    * @param v The value
+    */
+   public void setRegistry(TxRegistry v)
+   {
+      registry = v;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void begin() throws NotSupportedException,
+                              SystemException
+   {
+      Transaction tx = registry.getTransaction();
+      
+      if (tx != null)
+         throw new NotSupportedException();
+
+      registry.startTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void commit() throws RollbackException,
+                               HeuristicMixedException,
+                               HeuristicRollbackException,
+                               SecurityException,
+                               IllegalStateException,
+                               SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new SystemException();
+
+      if (tx.getStatus() == Status.STATUS_ROLLEDBACK ||
+          tx.getStatus() == Status.STATUS_MARKED_ROLLBACK)
+         throw new RollbackException();
+
+      registry.endTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void rollback() throws IllegalStateException,
+                                 SecurityException,
+                                 SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      registry.endTransaction();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setRollbackOnly() throws IllegalStateException,
+                                        SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         throw new IllegalStateException();
+
+      tx.setRollbackOnly();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int getStatus() throws SystemException
+   {
+      Transaction tx = registry.getTransaction();
+
+      if (tx == null)
+         return Status.STATUS_NO_TRANSACTION;
+
+      return tx.getStatus();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setTransactionTimeout(int seconds) throws SystemException
+   {
+   }
+
+   /**
+    * Start
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void start() throws Throwable
+   {
+      Context context = new InitialContext();
+
+      context.bind(JNDI_NAME, this);
+
+      context.close();
+   }
+
+   /**
+    * Stop
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void stop() throws Throwable
+   {
+      Context context = new InitialContext();
+
+      context.unbind(JNDI_NAME);
+
+      context.close();
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionRegistryImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/UserTransactionRegistryImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionRegistryImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/UserTransactionRegistryImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.spi.transaction.usertx.UserTransactionListener;
+import org.jboss.jca.core.spi.transaction.usertx.UserTransactionRegistry;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * UserTransactionRegistry implementation.
+ * 
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class UserTransactionRegistryImpl implements UserTransactionRegistry
+{
+   /** Listeners */
+   private Set<UserTransactionListener> listeners;
+
+   /**
+    * Constructor
+    */
+   public UserTransactionRegistryImpl()
+   {
+      this.listeners = Collections.synchronizedSet(new HashSet<UserTransactionListener>());
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void addListener(UserTransactionListener listener)
+   {
+      if (listener != null)
+         listeners.add(listener);
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public void removeListener(UserTransactionListener listener)
+   {
+      if (listener != null)
+         listeners.remove(listener);
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceRecoveryImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/XAResourceRecoveryImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceRecoveryImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceRecoveryImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecovery;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * An XAResourceRecovery implementation.
+ *
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class XAResourceRecoveryImpl implements XAResourceRecovery
+{
+   /**
+    * Constructor
+    */
+   public XAResourceRecoveryImpl()
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public XAResource[] getXAResources()
+   {
+      return new XAResource[0];
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void setJndiName(String jndiName)
+   {
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceWrapperImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/XAResourceWrapperImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceWrapperImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XAResourceWrapperImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.spi.transaction.xa.XAResourceWrapper;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A XAResourceWrapper.
+ * 
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class XAResourceWrapperImpl implements XAResourceWrapper
+{
+   /** Log instance */
+   private static Logger log = Logger.getLogger(XAResourceWrapperImpl.class);
+   
+   /** The XA resource */
+   private XAResource xaResource;
+   
+   /** Override Rm Value */
+   private Boolean overrideRmValue;
+
+   /** Product name */
+   private String productName;
+
+   /** Product version */
+   private String productVersion;
+   
+   /** Product version */
+   private String jndiName;
+   
+   /**
+    * Creates a new wrapper instance.
+    * @param resource xaresource
+    * @param override override
+    * @param productName product name
+    * @param productVersion product version
+    * @param jndiName jndi name
+    */   
+   public XAResourceWrapperImpl(XAResource resource, Boolean override, 
+                                String productName, String productVersion,
+                                String jndiName)
+   {
+      this.xaResource = resource;
+      this.overrideRmValue = override;
+      this.productName = productName;
+      this.productVersion = productVersion;
+      this.jndiName = jndiName;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void commit(Xid xid, boolean onePhase) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void end(Xid xid, int flags) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void forget(Xid xid) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int getTransactionTimeout() throws XAException
+   {
+      return 0;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean isSameRM(XAResource resource) throws XAException
+   {
+      if (overrideRmValue != null)
+      {
+         if (log.isTraceEnabled())
+         {
+            log.trace("Executing isSameRM with override value" + overrideRmValue + " for XAResourceWrapper" + this);
+         }
+         return overrideRmValue.booleanValue();
+      }
+      else
+      {
+         if (resource instanceof org.jboss.jca.core.spi.transaction.xa.XAResourceWrapper)
+         {
+            org.jboss.jca.core.spi.transaction.xa.XAResourceWrapper other =
+               (org.jboss.jca.core.spi.transaction.xa.XAResourceWrapper)resource;
+            return xaResource.isSameRM(other.getResource());
+         }
+         else
+         {
+            return xaResource.isSameRM(resource);
+         }
+         
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int prepare(Xid xid) throws XAException
+   {
+      return XAResource.XA_OK;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Xid[] recover(int flag) throws XAException
+   {
+      return new Xid[0];
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void rollback(Xid xid) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean setTransactionTimeout(int flag) throws XAException
+   {
+      return true;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void start(Xid xid, int flags) throws XAException
+   {
+   }
+
+   /**
+    * Get the XAResource that is being wrapped
+    * @return The XAResource
+    */
+   public XAResource getResource()
+   {
+      return xaResource;
+   }
+
+   /**
+    * Get product name
+    * @return Product name of the instance if defined; otherwise <code>null</code>
+    */
+   public String getProductName()
+   {
+      return productName;
+   }
+
+   /**
+    * Get product version
+    * @return Product version of the instance if defined; otherwise <code>null</code>
+    */
+   public String getProductVersion()
+   {
+      return productVersion;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public String getJndiName()
+   {
+      return jndiName;
+   }
+   
+   /**
+    * Return wrapper for given xid.
+    * @param xid xid
+    * @return return wrapper
+    */
+   private Xid convertXid(Xid xid)
+   {
+      return xid;
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XATerminatorImpl.java (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/XATerminatorImpl.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XATerminatorImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/XATerminatorImpl.java	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+package org.jboss.jca.core.tx.noopts;
+
+import org.jboss.jca.core.spi.transaction.xa.XATerminator;
+
+import java.io.Serializable;
+
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkCompletedException;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+/**
+ * An XATerminator implementation
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class XATerminatorImpl implements XATerminator, Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Constructor
+    */
+   public XATerminatorImpl()
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void commit(Xid xid, boolean onePhase) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void forget(Xid xid) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int prepare(Xid xid) throws XAException
+   {
+      return XAResource.XA_OK;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Xid[] recover(int flag) throws XAException
+   {
+      return new Xid[0];
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void rollback(Xid xid) throws XAException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void registerWork(Work work, Xid xid, long timeout) throws WorkCompletedException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void startWork(Work work, Xid xid) throws WorkCompletedException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void endWork(Work work, Xid xid)
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void cancelWork(Work work, Xid xid)
+   {
+   }
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/package.html (from rev 111404, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/txmgr/package.html)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/package.html	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,3 @@
+<body>
+This package contains a no-operation transaction manager implementation which can be used instead of a real implementation
+</body>

Deleted: projects/jboss-jca/trunk/core/src/test/resources/noop-transaction.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/noop-transaction.xml	2011-05-19 16:23:14 UTC (rev 111407)
+++ projects/jboss-jca/trunk/core/src/test/resources/noop-transaction.xml	2011-05-19 17:24:47 UTC (rev 111408)
@@ -1,70 +0,0 @@
-<deployment>
-
-  <!-- Transaction registry -->
-  <bean name="TxRegistry"
-        class="org.jboss.jca.test.txmgr.TxRegistry">
-  </bean>
-
-  <!-- User transaction registry -->
-  <bean name="UserTxRegistry"
-        class="org.jboss.jca.test.txmgr.TxRegistry">
-  </bean>
-
-  <!-- XATerminator -->
-  <bean name="XATerminator"
-        interface="org.jboss.jca.core.spi.transaction.xa.XATerminator" 
-        class="org.jboss.jca.test.txmgr.XATerminatorImpl">
-  </bean>
-
-  <!-- Transaction manager -->
-  <bean name="TransactionManager"
-        interface="javax.transaction.TransactionManager" 
-        class="org.jboss.jca.test.txmgr.TransactionManagerImpl">
-    <property name="Registry"><inject bean="TxRegistry"/></property>
-    <property name="XATerminator"><inject bean="XATerminator"/></property>
-  </bean>
-
-  <!-- Real Transaction manager -->
-  <bean name="RealTransactionManager"
-        interface="javax.transaction.TransactionManager" 
-        class="org.jboss.jca.test.txmgr.RealTransactionManagerImpl">
-    <property name="Registry"><inject bean="TxRegistry"/></property>
-    <depends>NamingServer</depends>
-  </bean>
-
-  <!-- TransactionSynchronizationRegistry -->
-  <bean name="TransactionSynchronizationRegistry"
-        interface="javax.transaction.TransactionSynchronizationRegistry" 
-        class="org.jboss.jca.test.txmgr.TransactionSynchronizationRegistryImpl">
-    <property name="Registry"><inject bean="TxRegistry"/></property>
-    <depends>NamingServer</depends>
-  </bean>
-
-  <!-- UserTransaction -->
-  <bean name="UserTransaction"
-        interface="javax.transaction.UserTransaction" 
-        class="org.jboss.jca.test.txmgr.UserTransactionImpl">
-    <property name="Registry"><inject bean="UserTxRegistry"/></property>
-    <depends>NamingServer</depends>
-  </bean>
-
-  <!-- UserTransactionRegistry -->
-  <bean name="UserTransactionRegistry"
-        interface="org.jboss.jca.core.spi.transaction.usertx.UserTransactionRegistry" 
-        class="org.jboss.jca.test.txmgr.UserTransactionRegistryImpl">
-  </bean>
-
-  <!-- Transaction integration -->
-  <bean name="TransactionIntegration"
-        interface="org.jboss.jca.core.spi.transaction.TransactionIntegration"
-        class="org.jboss.jca.test.txmgr.TransactionIntegrationImpl">
-    <constructor>
-      <parameter><inject bean="RealTransactionManager"/></parameter>
-      <parameter><inject bean="TransactionSynchronizationRegistry"/></parameter>
-      <parameter><inject bean="UserTransactionRegistry"/></parameter>
-      <parameter><inject bean="XATerminator"/></parameter>
-      <parameter><null/></parameter>
-    </constructor>
-  </bean>
-
-</deployment>

Copied: projects/jboss-jca/trunk/embedded/src/main/resources/noop-transaction.xml (from rev 111404, projects/jboss-jca/trunk/core/src/test/resources/noop-transaction.xml)
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/resources/noop-transaction.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/main/resources/noop-transaction.xml	2011-05-19 17:24:47 UTC (rev 111408)
@@ -0,0 +1,70 @@
+<deployment>
+
+  <!-- Transaction registry -->
+  <bean name="TxRegistry"
+        class="org.jboss.jca.core.tx.noopts.TxRegistry">
+  </bean>
+
+  <!-- User transaction registry -->
+  <bean name="UserTxRegistry"
+        class="org.jboss.jca.core.tx.noopts.TxRegistry">
+  </bean>
+
+  <!-- XATerminator -->
+  <bean name="XATerminator"
+        interface="org.jboss.jca.core.spi.transaction.xa.XATerminator" 
+        class="org.jboss.jca.core.tx.noopts.XATerminatorImpl">
+  </bean>
+
+  <!-- Transaction manager -->
+  <bean name="TransactionManager"
+        interface="javax.transaction.TransactionManager" 
+        class="org.jboss.jca.core.tx.noopts.TransactionManagerImpl">
+    <property name="Registry"><inject bean="TxRegistry"/></property>
+    <property name="XATerminator"><inject bean="XATerminator"/></property>
+  </bean>
+
+  <!-- Real Transaction manager -->
+  <bean name="RealTransactionManager"
+        interface="javax.transaction.TransactionManager" 
+        class="org.jboss.jca.core.tx.noopts.RealTransactionManagerImpl">
+    <property name="Registry"><inject bean="TxRegistry"/></property>
+    <depends>NamingServer</depends>
+  </bean>
+
+  <!-- TransactionSynchronizationRegistry -->
+  <bean name="TransactionSynchronizationRegistry"
+        interface="javax.transaction.TransactionSynchronizationRegistry" 
+        class="org.jboss.jca.core.tx.noopts.TransactionSynchronizationRegistryImpl">
+    <property name="Registry"><inject bean="TxRegistry"/></property>
+    <depends>NamingServer</depends>
+  </bean>
+
+  <!-- UserTransaction -->
+  <bean name="UserTransaction"
+        interface="javax.transaction.UserTransaction" 
+        class="org.jboss.jca.core.tx.noopts.UserTransactionImpl">
+    <property name="Registry"><inject bean="UserTxRegistry"/></property>
+    <depends>NamingServer</depends>
+  </bean>
+
+  <!-- UserTransactionRegistry -->
+  <bean name="UserTransactionRegistry"
+        interface="org.jboss.jca.core.spi.transaction.usertx.UserTransactionRegistry" 
+        class="org.jboss.jca.core.tx.noopts.UserTransactionRegistryImpl">
+  </bean>
+
+  <!-- Transaction integration -->
+  <bean name="TransactionIntegration"
+        interface="org.jboss.jca.core.spi.transaction.TransactionIntegration"
+        class="org.jboss.jca.core.tx.noopts.TransactionIntegrationImpl">
+    <constructor>
+      <parameter><inject bean="RealTransactionManager"/></parameter>
+      <parameter><inject bean="TransactionSynchronizationRegistry"/></parameter>
+      <parameter><inject bean="UserTransactionRegistry"/></parameter>
+      <parameter><inject bean="XATerminator"/></parameter>
+      <parameter><null/></parameter>
+    </constructor>
+  </bean>
+
+</deployment>



More information about the jboss-cvs-commits mailing list