You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2006/07/31 23:08:24 UTC

svn commit: r427273 [2/6] - in /geronimo/branches/dain/notcm: applications/magicGball/magicGball-ear/src/plan/ applications/magicGball/src/plan/ configs/client-corba/src/plan/ configs/client-deployer/src/plan/ configs/client/src/plan/ configs/j2ee-corb...

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectionReleaser.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectionReleaser.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectionReleaser.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectionReleaser.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,27 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector;
+
+/**
+ *
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
+ *
+ * */
+public interface ConnectionReleaser {
+    void afterCompletion(Object managedConnectionInfo);
+}

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,111 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.transaction.Transaction;
+import javax.transaction.Synchronization;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectorTransactionContext {
+    private static final ConcurrentHashMap DATA_INDEX = new ConcurrentHashMap();
+
+    public static ConnectorTransactionContext get(Transaction transaction) {
+        if (transaction == null) {
+            throw new NullPointerException("transaction is null");
+        }
+
+        ConnectorTransactionContext ctx = (ConnectorTransactionContext) DATA_INDEX.get(transaction);
+        if (ctx == null) {
+            ctx = new ConnectorTransactionContext();
+
+            try {
+                transaction.registerSynchronization(new ConnectorSynchronization(ctx, transaction));
+            } catch (RollbackException e) {
+                throw (IllegalStateException) new IllegalStateException("Transaction is already rolled back").initCause(e);
+            } catch (SystemException e) {
+                throw new RuntimeException("Unable to register ejb transaction synchronization callback", e);
+            }
+
+            // Note: no synchronization is necessary here.  Since a transaction can only be associated with a single
+            // thread at a time, it should not be possible for someone else to have snuck in and created a
+            // ConnectorTransactionContext for this transaction.  We still protect against that with the putIfAbsent
+            // call below, and we simply have an extra transaction synchronization registered that won't do anything
+            DATA_INDEX.putIfAbsent(transaction, ctx);
+        }
+        return ctx;
+    }
+
+    private static void remove(Transaction transaction) {
+        DATA_INDEX.remove(transaction);
+    }
+
+    private Map managedConnections;
+
+    public Object getManagedConnectionInfo(ConnectionReleaser key) {
+        if (managedConnections == null) {
+            return null;
+        }
+        return managedConnections.get(key);
+    }
+
+    public void setManagedConnectionInfo(ConnectionReleaser key, Object info) {
+        if (managedConnections == null) {
+            managedConnections = new HashMap();
+        }
+        managedConnections.put(key, info);
+    }
+
+    private static class ConnectorSynchronization implements Synchronization {
+        private final ConnectorTransactionContext ctx;
+        private final Transaction transaction;
+
+        public ConnectorSynchronization(ConnectorTransactionContext ctx, Transaction transaction) {
+            this.ctx = ctx;
+            this.transaction = transaction;
+        }
+
+        public void beforeCompletion() {
+        }
+
+        public void afterCompletion(int status) {
+            try {
+                if (ctx.managedConnections != null) {
+                    for (Iterator entries = ctx.managedConnections.entrySet().iterator(); entries.hasNext();) {
+                        Map.Entry entry = (Map.Entry) entries.next();
+                        ConnectionReleaser key = (ConnectionReleaser) entry.getKey();
+                        key.afterCompletion(entry.getValue());
+                    }
+                    //If BeanTransactionContext never reuses the same instance for sequential BMT, this
+                    //clearing is unnecessary.
+                    ctx.managedConnections.clear();
+                }
+            } finally {
+                remove(transaction);
+            }
+        }
+    }
+}

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContext.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContext.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContext.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContext.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector;
+
+import java.util.Timer;
+import javax.resource.spi.work.WorkManager;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.UnavailableException;
+
+/**
+ * GBean BootstrapContext implementation that refers to externally configured WorkManager
+ * and XATerminator gbeans.
+ *
+ * @version $Rev: 356022 $ $Date: 2005-12-11 12:58:34 -0800 (Sun, 11 Dec 2005) $
+ */
+public class GeronimoBootstrapContext implements javax.resource.spi.BootstrapContext {
+    private final WorkManager workManager;
+    private final XATerminator xATerminator;
+
+    /**
+     * Default constructor for use as a GBean Endpoint.
+     */
+    public GeronimoBootstrapContext() {
+        workManager = null;
+        xATerminator = null;
+    }
+
+    /**
+     * Normal constructor for use as a GBean.
+     * @param workManager
+     * @param xaTerminator
+     */
+    public GeronimoBootstrapContext(WorkManager workManager, XATerminator xaTerminator) {
+        this.workManager = workManager;
+        this.xATerminator = xaTerminator;
+    }
+
+
+    /**
+     * @see javax.resource.spi.BootstrapContext#getWorkManager()
+     */
+    public WorkManager getWorkManager() {
+        return workManager;
+    }
+
+    /**
+     * @see javax.resource.spi.BootstrapContext#getXATerminator()
+     */
+    public XATerminator getXATerminator() {
+        return xATerminator;
+    }
+
+    /**
+     * @see javax.resource.spi.BootstrapContext#createTimer()
+     */
+    public Timer createTimer() throws UnavailableException {
+        return new Timer();
+    }
+
+}

