[jboss-cvs] JBossAS SVN: r108137 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/connectionmanager/listener and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 14 08:15:21 EDT 2010


Author: jesper.pedersen
Date: 2010-09-14 08:15:20 -0400 (Tue, 14 Sep 2010)
New Revision: 108137

Added:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/NoTxConnectionManager.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/TxConnectionManager.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java
Removed:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManager.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java
Modified:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
Log:
[JBJCA-384] Refactor connection manager (Part 7)

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -40,7 +40,6 @@
 import javax.resource.spi.ConnectionRequestInfo;
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.security.auth.Subject;
-import javax.transaction.RollbackException;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -48,7 +47,6 @@
 import org.jboss.logging.Logger;
 
 import org.jboss.security.SubjectFactory;
-import org.jboss.util.NotImplementedException;
 
 /**
  * AbstractConnectionManager.
@@ -56,7 +54,7 @@
  * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
  */
-public abstract class AbstractConnectionManager implements ConnectionManager 
+public abstract class AbstractConnectionManager implements ConnectionManager
 {
    /** Log instance */
    private Logger log = Logger.getLogger(getClass());
@@ -463,51 +461,10 @@
       
       return connection;
    }
-   
-   
-   /**
-    * {@inheritDoc}
-    */
-   public TransactionManager getTransactionManager()
-   {
-      return null;
-   }
 
    /**
     * {@inheritDoc}
     */
