geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction InstanceContext.java TrackedConnectionAssociator.java
Date Mon, 31 May 2004 16:27:45 GMT
djencks     2004/05/31 09:27:45

  Modified:    modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking
                        ConnectionTrackingCoordinator.java
               modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/defaultimpl
                        DefaultComponentContext.java
               modules/connector/src/test/org/apache/geronimo/connector/outbound
                        ConnectionManagerStressTest.java
                        ConnectionManagerTestUtils.java
               modules/connector/src/test/org/apache/geronimo/connector/outbound/connectiontracking
                        ConnectionTrackingCoordinatorTest.java
                        DefaultComponentInterceptor.java
               modules/jetty/src/java/org/apache/geronimo/jetty
                        JettyWebApplicationContext.java
               modules/transaction/src/java/org/apache/geronimo/transaction
                        InstanceContext.java
                        TrackedConnectionAssociator.java
  Log:
  Eliminate two threadlocals.  Move more thread specific context information (unshareableResources
and applicationManagedSecurityResources) into the InstanceContext.
  
  Revision  Changes    Path
  1.9       +8 -15     incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java
  
  Index: ConnectionTrackingCoordinator.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ConnectionTrackingCoordinator.java	24 May 2004 19:10:34 -0000	1.8
  +++ ConnectionTrackingCoordinator.java	31 May 2004 16:27:43 -0000	1.9
  @@ -52,19 +52,13 @@
       public final static GBeanInfo GBEAN_INFO;
   
       private final ThreadLocal currentInstanceContexts = new ThreadLocal();
  -    private final ThreadLocal currentUnshareableResources = new ThreadLocal();
  -    private final ThreadLocal currentApplicationManagedSecurityResources = new ThreadLocal();
   
  -    public TrackedConnectionAssociator.ConnectorContextInfo enter(InstanceContext newInstanceContext,
Set newUnshareableResources, Set applicationManagedSecurityResources)
  +    public InstanceContext enter(InstanceContext newInstanceContext)
               throws ResourceException {
           InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
  -        Set oldUnshareableResources = (Set) currentUnshareableResources.get();
  -        Set oldApplicationManagedSecurityResources = (Set) currentApplicationManagedSecurityResources.get();
           currentInstanceContexts.set(newInstanceContext);
  -        currentUnshareableResources.set(newUnshareableResources);
  -        currentApplicationManagedSecurityResources.set(applicationManagedSecurityResources);
           notifyConnections(newInstanceContext);
  -        return new TrackedConnectionAssociator.ConnectorContextInfo(oldInstanceContext,
oldUnshareableResources, oldApplicationManagedSecurityResources);
  +        return oldInstanceContext;
       }
   
       private void notifyConnections(InstanceContext oldInstanceContext) throws ResourceException
{
  @@ -83,7 +77,7 @@
           notifyConnections(oldInstanceContext);
       }
   
  -    public void exit(ConnectorContextInfo reenteringConnectorContext)
  +    public void exit(InstanceContext reenteringInstanceContext)
               throws ResourceException {
           InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
           Map resources = oldInstanceContext.getConnectionManagerMap();
  @@ -97,9 +91,7 @@
                   i.remove();
               }
           }
  -        currentInstanceContexts.set(reenteringConnectorContext.getInstanceContext());
  -        currentUnshareableResources.set(reenteringConnectorContext.getUnshareableResources());
  -        currentApplicationManagedSecurityResources.set(reenteringConnectorContext.getApplicationManagedSecurityResources());
  +        currentInstanceContexts.set(reenteringInstanceContext);
       }
   
   
  @@ -133,10 +125,11 @@
       }
   
       public void setEnvironment(ConnectionInfo connectionInfo, String key) {
  -        Set unshareableResources = (Set) currentUnshareableResources.get();
  +        InstanceContext currentInstanceContext = (InstanceContext) currentInstanceContexts.get();
  +        Set unshareableResources = currentInstanceContext.getUnshareableResources();
           boolean unshareable = unshareableResources.contains(key);
           connectionInfo.setUnshareable(unshareable);
  -        Set applicationManagedSecurityResources = (Set) currentApplicationManagedSecurityResources.get();
  +        Set applicationManagedSecurityResources = currentInstanceContext.getApplicationManagedSecurityResources();
           boolean applicationManagedSecurity = applicationManagedSecurityResources.contains(key);
           connectionInfo.setApplicationManagedSecurity(applicationManagedSecurity);
       }
  
  
  
  1.6       +17 -1     incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/defaultimpl/DefaultComponentContext.java
  
  Index: DefaultComponentContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectiontracking/defaultimpl/DefaultComponentContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultComponentContext.java	21 Mar 2004 22:24:39 -0000	1.5
  +++ DefaultComponentContext.java	31 May 2004 16:27:44 -0000	1.6
  @@ -19,6 +19,7 @@
   
   import java.util.HashMap;
   import java.util.Map;
  +import java.util.Set;
   
   import org.apache.geronimo.transaction.InstanceContext;
   
  @@ -32,6 +33,13 @@
   public class DefaultComponentContext implements InstanceContext {
   
       private final Map connectionManagerMap = new HashMap();
  +    private final Set unshareableResources;
  +    private final Set applicationManagedSecurityResources;
  +
  +    public DefaultComponentContext(Set unshareableResources, Set applicationManagedSecurityResources)
{
  +        this.unshareableResources = unshareableResources;
  +        this.applicationManagedSecurityResources = applicationManagedSecurityResources;
  +    }
   
       public Object getId() {
           return null;
  @@ -58,6 +66,14 @@
   
       public Map getConnectionManagerMap() {
           return connectionManagerMap;
  +    }
  +
  +    public Set getUnshareableResources() {
  +        return unshareableResources;
  +    }
  +
  +    public Set getApplicationManagedSecurityResources() {
  +        return applicationManagedSecurityResources;
       }
   
   }
  
  
  
  1.3       +4 -2      incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerStressTest.java
  
  Index: ConnectionManagerStressTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerStressTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectionManagerStressTest.java	6 May 2004 03:59:56 -0000	1.2
  +++ ConnectionManagerStressTest.java	31 May 2004 16:27:44 -0000	1.3
  @@ -17,6 +17,8 @@
   
   package org.apache.geronimo.connector.outbound;
   
  +import java.util.HashSet;
  +
   import org.apache.geronimo.transaction.TransactionContext;
   import org.apache.geronimo.transaction.UnspecifiedTransactionContext;
   import org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl.DefaultComponentContext;
  @@ -73,7 +75,7 @@
                           for (int i = 0; i < repeatCount; i++) {
                               try {
                                   long start = System.currentTimeMillis();
  -                                defaultComponentInterceptor.invoke(new DefaultComponentContext());
  +                                defaultComponentInterceptor.invoke(new DefaultComponentContext(new
HashSet(), new HashSet()));
                                   long duration = System.currentTimeMillis() - start;
                                   if (duration > 100) {
                                       localSlowCount++;
  
  
  
  1.11      +15 -16    incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
  
  Index: ConnectionManagerTestUtils.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ConnectionManagerTestUtils.java	24 May 2004 22:36:13 -0000	1.10
  +++ ConnectionManagerTestUtils.java	31 May 2004 16:27:44 -0000	1.11
  @@ -17,31 +17,30 @@
   
   package org.apache.geronimo.connector.outbound;
   
  -import java.util.Set;
   import java.util.HashSet;
  +import java.util.Set;
   
   import javax.security.auth.Subject;
   import javax.transaction.TransactionManager;
   
   import junit.framework.TestCase;
  -import org.apache.geronimo.connector.outbound.connectiontracking.DefaultInterceptor;
  +import org.apache.geronimo.connector.mock.MockConnection;
  +import org.apache.geronimo.connector.mock.MockConnectionFactory;
  +import org.apache.geronimo.connector.mock.MockManagedConnection;
  +import org.apache.geronimo.connector.mock.MockManagedConnectionFactory;
  +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.connectionmanagerconfig.XATransactions;
   import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
   import org.apache.geronimo.connector.outbound.connectiontracking.DefaultComponentInterceptor;
  +import org.apache.geronimo.connector.outbound.connectiontracking.DefaultInterceptor;
   import org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl.DefaultComponentContext;
  -import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
  -import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
  -import org.apache.geronimo.connector.outbound.connectionmanagerconfig.XATransactions;
  -import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PartitionedPool;
  -import org.apache.geronimo.connector.mock.MockManagedConnectionFactory;
  -import org.apache.geronimo.connector.mock.MockConnectionFactory;
  -import org.apache.geronimo.connector.mock.MockConnection;
  -import org.apache.geronimo.connector.mock.MockXAResource;
  -import org.apache.geronimo.connector.mock.MockManagedConnection;
  -import org.apache.geronimo.security.bridge.RealmBridge;
   import org.apache.geronimo.security.ContextManager;
  -import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
  +import org.apache.geronimo.security.bridge.RealmBridge;
   import org.apache.geronimo.transaction.InstanceContext;
   import org.apache.geronimo.transaction.UserTransactionImpl;
  +import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
   
   /**
    *
  @@ -102,8 +101,8 @@
                   connectionTrackingCoordinator);
           connectionManagerDeployment.doStart();
           connectionFactory = (MockConnectionFactory) connectionManagerDeployment.createConnectionFactory(mockManagedConnectionFactory);
  -        defaultComponentContext = new DefaultComponentContext();
  -        defaultComponentInterceptor = new DefaultComponentInterceptor(this, connectionTrackingCoordinator,
unshareableResources, applicationManagedSecurityResources);
  +        defaultComponentContext = new DefaultComponentContext(unshareableResources, applicationManagedSecurityResources);
  +        defaultComponentInterceptor = new DefaultComponentInterceptor(this, connectionTrackingCoordinator);
       }
   
       protected void tearDown() throws Exception {
  
  
  
  1.7       +23 -23    incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java
  
  Index: ConnectionTrackingCoordinatorTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConnectionTrackingCoordinatorTest.java	24 May 2004 19:10:35 -0000	1.6
  +++ ConnectionTrackingCoordinatorTest.java	31 May 2004 16:27:44 -0000	1.7
  @@ -21,17 +21,17 @@
   import java.util.Map;
   import java.util.Set;
   
  -import javax.security.auth.Subject;
   import javax.resource.ResourceException;
  +import javax.security.auth.Subject;
   
   import junit.framework.TestCase;
   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.connector.outbound.ConnectionInterceptor;
   import org.apache.geronimo.connector.outbound.ConnectionReturnAction;
  +import org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor;
  +import org.apache.geronimo.connector.outbound.ManagedConnectionInfo;
   import org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl.DefaultComponentContext;
  -import org.apache.geronimo.transaction.TrackedConnectionAssociator;
  +import org.apache.geronimo.transaction.InstanceContext;
   
   /**
    *
  @@ -66,48 +66,48 @@
       }
   
       public void testSimpleComponentContextLifecyle() throws Exception {
  -        DefaultComponentContext componentContext = new DefaultComponentContext();
  -        TrackedConnectionAssociator.ConnectorContextInfo connectorContext = connectionTrackingCoordinator.enter(componentContext,
unshareableResources, applicationManagedSecurityResources);
  -        assertNull("Expected old component context to be null", connectorContext.getInstanceContext());
  +        DefaultComponentContext componentContext = new DefaultComponentContext(unshareableResources,
applicationManagedSecurityResources);
  +        InstanceContext oldInstanceContext = connectionTrackingCoordinator.enter(componentContext);
  +        assertNull("Expected old instance context to be null", oldInstanceContext);
           //give the context a ConnectionInfo
           ManagedConnectionInfo managedConnectionInfo = new ManagedConnectionInfo(null, null);
           ConnectionInfo connectionInfo = new ConnectionInfo(managedConnectionInfo);
           connectionTrackingCoordinator.handleObtained(key1, connectionInfo);
  -        connectionTrackingCoordinator.exit(connectorContext);
  +        connectionTrackingCoordinator.exit(oldInstanceContext);
           Map connectionManagerMap = componentContext.getConnectionManagerMap();
           Set infos = (Set) connectionManagerMap.get(key1);
           assertEquals("Expected one connection for key1", 1, infos.size());
           assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo
== infos.iterator().next());
   
           //Enter again, and close the handle
  -        connectorContext = connectionTrackingCoordinator.enter(componentContext, unshareableResources,
applicationManagedSecurityResources);
  -        assertNull("Expected old component context to be null", connectorContext.getInstanceContext());
  +        oldInstanceContext = connectionTrackingCoordinator.enter(componentContext);
  +        assertNull("Expected old instance context to be null", oldInstanceContext);
           connectionTrackingCoordinator.handleReleased(key1, connectionInfo);
  -        connectionTrackingCoordinator.exit(connectorContext);
  +        connectionTrackingCoordinator.exit(oldInstanceContext);
           connectionManagerMap = componentContext.getConnectionManagerMap();
           infos = (Set) connectionManagerMap.get(key1);
           assertEquals("Expected no connection set for key1", null, infos);
       }
   
       public void testNestedComponentContextLifecyle() throws Exception {
  -        DefaultComponentContext componentContext1 = new DefaultComponentContext();
  -        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext1 = connectionTrackingCoordinator.enter(componentContext1,
unshareableResources, applicationManagedSecurityResources);
  -        assertNull("Expected old component context to be null", oldConnectorContext1.getInstanceContext());
  +        DefaultComponentContext componentContext1 = new DefaultComponentContext(unshareableResources,
applicationManagedSecurityResources);
  +        InstanceContext oldInstanceContext1 = connectionTrackingCoordinator.enter(componentContext1);
  +        assertNull("Expected old component context to be null", oldInstanceContext1);
           //give the context a ConnectionInfo
           ManagedConnectionInfo managedConnectionInfo1 = new ManagedConnectionInfo(null,
null);
           ConnectionInfo connectionInfo1 = new ConnectionInfo(managedConnectionInfo1);
           connectionTrackingCoordinator.handleObtained(key1, connectionInfo1);
   
           //Simulate calling another component
  -        DefaultComponentContext componentContext2 = new DefaultComponentContext();
  -        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext2 = connectionTrackingCoordinator.enter(componentContext2,
unshareableResources, applicationManagedSecurityResources);
  -        assertTrue("Expected returned component context to be componentContext1", oldConnectorContext2.getInstanceContext()
== componentContext1);
  +        DefaultComponentContext componentContext2 = new DefaultComponentContext(unshareableResources,
applicationManagedSecurityResources);
  +        InstanceContext oldInstanceContext2 = connectionTrackingCoordinator.enter(componentContext2);
  +        assertTrue("Expected returned component context to be componentContext1", oldInstanceContext2
== componentContext1);
           //give the context a ConnectionInfo
           ManagedConnectionInfo managedConnectionInfo2 = new ManagedConnectionInfo(null,
null);
           ConnectionInfo connectionInfo2 = new ConnectionInfo(managedConnectionInfo2);
           connectionTrackingCoordinator.handleObtained(key2, connectionInfo2);
   
  -        connectionTrackingCoordinator.exit(oldConnectorContext2);
  +        connectionTrackingCoordinator.exit(oldInstanceContext2);
           Map connectionManagerMap2 = componentContext2.getConnectionManagerMap();
           Set infos2 = (Set) connectionManagerMap2.get(key2);
           assertEquals("Expected one connection for key2", 1, infos2.size());
  @@ -115,7 +115,7 @@
           assertEquals("Expected no connection for key1", null, connectionManagerMap2.get(key1));
   
   
  -        connectionTrackingCoordinator.exit(oldConnectorContext1);
  +        connectionTrackingCoordinator.exit(oldInstanceContext1);
           Map connectionManagerMap1 = componentContext1.getConnectionManagerMap();
           Set infos1 = (Set) connectionManagerMap1.get(key1);
           assertEquals("Expected one connection for key1", 1, infos1.size());
  @@ -123,10 +123,10 @@
           assertEquals("Expected no connection for key2", null, connectionManagerMap1.get(key2));
   
           //Enter again, and close the handle
  -        oldConnectorContext1 = connectionTrackingCoordinator.enter(componentContext1, unshareableResources,
applicationManagedSecurityResources);
  -        assertNull("Expected old component context to be null", oldConnectorContext1.getInstanceContext());
  +        oldInstanceContext1 = connectionTrackingCoordinator.enter(componentContext1);
  +        assertNull("Expected old component context to be null", oldInstanceContext1);
           connectionTrackingCoordinator.handleReleased(key1, connectionInfo1);
  -        connectionTrackingCoordinator.exit(oldConnectorContext1);
  +        connectionTrackingCoordinator.exit(oldInstanceContext1);
           connectionManagerMap1 = componentContext1.getConnectionManagerMap();
           infos1 = (Set) connectionManagerMap1.get(key1);
           assertEquals("Expected no connection set for key1", null, infos1);
  
  
  
  1.3       +8 -14     incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/connectiontracking/DefaultComponentInterceptor.java
  
  Index: DefaultComponentInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/outbound/connectiontracking/DefaultComponentInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultComponentInterceptor.java	24 May 2004 19:10:35 -0000	1.2
  +++ DefaultComponentInterceptor.java	31 May 2004 16:27:44 -0000	1.3
  @@ -17,15 +17,14 @@
   
   package org.apache.geronimo.connector.outbound.connectiontracking;
   
  -import java.util.Set;
  -
   import org.apache.geronimo.transaction.InstanceContext;
   import org.apache.geronimo.transaction.TrackedConnectionAssociator;
   import org.apache.geronimo.transaction.TransactionContext;
   import org.apache.geronimo.transaction.UnspecifiedTransactionContext;
   
   /**
  - *
  + * Sample functionality for an interceptor that enables connection caching and obtaining
  + * connections outside a UserTransaction.
    *
    * @version $Revision$ $Date$
    *
  @@ -33,28 +32,23 @@
   public class DefaultComponentInterceptor implements DefaultInterceptor {
   
       private final DefaultInterceptor next;
  -    private final TrackedConnectionAssociator cachedConnectionAssociator;
  -    private final Set unshareableResources;
  -    private final Set applicationManagedSecurityResources;
  +    private final TrackedConnectionAssociator trackedConnectionAssociator;
   
       public DefaultComponentInterceptor(DefaultInterceptor next,
  -            TrackedConnectionAssociator cachedConnectionManager,
  -            Set unshareableResources, Set applicationManagedSecurityResources) {
  +            TrackedConnectionAssociator trackedConnectionAssociator) {
           this.next = next;
  -        this.cachedConnectionAssociator = cachedConnectionManager;
  -        this.unshareableResources = unshareableResources;
  -        this.applicationManagedSecurityResources = applicationManagedSecurityResources;
  +        this.trackedConnectionAssociator = trackedConnectionAssociator;
       }
   
       public Object invoke(InstanceContext newInstanceContext) throws Throwable {
           if (TransactionContext.getContext() == null) {
               TransactionContext.setContext(new UnspecifiedTransactionContext());
           }
  -        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext = cachedConnectionAssociator.enter(newInstanceContext,
unshareableResources, applicationManagedSecurityResources);
  +        InstanceContext oldInstanceContext = trackedConnectionAssociator.enter(newInstanceContext);
           try {
               return next.invoke(newInstanceContext);
           } finally {
  -            cachedConnectionAssociator.exit(oldConnectorContext);
  +            trackedConnectionAssociator.exit(oldInstanceContext);
           }
       }
   }
  
  
  
  1.16      +16 -18    incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebApplicationContext.java
  
  Index: JettyWebApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebApplicationContext.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JettyWebApplicationContext.java	30 May 2004 19:09:57 -0000	1.15
  +++ JettyWebApplicationContext.java	31 May 2004 16:27:44 -0000	1.16
  @@ -17,12 +17,6 @@
   
   package org.apache.geronimo.jetty;
   
  -import javax.resource.ResourceException;
  -import javax.security.jacc.PolicyConfiguration;
  -import javax.security.jacc.PolicyConfigurationFactory;
  -import javax.security.jacc.PolicyContext;
  -import javax.security.jacc.PolicyContextException;
  -import javax.transaction.TransactionManager;
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URI;
  @@ -30,13 +24,15 @@
   import java.util.Arrays;
   import java.util.Set;
   
  -import org.mortbay.http.HttpException;
  -import org.mortbay.http.HttpRequest;
  -import org.mortbay.http.HttpResponse;
  -import org.mortbay.jetty.servlet.WebApplicationContext;
  +import javax.resource.ResourceException;
  +import javax.security.jacc.PolicyConfiguration;
  +import javax.security.jacc.PolicyConfigurationFactory;
  +import javax.security.jacc.PolicyContext;
  +import javax.security.jacc.PolicyContextException;
  +import javax.transaction.TransactionManager;
  +
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -
   import org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl.DefaultComponentContext;
   import org.apache.geronimo.gbean.GBean;
   import org.apache.geronimo.gbean.GBeanContext;
  @@ -49,11 +45,15 @@
   import org.apache.geronimo.naming.java.RootContext;
   import org.apache.geronimo.security.GeronimoSecurityException;
   import org.apache.geronimo.security.deploy.Security;
  +import org.apache.geronimo.transaction.InstanceContext;
   import org.apache.geronimo.transaction.TrackedConnectionAssociator;
   import org.apache.geronimo.transaction.TransactionContext;
   import org.apache.geronimo.transaction.UnspecifiedTransactionContext;
   import org.apache.geronimo.transaction.UserTransactionImpl;
  -
  +import org.mortbay.http.HttpException;
  +import org.mortbay.http.HttpRequest;
  +import org.mortbay.http.HttpResponse;
  +import org.mortbay.jetty.servlet.WebApplicationContext;
   
   /**
    * Wrapper for a WebApplicationContext that sets up its J2EE environment.
  @@ -172,7 +172,7 @@
           ReadOnlyContext oldComponentContext = RootContext.getComponentContext();
           String oldPolicyContextID = PolicyContext.getContextID();
   
  -        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext = null;
  +        InstanceContext oldInstanceContext = null;
   
           try {
               // set up java:comp JNDI Context
  @@ -188,7 +188,7 @@
                   TransactionContext.setContext(new UnspecifiedTransactionContext());
               }
               try {
  -                oldConnectorContext = associator.enter(new DefaultComponentContext(), unshareableResources,
applicationManagedSecurityResources);
  +                oldInstanceContext = associator.enter(new DefaultComponentContext(unshareableResources,
applicationManagedSecurityResources));
               } catch (ResourceException e) {
                   throw new RuntimeException(e);
               }
  @@ -196,9 +196,7 @@
               super.handle(pathInContext, pathParams, httpRequest, httpResponse);
           } finally {
               try {
  -                if (txManager != null) {
  -                    associator.exit(oldConnectorContext);
  -                }
  +                associator.exit(oldInstanceContext);
               } catch (ResourceException e) {
                   throw new RuntimeException(e);
               } finally {
  
  
  
  1.5       +6 -1      incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/InstanceContext.java
  
  Index: InstanceContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/InstanceContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- InstanceContext.java	21 Mar 2004 22:24:39 -0000	1.4
  +++ InstanceContext.java	31 May 2004 16:27:44 -0000	1.5
  @@ -18,6 +18,7 @@
   package org.apache.geronimo.transaction;
   
   import java.util.Map;
  +import java.util.Set;
   
   /**
    *
  @@ -45,5 +46,9 @@
        * @return map of ConnectionManager to (list of ) managed connection info objects.
        */
       Map getConnectionManagerMap();
  +
  +    Set getUnshareableResources();
  +
  +    Set getApplicationManagedSecurityResources();
   
   }
  
  
  
  1.3       +3 -29     incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/TrackedConnectionAssociator.java
  
  Index: TrackedConnectionAssociator.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/TrackedConnectionAssociator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TrackedConnectionAssociator.java	24 May 2004 19:11:14 -0000	1.2
  +++ TrackedConnectionAssociator.java	31 May 2004 16:27:44 -0000	1.3
  @@ -17,8 +17,6 @@
   
   package org.apache.geronimo.transaction;
   
  -import java.util.Set;
  -
   import javax.resource.ResourceException;
   
   /**
  @@ -29,36 +27,12 @@
    * */
   public interface TrackedConnectionAssociator {
   
  -    ConnectorContextInfo enter(InstanceContext newInstanceContext,
  -                               Set unshareableResources, Set applicationManagedSecurityResources)
  +    InstanceContext enter(InstanceContext newInstanceContext)
               throws ResourceException;
   
       void newTransaction() throws ResourceException;
   
  -    void exit(ConnectorContextInfo connectorContext)
  +    void exit(InstanceContext instanceContext)
               throws ResourceException;
   
  -    class ConnectorContextInfo {
  -        private final InstanceContext instanceContext;
  -        private final Set unshareableResources;
  -        private final Set applicationManagedSecurityResources;
  -
  -        public ConnectorContextInfo(InstanceContext instanceContext, Set unshareableResources,
Set applicationManagedSecurityResources) {
  -            this.instanceContext = instanceContext;
  -            this.unshareableResources = unshareableResources;
  -            this.applicationManagedSecurityResources = applicationManagedSecurityResources;
  -        }
  -
  -        public InstanceContext getInstanceContext() {
  -            return instanceContext;
  -        }
  -
  -        public Set getUnshareableResources() {
  -            return unshareableResources;
  -        }
  -
  -        public Set getApplicationManagedSecurityResources() {
  -            return applicationManagedSecurityResources;
  -        }
  -    }
   }
  
  
  

Mime
View raw message