Copied: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java (from r417848, geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/BootstrapContextGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java?p2=geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java&p1=geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/BootstrapContextGBean.java&r1=417848&r2=427273&rev=427273&view=diff
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/BootstrapContextGBean.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java Mon Jul 31 14:08:15 2006
@@ -22,26 +22,21 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 /**
  * 
  * @version $Revision$
  */
-public class BootstrapContextGBean {
-    
+public class GeronimoBootstrapContextGBean {
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(BootstrapContextGBean.class, BootstrapContext.class);
-          //adding interface does not work, creates attributes for references???
-//        infoFactory.addInterface(javax.resource.spi.BootstrapContext.class);
-
-        infoFactory.addOperation("createTimer");
-        infoFactory.addOperation("getWorkManager");
-        infoFactory.addOperation("getXATerminator");
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(GeronimoBootstrapContextGBean.class, GeronimoBootstrapContext.class, NameFactory.JCA_BOOTSTRAP_CONTEXT);
 
-        infoFactory.addReference("WorkManager", WorkManager.class);
-        infoFactory.addReference("XATerminator", XATerminator.class);
+        infoFactory.addReference("WorkManager", WorkManager.class, NameFactory.JCA_WORK_MANAGER);
+        infoFactory.addReference("XATerminator", XATerminator.class, NameFactory.JCA_XA_TERMINATOR);
 
         infoFactory.setConstructor(new String[]{"WorkManager", "XATerminator"});
 

Propchange: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java Mon Jul 31 14:08:15 2006
@@ -29,7 +29,7 @@
 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
 
 /**
- * @version $Rev: 395155 $ $Date$
+ * @version $Rev$ $Date$
  */
 public class ResourceAdapterModuleImpl implements ResourceAdapterModule {
     private final J2EEServer server;

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java Mon Jul 31 14:08:15 2006
@@ -17,8 +17,6 @@
 
 package org.apache.geronimo.connector;
 
-import org.apache.geronimo.connector.work.GeronimoWorkManager;
-
 import javax.resource.ResourceException;
 import javax.resource.spi.ActivationSpec;
 import javax.resource.spi.BootstrapContext;
@@ -52,18 +50,18 @@
         this.resourceAdapter = null;
     }
 
-    public ResourceAdapterWrapper(final String resourceAdapterClass,
-                                  final GeronimoWorkManager workManager,
-                                  ClassLoader cl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+    public ResourceAdapterWrapper(String resourceAdapterClass,
+            BootstrapContext bootstrapContext,
+            ClassLoader cl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
         this.resourceAdapterClass = resourceAdapterClass;
-        this.bootstrapContext = new BootstrapContextImpl(workManager);
+        this.bootstrapContext = bootstrapContext;
         Class clazz = cl.loadClass(resourceAdapterClass);
         resourceAdapter = (ResourceAdapter) clazz.newInstance();
     }
     
-    public ResourceAdapterWrapper(ResourceAdapter resourceAdapter, final GeronimoWorkManager workManager) {
+    public ResourceAdapterWrapper(ResourceAdapter resourceAdapter, BootstrapContext bootstrapContext) {
         this.resourceAdapterClass = resourceAdapter.getClass().getName();
-        this.bootstrapContext = new BootstrapContextImpl(workManager);
+        this.bootstrapContext = bootstrapContext;
         this.resourceAdapter = resourceAdapter;
     }
 

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java Mon Jul 31 14:08:15 2006
@@ -17,7 +17,6 @@
 
 package org.apache.geronimo.connector;
 
-import org.apache.geronimo.connector.work.GeronimoWorkManager;
 import org.apache.geronimo.gbean.DynamicGBean;
 import org.apache.geronimo.gbean.DynamicGBeanDelegate;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -28,6 +27,8 @@
 
 import javax.resource.spi.ResourceAdapter;
 import javax.resource.spi.ResourceAdapterAssociation;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkManager;
 
 /**
  * 
@@ -43,8 +44,8 @@
         objectName = null;
     }
 
-    public ResourceAdapterWrapperGBean(final String resourceAdapterClass, final GeronimoWorkManager workManager, ClassLoader cl, String objectName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
-        super(resourceAdapterClass, workManager, cl);
+    public ResourceAdapterWrapperGBean(String resourceAdapterClass, WorkManager workManager, XATerminator xaTerminator, ClassLoader cl, String objectName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        super(resourceAdapterClass, new GeronimoBootstrapContext (workManager, xaTerminator), cl);
         delegate = new DynamicGBeanDelegate();
         delegate.addAll(resourceAdapter);
         this.objectName = objectName;
@@ -87,14 +88,15 @@
         infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
         infoBuilder.addAttribute("objectName", String.class, false);
 
-        infoBuilder.addReference("WorkManager", GeronimoWorkManager.class, NameFactory.JCA_WORK_MANAGER);
+        infoBuilder.addReference("WorkManager", WorkManager.class, NameFactory.JCA_WORK_MANAGER);
+        infoBuilder.addReference("XATerminator", XATerminator.class, NameFactory.JCA_WORK_MANAGER);
 
         infoBuilder.addOperation("registerResourceAdapterAssociation", new Class[]{ResourceAdapterAssociation.class});
 
         infoBuilder.addInterface(ResourceAdapter.class);
         infoBuilder.addInterface(JCAResourceAdapter.class);
 
-        infoBuilder.setConstructor(new String[]{"resourceAdapterClass", "WorkManager", "classLoader", "objectName"});
+        infoBuilder.setConstructor(new String[]{"resourceAdapterClass", "WorkManager", "XATerminator", "classLoader", "objectName"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/ConnectionFactorySource.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/ConnectionFactorySource.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/ConnectionFactorySource.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/ConnectionFactorySource.java Mon Jul 31 14:08:15 2006
@@ -18,7 +18,7 @@
 package org.apache.geronimo.connector.outbound;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public interface ConnectionFactorySource {
 

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java Mon Jul 31 14:08:15 2006
@@ -17,11 +17,12 @@
 
 package org.apache.geronimo.connector.outbound;
 
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PartitionedPool;
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  * GenericConnectionManager sets up a connection manager stack according to the
@@ -40,10 +41,10 @@
                                     PoolingSupport pooling,
                                     boolean containerManagedSecurity,
                                     ConnectionTracker connectionTracker,
-                                    TransactionContextManager transactionContextManager,
+                                    TransactionManager transactionManager,
                                     String objectName,
                                     ClassLoader classLoader) {
-        super(new InterceptorsImpl(transactionSupport, pooling, containerManagedSecurity, objectName, connectionTracker, transactionContextManager, classLoader));
+        super(new InterceptorsImpl(transactionSupport, pooling, containerManagedSecurity, objectName, connectionTracker, transactionManager, classLoader));
     }
 
     private static class InterceptorsImpl implements AbstractConnectionManager.Interceptors {
@@ -70,7 +71,7 @@
                                 boolean containerManagedSecurity,
                                 String objectName,
                                 ConnectionTracker connectionTracker,
-                                TransactionContextManager transactionContextManager,
+                                TransactionManager transactionManager,
                                 ClassLoader classLoader) {
             //check for consistency between attributes
             if (!containerManagedSecurity && pooling instanceof PartitionedPool && ((PartitionedPool) pooling).isPartitionBySubject()) {
@@ -84,7 +85,7 @@
             stack = transactionSupport.addXAResourceInsertionInterceptor(stack, objectName);
             stack = pooling.addPoolingInterceptors(stack);
             this.poolingSupport = pooling;
-            stack = transactionSupport.addTransactionInterceptors(stack, transactionContextManager);
+            stack = transactionSupport.addTransactionInterceptors(stack, transactionManager);
 
             if (containerManagedSecurity) {
                 stack = new SubjectInterceptor(stack);

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java Mon Jul 31 14:08:15 2006
@@ -17,6 +17,8 @@
 package org.apache.geronimo.connector.outbound;
 
 import javax.resource.spi.ConnectionManager;
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
@@ -24,7 +26,6 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 
@@ -43,11 +44,11 @@
                                          PoolingSupport pooling,
                                          boolean containerManagedSecurity,
                                          ConnectionTracker connectionTracker,
-                                         TransactionContextManager transactionContextManager,
+                                         TransactionManager transactionManager,
                                          String objectName,
                                          ClassLoader classLoader,
                                          Kernel kernel) {
-        super(transactionSupport, pooling, containerManagedSecurity, connectionTracker, transactionContextManager, objectName, classLoader);
+        super(transactionSupport, pooling, containerManagedSecurity, connectionTracker, transactionManager, objectName, classLoader);
         this.kernel = kernel;
     }
 
@@ -75,7 +76,7 @@
         infoBuilder.addAttribute("kernel", Kernel.class, false);
 
         infoBuilder.addReference("ConnectionTracker", ConnectionTracker.class, NameFactory.JCA_CONNECTION_TRACKER);
-        infoBuilder.addReference("TransactionContextManager", TransactionContextManager.class, NameFactory.TRANSACTION_CONTEXT_MANAGER);
+        infoBuilder.addReference("TransactionManager", TransactionManager.class, NameFactory.TRANSACTION_MANAGER);
 
 
         infoBuilder.setConstructor(new String[]{
@@ -83,7 +84,7 @@
             "pooling",
             "containerManagedSecurity",
             "ConnectionTracker",
-            "TransactionContextManager",
+            "TransactionManager",
             "objectName",
             "classLoader",
             "kernel"

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java Mon Jul 31 14:08:15 2006
@@ -22,10 +22,11 @@
 import java.util.Iterator;
 import java.util.Set;
 import javax.resource.ResourceException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
 
-import org.apache.geronimo.transaction.ConnectionReleaser;
-import org.apache.geronimo.transaction.context.TransactionContext;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.connector.ConnectorTransactionContext;
+import org.apache.geronimo.connector.ConnectionReleaser;
 
 /**
  * TransactionCachingInterceptor.java
@@ -50,22 +51,25 @@
 public class TransactionCachingInterceptor implements ConnectionInterceptor, ConnectionReleaser {
 
     private final ConnectionInterceptor next;
-    private final TransactionContextManager transactionContextManager;
+    private final TransactionManager transactionManager;
 
-    public TransactionCachingInterceptor(ConnectionInterceptor next, TransactionContextManager transactionContextManager) {
+    public TransactionCachingInterceptor(ConnectionInterceptor next, TransactionManager transactionManager) {
         this.next = next;
-        this.transactionContextManager = transactionContextManager;
+        this.transactionManager = transactionManager;
     }
 
     public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
         //There can be an inactive transaction context when a connection is requested in
         //Synchronization.afterCompletion().
-        TransactionContext transactionContext = transactionContextManager.getContext();
-        if (transactionContext != null && transactionContext.isInheritable() && transactionContext.isActive()) {
-            ManagedConnectionInfos managedConnectionInfos = (ManagedConnectionInfos) transactionContext.getManagedConnectionInfo(this);
+
+        // get the current transation and status... if there is a problem just assume there is no transaction present
+        Transaction transaction = TxUtil.getTransactionIfActive(transactionManager);
+        if (transaction != null) {
+            ConnectorTransactionContext connectorTransactionContext = ConnectorTransactionContext.get(transaction);
+            ManagedConnectionInfos managedConnectionInfos = (ManagedConnectionInfos) connectorTransactionContext.getManagedConnectionInfo(this);
             if (managedConnectionInfos == null) {
                 managedConnectionInfos = new ManagedConnectionInfos();
-                transactionContext.setManagedConnectionInfo(this, managedConnectionInfos);
+                connectorTransactionContext.setManagedConnectionInfo(this, managedConnectionInfos);
             }
             if (connectionInfo.isUnshareable()) {
                 if (!managedConnectionInfos.containsUnshared(connectionInfo.getManagedConnectionInfo())) {
@@ -94,8 +98,7 @@
             return;
         }
 
-        TransactionContext transactionContext = transactionContextManager.getContext();
-        if (transactionContext != null && transactionContext.isInheritable() && transactionContext.isActive()) {
+        if (TxUtil.isTransactionActive(transactionManager)) {
             return;
         }
         internalReturn(connectionInfo, connectionReturnAction);
@@ -112,7 +115,7 @@
     public void destroy() {
         next.destroy();
     }
-    
+
     public void afterCompletion(Object stuff) {
         ManagedConnectionInfos managedConnectionInfos = (ManagedConnectionInfos) stuff;
         ManagedConnectionInfo sharedMCI = managedConnectionInfos.getShared();

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java Mon Jul 31 14:08:15 2006
@@ -20,11 +20,10 @@
 import javax.resource.ResourceException;
 import javax.transaction.RollbackException;
 import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;
 
-import org.apache.geronimo.transaction.context.TransactionContext;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
-
 /**
  * TransactionEnlistingInterceptor.java
  * <p/>
@@ -36,21 +35,23 @@
 public class TransactionEnlistingInterceptor implements ConnectionInterceptor {
 
     private final ConnectionInterceptor next;
-    private final TransactionContextManager transactionContextManager;
+    private final TransactionManager transactionManager;
 
-    public TransactionEnlistingInterceptor(ConnectionInterceptor next, TransactionContextManager transactionContextManager) {
+    public TransactionEnlistingInterceptor(ConnectionInterceptor next, TransactionManager transactionManager) {
         this.next = next;
-        this.transactionContextManager = transactionContextManager;
+        this.transactionManager = transactionManager;
     }
 
     public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
         next.getConnection(connectionInfo);
         try {
             ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
-            TransactionContext transactionContext = transactionContextManager.getContext();
-            if (transactionContext != null && transactionContext.isInheritable() && transactionContext.isActive()) {
+
+            // get the current transation and status... if there is a problem just assume there is no transaction present
+            Transaction transaction = TxUtil.getTransactionIfActive(transactionManager);
+            if (transaction != null) {
                 XAResource xares = mci.getXAResource();
-                transactionContext.enlistResource(xares);
+                transaction.enlistResource(xares);
             }
         } catch (SystemException e) {
             returnConnection(connectionInfo, ConnectionReturnAction.DESTROY);
@@ -78,10 +79,10 @@
                                  ConnectionReturnAction connectionReturnAction) {
         try {
             ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
-            TransactionContext transactionContext = transactionContextManager.getContext();
-            if (transactionContext != null && transactionContext.isInheritable() && transactionContext.isActive()) {
+            Transaction transaction = TxUtil.getTransactionIfActive(transactionManager);
+            if (transaction != null) {
                 XAResource xares = mci.getXAResource();
-                transactionContext.delistResource(xares, XAResource.TMSUSPEND);
+                transaction.delistResource(xares, XAResource.TMSUSPEND);
             }
 
         } catch (SystemException e) {
@@ -97,5 +98,5 @@
     public void destroy() {
         next.destroy();
     }
-    
+
 }

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TxUtil.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TxUtil.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TxUtil.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/TxUtil.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.outbound;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class TxUtil {
+    private TxUtil() {
+    }
+
+    public static Transaction getTransactionIfActive(TransactionManager transactionManager) {
+        Transaction transaction = null;
+        int status = Status.STATUS_NO_TRANSACTION;
+        try {
+            transaction = transactionManager.getTransaction();
+            if (transaction != null) status = transaction.getStatus();
+        } catch (SystemException ignored) {
+        }
+
+        if (transaction != null && status == Status.STATUS_ACTIVE || status == Status.STATUS_MARKED_ROLLBACK) {
+            return transaction;
+        }
+        return null;
+    }
+
+    public static boolean isTransactionActive(TransactionManager transactionManager) {
+        try {
+            int status = transactionManager.getStatus();
+            return status == Status.STATUS_ACTIVE || status == Status.STATUS_MARKED_ROLLBACK;
+        } catch (SystemException ignored) {
+            return false;
+        }
+    }
+
+    public static boolean isActive(Transaction transaction) {
+        try {
+            int status = transaction.getStatus();
+            return status == Status.STATUS_ACTIVE || status == Status.STATUS_MARKED_ROLLBACK;
+        } catch (SystemException ignored) {
+            return false;
+        }
+    }
+}
+

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java Mon Jul 31 14:08:15 2006
@@ -17,11 +17,12 @@
 
 package org.apache.geronimo.connector.outbound.connectionmanagerconfig;
 
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.LocalXAResourceInsertionInterceptor;
 import org.apache.geronimo.connector.outbound.TransactionCachingInterceptor;
 import org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  *
@@ -39,8 +40,8 @@
         return new LocalXAResourceInsertionInterceptor(stack, name);
     }
 
-    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionContextManager transactionContextManager) {
-        stack = new TransactionEnlistingInterceptor(stack, transactionContextManager);
-        return new TransactionCachingInterceptor(stack, transactionContextManager);
+    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) {
+        stack = new TransactionEnlistingInterceptor(stack, transactionManager);
+        return new TransactionCachingInterceptor(stack, transactionManager);
     }
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java Mon Jul 31 14:08:15 2006
@@ -17,8 +17,9 @@
 
 package org.apache.geronimo.connector.outbound.connectionmanagerconfig;
 
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  *
@@ -36,7 +37,7 @@
         return stack;
     }
 
-    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionContextManager transactionContextManager) {
+    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) {
         return stack;
     }
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java Mon Jul 31 14:08:15 2006
@@ -17,11 +17,12 @@
 
 package org.apache.geronimo.connector.outbound.connectionmanagerconfig;
 
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.TransactionCachingInterceptor;
 import org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor;
 import org.apache.geronimo.connector.outbound.transactionlog.LogXAResourceInsertionInterceptor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  *
@@ -40,8 +41,8 @@
         return new LogXAResourceInsertionInterceptor(stack, name);
     }
 
-    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionContextManager transactionContextManager) {
-        stack = new TransactionEnlistingInterceptor(stack, transactionContextManager);
-        return new TransactionCachingInterceptor(stack, transactionContextManager);
+    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) {
+        stack = new TransactionEnlistingInterceptor(stack, transactionManager);
+        return new TransactionCachingInterceptor(stack, transactionManager);
     }
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java Mon Jul 31 14:08:15 2006
@@ -19,8 +19,9 @@
 
 import java.io.Serializable;
 
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  *
@@ -30,6 +31,6 @@
  * */
 public abstract class TransactionSupport implements Serializable {
     public abstract ConnectionInterceptor addXAResourceInsertionInterceptor(ConnectionInterceptor stack, String name);
-    public abstract ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionContextManager transactionContextManager);
+    public abstract ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager);
 
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java Mon Jul 31 14:08:15 2006
@@ -17,12 +17,13 @@
 
 package org.apache.geronimo.connector.outbound.connectionmanagerconfig;
 
+import javax.transaction.TransactionManager;
+
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.ThreadLocalCachingConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.TransactionCachingInterceptor;
 import org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor;
 import org.apache.geronimo.connector.outbound.XAResourceInsertionInterceptor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  *
@@ -59,15 +60,15 @@
         return new XAResourceInsertionInterceptor(stack, name);
     }
 
-    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionContextManager transactionContextManager) {
+    public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) {
         //experimental thread local caching
         if (isUseThreadCaching()) {
             //useMatching should be configurable
             stack = new ThreadLocalCachingConnectionInterceptor(stack, false);
         }
-        stack = new TransactionEnlistingInterceptor(stack, transactionContextManager);
+        stack = new TransactionEnlistingInterceptor(stack, transactionManager);
         if (isUseTransactionCaching()) {
-            stack = new TransactionCachingInterceptor(stack, transactionContextManager);
+            stack = new TransactionCachingInterceptor(stack, transactionManager);
         }
         return stack;
     }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java Mon Jul 31 14:08:15 2006
@@ -22,14 +22,11 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-
 import javax.resource.ResourceException;
 
 import org.apache.geronimo.connector.outbound.ConnectionInfo;
 import org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor;
 import org.apache.geronimo.connector.outbound.ManagedConnectionInfo;
-import org.apache.geronimo.transaction.InstanceContext;
-import org.apache.geronimo.transaction.TrackedConnectionAssociator;
 
 /**
  * ConnectionTrackingCoordinator tracks connections that are in use by
@@ -51,16 +48,16 @@
 
     private final ThreadLocal currentInstanceContexts = new ThreadLocal();
 
-    public InstanceContext enter(InstanceContext newInstanceContext)
+    public ConnectorInstanceContext enter(ConnectorInstanceContext newConnectorInstanceContext)
             throws ResourceException {
-        InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
-        currentInstanceContexts.set(newInstanceContext);
-        notifyConnections(newInstanceContext);
-        return oldInstanceContext;
+        ConnectorInstanceContext oldConnectorInstanceContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+        currentInstanceContexts.set(newConnectorInstanceContext);
+        notifyConnections(newConnectorInstanceContext);
+        return oldConnectorInstanceContext;
     }
 
-    private void notifyConnections(InstanceContext oldInstanceContext) throws ResourceException {
-        Map connectionManagerToManagedConnectionInfoMap = oldInstanceContext.getConnectionManagerMap();
+    private void notifyConnections(ConnectorInstanceContext oldConnectorInstanceContext) throws ResourceException {
+        Map connectionManagerToManagedConnectionInfoMap = oldConnectorInstanceContext.getConnectionManagerMap();
         for (Iterator i = connectionManagerToManagedConnectionInfoMap.entrySet().iterator(); i.hasNext();) {
             Map.Entry entry = (Map.Entry) i.next();
             ConnectionTrackingInterceptor mcci =
@@ -71,14 +68,17 @@
     }
 
     public void newTransaction() throws ResourceException {
-        InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
-        notifyConnections(oldInstanceContext);
+        ConnectorInstanceContext oldConnectorInstanceContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+        if (oldConnectorInstanceContext == null) {
+            return;
+        }
+        notifyConnections(oldConnectorInstanceContext);
     }
 
-    public void exit(InstanceContext reenteringInstanceContext)
+    public void exit(ConnectorInstanceContext reenteringConnectorInstanceContext)
             throws ResourceException {
-        InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
-        Map resources = oldInstanceContext.getConnectionManagerMap();
+        ConnectorInstanceContext oldConnectorInstanceContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+        Map resources = oldConnectorInstanceContext.getConnectionManagerMap();
         for (Iterator i = resources.entrySet().iterator(); i.hasNext();) {
             Map.Entry entry = (Map.Entry) i.next();
             ConnectionTrackingInterceptor mcci =
@@ -89,18 +89,18 @@
                 i.remove();
             }
         }
-        currentInstanceContexts.set(reenteringInstanceContext);
+        currentInstanceContexts.set(reenteringConnectorInstanceContext);
     }
 
 
     public void handleObtained(
             ConnectionTrackingInterceptor connectionTrackingInterceptor,
             ConnectionInfo connectionInfo) {
-        InstanceContext instanceContext = (InstanceContext) currentInstanceContexts.get();
-        if (instanceContext == null) {
+        ConnectorInstanceContext connectorInstanceContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+        if (connectorInstanceContext == null) {
             return;
         }
-        Map resources = instanceContext.getConnectionManagerMap();
+        Map resources = connectorInstanceContext.getConnectionManagerMap();
         Set infos = (Set) resources.get(connectionTrackingInterceptor);
         if (infos == null) {
             infos = new HashSet();
@@ -112,11 +112,11 @@
     public void handleReleased(
             ConnectionTrackingInterceptor connectionTrackingInterceptor,
             ConnectionInfo connectionInfo) {
-        InstanceContext instanceContext = (InstanceContext) currentInstanceContexts.get();
-        if (instanceContext == null) {
+        ConnectorInstanceContext connectorInstanceContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+        if (connectorInstanceContext == null) {
             return;
         }
-        Map resources = instanceContext.getConnectionManagerMap();
+        Map resources = connectorInstanceContext.getConnectionManagerMap();
         Set infos = (Set) resources.get(connectionTrackingInterceptor);
         if (connectionInfo.getConnectionHandle() == null) {
             //destroy was called as a result of an error
@@ -129,12 +129,12 @@
     }
 
     public void setEnvironment(ConnectionInfo connectionInfo, String key) {
-        InstanceContext currentInstanceContext = (InstanceContext) currentInstanceContexts.get();
-        if (currentInstanceContext != null) {
-            Set unshareableResources = currentInstanceContext.getUnshareableResources();
+        ConnectorInstanceContext currentConnectorInstanceContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+        if (currentConnectorInstanceContext != null) {
+            Set unshareableResources = currentConnectorInstanceContext.getUnshareableResources();
             boolean unshareable = unshareableResources.contains(key);
             connectionInfo.setUnshareable(unshareable);
-            Set applicationManagedSecurityResources = currentInstanceContext.getApplicationManagedSecurityResources();
+            Set applicationManagedSecurityResources = currentConnectorInstanceContext.getApplicationManagedSecurityResources();
             boolean applicationManagedSecurity = applicationManagedSecurityResources.contains(key);
             connectionInfo.setApplicationManagedSecurity(applicationManagedSecurity);
         }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.java Mon Jul 31 14:08:15 2006
@@ -19,21 +19,46 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.transaction.TrackedConnectionAssociator;
+import org.apache.geronimo.transaction.manager.MonitorableTransactionManager;
 
 /**
  * 
  * @version $Revision$
  */
-public class ConnectionTrackingCoordinatorGBean {
-    
+public class ConnectionTrackingCoordinatorGBean extends ConnectionTrackingCoordinator implements GBeanLifecycle {
+    private final MonitorableTransactionManager monitorableTm;
+    private final GeronimoTransactionListener listener;
+
+    public ConnectionTrackingCoordinatorGBean(MonitorableTransactionManager monitorableTm) {
+        this.monitorableTm = monitorableTm;
+        listener = new GeronimoTransactionListener(this);
+    }
+
+    public void doStart() throws Exception {
+        monitorableTm.addTransactionAssociationListener(listener);
+    }
+
+    public void doStop() throws Exception {
+        monitorableTm.removeTransactionAssociationListener(listener);
+    }
+
+    public void doFail() {
+        monitorableTm.removeTransactionAssociationListener(listener);
+    }
+
     public final static GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ConnectionTrackingCoordinatorGBean.class, ConnectionTrackingCoordinator.class, NameFactory.JCA_CONNECTION_TRACKER);
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ConnectionTrackingCoordinatorGBean.class, NameFactory.JCA_CONNECTION_TRACKER);
+
+        infoFactory.addReference("TransactionManager", MonitorableTransactionManager.class, NameFactory.TRANSACTION_MANAGER);
+
         infoFactory.addInterface(TrackedConnectionAssociator.class);
         infoFactory.addInterface(ConnectionTracker.class);
+
+        infoFactory.setConstructor(new String[] {"TransactionManager"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.connector.outbound.connectiontracking;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
+ */
+public interface ConnectorInstanceContext {
+    /**
+     * IMPORTANT INVARIANT: this should always return a map, never null.
+     * @return map of ConnectionManager to (list of ) managed connection info objects.
+     */
+    Map getConnectionManagerMap();
+
+    Set getUnshareableResources();
+
+    Set getApplicationManagedSecurityResources();
+}

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.connector.outbound.connectiontracking;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Simple implementation of ComponentContext satisfying invariant.
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
+ *
+ * */
+public class ConnectorInstanceContextImpl implements ConnectorInstanceContext {
+    private final Map connectionManagerMap = new HashMap();
+    private final Set unshareableResources;
+    private final Set applicationManagedSecurityResources;
+
+    public ConnectorInstanceContextImpl(Set unshareableResources, Set applicationManagedSecurityResources) {
+        this.unshareableResources = unshareableResources;
+        this.applicationManagedSecurityResources = applicationManagedSecurityResources;
+    }
+
+    public Map getConnectionManagerMap() {
+        return connectionManagerMap;
+    }
+
+    public Set getUnshareableResources() {
+        return unshareableResources;
+    }
+
+    public Set getApplicationManagedSecurityResources() {
+        return applicationManagedSecurityResources;
+    }
+}

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/GeronimoTransactionListener.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/GeronimoTransactionListener.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/GeronimoTransactionListener.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/GeronimoTransactionListener.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.outbound.connectiontracking;
+
+import javax.transaction.Transaction;
+import javax.resource.ResourceException;
+
+import org.apache.geronimo.transaction.manager.TransactionManagerMonitor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTransactionListener implements TransactionManagerMonitor {
+    private static final Log log = LogFactory.getLog(GeronimoTransactionListener.class);
+    private final TrackedConnectionAssociator trackedConnectionAssociator;
+
+    public GeronimoTransactionListener(TrackedConnectionAssociator trackedConnectionAssociator) {
+        this.trackedConnectionAssociator = trackedConnectionAssociator;
+    }
+
+    public void threadAssociated(Transaction transaction) {
+        try {
+            trackedConnectionAssociator.newTransaction();
+        } catch (ResourceException e) {
+            log.warn("Error notifying connection tranker of transaction association", e);
+        }
+    }
+
+    public void threadUnassociated(Transaction transaction) {
+        try {
+            trackedConnectionAssociator.newTransaction();
+        } catch (ResourceException e) {
+            log.warn("Error notifying connection tranker of transaction dissociation", e);
+        }
+    }
+}

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/TrackedConnectionAssociator.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/TrackedConnectionAssociator.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/TrackedConnectionAssociator.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/TrackedConnectionAssociator.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.connector.outbound.connectiontracking;
+
+import javax.resource.ResourceException;
+
+/**
+ *
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
+ *
+ */
+public interface TrackedConnectionAssociator {
+
+    ConnectorInstanceContext enter(ConnectorInstanceContext newConnectorInstanceContext)
+            throws ResourceException;
+
+    void newTransaction() throws ResourceException;
+
+    void exit(ConnectorInstanceContext connectorInstanceContext)
+            throws ResourceException;
+
+}

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java Mon Jul 31 14:08:15 2006
@@ -17,19 +17,19 @@
 
 package org.apache.geronimo.connector.work;
 
-import javax.resource.spi.XATerminator;
 import javax.resource.spi.work.ExecutionContext;
 import javax.resource.spi.work.Work;
 import javax.resource.spi.work.WorkCompletedException;
 import javax.resource.spi.work.WorkException;
 import javax.resource.spi.work.WorkListener;
 import javax.resource.spi.work.WorkManager;
+
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 import org.apache.geronimo.connector.work.pool.ScheduleWorkExecutor;
 import org.apache.geronimo.connector.work.pool.StartWorkExecutor;
 import org.apache.geronimo.connector.work.pool.SyncWorkExecutor;
 import org.apache.geronimo.connector.work.pool.WorkExecutor;
-import org.apache.geronimo.pool.GeronimoExecutor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.transaction.manager.XAWork;
 
 /**
  * WorkManager implementation which uses under the cover three WorkExecutorPool
@@ -49,21 +49,21 @@
      * Pool of threads used by this WorkManager in order to process
      * the Work instances submitted via the doWork methods.
      */
-    private GeronimoExecutor syncWorkExecutorPool;
+    private Executor syncWorkExecutorPool;
 
     /**
      * Pool of threads used by this WorkManager in order to process
      * the Work instances submitted via the startWork methods.
      */
-    private GeronimoExecutor startWorkExecutorPool;
+    private Executor startWorkExecutorPool;
 
     /**
      * Pool of threads used by this WorkManager in order to process
      * the Work instances submitted via the scheduleWork methods.
      */
-    private GeronimoExecutor scheduledWorkExecutorPool;
+    private Executor scheduledWorkExecutorPool;
 
-    private final TransactionContextManager transactionContextManager;
+    private final XAWork transactionManager;
 
     private final WorkExecutor scheduleWorkExecutor = new ScheduleWorkExecutor();
     private final WorkExecutor startWorkExecutor = new StartWorkExecutor();
@@ -76,11 +76,11 @@
         this(null, null, null, null);
     }
 
-    public GeronimoWorkManager(GeronimoExecutor sync, GeronimoExecutor start, GeronimoExecutor sched, TransactionContextManager transactionContextManager) {
+    public GeronimoWorkManager(Executor sync, Executor start, Executor sched, XAWork xaWork) {
         syncWorkExecutorPool = sync;
         startWorkExecutorPool = start;
         scheduledWorkExecutorPool = sched;
-        this.transactionContextManager = transactionContextManager;
+        this.transactionManager = xaWork;
     }
 
     public void doStart() throws Exception {
@@ -97,19 +97,15 @@
         }
     }
 
-    public XATerminator getXATerminator() {
-        return transactionContextManager;
-    }
-
-    public GeronimoExecutor getSyncWorkExecutorPool() {
+    public Executor getSyncWorkExecutorPool() {
         return syncWorkExecutorPool;
     }
 
-    public GeronimoExecutor getStartWorkExecutorPool() {
+    public Executor getStartWorkExecutorPool() {
         return startWorkExecutorPool;
     }
 
-    public GeronimoExecutor getScheduledWorkExecutorPool() {
+    public Executor getScheduledWorkExecutorPool() {
         return scheduledWorkExecutorPool;
     }
 
@@ -117,7 +113,7 @@
     * @see javax.resource.spi.work.WorkManager#doWork(javax.resource.spi.work.Work)
     */
     public void doWork(Work work) throws WorkException {
-        executeWork(new WorkerContext(work, transactionContextManager), syncWorkExecutor, syncWorkExecutorPool);
+        executeWork(new WorkerContext(work, transactionManager), syncWorkExecutor, syncWorkExecutorPool);
     }
 
     /* (non-Javadoc)
@@ -130,7 +126,7 @@
             WorkListener workListener)
             throws WorkException {
         WorkerContext workWrapper =
-                new WorkerContext(work, startTimeout, execContext, transactionContextManager, workListener);
+                new WorkerContext(work, startTimeout, execContext, transactionManager, workListener);
         workWrapper.setThreadPriority(Thread.currentThread().getPriority());
         executeWork(workWrapper, syncWorkExecutor, syncWorkExecutorPool);
     }
@@ -139,7 +135,7 @@
      * @see javax.resource.spi.work.WorkManager#startWork(javax.resource.spi.work.Work)
      */
     public long startWork(Work work) throws WorkException {
-        WorkerContext workWrapper = new WorkerContext(work, transactionContextManager);
+        WorkerContext workWrapper = new WorkerContext(work, transactionManager);
         workWrapper.setThreadPriority(Thread.currentThread().getPriority());
         executeWork(workWrapper, startWorkExecutor, startWorkExecutorPool);
         return System.currentTimeMillis() - workWrapper.getAcceptedTime();
@@ -155,7 +151,7 @@
             WorkListener workListener)
             throws WorkException {
         WorkerContext workWrapper =
-                new WorkerContext(work, startTimeout, execContext, transactionContextManager, workListener);
+                new WorkerContext(work, startTimeout, execContext, transactionManager, workListener);
         workWrapper.setThreadPriority(Thread.currentThread().getPriority());
         executeWork(workWrapper, startWorkExecutor, startWorkExecutorPool);
         return System.currentTimeMillis() - workWrapper.getAcceptedTime();
@@ -165,7 +161,7 @@
      * @see javax.resource.spi.work.WorkManager#scheduleWork(javax.resource.spi.work.Work)
      */
     public void scheduleWork(Work work) throws WorkException {
-        WorkerContext workWrapper = new WorkerContext(work, transactionContextManager);
+        WorkerContext workWrapper = new WorkerContext(work, transactionManager);
         workWrapper.setThreadPriority(Thread.currentThread().getPriority());
         executeWork(workWrapper, scheduleWorkExecutor, scheduledWorkExecutorPool);
     }
@@ -180,7 +176,7 @@
             WorkListener workListener)
             throws WorkException {
         WorkerContext workWrapper =
-                new WorkerContext(work, startTimeout, execContext, transactionContextManager, workListener);
+                new WorkerContext(work, startTimeout, execContext, transactionManager, workListener);
         workWrapper.setThreadPriority(Thread.currentThread().getPriority());
         executeWork(workWrapper, scheduleWorkExecutor, scheduledWorkExecutorPool);
     }
@@ -193,7 +189,7 @@
      * @exception WorkException Indicates that the Work execution has been
      * unsuccessful.
      */
-    private void executeWork(WorkerContext work, WorkExecutor workExecutor, GeronimoExecutor pooledExecutor) throws WorkException {
+    private void executeWork(WorkerContext work, WorkExecutor workExecutor, Executor pooledExecutor) throws WorkException {
         work.workAccepted(this);
         try {
             workExecutor.doExecute(work, pooledExecutor);

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java Mon Jul 31 14:08:15 2006
@@ -21,8 +21,8 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.pool.GeronimoExecutor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.transaction.manager.XAWork;
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 
 /**
  * 
@@ -33,8 +33,8 @@
     public GeronimoWorkManagerGBean() {
     }
 
-    public GeronimoWorkManagerGBean(GeronimoExecutor sync, GeronimoExecutor start, GeronimoExecutor sched, TransactionContextManager transactionContextManager) {
-        super(sync, start, sched, transactionContextManager);
+    public GeronimoWorkManagerGBean(Executor sync, Executor start, Executor sched, XAWork xaWork) {
+        super(sync, start, sched, xaWork);
     }
 
     public static final GBeanInfo GBEAN_INFO;
@@ -43,19 +43,17 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(GeronimoWorkManagerGBean.class, NameFactory.JCA_WORK_MANAGER);
         infoFactory.addInterface(GeronimoWorkManager.class);
 
-        infoFactory.addReference("SyncPool", GeronimoExecutor.class, NameFactory.GERONIMO_SERVICE);
-        infoFactory.addReference("StartPool", GeronimoExecutor.class, NameFactory.GERONIMO_SERVICE);
-        infoFactory.addReference("ScheduledPool", GeronimoExecutor.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("SyncPool", Executor.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("StartPool", Executor.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("ScheduledPool", Executor.class, NameFactory.GERONIMO_SERVICE);
 
-        infoFactory.addOperation("getXATerminator");
-
-        infoFactory.addReference("TransactionContextManager", TransactionContextManager.class, NameFactory.TRANSACTION_CONTEXT_MANAGER);
+        infoFactory.addReference("TransactionManager", XAWork.class, NameFactory.TRANSACTION_MANAGER);
 
         infoFactory.setConstructor(new String[]{
             "SyncPool",
             "StartPool",
             "ScheduledPool",
-            "TransactionContextManager"});
+            "TransactionManager"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java Mon Jul 31 14:08:15 2006
@@ -33,9 +33,8 @@
 import EDU.oswego.cs.dl.util.concurrent.Latch;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
-import org.apache.geronimo.transaction.context.TransactionContext;
-import org.apache.geronimo.transaction.ImportedTransactionActiveException;
+import org.apache.geronimo.transaction.manager.ImportedTransactionActiveException;
+import org.apache.geronimo.transaction.manager.XAWork;
 
 /**
  * Work wrapper providing an execution context to a Work instance.
@@ -97,7 +96,7 @@
      */
     private final ExecutionContext executionContext;
 
-    private final TransactionContextManager transactionContextManager;
+    private final XAWork xaWork;
 
     /**
      * Listener to be notified during the life-cycle of the work treatment.
@@ -123,12 +122,12 @@
      * Create a WorkWrapper.
      *
      * @param work                      Work to be wrapped.
-     * @param transactionContextManager
+     * @param xaWork
      */
-    public WorkerContext(Work work, TransactionContextManager transactionContextManager) {
+    public WorkerContext(Work work, XAWork xaWork) {
         adaptee = work;
         executionContext = null;
-        this.transactionContextManager = transactionContextManager;
+        this.xaWork = xaWork;
     }
 
     /**
@@ -142,14 +141,15 @@
      * @param workListener  an object which would be notified when the various
      *                      Work processing events (work accepted, work rejected, work started,
      */
-    public WorkerContext(Work aWork, long aStartTimeout,
-                         ExecutionContext execContext,
-                         TransactionContextManager transactionContextManager,
-                         WorkListener workListener) {
+    public WorkerContext(Work aWork,
+            long aStartTimeout,
+            ExecutionContext execContext,
+            XAWork xaWork,
+            WorkListener workListener) {
         adaptee = aWork;
         startTimeOut = aStartTimeout;
         executionContext = execContext;
-        this.transactionContextManager = transactionContextManager;
+        this.xaWork = xaWork;
         if (null != workListener) {
             this.workListener = workListener;
         }
@@ -286,22 +286,12 @@
         //and ignore/replace whatever is associated with the current thread.
         try {
             if (executionContext == null || executionContext.getXid() == null) {
-                TransactionContext context = transactionContextManager.newUnspecifiedTransactionContext();
-                try {
-                    adaptee.run();
-                } finally {
-                    TransactionContext returningContext = transactionContextManager.getContext();
-                    transactionContextManager.setContext(null);
-                    if (context != returningContext) {
-                        throw new WorkCompletedException("Wrong TransactionContext on return from work done");
-                    }
-                }
-                //TODO should we commit the txContext to flush any leftover state???
+                adaptee.run();
             } else {
                 try {
                     long transactionTimeout = executionContext.getTransactionTimeout();
                     //translate -1 value to 0 to indicate default transaction timeout.
-                    transactionContextManager.begin(executionContext.getXid(), transactionTimeout == -1 ? 0 : transactionTimeout);
+                    xaWork.begin(executionContext.getXid(), transactionTimeout < 0 ? 0 : transactionTimeout);
                 } catch (XAException e) {
                     throw new WorkCompletedException("Transaction import failed for xid " + executionContext.getXid(), WorkCompletedException.TX_RECREATE_FAILED).initCause(e);
                 } catch (InvalidTransactionException e) {
@@ -314,7 +304,7 @@
                 try {
                     adaptee.run();
                 } finally {
-                    transactionContextManager.end(executionContext.getXid());
+                    xaWork.end(executionContext.getXid());
                 }
 
             }

Added: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/NamedRunnable.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/NamedRunnable.java?rev=427273&view=auto
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/NamedRunnable.java (added)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/NamedRunnable.java Mon Jul 31 14:08:15 2006
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.work.pool;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NamedRunnable implements Runnable {
+    private final String name;
+    private final Runnable runnable;
+
+    public NamedRunnable(String name, Runnable runnable) {
+        this.name = name;
+        this.runnable = runnable;
+    }
+
+    public void run() {
+        runnable.run();
+    }
+
+    public String toString() {
+        return name;
+    }
+}

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java Mon Jul 31 14:08:15 2006
@@ -18,8 +18,9 @@
 package org.apache.geronimo.connector.work.pool;
 
 import javax.resource.spi.work.WorkException;
+
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 import org.apache.geronimo.connector.work.WorkerContext;
-import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  *
@@ -29,8 +30,8 @@
  * */
 public class ScheduleWorkExecutor implements WorkExecutor {
 
-    public void doExecute(WorkerContext work, GeronimoExecutor executor)
+    public void doExecute(WorkerContext work, Executor executor)
             throws WorkException, InterruptedException {
-        executor.execute("A J2EE Connector", work);
+        executor.execute(new NamedRunnable("A J2EE Connector", work));
     }
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java Mon Jul 31 14:08:15 2006
@@ -19,6 +19,7 @@
 
 import javax.resource.spi.work.WorkException;
 import EDU.oswego.cs.dl.util.concurrent.Latch;
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 import org.apache.geronimo.connector.work.WorkerContext;
 import org.apache.geronimo.pool.GeronimoExecutor;
 
@@ -30,10 +31,10 @@
  * */
 public class StartWorkExecutor implements WorkExecutor {
 
-    public void doExecute(WorkerContext work, GeronimoExecutor executor)
+    public void doExecute(WorkerContext work, Executor executor)
             throws WorkException, InterruptedException {
         Latch latch = work.provideStartLatch();
-        executor.execute("A J2EE Connector", work);
+        executor.execute(new NamedRunnable("A J2EE Connector", work));
         latch.acquire();
     }
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java Mon Jul 31 14:08:15 2006
@@ -19,6 +19,7 @@
 
 import javax.resource.spi.work.WorkException;
 import EDU.oswego.cs.dl.util.concurrent.Latch;
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 import org.apache.geronimo.connector.work.WorkerContext;
 import org.apache.geronimo.pool.GeronimoExecutor;
 
@@ -30,10 +31,11 @@
  * */
 public class SyncWorkExecutor implements WorkExecutor {
 
-    public void doExecute(WorkerContext work, GeronimoExecutor executor)
+    public void doExecute(WorkerContext work, Executor executor)
             throws WorkException, InterruptedException {
         Latch latch = work.provideEndLatch();
-        executor.execute("A J2EE Connector", work);
+        executor.execute(new NamedRunnable("A J2EE Connector", work));
         latch.acquire();
     }
+
 }

Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java Mon Jul 31 14:08:15 2006
@@ -1,8 +1,9 @@
 package org.apache.geronimo.connector.work.pool;
 
 import javax.resource.spi.work.WorkException;
+
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 import org.apache.geronimo.connector.work.WorkerContext;
-import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  *
@@ -23,7 +24,7 @@
      * @throws InterruptedException Indicates that the thread in charge of the
      * execution of the specified work has been interrupted.
      */
-     void doExecute(WorkerContext work, GeronimoExecutor executor)
+     void doExecute(WorkerContext work, Executor executor)
             throws WorkException, InterruptedException;
 
 

Modified: geronimo/branches/dain/notcm/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java?rev=427273&r1=427272&r2=427273&view=diff
==============================================================================
--- geronimo/branches/dain/notcm/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java (original)
+++ geronimo/branches/dain/notcm/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java Mon Jul 31 14:08:15 2006
@@ -38,7 +38,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
- * @version $Rev: 386505 $ $Date$
+ * @version $Rev$ $Date$
  */
 public class AdminObjectWrapperTest extends TestCase {