-   public boolean isTransactional()
-   {
-      return false;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public long getTimeLeftBeforeTransactionTimeout(boolean arg0) throws RollbackException
-   {
-      return -1;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public int getTransactionTimeout() throws SystemException
-   {
-      throw new NotImplementedException("NYI: getTransactionTimeout()");
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public void checkTransactionActive() throws RollbackException, SystemException
-   {
-      //Do Nothing as default
-   }
-
-   /**
-    * {@inheritDoc}
-    */
    public void disconnect(Collection<ConnectionRecord> conRecords, Set<String> unsharableResources) 
       throws ResourceException
    {
@@ -576,16 +533,7 @@
          cr.setConnectionListener(cl);
       }
    }
-
-   /**
-    * {@inheritDoc}
-    */
-   public void transactionStarted(Collection<ConnectionRecord> conns) throws SystemException
-   {
-      //reimplement in subclasses      
-   }
    
-   
    /**
     * Unregister association.
     * @param cl connection listener
@@ -675,8 +623,36 @@
       cl.registerConnection(c);
    }
    
-   
    /**
+    * {@inheritDoc}
+    */
+   public void transactionStarted(Collection<ConnectionRecord> conns) throws SystemException
+   {
+      // Reimplement in subclasses
+      // This needs to go away - as non-tx and tx should be separate
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public TransactionManager getTransactionManager()
+   {
+      // Reimplement in subclasses
+      // This needs to go away - as non-tx and tx should be separate
+      return null;
+   }
+ 
+   /**
+    * {@inheritDoc}
+    */
+   public boolean isTransactional()
+   {
+      // Reimplement in subclasses
+      // This needs to go away - as non-tx and tx should be separate
+      return false;
+   }
+
+   /**
     * Gets subject.
     * @return subject
     */
@@ -696,6 +672,4 @@
       
       return subject;
    }
-
-
 }

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -21,15 +21,12 @@
  */
 package org.jboss.jca.core.connectionmanager;
 
-import org.jboss.jca.core.api.connectionmanager.transaction.JTATransactionChecker;
 import org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManager;
 import org.jboss.jca.core.connectionmanager.listener.ConnectionCacheListener;
 import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
 import org.jboss.jca.core.connectionmanager.listener.ConnectionListenerFactory;
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
 
-import org.jboss.tm.TransactionTimeoutConfiguration;
-
 /**
  * Internal connection manager contract.
  * <p>
@@ -38,8 +35,6 @@
  *    components via {@link ConnectionCacheListener}</li>
  *    <li>Responsible for managing connection instances using event listener 
  *    via {@link ConnectionListenerFactory}</li>
- *    <li>Responsible for managing transaction operations via 
- *    {@link TransactionTimeoutConfiguration} and {@link JTATransactionChecker}</li>.
  * </ul>
  * </p> 
  * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a> 
@@ -48,35 +43,45 @@
 public interface ConnectionManager extends
    org.jboss.jca.core.api.connectionmanager.ConnectionManager,
    ConnectionCacheListener, 
-   ConnectionListenerFactory, 
-   TransactionTimeoutConfiguration, 
-   JTATransactionChecker
+   ConnectionListenerFactory
 {
    /**
-    * Set the pool.
-    * @param pool the pool
-    */
-   public void setPool(Pool pool);
-   
-   /**
     * Get the pool.
     * @return the pool
     */
    public Pool getPool();
 
    /**
-    * Sets cached connection manager.
-    * @param cachedConnectionManager cached connection manager
-    */
-   public void setCachedConnectionManager(CachedConnectionManager cachedConnectionManager);
-
-   /**
     * Gets cached connection manager
     * @return The cached connection manager
     */
    public CachedConnectionManager getCachedConnectionManager();
 
    /**
+    * Get the number of allocation retries
+    * @return The number of retries
+    */
+   public int getAllocationRetry();
+
+   /**
+    * Get the wait time between each allocation retry
+    * @return The millis
+    */
+   public long getAllocationRetryWaitMillis();
+
+   /**
+    * Get the JNDI name
+    * @return The value
+    */
+   public String getJndiName();
+
+   /**
+    * Set the JNDI name
+    * @param value The value
+    */
+   public void setJndiName(String value);
+
+   /**
     * Kill given connection listener wrapped connection instance.
     * @param cl connection listener that wraps connection
     * @param kill kill connection or not

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -23,9 +23,9 @@
 package org.jboss.jca.core.connectionmanager;
 
 import org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManager;
-import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
+import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManagerImpl;
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
-import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
+import org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl;
 
 import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
 import javax.transaction.TransactionManager;
@@ -47,12 +47,14 @@
     * Create a connection manager
     * @param tsl The transaction support level
     * @param pool The pool for the connection manager
-    * @param tm The transaction manager
+    * @param allocationRetry The allocation retry value
+    * @param allocationRetryWaitMillis The allocation retry millis value
     * @return The connection manager instance
     */
-   public ConnectionManager create(final TransactionSupportLevel tsl,
-                                   final Pool pool,
-                                   final TransactionManager tm)
+   public NoTxConnectionManager createNonTransactional(final TransactionSupportLevel tsl,
+                                                       final Pool pool,
+                                                       final Long allocationRetry,
+                                                       final Long allocationRetryWaitMillis)
    {
       if (tsl == null)
          throw new IllegalArgumentException("TransactionSupportLevel is null");
@@ -60,35 +62,101 @@
       if (pool == null)
          throw new IllegalArgumentException("Pool is null");
 
-      ConnectionManager cm = null;
+      NoTxConnectionManagerImpl cm = null;
 
       switch (tsl)
       {
          case NoTransaction:
-            cm = new NoTxConnectionManager();
+            cm = new NoTxConnectionManagerImpl();
             break;
 
          case LocalTransaction:
-            if (tm == null)
-               throw new IllegalStateException("TransactionManager is null");
+            throw new IllegalArgumentException("Transactional connection manager not supported");
 
-            cm = new TxConnectionManager(tm, true);
+         case XATransaction:
+            throw new IllegalArgumentException("Transactional connection manager not supported");
+
+         default:
+            throw new IllegalArgumentException("Unknown transaction support level " + tsl);
+      }
+
+      setProperties(cm, pool, allocationRetry, allocationRetryWaitMillis, null);
+
+      return cm;
+   }
+
+   /**
+    * Create a transactional connection manager
+    * @param tsl The transaction support level
+    * @param pool The pool for the connection manager
+    * @param allocationRetry The allocation retry value
+    * @param allocationRetryWaitMillis The allocation retry millis value
+    * @param tm The transaction manager
+    * @return The connection manager instance
+    */
+   public TxConnectionManager createTransactional(final TransactionSupportLevel tsl,
+                                                  final Pool pool,
+                                                  final Long allocationRetry,
+                                                  final Long allocationRetryWaitMillis,
+                                                  final TransactionManager tm)
+   {
+      if (tsl == null)
+         throw new IllegalArgumentException("TransactionSupportLevel is null");
+
+      if (pool == null)
+         throw new IllegalArgumentException("Pool is null");
+
+      if (tm == null)
+         throw new IllegalArgumentException("TransactionManager is null");
+
+      TxConnectionManagerImpl cm = null;
+
+      switch (tsl)
+      {
+         case NoTransaction:
+            throw new IllegalArgumentException("Non transactional connection manager not supported");
+
+         case LocalTransaction:
+            cm = new TxConnectionManagerImpl(tm, true);
             break;
 
          case XATransaction:
-            if (tm == null)
-               throw new IllegalStateException("TransactionManager is null");
-
-            cm = new TxConnectionManager(tm, false);
+            cm = new TxConnectionManagerImpl(tm, false);
             break;
 
          default:
             throw new IllegalArgumentException("Unknown transaction support level " + tsl);
       }
 
+      setProperties(cm, pool, allocationRetry, allocationRetryWaitMillis, tm);
+
+      return cm;
+   }
+
+   /**
+    * Common properties
+    * @param cm The connection manager
+    * @param pool The pool
+    * @param allocationRetry The allocation retry value
+    * @param allocationRetryWaitMillis The allocation retry millis value
+    * @param tm The transaction manager
+    * @return The updated connection manager
+    */
+   private AbstractConnectionManager setProperties(AbstractConnectionManager cm,
+                                                   Pool pool,
+                                                   Long allocationRetry,
+                                                   Long allocationRetryWaitMillis,
+                                                   TransactionManager tm)
+   {
       pool.setConnectionListenerFactory(cm);
       cm.setPool(pool);
 
+      if (allocationRetry != null)
+         cm.setAllocationRetry(allocationRetry.intValue());
+
+      if (allocationRetryWaitMillis != null)
+         cm.setAllocationRetryWaitMillis(allocationRetryWaitMillis.longValue());
+
       CachedConnectionManager ccm = new CachedConnectionManager(tm);
       cm.setCachedConnectionManager(ccm);
 

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/NoTxConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/NoTxConnectionManager.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/NoTxConnectionManager.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -0,0 +1,31 @@
+/*
+ * 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.connectionmanager;
+
+/**
+ * Internal connection manager contract for non-transactional contexts.
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a> 
+ */
+public interface NoTxConnectionManager extends ConnectionManager
+{
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/TxConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/TxConnectionManager.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/TxConnectionManager.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.connectionmanager;
+
+import org.jboss.jca.core.api.connectionmanager.transaction.JTATransactionChecker;
+
+import org.jboss.tm.TransactionTimeoutConfiguration;
+
+/**
+ * Internal connection manager contract for transactional contexts.
+ * <p>
+ * <ul>
+ *    <li>Responsible for managing transaction operations via 
+ *    {@link TransactionTimeoutConfiguration} and {@link JTATransactionChecker}</li>.
+ * </ul>
+ * </p> 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a> 
+ */
+public interface TxConnectionManager extends ConnectionManager,
+                                             TransactionTimeoutConfiguration, 
+                                             JTATransactionChecker
+{
+}

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -25,7 +25,7 @@
 import org.jboss.jca.core.connectionmanager.ConnectionManager;
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
 import org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer;
-import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
+import org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl;
 import org.jboss.jca.core.connectionmanager.xa.LocalXAResource;
 
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -211,7 +211,7 @@
          catch (Throwable t)
          {
             setTrackByTx(false);
-            TxConnectionManager.rethrowAsSystemException("Cannot register synchronization", threadTx, t);
+            TxConnectionManagerImpl.rethrowAsSystemException("Cannot register synchronization", threadTx, t);
          }
 
          // First time through, create a transaction synchronization

Deleted: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManager.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManager.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, 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.connectionmanager.notx;
-
-import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
-import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
-import org.jboss.jca.core.connectionmanager.listener.NoTxConnectionListener;
-
-
-import javax.resource.ResourceException;
-import javax.resource.spi.ManagedConnection;
-
-/**
- * Non transactional connection manager implementation.
- * 
- * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-public class NoTxConnectionManager extends AbstractConnectionManager
-{
-   /** Serial version uid */
-   private static final long serialVersionUID = 1L;
-
-   /**
-    * Default constructor.
-    */
-   public NoTxConnectionManager()
-   {
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public ConnectionListener createConnectionListener(ManagedConnection managedConnection, Object context) 
-      throws ResourceException
-   {
-      ConnectionListener cli = new NoTxConnectionListener(this, managedConnection, getPool(), context);
-      managedConnection.addConnectionEventListener(cli);
-      
-      return cli;
-   }
-}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerImpl.java (from rev 108125, projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManager.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerImpl.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.connectionmanager.notx;
+
+import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
+import org.jboss.jca.core.connectionmanager.NoTxConnectionManager;
+import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
+import org.jboss.jca.core.connectionmanager.listener.NoTxConnectionListener;
+
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnection;
+
+/**
+ * Non transactional connection manager implementation.
+ * 
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class NoTxConnectionManagerImpl extends AbstractConnectionManager implements NoTxConnectionManager
+{
+   /** Serial version uid */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Default constructor.
+    */
+   public NoTxConnectionManagerImpl()
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public ConnectionListener createConnectionListener(ManagedConnection managedConnection, Object context) 
+      throws ResourceException
+   {
+      ConnectionListener cli = new NoTxConnectionListener(this, managedConnection, getPool(), context);
+      managedConnection.addConnectionEventListener(cli);
+      
+      return cli;
+   }
+}

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -61,7 +61,7 @@
    public PoolConfiguration()
    {
       minSize = 0;
-      maxSize = 10;
+      maxSize = 20;
       blockingTimeout = 30000;
       idleTimeout = 1000 * 60 * 30;
       backgroundValidationInterval = 0;

Deleted: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -1,583 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt 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.connectionmanager.tx;
-
-import org.jboss.jca.common.JBossResourceException;
-import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
-import org.jboss.jca.core.connectionmanager.ConnectionRecord;
-import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
-import org.jboss.jca.core.connectionmanager.listener.TxConnectionListener;
-import org.jboss.jca.core.connectionmanager.pool.SubPoolContext;
-import org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool;
-import org.jboss.jca.core.connectionmanager.xa.LocalXAResource;
-import org.jboss.jca.core.connectionmanager.xa.XAResourceWrapperImpl;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.resource.ResourceException;
-import javax.resource.spi.ConnectionRequestInfo;
-import javax.resource.spi.ManagedConnection;
-import javax.security.auth.Subject;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-
-import org.jboss.tm.TransactionLocal;
-import org.jboss.tm.TransactionTimeoutConfiguration;
-import org.jboss.tm.TxUtils;
-import org.jboss.util.NestedRuntimeException;
-
-/**
- * The TxConnectionManager is a JBoss ConnectionManager
- * implementation for jca adapters implementing LocalTransaction and XAResource support.
- * 
- * It implements a ConnectionEventListener that implements XAResource to
- * manage transactions through the Transaction Manager. To assure that all
- * work in a local transaction occurs over the same ManagedConnection, it
- * includes a xid to ManagedConnection map.  When a Connection is requested
- * or a transaction started with a connection handle in use, it checks to
- * see if a ManagedConnection already exists enrolled in the global
- * transaction and uses it if found. Otherwise a free ManagedConnection
- * has its LocalTransaction started and is used.  From the
- * BaseConnectionManager2, it includes functionality to obtain managed
- * connections from
- * a ManagedConnectionPool mbean, find the Subject from a SubjectSecurityDomain,
- * and interact with the CachedConnectionManager for connections held over
- * transaction and method boundaries.  Important mbean references are to a
- * ManagedConnectionPool supplier (typically a JBossManagedConnectionPool), and a
- * RARDeployment representing the ManagedConnectionFactory.
- *
- * This connection manager has to perform the following operations:
- *
- * 1. When an application component requests a new ConnectionHandle,
- *    it must find a ManagedConnection, and make sure a
- *    ConnectionEventListener is registered. It must inform the
- *    CachedConnectionManager that a connection handle has been given
- *    out. It needs to count the number of handles for each
- *    ManagedConnection.  If there is a current transaction, it must
- *    enlist the ManagedConnection's LocalTransaction in the transaction
- *    using the ConnectionEventListeners XAResource XAResource implementation.
- * Entry point: ConnectionManager.allocateConnection.
- * written.
- *
- * 2. When a ConnectionClosed event is received from the
- *    ConnectionEventListener, it must reduce the handle count.  If
- *    the handle count is zero, the XAResource should be delisted from
- *    the Transaction, if any. The CachedConnectionManager must be
- *    notified that the connection is closed.
- * Entry point: ConnectionEventListener.ConnectionClosed.
- * written
- *
- *3. When a transaction begun notification is received from the
- * UserTransaction (via the CachedConnectionManager, all
- * managedConnections associated with the current object must be
- * enlisted in the transaction.
- *  Entry point: (from
- * CachedConnectionManager)
- * ConnectionCacheListener.transactionStarted(Transaction,
- * Collection). The collection is of ConnectionRecord objects.
- * written.
- *
- * 5. When an "entering object" notification is received from the
- * CachedConnectionInterceptor, all the connections for the current
- * object must be associated with a ManagedConnection.  if there is a
- * Transaction, the XAResource must be enlisted with it.
- *  Entry point: ConnectionCacheListener.reconnect(Collection conns) The Collection
- * is of ConnectionRecord objects.
- * written.
- *
- * 6. When a "leaving object" notification is received from the
- * CachedConnectionInterceptor, all the managedConnections for the
- * current object must have their XAResources delisted from the
- * current Transaction, if any, and cleanup called on each
- * ManagedConnection.
- * Entry point: ConnectionCacheListener.disconnect(Collection conns).
- * written.
- *
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- * @author <a href="weston.price at jboss.com">Weston Price</a>
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-public class TxConnectionManager extends AbstractConnectionManager
-{
-   /** Serial version uid */
-   private static final long serialVersionUID = 1L;
-
-   /**Transaction manager instance*/
-   private transient TransactionManager transactionManager;
-
-   /**Interleaving or not*/
-   private boolean interleaving;
-
-   /**Local tx or not*/
-   private boolean localTransactions;
-   
-   /**XA resource timeout*/
-   private int xaResourceTimeout = 0;
-   
-   /**Xid pad*/
-   private boolean padXid;
-   
-   /**XA resource wrapped or not*/
-   private boolean wrapXAResource = true;
-
-   /**Same RM override*/
-   private Boolean isSameRMOverrideValue;
-   
-   /**Log trace*/
-   private boolean trace = getLog().isTraceEnabled();
-      
-   /**
-    * Constructor
-    * @param tm The transaction manager
-    * @param localTransactions Is local transactions enabled
-    */
-   public TxConnectionManager(final TransactionManager tm, final boolean localTransactions)
-   {
-      this.transactionManager = tm;
-
-      setLocalTransactions(localTransactions);
-   }
-
-   /**
-    * Get the transaction manager instance
-    * @return The transaction manager
-    */
-   public TransactionManager getTransactionManager()
-   {
-      return transactionManager;
-   }
-
-   /**
-    * Gets interleaving flag.
-    * @return interleaving flag
-    */
-   public boolean isInterleaving()
-   {
-      return interleaving;
-   }
-   
-   /**
-    * Sets interleaving flag.
-    * @param value interleaving
-    */
-   private void setInterleaving(boolean value)
-   {
-      this.interleaving = value;
-   }
-   
-   /**
-    * Returns local tx or not.
-    * @return local tx or not
-    */
-   public boolean isLocalTransactions()
-   {
-      return localTransactions;
-   }
-
-   /**
-    * Set the local transaction
-    * @param v The value
-    */
-   void setLocalTransactions(boolean v)
-   {
-      this.localTransactions = v;
-
-      if (v)
-         setInterleaving(false);
-   }
-
-   /**
-    * Gets XA resource transaction time out.
-    * @return xa resource transaction timeout
-    */
-   public int getXAResourceTransactionTimeout()
-   {
-      return xaResourceTimeout;
-   }
-   
-   /**
-    * Sets XA resource transaction timeout.
-    * @param timeout xa resource transaction timeout
-    */
-   public void setXAResourceTransactionTimeout(int timeout)
-   {
-      this.xaResourceTimeout = timeout;
-   }
-   
-   /**
-    * Get the IsSameRMOverrideValue value.
-    * 
-    * @return the IsSameRMOverrideValue value.
-    */
-   public Boolean getIsSameRMOverrideValue()
-   {
-      return isSameRMOverrideValue;
-   }
-   
-   /**
-    * Returns true if wrap xa resource.
-    * @return true if wrap xa resource
-    */
-   public boolean getWrapXAResource()
-   {      
-      return wrapXAResource;      
-   }
-   
-   /**
-    * Sets use xa wrapper.
-    * @param useXAWrapper use xa wrapper
-    */
-   public void setWrapXAResource(boolean useXAWrapper)
-   {
-      this.wrapXAResource = useXAWrapper;
-      
-   }
-   
-   /**
-    * Gets pad.
-    * @return pad 
-    */
-   public boolean getPadXid()
-   {
-      return this.padXid;
-      
-   }
-   
-   /**
-    * Sets pad.
-    * @param padXid pad
-    */
-   public void setPadXid(boolean padXid)
-   {
-      this.padXid = padXid;
-   }
-   /**
-    * Set the IsSameRMOverrideValue value.
-    * 
-    * @param isSameRMOverrideValue The new IsSameRMOverrideValue value.
-    */
-   public void setIsSameRMOverrideValue(Boolean isSameRMOverrideValue)
-   {
-      this.isSameRMOverrideValue = isSameRMOverrideValue;
-   }
-   
-   /**
-    * Gets time left.
-    * @param errorRollback error rollback
-    * @return time left
-    * @throws RollbackException if exception
-    */
-   public long getTimeLeftBeforeTransactionTimeout(boolean errorRollback) throws RollbackException
-   {
-      if (this.transactionManager == null)
-      {
-         throw new IllegalStateException("No transaction manager: " + getCachedConnectionManager());  
-      }
-
-      if (this.transactionManager instanceof TransactionTimeoutConfiguration)
-      {
-         return ((TransactionTimeoutConfiguration) this.transactionManager).
-            getTimeLeftBeforeTransactionTimeout(errorRollback);  
-      }
-      
-      return -1;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public void checkTransactionActive() throws RollbackException, SystemException
-   {
-      if (this.transactionManager == null)
-      {
-         throw new IllegalStateException("No transaction manager: " + getCachedConnectionManager());  
-      }
-      
-      Transaction tx = this.transactionManager.getTransaction();
-      if (tx != null)
-      {
-         int status = tx.getStatus();
-         // Only allow states that will actually succeed
-         if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING && 
-               status != Status.STATUS_PREPARED && status != Status.STATUS_COMMITTING)
-         {
-            throw new RollbackException("Transaction " + tx + " cannot proceed " + TxUtils.getStatusAsString(status));  
-         }
-      }
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public ConnectionListener getManagedConnection(Subject subject, ConnectionRequestInfo cri)
-      throws ResourceException
-   {
-      Transaction trackByTransaction = null;
-      try
-      {
-         Transaction tx = this.transactionManager.getTransaction();
-         if (tx != null && !TxUtils.isActive(tx))
-         {
-            throw new ResourceException("Transaction is not active: tx=" + tx);  
-         }
-         
-         if (!interleaving)
-         {
-            trackByTransaction = tx;  
-         }
-      }
-      catch (Throwable t)
-      {
-         JBossResourceException.rethrowAsResourceException("Error checking for a transaction.", t);
-      }
-
-      if (this.trace)
-      {
-         getLog().trace("getManagedConnection interleaving=" + interleaving + " tx=" + trackByTransaction);  
-      }
-      
-      return super.getManagedConnection(trackByTransaction, subject, cri);
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public void transactionStarted(Collection<ConnectionRecord> crs) throws SystemException
-   {
-      Set<ConnectionListener> cls = new HashSet<ConnectionListener>(crs.size());
-      for (Iterator<ConnectionRecord> i = crs.iterator(); i.hasNext(); )
-      {
-         ConnectionRecord cr = i.next();
-         ConnectionListener cl = cr.getConnectionListener();
-         if (!cls.contains(cl))
-         {
-            cls.add(cl);
-            cl.enlist();
-
-            if (!isInterleaving())
-            {
-               cl.setTrackByTx(true);
-               ManagedConnectionPool mcp = (ManagedConnectionPool)cl.getContext();
-               SubPoolContext subPool = mcp.getSubPool();
-               TransactionLocal trackByTx = subPool.getTrackByTx();
-               try
-               {
-                  trackByTx.lock();
-               }
-               catch (Throwable t)
-               {
-                  rethrowAsSystemException("Unable to begin transaction with JCA lazy enlistment scenario", 
-                                           trackByTx.getTransaction(), t);
-               }             
-               try
-               {
-                  trackByTx.set(cl);
-               }
-               finally
-               {
-                  trackByTx.unlock();
-               }
-            }
-         }
-      }
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   protected void managedConnectionReconnected(ConnectionListener cl) throws ResourceException
-   {
-      try
-      {
-         cl.enlist();
-      }
-      catch (Throwable t)
-      {
-         if (trace)
-         {
-            getLog().trace("Could not enlist in transaction on entering meta-aware object! " + cl, t);  
-         }
-         throw new JBossResourceException("Could not enlist in transaction on entering meta-aware object!", t);
-      }
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   protected void managedConnectionDisconnected(ConnectionListener cl) throws ResourceException
-   {
-      Throwable throwable = null;
-      try
-      {
-         cl.delist();
-      }
-      catch (Throwable t)
-      {
-         throwable = t;
-      }
-
-      //if there are no more handles and tx is complete, we can return to pool.
-      if (cl.isManagedConnectionFree())
-      {
-         if (trace)
-            getLog().trace("Disconnected isManagedConnectionFree=true" + " cl=" + cl);
-         returnManagedConnection(cl, false);
-      }
-      else if (trace)
-      {
-         getLog().trace("Disconnected isManagedConnectionFree=false" + " cl=" + cl);
-      }
-
-      // Rethrow the error
-      if (throwable != null)
-      {
-         JBossResourceException.rethrowAsResourceException(
-               "Could not delist resource, probably a transaction rollback? ", throwable);  
-      }      
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public ConnectionListener createConnectionListener(ManagedConnection mc, Object context)
-      throws ResourceException
-   {
-      XAResource xaResource = null;
-      
-      if (this.localTransactions)
-      {
-         xaResource = new LocalXAResource(this);
-    
-         if (xaResourceTimeout != 0)
-         {
-            getLog().debug("XAResource transaction timeout cannot be set for local transactions: " + getJndiName());  
-         }
-      }
-      
-      else
-      {
-         
-         if (this.wrapXAResource)
-         {
-            String eisProductName = null;
-            String eisProductVersion = null;
-
-            try
-            {
-               if (mc.getMetaData() != null)
-               {
-                  eisProductName = mc.getMetaData().getEISProductName();
-                  eisProductVersion = mc.getMetaData().getEISProductVersion();
-               }
-            }
-            catch (ResourceException re)
-            {
-               // Ignore
-            }
-
-            getLog().trace("Generating XAResourceWrapper for TxConnectionManager" + this);
-            xaResource = new XAResourceWrapperImpl(mc.getXAResource(), padXid, 
-                  isSameRMOverrideValue, eisProductName, eisProductVersion);
-         }
-         
-         else
-         {
-            getLog().trace("Not wrapping XAResource.");
-            xaResource = mc.getXAResource();
-         }
-                                
-         if (xaResourceTimeout != 0)
-         {
-            try
-            {
-               if (!xaResource.setTransactionTimeout(xaResourceTimeout))
-                  getLog().debug("XAResource does not support transaction timeout configuration: " + getJndiName());
-            }
-            catch (XAException e)
-            {
-               throw new JBossResourceException("Unable to set XAResource transaction timeout: " + getJndiName(), e);
-            }
-         }
-      }
-
-      ConnectionListener cli = new TxConnectionListener(this, mc, getPool(), context, xaResource);
-      mc.addConnectionEventListener(cli);
-      return cli;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public boolean isTransactional()
-   {
-      return !TxUtils.isCompleted(this.transactionManager);
-   }
-   
-   /**
-    * RethrowAsSystemException.
-    * @param context context
-    * @param tx transaction
-    * @param t throwable
-    * @throws SystemException system exception
-    */
-   public static void rethrowAsSystemException(String context, Transaction tx, Throwable t)
-      throws SystemException
-   {
-      if (t instanceof SystemException)
-         throw (SystemException) t;
-      if (t instanceof RuntimeException)
-         throw (RuntimeException) t;
-      if (t instanceof Error)
-         throw (Error) t;
-      if (t instanceof RollbackException)
-         throw new IllegalStateException(context + " tx=" + tx + " marked for rollback.");
-      throw new NestedRuntimeException(context + " tx=" + tx + " got unexpected error ", t);
-   }
-
-
-   private void writeObject(ObjectOutputStream out)
-      throws IOException
-   {
-
-
-   }
-
-
-   private void readObject(ObjectInputStream in)
-      throws IOException, ClassNotFoundException
-   {
-
-   }
-}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java (from rev 108125, projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -0,0 +1,593 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt 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.connectionmanager.tx;
+
+import org.jboss.jca.common.JBossResourceException;
+import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionRecord;
+import org.jboss.jca.core.connectionmanager.TxConnectionManager;
+import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
+import org.jboss.jca.core.connectionmanager.listener.TxConnectionListener;
+import org.jboss.jca.core.connectionmanager.pool.SubPoolContext;
+import org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool;
+import org.jboss.jca.core.connectionmanager.xa.LocalXAResource;
+import org.jboss.jca.core.connectionmanager.xa.XAResourceWrapperImpl;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.security.auth.Subject;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.tm.TransactionLocal;
+import org.jboss.tm.TransactionTimeoutConfiguration;
+import org.jboss.tm.TxUtils;
+import org.jboss.util.NestedRuntimeException;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * The TxConnectionManager is a JBoss ConnectionManager
+ * implementation for jca adapters implementing LocalTransaction and XAResource support.
+ * 
+ * It implements a ConnectionEventListener that implements XAResource to
+ * manage transactions through the Transaction Manager. To assure that all
+ * work in a local transaction occurs over the same ManagedConnection, it
+ * includes a xid to ManagedConnection map.  When a Connection is requested
+ * or a transaction started with a connection handle in use, it checks to
+ * see if a ManagedConnection already exists enrolled in the global
+ * transaction and uses it if found. Otherwise a free ManagedConnection
+ * has its LocalTransaction started and is used.  From the
+ * BaseConnectionManager2, it includes functionality to obtain managed
+ * connections from
+ * a ManagedConnectionPool mbean, find the Subject from a SubjectSecurityDomain,
+ * and interact with the CachedConnectionManager for connections held over
+ * transaction and method boundaries.  Important mbean references are to a
+ * ManagedConnectionPool supplier (typically a JBossManagedConnectionPool), and a
+ * RARDeployment representing the ManagedConnectionFactory.
+ *
+ * This connection manager has to perform the following operations:
+ *
+ * 1. When an application component requests a new ConnectionHandle,
+ *    it must find a ManagedConnection, and make sure a
+ *    ConnectionEventListener is registered. It must inform the
+ *    CachedConnectionManager that a connection handle has been given
+ *    out. It needs to count the number of handles for each
+ *    ManagedConnection.  If there is a current transaction, it must
+ *    enlist the ManagedConnection's LocalTransaction in the transaction
+ *    using the ConnectionEventListeners XAResource XAResource implementation.
+ * Entry point: ConnectionManager.allocateConnection.
+ * written.
+ *
+ * 2. When a ConnectionClosed event is received from the
+ *    ConnectionEventListener, it must reduce the handle count.  If
+ *    the handle count is zero, the XAResource should be delisted from
+ *    the Transaction, if any. The CachedConnectionManager must be
+ *    notified that the connection is closed.
+ * Entry point: ConnectionEventListener.ConnectionClosed.
+ * written
+ *
+ *3. When a transaction begun notification is received from the
+ * UserTransaction (via the CachedConnectionManager, all
+ * managedConnections associated with the current object must be
+ * enlisted in the transaction.
+ *  Entry point: (from
+ * CachedConnectionManager)
+ * ConnectionCacheListener.transactionStarted(Transaction,
+ * Collection). The collection is of ConnectionRecord objects.
+ * written.
+ *
+ * 5. When an "entering object" notification is received from the
+ * CachedConnectionInterceptor, all the connections for the current
+ * object must be associated with a ManagedConnection.  if there is a
+ * Transaction, the XAResource must be enlisted with it.
+ *  Entry point: ConnectionCacheListener.reconnect(Collection conns) The Collection
+ * is of ConnectionRecord objects.
+ * written.
+ *
+ * 6. When a "leaving object" notification is received from the
+ * CachedConnectionInterceptor, all the managedConnections for the
+ * current object must have their XAResources delisted from the
+ * current Transaction, if any, and cleanup called on each
+ * ManagedConnection.
+ * Entry point: ConnectionCacheListener.disconnect(Collection conns).
+ * written.
+ *
+ * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="weston.price at jboss.com">Weston Price</a>
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TxConnectionManagerImpl extends AbstractConnectionManager implements TxConnectionManager
+{
+   /** Serial version uid */
+   private static final long serialVersionUID = 1L;
+
+   /**Transaction manager instance*/
+   private transient TransactionManager transactionManager;
+
+   /**Interleaving or not*/
+   private boolean interleaving;
+
+   /**Local tx or not*/
+   private boolean localTransactions;
+   
+   /**XA resource timeout*/
+   private int xaResourceTimeout = 0;
+   
+   /**Xid pad*/
+   private boolean padXid;
+   
+   /**XA resource wrapped or not*/
+   private boolean wrapXAResource = true;
+
+   /**Same RM override*/
+   private Boolean isSameRMOverrideValue;
+   
+   /**Log trace*/
+   private boolean trace = getLog().isTraceEnabled();
+      
+   /**
+    * Constructor
+    * @param tm The transaction manager
+    * @param localTransactions Is local transactions enabled
+    */
+   public TxConnectionManagerImpl(final TransactionManager tm, final boolean localTransactions)
+   {
+      this.transactionManager = tm;
+
+      setLocalTransactions(localTransactions);
+   }
+
+   /**
+    * Get the transaction manager instance
+    * @return The transaction manager
+    */
+   public TransactionManager getTransactionManager()
+   {
+      return transactionManager;
+   }
+
+   /**
+    * Gets interleaving flag.
+    * @return interleaving flag
+    */
+   public boolean isInterleaving()
+   {
+      return interleaving;
+   }
+   
+   /**
+    * Sets interleaving flag.
+    * @param value interleaving
+    */
+   private void setInterleaving(boolean value)
+   {
+      this.interleaving = value;
+   }
+   
+   /**
+    * Returns local tx or not.
+    * @return local tx or not
+    */
+   public boolean isLocalTransactions()
+   {
+      return localTransactions;
+   }
+
+   /**
+    * Set the local transaction
+    * @param v The value
+    */
+   void setLocalTransactions(boolean v)
+   {
+      this.localTransactions = v;
+
+      if (v)
+         setInterleaving(false);
+   }
+
+   /**
+    * Gets XA resource transaction time out.
+    * @return xa resource transaction timeout
+    */
+   public int getXAResourceTransactionTimeout()
+   {
+      return xaResourceTimeout;
+   }
+   
+   /**
+    * Sets XA resource transaction timeout.
+    * @param timeout xa resource transaction timeout
+    */
+   public void setXAResourceTransactionTimeout(int timeout)
+   {
+      this.xaResourceTimeout = timeout;
+   }
+   
+   /**
+    * Get the IsSameRMOverrideValue value.
+    * 
+    * @return the IsSameRMOverrideValue value.
+    */
+   public Boolean getIsSameRMOverrideValue()
+   {
+      return isSameRMOverrideValue;
+   }
+   
+   /**
+    * Returns true if wrap xa resource.
+    * @return true if wrap xa resource
+    */
+   public boolean getWrapXAResource()
+   {      
+      return wrapXAResource;      
+   }
+   
+   /**
+    * Sets use xa wrapper.
+    * @param useXAWrapper use xa wrapper
+    */
+   public void setWrapXAResource(boolean useXAWrapper)
+   {
+      this.wrapXAResource = useXAWrapper;
+      
+   }
+   
+   /**
+    * Gets pad.
+    * @return pad 
+    */
+   public boolean getPadXid()
+   {
+      return this.padXid;
+      
+   }
+   
+   /**
+    * Sets pad.
+    * @param padXid pad
+    */
+   public void setPadXid(boolean padXid)
+   {
+      this.padXid = padXid;
+   }
+   /**
+    * Set the IsSameRMOverrideValue value.
+    * 
+    * @param isSameRMOverrideValue The new IsSameRMOverrideValue value.
+    */
+   public void setIsSameRMOverrideValue(Boolean isSameRMOverrideValue)
+   {
+      this.isSameRMOverrideValue = isSameRMOverrideValue;
+   }
+   
+   /**
+    * Gets time left.
+    * @param errorRollback error rollback
+    * @return time left
+    * @throws RollbackException if exception
+    */
+   public long getTimeLeftBeforeTransactionTimeout(boolean errorRollback) throws RollbackException
+   {
+      if (this.transactionManager == null)
+      {
+         throw new IllegalStateException("No transaction manager: " + getCachedConnectionManager());  
+      }
+
+      if (this.transactionManager instanceof TransactionTimeoutConfiguration)
+      {
+         return ((TransactionTimeoutConfiguration) this.transactionManager).
+            getTimeLeftBeforeTransactionTimeout(errorRollback);  
+      }
+      
+      return -1;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void checkTransactionActive() throws RollbackException, SystemException
+   {
+      if (this.transactionManager == null)
+      {
+         throw new IllegalStateException("No transaction manager: " + getCachedConnectionManager());  
+      }
+      
+      Transaction tx = this.transactionManager.getTransaction();
+      if (tx != null)
+      {
+         int status = tx.getStatus();
+         // Only allow states that will actually succeed
+         if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING && 
+               status != Status.STATUS_PREPARED && status != Status.STATUS_COMMITTING)
+         {
+            throw new RollbackException("Transaction " + tx + " cannot proceed " + TxUtils.getStatusAsString(status));  
+         }
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public ConnectionListener getManagedConnection(Subject subject, ConnectionRequestInfo cri)
+      throws ResourceException
+   {
+      Transaction trackByTransaction = null;
+      try
+      {
+         Transaction tx = this.transactionManager.getTransaction();
+         if (tx != null && !TxUtils.isActive(tx))
+         {
+            throw new ResourceException("Transaction is not active: tx=" + tx);  
+         }
+         
+         if (!interleaving)
+         {
+            trackByTransaction = tx;  
+         }
+      }
+      catch (Throwable t)
+      {
+         JBossResourceException.rethrowAsResourceException("Error checking for a transaction.", t);
+      }
+
+      if (this.trace)
+      {
+         getLog().trace("getManagedConnection interleaving=" + interleaving + " tx=" + trackByTransaction);  
+      }
+      
+      return super.getManagedConnection(trackByTransaction, subject, cri);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void transactionStarted(Collection<ConnectionRecord> crs) throws SystemException
+   {
+      Set<ConnectionListener> cls = new HashSet<ConnectionListener>(crs.size());
+      for (Iterator<ConnectionRecord> i = crs.iterator(); i.hasNext(); )
+      {
+         ConnectionRecord cr = i.next();
+         ConnectionListener cl = cr.getConnectionListener();
+         if (!cls.contains(cl))
+         {
+            cls.add(cl);
+            cl.enlist();
+
+            if (!isInterleaving())
+            {
+               cl.setTrackByTx(true);
+               ManagedConnectionPool mcp = (ManagedConnectionPool)cl.getContext();
+               SubPoolContext subPool = mcp.getSubPool();
+               TransactionLocal trackByTx = subPool.getTrackByTx();
+               try
+               {
+                  trackByTx.lock();
+               }
+               catch (Throwable t)
+               {
+                  rethrowAsSystemException("Unable to begin transaction with JCA lazy enlistment scenario", 
+                                           trackByTx.getTransaction(), t);
+               }             
+               try
+               {
+                  trackByTx.set(cl);
+               }
+               finally
+               {
+                  trackByTx.unlock();
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   protected void managedConnectionReconnected(ConnectionListener cl) throws ResourceException
+   {
+      try
+      {
+         cl.enlist();
+      }
+      catch (Throwable t)
+      {
+         if (trace)
+         {
+            getLog().trace("Could not enlist in transaction on entering meta-aware object! " + cl, t);  
+         }
+         throw new JBossResourceException("Could not enlist in transaction on entering meta-aware object!", t);
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   protected void managedConnectionDisconnected(ConnectionListener cl) throws ResourceException
+   {
+      Throwable throwable = null;
+      try
+      {
+         cl.delist();
+      }
+      catch (Throwable t)
+      {
+         throwable = t;
+      }
+
+      //if there are no more handles and tx is complete, we can return to pool.
+      if (cl.isManagedConnectionFree())
+      {
+         if (trace)
+            getLog().trace("Disconnected isManagedConnectionFree=true" + " cl=" + cl);
+         returnManagedConnection(cl, false);
+      }
+      else if (trace)
+      {
+         getLog().trace("Disconnected isManagedConnectionFree=false" + " cl=" + cl);
+      }
+
+      // Rethrow the error
+      if (throwable != null)
+      {
+         JBossResourceException.rethrowAsResourceException(
+               "Could not delist resource, probably a transaction rollback? ", throwable);  
+      }      
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public ConnectionListener createConnectionListener(ManagedConnection mc, Object context)
+      throws ResourceException
+   {
+      XAResource xaResource = null;
+      
+      if (this.localTransactions)
+      {
+         xaResource = new LocalXAResource(this);
+    
+         if (xaResourceTimeout != 0)
+         {
+            getLog().debug("XAResource transaction timeout cannot be set for local transactions: " + getJndiName());  
+         }
+      }
+      
+      else
+      {
+         
+         if (this.wrapXAResource)
+         {
+            String eisProductName = null;
+            String eisProductVersion = null;
+
+            try
+            {
+               if (mc.getMetaData() != null)
+               {
+                  eisProductName = mc.getMetaData().getEISProductName();
+                  eisProductVersion = mc.getMetaData().getEISProductVersion();
+               }
+            }
+            catch (ResourceException re)
+            {
+               // Ignore
+            }
+
+            getLog().trace("Generating XAResourceWrapper for TxConnectionManager" + this);
+            xaResource = new XAResourceWrapperImpl(mc.getXAResource(), padXid, 
+                  isSameRMOverrideValue, eisProductName, eisProductVersion);
+         }
+         
+         else
+         {
+            getLog().trace("Not wrapping XAResource.");
+            xaResource = mc.getXAResource();
+         }
+                                
+         if (xaResourceTimeout != 0)
+         {
+            try
+            {
+               if (!xaResource.setTransactionTimeout(xaResourceTimeout))
+                  getLog().debug("XAResource does not support transaction timeout configuration: " + getJndiName());
+            }
+            catch (XAException e)
+            {
+               throw new JBossResourceException("Unable to set XAResource transaction timeout: " + getJndiName(), e);
+            }
+         }
+      }
+
+      ConnectionListener cli = new TxConnectionListener(this, mc, getPool(), context, xaResource);
+      mc.addConnectionEventListener(cli);
+      return cli;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean isTransactional()
+   {
+      return !TxUtils.isCompleted(this.transactionManager);
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public int getTransactionTimeout() throws SystemException
+   {
+      throw new NotImplementedException("NYI: getTransactionTimeout()");
+   }
+
+   /**
+    * RethrowAsSystemException.
+    * @param context context
+    * @param tx transaction
+    * @param t throwable
+    * @throws SystemException system exception
+    */
+   public static void rethrowAsSystemException(String context, Transaction tx, Throwable t)
+      throws SystemException
+   {
+      if (t instanceof SystemException)
+         throw (SystemException) t;
+      if (t instanceof RuntimeException)
+         throw (RuntimeException) t;
+      if (t instanceof Error)
+         throw (Error) t;
+      if (t instanceof RollbackException)
+         throw new IllegalStateException(context + " tx=" + tx + " marked for rollback.");
+      throw new NestedRuntimeException(context + " tx=" + tx + " got unexpected error ", t);
+   }
+
+
+   private void writeObject(ObjectOutputStream out)
+      throws IOException
+   {
+
+
+   }
+
+
+   private void readObject(ObjectInputStream in)
+      throws IOException, ClassNotFoundException
+   {
+
+   }
+}

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -23,6 +23,7 @@
 
 import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
 import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.TxConnectionManager;
 import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
 import org.jboss.jca.core.connectionmanager.common.MockHandle;
 import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
@@ -36,6 +37,7 @@
 
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.RollbackException;
 import javax.transaction.TransactionManager;
 
 import org.junit.AfterClass;
@@ -72,7 +74,8 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
       
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager connectionManager = cmf.create(TransactionSupportLevel.LocalTransaction, pool, tm);
+      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.LocalTransaction, 
+                                                                    pool, null, null, tm);
       assertNotNull(connectionManager);
       
       assertTrue(connectionManager instanceof TxConnectionManager);
@@ -97,6 +100,41 @@
    }
    
    /**
+    * testGetTimeLeftBeforeTrsTimeout.
+    * @throws Throwable for exception
+    */
+   @Test
+   public void testGetTimeLeftBeforeTrsTimeout() throws Throwable
+   {
+      TransactionManager tm = embedded.lookup("RealTransactionManager", TransactionManager.class);
+      assertNotNull(tm);
+      
+      ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+      PoolConfiguration pc = new PoolConfiguration();      
+      PoolFactory pf = new PoolFactory();      
+      
+      Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+      
+      ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.LocalTransaction, 
+                                                                    pool, null, null, tm);
+      assertNotNull(connectionManager);
+      
+      assertTrue(connectionManager instanceof TxConnectionManager);
+
+      TxConnectionManager txConnectionManager = (TxConnectionManager)connectionManager;
+      
+      try
+      {
+         assertEquals(-1L, txConnectionManager.getTimeLeftBeforeTransactionTimeout(false));
+      }
+      catch (RollbackException e)
+      {
+         //No action
+      }
+   }
+
+   /**
     * testConnectionEventListenerConnectionClosed.
     * @throws Exception for exception
     */

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -23,6 +23,7 @@
 
 import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
 import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.TxConnectionManager;
 import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
 import org.jboss.jca.core.connectionmanager.common.MockHandle;
 import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
@@ -36,6 +37,7 @@
 
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.RollbackException;
 import javax.transaction.TransactionManager;
 
 import org.junit.AfterClass;
@@ -72,7 +74,10 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
       
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager connectionManager = cmf.create(TransactionSupportLevel.XATransaction, pool, tm);
+      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.XATransaction,
+                                                                    pool,
+                                                                    null, null,
+                                                                    tm);
       assertNotNull(connectionManager);
       
       assertTrue(connectionManager instanceof TxConnectionManager);
@@ -95,6 +100,41 @@
    }
    
    /**
+    * testGetTimeLeftBeforeTrsTimeout.
+    * @throws Throwable for exception
+    */
+   @Test
+   public void testGetTimeLeftBeforeTrsTimeout() throws Throwable
+   {
+      TransactionManager tm = embedded.lookup("RealTransactionManager", TransactionManager.class);
+      assertNotNull(tm);
+      
+      ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+      PoolConfiguration pc = new PoolConfiguration();      
+      PoolFactory pf = new PoolFactory();      
+      
+      Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+      
+      ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.XATransaction, 
+                                                                    pool, null, null, tm);
+      assertNotNull(connectionManager);
+      
+      assertTrue(connectionManager instanceof TxConnectionManager);
+
+      TxConnectionManager txConnectionManager = (TxConnectionManager)connectionManager;
+
+      try
+      {
+         assertEquals(-1L, txConnectionManager.getTimeLeftBeforeTransactionTimeout(false));
+      }
+      catch (RollbackException e)
+      {
+         //No action
+      }
+   }
+   
+   /**
     * testEnlistInExistingTx.
     * @throws Exception for exception
     */

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -32,11 +32,8 @@
 
 import javax.resource.ResourceException;
 import javax.security.auth.Subject;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
 
 import org.jboss.security.SubjectFactory;
-import org.jboss.util.NotImplementedException;
 
 import org.junit.Test;
 
@@ -201,41 +198,6 @@
    }
    
    /**
-    * testGetTimeLeftBeforeTrsTimeout.
-    */
-   @Test
-   public void testGetTimeLeftBeforeTrsTimeout()
-   {
-      AbstractConnectionManager connectionManager = new MockConnectionManager();
-      try
-      {
-         assertEquals(-1L, connectionManager.getTimeLeftBeforeTransactionTimeout(false));
-      }
-      catch (RollbackException e)
-      {
-         //No action
-      }
-   }
-   
-   /**
-    * testGetTransactionTimeout.
-    */
-   @Test(expected = NotImplementedException.class)
-   public void testGetTransactionTimeout()
-   {
-      AbstractConnectionManager connectionManager = new MockConnectionManager();
-      try
-      {
-         connectionManager.getTransactionTimeout();
-      }
-      catch (SystemException e)
-      {
-         //No action
-      }
-   }
-      
-   
-   /**
     * testGetManagedConnectionFactoryIsNull.
     */
    @Test

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -23,10 +23,10 @@
 
 import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
 import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.NoTxConnectionManager;
 import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
 import org.jboss.jca.core.connectionmanager.common.MockHandle;
 import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
-import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
@@ -70,7 +70,7 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
       
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      connectionManager = cmf.create(TransactionSupportLevel.NoTransaction, pool, tm);
+      connectionManager = cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool, null, null);
       assertNotNull(connectionManager);
 
       assertTrue(connectionManager instanceof NoTxConnectionManager);

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -55,9 +55,9 @@
    public void testMaxSize()
    {
       PoolConfiguration params = new PoolConfiguration();
-      assertEquals(10, params.getMaxSize());
-      params.setMaxSize(20);
-      assertEquals(20, params.getMaxSize());      
+      assertEquals(20, params.getMaxSize());
+      params.setMaxSize(30);
+      assertEquals(30, params.getMaxSize());      
    }
 
    /**

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -248,12 +248,16 @@
                {
                   try
                   {
-                     Object cf = deployDataSource(dataSource, urlJdbcLocal, jdbcLocalDeployment.getClassLoader());
                      String jndiName = dataSource.getJndiName();
 
                      if (!jndiName.startsWith("java:/"))
                         jndiName = "java:/" + jndiName;
 
+                     Object cf = deployDataSource(dataSource, 
+                                                  jndiName,
+                                                  urlJdbcLocal,
+                                                  jdbcLocalDeployment.getClassLoader());
+
                      bindConnectionFactory(deploymentName, jndiName, cf);
 
                      cfs.add(cf);
@@ -283,12 +287,16 @@
                {
                   try
                   {
-                     Object cf = deployXADataSource(xaDataSource, urlJdbcXA, jdbcXADeployment.getClassLoader());
                      String jndiName = xaDataSource.getJndiName();
 
                      if (!jndiName.startsWith("java:/"))
                         jndiName = "java:/" + jndiName;
 
+                     Object cf = deployXADataSource(xaDataSource,
+                                                    jndiName,
+                                                    urlJdbcXA,
+                                                    jdbcXADeployment.getClassLoader());
+
                      bindConnectionFactory(deploymentName, jndiName, cf);
 
                      cfs.add(cf);
@@ -343,12 +351,13 @@
    /**
     * Deploy a datasource
     * @param ds The datasource
+    * @param jndiName The JNDI name
     * @param ra The resource adapter
     * @param cl The class loader
     * @return The connection factory
     * @exception Throwable Thrown if an error occurs during deployment
     */
-   private Object deployDataSource(DataSource ds, URL ra, ClassLoader cl) throws Throwable
+   private Object deployDataSource(DataSource ds, String jndiName, URL ra, ClassLoader cl) throws Throwable
    {
       log.debug("DataSource=" + ds);
 
@@ -373,8 +382,8 @@
       Long blockingTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getBlockingTimeoutMillis() : null;
       Long idleTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getIdleTimeoutMinutes() : null;
       Long backgroundValidationInterval = null; // TODO
-      Boolean prefill = ds.getPool() == null ? false : ds.getPool().isPrefill();
-      Boolean strictMin = null; // TODO
+      Boolean prefill = ds.getPool() == null ? null : ds.getPool().isPrefill();
+      Boolean strictMin = ds.getPool() == null ? null : ds.getPool().isUseStrictMin();
       Boolean useFastFail = ds.getValidation() != null ? ds.getValidation().isUseFastFail() : null;
 
       PoolConfiguration pc = createPoolConfiguration(minSize,
@@ -389,26 +398,41 @@
       PoolFactory pf = new PoolFactory();
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
+      // Connection manager properties
+      Long allocationRetry = null; // TODO
+      Long allocationRetryWaitMillis = null;
+
+      if (ds.getTimeOut() != null)
+      {
+         allocationRetry = ds.getTimeOut().getAllocationRetry();
+         allocationRetryWaitMillis = ds.getTimeOut().getAllocationRetryWaitMillis();
+      }
+
       // Select the correct connection manager
       TransactionSupportLevel tsl = TransactionSupportLevel.LocalTransaction;
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager cm = cmf.create(tsl, pool, getTransactionManager());
+      ConnectionManager cm = cmf.createTransactional(tsl, 
+                                                     pool,
+                                                     allocationRetry,
+                                                     allocationRetryWaitMillis,
+                                                     getTransactionManager());
 
+      cm.setJndiName(jndiName);
+
       // ConnectionFactory
-      Object cf = mcf.createConnectionFactory(cm);
-
-      return cf;
+      return mcf.createConnectionFactory(cm);
    }
 
    /**
     * Deploy an XA datasource
     * @param ds The datasource
+    * @param jndiName The JNDI name
     * @param ra The resource adapter
     * @param cl The class loader
     * @return The connection factory
     * @exception Throwable Thrown if an error occurs during deployment
     */
-   private Object deployXADataSource(XaDataSource ds, URL ra, ClassLoader cl) throws Throwable
+   private Object deployXADataSource(XaDataSource ds, String jndiName, URL ra, ClassLoader cl) throws Throwable
    {
       log.debug("XaDataSource=" + ds);
 
@@ -433,8 +457,8 @@
       Long blockingTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getBlockingTimeoutMillis() : null;
       Long idleTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getIdleTimeoutMinutes() : null;
       Long backgroundValidationInterval = null; // TODO
-      Boolean prefill = ds.getXaPool() == null ? false : ds.getXaPool().isPrefill();
-      Boolean strictMin = null; // TODO
+      Boolean prefill = ds.getXaPool() == null ? null : ds.getXaPool().isPrefill();
+      Boolean strictMin = ds.getXaPool() == null ? null : ds.getXaPool().isUseStrictMin();
       Boolean useFastFail = ds.getValidation() != null ? ds.getValidation().isUseFastFail() : null;
 
       PoolConfiguration pc = createPoolConfiguration(minSize,
@@ -449,15 +473,29 @@
       PoolFactory pf = new PoolFactory();
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
+      // Connection manager properties
+      Long allocationRetry = null; // TODO
+      Long allocationRetryWaitMillis = null;
+
+      if (ds.getTimeOut() != null)
+      {
+         allocationRetry = ds.getTimeOut().getAllocationRetry();
+         allocationRetryWaitMillis = ds.getTimeOut().getAllocationRetryWaitMillis();
+      }
+
       // Select the correct connection manager
-      TransactionSupportLevel tsl = TransactionSupportLevel.LocalTransaction;
+      TransactionSupportLevel tsl = TransactionSupportLevel.XATransaction;
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager cm = cmf.create(tsl, pool, getTransactionManager());
+      ConnectionManager cm = cmf.createTransactional(tsl,
+                                                     pool,
+                                                     allocationRetry,
+                                                     allocationRetryWaitMillis,
+                                                     getTransactionManager());
 
+      cm.setJndiName(jndiName);
+
       // ConnectionFactory
-      Object cf = mcf.createConnectionFactory(cm);
-
-      return cf;
+      return mcf.createConnectionFactory(cm);
    }
 
    /**

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -301,7 +301,7 @@
 
          // Get metadata
          Connector cmd = getConfiguration().getMetadataRepository().getResourceAdapter(url);
-         IronJacamar ijmd = null; // TODO - through MDR
+         IronJacamar ijmd = getConfiguration().getMetadataRepository().getIronJacamar(url);
 
          ResourceAdapter resourceAdapter = null;
          List<Validate> archiveValidationObjects = new ArrayList<Validate>();
@@ -372,6 +372,7 @@
                Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
                // Add a connection manager
+               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
                ConnectionManager cm = null;
 
                TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
@@ -395,9 +396,35 @@
                if (mcf instanceof TransactionSupport)
                   tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
+               // Connection manager properties
+               Long allocationRetry = null; // TODO
+               Long allocationRetryWaitMillis = null;
+               
+               if (ijmd != null)
+               {
+                  /*
+                    TODO
+                  allocationRetry = ijmd.getTimeOut().getAllocationRetry();
+                  allocationRetryWaitMillis = ijmd.getTimeOut().getAllocationRetryWaitMillis();
+                  */
+               }
+
                // Select the correct connection manager
-               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-               cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+               if (tsl == TransactionSupportLevel.NoTransaction)
+               {
+                  cm = cmf.createNonTransactional(tsl, 
+                                                  pool,
+                                                  allocationRetry,
+                                                  allocationRetryWaitMillis);
+               }
+               else
+               {
+                  cm = cmf.createTransactional(tsl, 
+                                               pool,
+                                               allocationRetry,
+                                               allocationRetryWaitMillis,
+                                               getConfiguration().getTransactionManager());
+               }
 
                // ConnectionFactory
                Object cf = mcf.createConnectionFactory(cm);
@@ -423,6 +450,8 @@
                   String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
                   cfs = new Object[] {cf};
                   jndis = new String[] {jndiNames[0]};
+
+                  cm.setJndiName(jndiNames[0]);
                }
             }
             else
@@ -466,6 +495,7 @@
                         Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
                         // Add a connection manager
+                        ConnectionManagerFactory cmf = new ConnectionManagerFactory();
                         ConnectionManager cm = null;
                         TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
                         TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
@@ -489,9 +519,35 @@
                         if (mcf instanceof TransactionSupport)
                            tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
+                        // Connection manager properties
+                        Long allocationRetry = null; // TODO
+                        Long allocationRetryWaitMillis = null;
+               
+                        if (ijmd != null)
+                        {
+                           /*
+                             TODO
+                             allocationRetry = ijmd.getTimeOut().getAllocationRetry();
+                             allocationRetryWaitMillis = ijmd.getTimeOut().getAllocationRetryWaitMillis();
+                           */
+                        }
+
                         // Select the correct connection manager
-                        ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                        cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+                        if (tsl == TransactionSupportLevel.NoTransaction)
+                        {
+                           cm = cmf.createNonTransactional(tsl, 
+                                                           pool,
+                                                           allocationRetry,
+                                                           allocationRetryWaitMillis);
+                        }
+                        else
+                        {
+                           cm = cmf.createTransactional(tsl, 
+                                                        pool,
+                                                        allocationRetry,
+                                                        allocationRetryWaitMillis,
+                                                        getConfiguration().getTransactionManager());
+                        }
 
                         // ConnectionFactory
                         Object cf = mcf.createConnectionFactory(cm);
@@ -518,6 +574,8 @@
                            String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
                            cfs = new Object[] {cf};
                            jndis = new String[] {jndiNames[0]};
+
+                           cm.setJndiName(jndiNames[0]);
                         }
                      }
                      else

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -273,6 +273,7 @@
                   Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
                   // Add a connection manager
+                  ConnectionManagerFactory cmf = new ConnectionManagerFactory();
                   ConnectionManager cm = null;
 
                   TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
@@ -292,10 +293,36 @@
                   {
                      tsl = TransactionSupportLevel.XATransaction;
                   }
+                  
+                  // Connection manager properties
+                  Long allocationRetry = null; // TODO
+                  Long allocationRetryWaitMillis = null;
+               
+                  if (ijmd != null)
+                  {
+                     /*
+                       TODO
+                       allocationRetry = ijmd.getTimeOut().getAllocationRetry();
+                       allocationRetryWaitMillis = ijmd.getTimeOut().getAllocationRetryWaitMillis();
+                     */
+                  }
 
                   // Select the correct connection manager
-                  ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                  cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+                  if (tsl == TransactionSupportLevel.NoTransaction)
+                  {
+                     cm = cmf.createNonTransactional(tsl, 
+                                                     pool,
+                                                     allocationRetry,
+                                                     allocationRetryWaitMillis);
+                  }
+                  else
+                  {
+                     cm = cmf.createTransactional(tsl, 
+                                                  pool,
+                                                  allocationRetry,
+                                                  allocationRetryWaitMillis,
+                                                  getConfiguration().getTransactionManager());
+                  }
 
                   // ConnectionFactory
                   Object cf = mcf.createConnectionFactory(cm);
@@ -318,8 +345,10 @@
 
                   if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
                   {
-                     bindConnectionFactory(url, deploymentName, cf);
+                     String[] jndis = bindConnectionFactory(url, deploymentName, cf);
                      cfs = new Object[] {cf};
+                     
+                     cm.setJndiName(jndis[0]);
                   }
                }
             }
@@ -377,6 +406,7 @@
                               Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
                               // Add a connection manager
+                              ConnectionManagerFactory cmf = new ConnectionManagerFactory();
                               ConnectionManager cm = null;
                               TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
                               TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
@@ -400,9 +430,35 @@
                               if (mcf instanceof TransactionSupport)
                                  tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
+                              // Connection manager properties
+                              Long allocationRetry = null; // TODO
+                              Long allocationRetryWaitMillis = null;
+                              
+                              if (ijmd != null)
+                              {
+                                 /*
+                                   TODO
+                                   allocationRetry = ijmd.getTimeOut().getAllocationRetry();
+                                   allocationRetryWaitMillis = ijmd.getTimeOut().getAllocationRetryWaitMillis();
+                                 */
+                              }
+
                               // Select the correct connection manager
-                              ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                              cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+                              if (tsl == TransactionSupportLevel.NoTransaction)
+                              {
+                                 cm = cmf.createNonTransactional(tsl,
+                                                                 pool,
+                                                                 allocationRetry,
+                                                                 allocationRetryWaitMillis);
+                              }
+                              else
+                              {
+                                 cm = cmf.createTransactional(tsl, 
+                                                              pool,
+                                                              allocationRetry,
+                                                              allocationRetryWaitMillis,
+                                                              getConfiguration().getTransactionManager());
+                              }
 
                               // ConnectionFactory
                               Object cf = mcf.createConnectionFactory(cm);
@@ -428,8 +484,10 @@
                                  if (cdMetas.size() == 1)
                                  {
                                     deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
-                                    bindConnectionFactory(url, deploymentName, cf);
+                                    String[] jndis = bindConnectionFactory(url, deploymentName, cf);
                                     cfs = new Object[] {cf};
+
+                                    cm.setJndiName(jndis[0]);
                                  }
                                  else
                                  {

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java	2010-09-14 10:43:32 UTC (rev 108136)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java	2010-09-14 12:15:20 UTC (rev 108137)
@@ -23,6 +23,7 @@
 package org.jboss.jca.deployers.fungal;
 
 import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
 import org.jboss.jca.common.api.metadata.ra.AdminObject;
 import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
 import org.jboss.jca.common.api.metadata.ra.Connector;
@@ -291,6 +292,7 @@
          }
 
          Connector cmd = getConfiguration().getMetadataRepository().getResourceAdapter(deployment);
+         IronJacamar ijmd = getConfiguration().getMetadataRepository().getIronJacamar(deployment);
          File root = getConfiguration().getMetadataRepository().getRoot(deployment);
 
          // Create classloader
@@ -375,6 +377,7 @@
                Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
                // Add a connection manager
+               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
                ConnectionManager cm = null;
 
                TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
@@ -398,9 +401,35 @@
                if (mcf instanceof TransactionSupport)
                   tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
+               // Connection manager properties
+               Long allocationRetry = null; // TODO
+               Long allocationRetryWaitMillis = null;
+               
+               if (ijmd != null)
+               {
+                  /*
+                    TODO
+                  allocationRetry = ijmd.getTimeOut().getAllocationRetry();
+                  allocationRetryWaitMillis = ijmd.getTimeOut().getAllocationRetryWaitMillis();
+                  */
+               }
+
                // Select the correct connection manager
-               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-               cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+               if (tsl == TransactionSupportLevel.NoTransaction)
+               {
+                  cm = cmf.createNonTransactional(tsl,
+                                                  pool,
+                                                  allocationRetry,
+                                                  allocationRetryWaitMillis);
+               }
+               else
+               {
+                  cm = cmf.createTransactional(tsl,
+                                               pool,
+                                               allocationRetry,
+                                               allocationRetryWaitMillis,
+                                               getConfiguration().getTransactionManager());
+               }
 
                // ConnectionFactory
                Object cf = mcf.createConnectionFactory(cm);
@@ -431,6 +460,8 @@
                   bindConnectionFactory(deployment, deploymentName, cf, jndiName);
                   cfs = new Object[] {cf};
                   jndiNames = new String[] {jndiName};
+
+                  cm.setJndiName(jndiName);
                }
             }
             else
@@ -485,6 +516,7 @@
                            Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
                            // Add a connection manager
+                           ConnectionManagerFactory cmf = new ConnectionManagerFactory();
                            ConnectionManager cm = null;
                            TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
                            TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
@@ -508,9 +540,35 @@
                            if (mcf instanceof TransactionSupport)
                               tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
+                           // Connection manager properties
+                           Long allocationRetry = null; // TODO
+                           Long allocationRetryWaitMillis = null;
+               
+                           if (ijmd != null)
+                           {
+                              /*
+                                TODO
+                              allocationRetry = ijmd.getTimeOut().getAllocationRetry();
+                              allocationRetryWaitMillis = ijmd.getTimeOut().getAllocationRetryWaitMillis();
+                              */
+                           }
+
                            // Select the correct connection manager
-                           ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                           cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+                           if (tsl == TransactionSupportLevel.NoTransaction)
+                           {
+                              cm = cmf.createNonTransactional(tsl,
+                                                              pool,
+                                                              allocationRetry,
+                                                              allocationRetryWaitMillis);
+                           }
+                           else
+                           {
+                              cm = cmf.createTransactional(tsl, 
+                                                           pool,
+                                                           allocationRetry,
+                                                           allocationRetryWaitMillis,
+                                                           getConfiguration().getTransactionManager());
+                           }
 
                            // ConnectionFactory
                            Object cf = mcf.createConnectionFactory(cm);
@@ -538,6 +596,8 @@
                               bindConnectionFactory(deployment, deploymentName, cf, jndiName);
                               cfs[cdIndex] = cf;
                               jndiNames[cdIndex] = jndiName;
+
+                              cm.setJndiName(jndiName);
                            }
                         }
                      }



More information about the jboss-cvs-commits mailing list