geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r442665 [4/4] - in /geronimo/server/branches/sachin: ./ applications/magicGball/magicGball-ear/src/main/plan/ assemblies/geronimo-boilerplate-minimal/ configs/axis-deployer/src/plan/ configs/client-deployer/src/plan/ configs/client/ configs...
Date Tue, 12 Sep 2006 18:15:29 GMT
Modified: geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java Tue Sep 12 11:15:24 2006
@@ -14,10 +14,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package org.apache.geronimo.security.jaas.server;
 
-import EDU.oswego.cs.dl.util.concurrent.ClockDaemon;
-import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.GeronimoSecurityException;
@@ -34,6 +33,7 @@
 import javax.crypto.Mac;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
+
 import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.login.LoginException;
@@ -41,6 +41,7 @@
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
 import java.security.Principal;
+
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -49,7 +50,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-
+import java.util.Timer;
+import java.util.TimerTask;
 
 /**
  * The single point of contact for Geronimo JAAS realms.  Instead of attempting
@@ -63,10 +65,9 @@
     public static final Log log = LogFactory.getLog(JaasLoginService.class);
     private final static int DEFAULT_EXPIRED_LOGIN_SCAN_INTERVAL = 300000; // 5 mins
     private final static int DEFAULT_MAX_LOGIN_DURATION = 1000 * 3600 * 24; // 1 day
-    private final static ClockDaemon clockDaemon;
+    private final static Timer clockDaemon = new Timer(/* Name requires JDK 1.5 "LoginService login modules monitor", */ true);
     private static long nextLoginModuleId = System.currentTimeMillis();
     private Collection realms;
-    private Object expiredLoginScanIdentifier;
     private final String objectName;
     private final SecretKey key;
     private final String algorithm;
@@ -74,7 +75,7 @@
     private final Map activeLogins = new Hashtable();
     private int expiredLoginScanIntervalMillis = DEFAULT_EXPIRED_LOGIN_SCAN_INTERVAL;
     private int maxLoginDurationMillis = DEFAULT_MAX_LOGIN_DURATION;
-
+    private ExpirationMonitor expirationMonitor;
 
     public JaasLoginService(String algorithm, String password, ClassLoader classLoader, String objectName) {
         this.classLoader = classLoader;
@@ -137,11 +138,18 @@
     }
 
     public void doStart() throws Exception {
-        expiredLoginScanIdentifier = clockDaemon.executePeriodically(expiredLoginScanIntervalMillis, new ExpirationMonitor(), true);
+        expirationMonitor = new ExpirationMonitor();
+
+        clockDaemon.scheduleAtFixedRate(
+                expirationMonitor, expiredLoginScanIntervalMillis, expiredLoginScanIntervalMillis);
     }
 
     public void doStop() throws Exception {
-        ClockDaemon.cancel(expiredLoginScanIdentifier);
+        if (expirationMonitor != null) {
+            expirationMonitor.cancel();
+            expirationMonitor = null;
+        }
+
         //todo: shut down all logins
     }
 
@@ -389,20 +397,7 @@
         return null;
     }
 
