You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2010/05/10 15:15:15 UTC

svn commit: r942728 - in /geronimo/server/trunk/plugins: j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/ j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ jetty8/geronimo-jetty8/src/test/java/org/apache/g...

Author: xuhaihong
Date: Mon May 10 13:15:14 2010
New Revision: 942728

URL: http://svn.apache.org/viewvc?rev=942728&view=rev
Log:
1. Separate the map for module scope and comp scope
2. Keep the same map instance in the shareContext, so that other module extension could have chance to add jndi info

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/WebContextSource.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/WebContextSource.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/WebContextSource.java?rev=942728&r1=942727&r2=942728&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/WebContextSource.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/WebContextSource.java Mon May 10 13:15:14 2010
@@ -44,15 +44,18 @@ public class WebContextSource implements
 
     private final Context context;
 
-    public WebContextSource(@ParamAttribute(name = "componentContext") Map<String, Object> componentContext,
+    public WebContextSource(@ParamAttribute(name = "moduleContext") Map<String, Object> moduleContext,
+                            @ParamAttribute(name = "componentContext") Map<String, Object> componentContext,
                             @ParamReference(name = "TransactionManager") TransactionManager transactionManager,
                             @ParamReference(name = "ApplicationJndi") ApplicationJndi applicationJndi,
                             @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
                             @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel) throws NamingException {
         GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
         Set<Context> contexts = new LinkedHashSet<Context>(3);
-        Context localContext = EnterpriseNamingContext.livenReferences(componentContext, userTransaction, kernel, classLoader, "comp/");
-        contexts.add(localContext);
+        Context localCompContext = EnterpriseNamingContext.livenReferences(componentContext, userTransaction, kernel, classLoader, "comp/");
+        Context localModuleContext = EnterpriseNamingContext.livenReferences(moduleContext, null, kernel, classLoader, "module/");
+        contexts.add(localCompContext);
+        contexts.add(localModuleContext);
         if (applicationJndi != null) {
             if (applicationJndi.getApplicationContext() != null) {
                 contexts.add(applicationJndi.getApplicationContext());

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=942728&r1=942727&r2=942728&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java Mon May 10 13:15:14 2010
@@ -705,16 +705,11 @@ public abstract class AbstractWebModuleB
         //This means that you cannot use the default environment of the web builder to add configs that will be searched.
         getNamingBuilders().buildNaming(webApp, vendorPlan, webModule, buildingContext);
         //Combine contexts.  Note this may not work right for jaxws which has a comp/env/WebServiceContext binding
-        Map<String, Object> compContext = new HashMap<String, Object>();
-        if (jndiContext.get(JndiScope.comp) != null) {
-            compContext.putAll(jndiContext.get(JndiScope.comp));
-        }
-        if (jndiContext.get(JndiScope.module) != null) {
-            compContext.putAll(jndiContext.get(JndiScope.module));
-        }
         AbstractName contextSourceName = moduleContext.getNaming().createChildName(webModuleData.getAbstractName(), "ContextSource", "ContextSource");
         GBeanData contextSourceData = new GBeanData(contextSourceName, WebContextSource.class);
-        contextSourceData.setAttribute("componentContext", compContext);
+
+        contextSourceData.setAttribute("componentContext", jndiContext.get(JndiScope.comp));
+        contextSourceData.setAttribute("moduleContext", jndiContext.get(JndiScope.module));
         contextSourceData.setReferencePattern("ApplicationJndi", EARContext.APPLICATION_JNDI_NAME_KEY.get(earContext.getGeneralData()));
         contextSourceData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
         try {

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java?rev=942728&r1=942727&r2=942728&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java Mon May 10 13:15:14 2010
@@ -142,6 +142,7 @@ public class AbstractWebModuleTest exten
         }
         String contextPath = "/test";
         ContextSource contextSource = new WebContextSource(Collections.<String, Object>emptyMap(),
+                Collections.<String, Object>emptyMap(),
                 transactionManager,
                 null,
                 cl,

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=942728&r1=942727&r2=942728&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Mon May 10 13:15:14 2010
@@ -86,6 +86,7 @@ public abstract class AbstractWebModuleT
         MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), locationURI.toString(), new HashMap<Artifact, ConfigurationData>(), null);
         bundle = bundleContext.getBundle();
         ContextSource contextSource = new WebContextSource(Collections.<String, Object>emptyMap(),
+                Collections.<String, Object>emptyMap(),
                 transactionManager,
                 null,
                 cl,