-
-    // This stuff takes care of whacking old logins
-    static {
-        clockDaemon = new ClockDaemon();
-        clockDaemon.setThreadFactory(new ThreadFactory() {
-            public Thread newThread(Runnable r) {
-                Thread t = new Thread(r, "LoginService login modules monitor");
-                t.setDaemon(true);
-                return t;
-            }
-        });
-    }
-
-    private class ExpirationMonitor implements Runnable { //todo: different timeouts per realm?
+    private class ExpirationMonitor extends TimerTask { //todo: different timeouts per realm?
 
         public void run() {
             long now = System.currentTimeMillis();

Modified: geronimo/server/branches/sachin/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java Tue Sep 12 11:15:24 2006
@@ -154,8 +154,10 @@
 
     public static void unregisterSubstitutionGroupElements(QName substitutionGroup, QNameSet substitutions) {
         QNameSet oldSubstitutions = (QNameSet) substitutionGroups.get(substitutionGroup);
-        QNameSet difference = oldSubstitutions.intersect(substitutions.inverse());
-        substitutionGroups.put(substitutionGroup, difference);
+        if (oldSubstitutions != null && substitutions != null) {
+            QNameSet difference = oldSubstitutions.intersect(substitutions.inverse());
+            substitutionGroups.put(substitutionGroup, difference);
+        }
     }
 
     public static QNameSet getQNameSetForSubstitutionGroup(QName substitutionGroup) {

Modified: geronimo/server/branches/sachin/modules/geronimo-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-system/pom.xml?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-system/pom.xml (original)
+++ geronimo/server/branches/sachin/modules/geronimo-system/pom.xml Tue Sep 12 11:15:24 2006
@@ -52,8 +52,8 @@
         </dependency>
         
         <dependency>
-            <groupId>concurrent</groupId>
-            <artifactId>concurrent</artifactId>
+            <groupId>backport-util-concurrent</groupId>
+            <artifactId>backport-util-concurrent</artifactId>
         </dependency>
         
         <!--

Modified: geronimo/server/branches/sachin/modules/geronimo-system/src/main/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-system/src/main/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-system/src/main/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-system/src/main/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java Tue Sep 12 11:15:24 2006
@@ -26,7 +26,8 @@
 
 import java.rmi.server.RMIClassLoader;
 import java.rmi.server.RMIClassLoaderSpi;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+
+import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
 
 /**
  * An implementation of {@link RMIClassLoaderSpi} which provides normilzation
@@ -40,7 +41,7 @@
     private RMIClassLoaderSpi delegate = RMIClassLoader.getDefaultProviderInstance();
 
     //TODO: Not sure of the best initial size.  Starting with 100 which should be reasonable.
-    private ConcurrentReaderHashMap cachedCodebases = new ConcurrentReaderHashMap(100, 0.75F);
+    private ConcurrentHashMap cachedCodebases = new ConcurrentHashMap(100, 0.75F);
 
 
     public Class loadClass(String codebase, String name, ClassLoader defaultLoader)

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/pom.xml?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/pom.xml (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/pom.xml Tue Sep 12 11:15:24 2006
@@ -38,7 +38,10 @@
                
                https://issues.apache.org/jira/browse/GERONIMO-2183
         -->
+        <!-- 
+        TEMP: Testing concurrent changes...
         <maven.test.skip>true</maven.test.skip>
+        -->
     </properties>
     
     <dependencies>
@@ -87,10 +90,10 @@
             <groupId>org.apache.derby</groupId>
             <artifactId>derby</artifactId>
         </dependency>
-
+        
         <dependency>
-            <groupId>concurrent</groupId>
-            <artifactId>concurrent</artifactId>
+            <groupId>backport-util-concurrent</groupId>
+            <artifactId>backport-util-concurrent</artifactId>
         </dependency>
         
     </dependencies>

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ExecutorFeedingTimerTask.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ExecutorFeedingTimerTask.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ExecutorFeedingTimerTask.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ExecutorFeedingTimerTask.java Tue Sep 12 11:15:24 2006
@@ -47,11 +47,7 @@
     }
 
     public void run() {
-        try {
-            threadPooledTimer.getExecutor().execute(workInfo.getExecutorTask());
-        } catch (InterruptedException e) {
-            log.warn("Exception running task", e);
-        }
+        threadPooledTimer.getExecutor().execute(workInfo.getExecutorTask());
     }
 
     public boolean cancel() {

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ThreadPooledTimer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ThreadPooledTimer.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ThreadPooledTimer.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/ThreadPooledTimer.java Tue Sep 12 11:15:24 2006
@@ -33,7 +33,8 @@
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanLifecycle;

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledNonTransactionalTimer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledNonTransactionalTimer.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledNonTransactionalTimer.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledNonTransactionalTimer.java Tue Sep 12 11:15:24 2006
@@ -21,7 +21,8 @@
 import javax.sql.DataSource;
 import javax.transaction.TransactionManager;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
 import org.apache.geronimo.connector.outbound.ConnectionFactorySource;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledTransactionalTimer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledTransactionalTimer.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledTransactionalTimer.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/jdbc/JDBCStoreThreadPooledTransactionalTimer.java Tue Sep 12 11:15:24 2006
@@ -21,7 +21,8 @@
 import javax.sql.DataSource;
 import javax.transaction.TransactionManager;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
 import org.apache.geronimo.connector.outbound.ConnectionFactorySource;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledNonTransactionalTimer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledNonTransactionalTimer.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledNonTransactionalTimer.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledNonTransactionalTimer.java Tue Sep 12 11:15:24 2006
@@ -19,7 +19,8 @@
 
 import javax.transaction.TransactionManager;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledTransactionalTimer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledTransactionalTimer.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledTransactionalTimer.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMStoreThreadPooledTransactionalTimer.java Tue Sep 12 11:15:24 2006
@@ -19,7 +19,8 @@
 
 import javax.transaction.TransactionManager;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMWorkerPersistence.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMWorkerPersistence.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMWorkerPersistence.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/main/java/org/apache/geronimo/timer/vm/VMWorkerPersistence.java Tue Sep 12 11:15:24 2006
@@ -24,7 +24,8 @@
 import java.util.Collection;
 import java.util.ArrayList;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.geronimo.timer.PersistenceException;
 import org.apache.geronimo.timer.Playback;
 import org.apache.geronimo.timer.WorkInfo;
@@ -40,10 +41,10 @@
 
     private final Map tasks = Collections.synchronizedMap(new LinkedHashMap());
 
-    private final SynchronizedLong counter = new SynchronizedLong(0);
+    private final AtomicLong counter = new AtomicLong(0);
 
     public void save(WorkInfo workInfo) throws PersistenceException {
-        long id = counter.increment();
+        long id = counter.incrementAndGet();
         workInfo.setId(id);
         tasks.put(new Long(id), workInfo);
     }

Modified: geronimo/server/branches/sachin/modules/geronimo-timer/src/test/java/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-timer/src/test/java/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-timer/src/test/java/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-timer/src/test/java/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java Tue Sep 12 11:15:24 2006
@@ -19,8 +19,10 @@
 
 import javax.transaction.TransactionManager;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
+
 import junit.framework.TestCase;
+
 import org.apache.geronimo.pool.ThreadPool;
 import org.apache.geronimo.timer.vm.VMWorkerPersistence;
 
@@ -41,7 +43,7 @@
     private ThreadPool threadPool;
     private ThreadPooledTimer timer;
 
-    private SynchronizedInt counter = new SynchronizedInt(0);
+    private AtomicInteger counter = new AtomicInteger(0);
     protected TransactionManager transactionManager;
     protected ExecutorTaskFactory executableWorkFactory;
     protected UserTaskFactory userTaskFactory;
@@ -177,7 +179,7 @@
         public Runnable newTask(long id) {
             return new Runnable() {
                 public void run() {
-                    counter.increment();
+                    counter.incrementAndGet();
                 }
 
             };

Modified: geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Tue Sep 12 11:15:24 2006
@@ -54,10 +54,12 @@
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -74,11 +76,9 @@
 import org.apache.geronimo.web.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.webservices.WebServiceContainer;
-import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppType;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.config.GerTomcatDocument;
-import org.apache.geronimo.xbeans.j2ee.MessageDestinationType;
 import org.apache.geronimo.xbeans.j2ee.ServletType;
 import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
 import org.apache.geronimo.xbeans.j2ee.WebAppType;
@@ -104,8 +104,8 @@
             AbstractNameQuery tomcatContainerName,
             Collection webServiceBuilder,
             Collection securityBuilders,
-            Collection serviceBuilders, Kernel kernel) {
-        super(kernel, securityBuilders, serviceBuilders);
+            Collection serviceBuilders, NamingBuilder namingBuilders, Kernel kernel) {
+        super(kernel, securityBuilders, serviceBuilders, namingBuilders);
         this.defaultEnvironment = defaultEnvironment;
 
         this.tomcatContainerName = tomcatContainerName;
@@ -146,7 +146,7 @@
             // Output the target path in the error to make it clearer to the user which webapp
             // has the problem.  The targetPath is used, as moduleFile may have an unhelpful
             // value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
-            throw new DeploymentException("Error parsing web.xml for "+targetPath, xmle);
+            throw new DeploymentException("Error parsing web.xml for " + targetPath, xmle);
         }
         check(webApp);
 
@@ -165,9 +165,12 @@
 
         EnvironmentType environmentType = tomcatWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+
+        getNamingBuilders().buildEnvironment(webApp, tomcatWebApp, environment);
+
         // Note: logic elsewhere depends on the default artifact ID being the file name less extension (ConfigIDExtractor)
         String warName = new File(moduleFile.getName()).getName();
-        if(warName.lastIndexOf('.') > -1) {
+        if (warName.lastIndexOf('.') > -1) {
             warName = warName.substring(0, warName.lastIndexOf('.'));
         }
         idBuilder.resolve(environment, warName, "war");
@@ -213,7 +216,7 @@
                             try {
                                 rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                             } catch (FileNotFoundException e1) {
-                                log.warn("Web application "+ targetPath + " does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.");
+                                log.warn("Web application " + targetPath + " does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.");
                             }
                         }
                     }
@@ -234,7 +237,7 @@
             }
             return tomcatWebApp;
         } catch (XmlException e) {
-            throw new DeploymentException("xml problem for web app "+targetPath, e);
+            throw new DeploymentException("xml problem for web app " + targetPath, e);
         }
     }
 
@@ -247,12 +250,13 @@
 
     public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
         WebAppType webApp = (WebAppType) module.getSpecDD();
-        MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
+//        MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
         TomcatWebAppType gerWebApp = (TomcatWebAppType) module.getVendorDD();
-        GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
+//        GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
 
-        ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(), messageDestinations, gerMessageDestinations);
-        if((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
+//        ENCConfigBuilder.registerMessageDestinations(earContext, module.getName(), messageDestinations, gerMessageDestinations);
+        getNamingBuilders().initContext(webApp, gerWebApp, module.getEarContext().getConfiguration(), earContext.getConfiguration(), module);
+        if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
                 !gerWebApp.isSetSecurityRealmName()) {
             throw new DeploymentException("web.xml for web app " + module.getName() + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
         }
@@ -272,7 +276,6 @@
 //        GbeanType[] gbeans = tomcatWebApp.getGbeanArray();
 //        ServiceConfigBuilder.addGBeans(gbeans, moduleClassLoader, moduleName, moduleContext);
 
-
         //this may add to the web classpath with enhanced classes.
         //N.B. we use the ear context which has all the gbeans we could possibly be looking up from this ear.
         Map compContext = buildComponentContext(earContext, webModule, webApp, tomcatWebApp, moduleClassLoader);
@@ -302,8 +305,8 @@
             //N.B. use earContext not moduleContext
             ENCConfigBuilder.setResourceEnvironment(rebuilder, webApp.getResourceRefArray(), tomcatWebApp.getResourceRefArray());
 
-            webModuleData.setReferencePattern("TransactionManager", earContext.getTransactionManagerObjectName());
-            webModuleData.setReferencePattern("TrackedConnectionAssociator", earContext.getConnectionTrackerObjectName());
+            webModuleData.setReferencePattern("TransactionManager", earContext.getTransactionManagerName());
+            webModuleData.setReferencePattern("TrackedConnectionAssociator", earContext.getConnectionTrackerName());
 
             if (tomcatWebApp.isSetWebContainer()) {
                 AbstractNameQuery webContainerName = ENCConfigBuilder.getGBeanQuery(NameFactory.GERONIMO_SERVICE, tomcatWebApp.getWebContainer());
@@ -335,7 +338,7 @@
 
             if (tomcatWebApp.isSetCluster()) {
                 String cluster = tomcatWebApp.getCluster().trim();
-                AbstractName clusterName =earContext.getNaming().createChildName(moduleName, cluster, CatalinaClusterGBean.J2EE_TYPE);
+                AbstractName clusterName = earContext.getNaming().createChildName(moduleName, cluster, CatalinaClusterGBean.J2EE_TYPE);
                 webModuleData.setReferencePattern("Cluster", clusterName);
             }
 
@@ -365,7 +368,7 @@
                         String servletClassName = servletType.getServletClass().getStringValue().trim();
                         Object portInfo = portMap.get(servletName);
                         if (portInfo == null) {
-                            throw new DeploymentException("No web service deployment info for servlet name " + servletName +" in web app "+module.getName());
+                            throw new DeploymentException("No web service deployment info for servlet name " + servletName + " in web app " + module.getName());
                         }
 
                         WebServiceContainer wsContainer = configurePOJO(webModule.getModuleFile(), portInfo, servletClassName, moduleClassLoader);
@@ -381,7 +384,7 @@
 
             if (tomcatWebApp.isSetSecurityRealmName()) {
                 if (earContext.getSecurityConfiguration() == null) {
-                     throw new DeploymentException("You have specified a <security-realm-name> for the webapp " + moduleName + " but no <security> configuration (role mapping) is supplied in the Geronimo plan for the web application (or the Geronimo plan for the EAR if the web app is in an EAR)");
+                    throw new DeploymentException("You have specified a <security-realm-name> for the webapp " + moduleName + " but no <security> configuration (role mapping) is supplied in the Geronimo plan for the web application (or the Geronimo plan for the EAR if the web app is in an EAR)");
                 }
 
                 SecurityHolder securityHolder = new SecurityHolder();
@@ -405,7 +408,7 @@
                 }
                 securityHolder.setChecked(checkedPermissions);
                 earContext.addSecurityContext(policyContextID, componentPermissions);
-                DefaultPrincipal defaultPrincipal = ((SecurityConfiguration)earContext.getSecurityConfiguration()).getDefaultPrincipal();
+                DefaultPrincipal defaultPrincipal = ((SecurityConfiguration) earContext.getSecurityConfiguration()).getDefaultPrincipal();
                 securityHolder.setDefaultPrincipal(defaultPrincipal);
                 if (defaultPrincipal != null) {
                     securityHolder.setSecurity(true);
@@ -423,7 +426,7 @@
         } catch (DeploymentException de) {
             throw de;
         } catch (Exception e) {
-            throw new DeploymentException("Unable to initialize GBean for web app "+module.getName(), e);
+            throw new DeploymentException("Unable to initialize GBean for web app " + module.getName(), e);
         }
     }
 
@@ -443,20 +446,12 @@
 
 
     private Map buildComponentContext(EARContext earContext, Module webModule, WebAppType webApp, TomcatWebAppType tomcatWebApp, ClassLoader cl) throws DeploymentException {
-        return ENCConfigBuilder.buildComponentContext(earContext,
-                earContext.getConfiguration(),
-                webModule,
-                null,
-                webApp.getEnvEntryArray(),
-                webApp.getEjbRefArray(), tomcatWebApp.getEjbRefArray(),
-                webApp.getEjbLocalRefArray(), tomcatWebApp.getEjbLocalRefArray(),
-                webApp.getResourceRefArray(), tomcatWebApp.getResourceRefArray(),
-                webApp.getResourceEnvRefArray(), tomcatWebApp.getResourceEnvRefArray(),
-                webApp.getMessageDestinationRefArray(),
-                webApp.getServiceRefArray(), tomcatWebApp.getServiceRefArray(),
-                tomcatWebApp.getGbeanRefArray(),
-                cl);
+        Map componentContext = new HashMap();
+        Configuration earConfiguration = earContext.getConfiguration();
+        getNamingBuilders().buildNaming(webApp, tomcatWebApp, earConfiguration, earConfiguration, webModule, componentContext);
+        return componentContext;
     }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -466,16 +461,18 @@
         infoBuilder.addReference("WebServiceBuilder", WebServiceBuilder.class, NameFactory.MODULE_BUILDER);
         infoBuilder.addReference("SecurityBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
         infoBuilder.addReference("ServiceBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
+        infoBuilder.addReference("NamingBuilders", NamingBuilder.class, NameFactory.MODULE_BUILDER);
         infoBuilder.addAttribute("kernel", Kernel.class, false);
         infoBuilder.addInterface(ModuleBuilder.class);
 
         infoBuilder.setConstructor(new String[]{
-            "defaultEnvironment",
-            "tomcatContainerName",
-            "WebServiceBuilder",
-            "SecurityBuilders",
-            "ServiceBuilders",
-            "kernel"});
+                "defaultEnvironment",
+                "tomcatContainerName",
+                "WebServiceBuilder",
+                "SecurityBuilders",
+                "ServiceBuilders",
+                "NamingBuilders",
+                "kernel"});
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }
 

Modified: geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java Tue Sep 12 11:15:24 2006
@@ -8,11 +8,11 @@
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
@@ -38,7 +38,7 @@
     private TomcatModuleBuilder builder;
 
     protected void setUp() throws Exception {
-        builder = new TomcatModuleBuilder(defaultEnvironment, tomcatContainerObjectName, Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), null);
+        builder = new TomcatModuleBuilder(defaultEnvironment, tomcatContainerObjectName, Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), new NamingBuilderCollection(null, null), null);
     }
 
     public void testResourceRef() throws Exception {

Modified: geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Tue Sep 12 11:15:24 2006
@@ -19,7 +19,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
-import java.net.URI;
 import java.net.URL;
 import java.security.PermissionCollection;
 import java.security.Permissions;
@@ -27,20 +26,14 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import javax.management.ObjectName;
-import javax.naming.Reference;
-import javax.xml.namespace.QName;
-
 import org.apache.geronimo.testsupport.TestSupport;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
-import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
@@ -50,13 +43,10 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.apache.geronimo.j2ee.deployment.EJBReferenceBuilder;
 import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.RefContext;
-import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder;
-import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
 import org.apache.geronimo.j2ee.deployment.UnavailableWebServiceBuilder;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
 import org.apache.geronimo.kernel.Jsr77Naming;
@@ -166,6 +156,7 @@
         earContext.addGBean(jaccBeanData);
         earContext.setJaccManagerName(jaccBeanName);
         module.setEarContext(earContext);
+        module.setRootEarContext(earContext);
         builder.initContext(earContext, module, cl);
         builder.addGBeans(earContext, module, cl, null);
         ConfigurationData configurationData = earContext.getConfigurationData();
@@ -202,59 +193,8 @@
                 new AbstractNameQuery(ctcName),
                 null,
                 null,
-                null,
-                new RefContext(new EJBReferenceBuilder() {
-
-
-                    public Reference createCORBAReference(Configuration configuration, AbstractNameQuery containerNameQuery, URI nsCorbaloc, String objectName, String home) {
-                        return null;
-                    }
-
-                    public Reference createEJBRemoteRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String home, String remote) {
-                        return null;
-                    }
-
-                    public Reference createEJBLocalRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String localHome, String local) {
-                        return null;
-                    }
-
-                },
-                        new ResourceReferenceBuilder() {
-
-                            public Reference createResourceRef(AbstractNameQuery containerId, Class iface, Configuration configuration) {
-                                return null;
-                            }
-
-                            public Reference createAdminObjectRef(AbstractNameQuery containerId, Class iface, Configuration configuration) {
-                                return null;
-                            }
-
-                            public ObjectName locateResourceName(ObjectName query) {
-                                return null;
-                            }
-
-                            public GBeanData locateActivationSpecInfo(AbstractNameQuery nameQuery, String messageListenerInterface, Configuration configuration) {
-                                return null;
-                            }
-
-                            public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) {
-                                return null;
-                            }
-
-                            public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) {
-                                return null;
-                            }
-
-                            public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) {
-                                return null;
-                            }
-                        },
-                        new ServiceReferenceBuilder() {
-                            //it could return a Service or a Reference, we don't care
-                            public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) {
-                                return null;
-                            }
-                        }));
+                null
+        );
     }
 
     private void recursiveDelete(File path) {
@@ -376,7 +316,7 @@
 
         defaultEnvironment.addDependency(baseId, ImportType.ALL);
         defaultEnvironment.setConfigId(webModuleArtifact);
-        builder = new TomcatModuleBuilder(defaultEnvironment, new AbstractNameQuery(containerName), Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), null);
+        builder = new TomcatModuleBuilder(defaultEnvironment, new AbstractNameQuery(containerName), Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), new NamingBuilderCollection(null, null), null);
     }
 
     protected void tearDown() throws Exception {

Modified: geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java Tue Sep 12 11:15:24 2006
@@ -18,12 +18,14 @@
 package org.apache.geronimo.transaction.manager;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
 import javax.transaction.RollbackException;
@@ -34,6 +36,7 @@
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
+import javax.ejb.EJBException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -57,6 +60,10 @@
     private int status = Status.STATUS_NO_TRANSACTION;
     private Object logMark;
 
+    private final Map resources = new HashMap();
+    private Synchronization interposedSynchronization;
+    private final Map entityManagers = new HashMap();
+
     TransactionImpl(XidFactory xidFactory, TransactionLog txnLog, long transactionTimeoutMilliseconds) throws SystemException {
         this(xidFactory.createXid(), xidFactory, txnLog, transactionTimeoutMilliseconds);
     }
@@ -87,11 +94,38 @@
         this.timeout = Long.MAX_VALUE;
     }
 
-    public synchronized int getStatus() throws SystemException {
+    public synchronized int getStatus() {
         return status;
     }
 
-    public synchronized void setRollbackOnly() throws IllegalStateException, SystemException {
+    public Object getResource(Object key) {
+        return resources.get(key);
+    }
+
+    public boolean getRollbackOnly() {
+        return status == Status.STATUS_MARKED_ROLLBACK;
+    }
+
+    public Object getTransactionKey() {
+        return xid;
+    }
+
+    public int getTransactionStatus() {
+        return status;
+    }
+
+    public void putResource(Object key, Object value) {
+        if (key == null) {
+            throw new NullPointerException("You must supply a non-null key for putResource");
+        }
+        resources.put(key, value);
+    }
+
+    public void registerInterposedSynchronization(Synchronization synchronization) {
+        interposedSynchronization = synchronization;
+    }
+
+    public synchronized void setRollbackOnly() throws IllegalStateException {
         switch (status) {
             case Status.STATUS_ACTIVE:
             case Status.STATUS_PREPARING:
@@ -171,7 +205,7 @@
             //we know nothing about this XAResource or resource manager
             Xid branchId = xidFactory.createBranch(xid, resourceManagers.size() + 1);
             xaRes.start(branchId, XAResource.TMNOFLAGS);
-            activeXaResources.put(xaRes, addBranchXid(xaRes,  branchId));
+            activeXaResources.put(xaRes, addBranchXid(xaRes, branchId));
             return true;
         } catch (XAException e) {
             log.warn("Unable to enlist XAResource " + xaRes + ", errorCode: " + e.errorCode, e);
@@ -222,23 +256,19 @@
         beforePrepare();
 
         try {
-                      boolean timedout = false;
-                      if (TransactionTimer.getCurrentTime() > timeout)
-                      {
-                          status = Status.STATUS_MARKED_ROLLBACK;
-                          timedout = true;
-                      }
+            boolean timedout = false;
+            if (TransactionTimer.getCurrentTime() > timeout) {
+                status = Status.STATUS_MARKED_ROLLBACK;
+                timedout = true;
+            }
 
             if (status == Status.STATUS_MARKED_ROLLBACK) {
                 rollbackResources(resourceManagers);
-                              if(timedout)
-                              {
-                                  throw new RollbackException("Transaction timout");
-                              }
-                              else
-                              {
-                                  throw new RollbackException("Unable to commit: transaction marked for rollback");
-                              }
+                if (timedout) {
+                    throw new RollbackException("Transaction timout");
+                } else {
+                    throw new RollbackException("Unable to commit: transaction marked for rollback");
+                }
             }
             synchronized (this) {
                 if (status == Status.STATUS_ACTIVE) {
@@ -256,7 +286,6 @@
                 // resourceManagers is now immutable
             }
 
-
             // no-phase
             if (resourceManagers.size() == 0) {
                 synchronized (this) {
@@ -400,7 +429,6 @@
             }
         }
 
-
         // decision time...
         boolean willCommit;
         synchronized (this) {
@@ -471,9 +499,17 @@
             Synchronization synch;
             synchronized (this) {
                 if (i == syncList.size()) {
+                    if (interposedSynchronization != null) {
+                        synch = interposedSynchronization;
+                        i++;
+                    } else {
+                        return;
+                    }
+                } else if (i == syncList.size() + 1) {
                     return;
+                } else {
+                    synch = (Synchronization) syncList.get(i++);
                 }
-                synch = (Synchronization) syncList.get(i++);
             }
             try {
                 synch.beforeCompletion();
@@ -488,6 +524,13 @@
 
     private void afterCompletion() {
         // this does not synchronize because nothing can modify our state at this time
+        if (interposedSynchronization != null) {
+            try {
+                interposedSynchronization.afterCompletion(status);
+            } catch (Exception e) {
+                log.warn("Unexpected exception from afterCompletion; continuing", e);
+            }
+        }
         for (Iterator i = syncList.iterator(); i.hasNext();) {
             Synchronization synch = (Synchronization) i.next();
             try {
@@ -497,6 +540,10 @@
                 continue;
             }
         }
+        for (Iterator i = entityManagers.values().iterator(); i.hasNext();) {
+            Closeable entityManager = (Closeable) i.next();
+            entityManager.close();
+        }
     }
 
     private void endResources() {
@@ -579,7 +626,7 @@
                 txnLog.commit(xid, logMark);
             } catch (LogException e) {
                 log.error("Unexpected exception logging commit completion for xid " + xid, e);
-                throw (SystemException)new SystemException("Unexpected error logging commit completion for xid " + xid).initCause(e);
+                throw (SystemException) new SystemException("Unexpected error logging commit completion for xid " + xid).initCause(e);
             }
         }
         synchronized (this) {
@@ -634,6 +681,17 @@
         return manager;
     }
 
+    public Object getEntityManager(String persistenceUnit) {
+        return entityManagers.get(persistenceUnit);
+    }
+
+    public void setEntityManager(String persistenceUnit, Object entityManager) {
+        Object oldEntityManager = entityManagers.put(persistenceUnit, entityManager);
+        if (oldEntityManager != null) {
+            throw new EJBException("EntityManager " + oldEntityManager + " for persistenceUnit " + persistenceUnit + " already associated with this transaction " + xid);
+        }
+    }
+
     private static class TransactionBranch implements TransactionBranchInfo {
         private final XAResource committer;
         private final Xid branchId;
@@ -653,7 +711,7 @@
 
         public String getResourceName() {
             if (committer instanceof NamedXAResource) {
-            return ((NamedXAResource)committer).getName();
+                return ((NamedXAResource) committer).getName();
             } else {
                 throw new IllegalStateException("Cannot log transactions unles XAResources are named! " + committer);
             }

Modified: geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java Tue Sep 12 11:15:24 2006
@@ -23,12 +23,14 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
 import javax.transaction.InvalidTransactionException;
 import javax.transaction.NotSupportedException;
 import javax.transaction.RollbackException;
 import javax.transaction.Status;
+import javax.transaction.Synchronization;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -121,7 +123,7 @@
         return new ArrayList(resourceManagers);
     }
 
-    public Transaction getTransaction() throws SystemException {
+    public Transaction getTransaction() {
         return (Transaction) threadTx.get();
     }
 
@@ -136,7 +138,7 @@
         fireThreadAssociated(tx);
     }
 
-    private void unassociate() throws SystemException {
+    private void unassociate() {
         Transaction tx = getTransaction();
         if (tx != null) {
             associatedTransactions.remove(tx);
@@ -200,8 +202,53 @@
         associate((TransactionImpl) tx);
     }
 
-    public void setRollbackOnly() throws IllegalStateException, SystemException {
-        Transaction tx = getTransaction();
+    public Object getResource(Object key) {
+        TransactionImpl tx = getActiveTransactionImpl();
+        return tx.getResource(key);
+    }
+
+    private TransactionImpl getActiveTransactionImpl() {
+        TransactionImpl tx = (TransactionImpl)threadTx.get();
+        if (tx == null) {
+            throw new IllegalStateException("No tx on thread");
+        }
+        if (tx.getStatus() != Status.STATUS_ACTIVE) {
+            throw new IllegalStateException("Transaction " + tx + " is not active");
+        }
+        return tx;
+    }
+
+    public boolean getRollbackOnly() {
+        TransactionImpl tx = getActiveTransactionImpl();
+        return tx.getRollbackOnly();
+    }
+
+    public Object getTransactionKey() {
+        TransactionImpl tx = getActiveTransactionImpl();
+        return tx.getTransactionKey();
+    }
+
+    public int getTransactionStatus() {
+        TransactionImpl tx = getActiveTransactionImpl();
+        return tx.getTransactionStatus();
+    }
+
+    public void putResource(Object key, Object value) {
+        TransactionImpl tx = getActiveTransactionImpl();
+        tx.putResource(key, value);
+    }
+
+    /**
+     * jta 1.1 method so the jpa implementations can be told to flush their caches.
+     * @param synchronization
+     */
+    public void registerInterposedSynchronization(Synchronization synchronization) {
+        TransactionImpl tx = getActiveTransactionImpl();
+        tx.registerInterposedSynchronization(synchronization);
+    }
+
+    public void setRollbackOnly() throws IllegalStateException {
+        TransactionImpl tx = (TransactionImpl) threadTx.get();
         if (tx == null) {
             throw new IllegalStateException("No transaction associated with current thread");
         }
@@ -301,7 +348,7 @@
     }
 
     protected void recoverResourceManager(ResourceManager resourceManager) {
-        NamedXAResource namedXAResource = null;
+        NamedXAResource namedXAResource;
         try {
             namedXAResource = resourceManager.getRecoveryXAResources();
         } catch (SystemException e) {

Modified: geronimo/server/branches/sachin/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Tue Sep 12 11:15:24 2006
@@ -56,6 +56,7 @@
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
@@ -95,6 +96,9 @@
     protected final Kernel kernel;
     protected final NamespaceDrivenBuilderCollection securityBuilders;
     protected final NamespaceDrivenBuilderCollection serviceBuilders;
+
+    protected final NamingBuilder namingBuilders;
+
     private static final QName SECURITY_QNAME = GerSecurityDocument.type.getDocumentElementName();
     private static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
 
@@ -105,10 +109,11 @@
      */
     private static final URI RELATIVE_MODULE_BASE_URI = URI.create("../");
 
-    protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection serviceBuilders) {
+    protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection serviceBuilders, NamingBuilder namingBuilders) {
         this.kernel = kernel;
         this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders);
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+        this.namingBuilders = namingBuilders;
 
     }
 
@@ -121,6 +126,10 @@
 
     }
 
+    public NamingBuilder getNamingBuilders() {
+        return namingBuilders;
+    }
+
     //TODO configid these need to be converted to ReferencePatterns
     protected Set findGBeanDependencies(EARContext earContext) {
         Set dependencies = new HashSet();
@@ -224,6 +233,7 @@
             }
         }
         module.setEarContext(moduleContext);
+        module.setRootEarContext(earContext);
 
         try {
             // add the warfile's content to the configuration

Modified: geronimo/server/branches/sachin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/pom.xml?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/pom.xml (original)
+++ geronimo/server/branches/sachin/pom.xml Tue Sep 12 11:15:24 2006
@@ -202,7 +202,13 @@
             <dependency>
                 <groupId>backport-util-concurrent</groupId>
                 <artifactId>backport-util-concurrent</artifactId>
-                <version>2.0_01_pd</version>
+                <version>2.2</version>
+            </dependency>
+
+            <dependency>
+                <groupId>concurrent</groupId>
+                <artifactId>concurrent</artifactId>
+                <version>1.3.4</version>
             </dependency>
 
             <dependency>
@@ -228,13 +234,7 @@
                 <artifactId>commons-logging</artifactId>
                 <version>1.0.4</version>
             </dependency>
-
-            <dependency>
-                <groupId>concurrent</groupId>
-                <artifactId>concurrent</artifactId>
-                <version>1.3.4</version>
-            </dependency>
-
+            
             <dependency>
                 <groupId>org.objectweb.howl</groupId>
                 <artifactId>howl</artifactId>



Mime
View raw message