geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1137888 - in /geronimo/server/trunk/plugins: client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/ j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ j2ee/geronimo-web-2.5-builder/src/m...
Date Tue, 21 Jun 2011 07:22:59 GMT
Author: genspring
Date: Tue Jun 21 07:22:59 2011
New Revision: 1137888

URL: http://svn.apache.org/viewvc?rev=1137888&view=rev
Log:
GERONIMO-6016 Geronimo can't handle well when modules in ear has the same name.

Modified:
    geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.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/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java

Modified: geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=1137888&r1=1137887&r2=1137888&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Tue Jun 21 07:22:59 2011
@@ -778,7 +778,18 @@ public class AppClientModuleBuilder impl
                         appClient.setMainClass(appClientModule.getMainClassName());
                     }
                     
-                    appClientModule.getJndiScope(JndiScope.module).put("module/ModuleName",
module.getName());
+                    String moduleName =  module.getName();
+                    
+                    if (earContext.getSubModuleNames().contains(moduleName)){
+                        log.warn("Duplicated moduleName: '"+moduleName +"' is found ! deployer
will rename it to: '"+moduleName +
+                                "_duplicated' , please check your modules in application
to make sure they don't share the same name");
+                        moduleName = moduleName +"_duplicated";
+                        earContext.getSubModuleNames().add(moduleName);
+                    } 
+                        
+                   earContext.getSubModuleNames().add(moduleName);                    
+                   appClientModule.getJndiScope(JndiScope.module).put("module/ModuleName",
moduleName);
+                    
                     namingBuilders.buildNaming(appClient, geronimoAppClient, appClientModule,
buildingContext);
 
                     if (!appClient.isMetadataComplete()) {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java?rev=1137888&r1=1137887&r2=1137888&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java
Tue Jun 21 07:22:59 2011
@@ -19,7 +19,9 @@ package org.apache.geronimo.j2ee.deploym
 import java.io.File;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
@@ -43,6 +45,7 @@ public class EARContext extends Deployme
     private final AbstractNameQuery corbaGBeanObjectName;
 
     private final Map<String, Object> contextIDToPermissionsMap = new HashMap<String,
Object>();
+    private final Set<String> subModuleNames = new HashSet<String>();
     private Object securityConfiguration;
     private boolean hasSecurity;
 
@@ -211,6 +214,10 @@ public class EARContext extends Deployme
         this.hasSecurity = hasSecurity;
     }
 
+    public Set<String> getSubModuleNames() {
+        return subModuleNames;
+    }
+
     public static interface Key<T> {
         T get(Map<Key, Object> context);
     }

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=1137888&r1=1137887&r2=1137888&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
Tue Jun 21 07:22:59 2011
@@ -676,7 +676,20 @@ public abstract class AbstractWebModuleB
             throws DeploymentException {
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key,
Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleContext.getModuleName());
-        webModule.getJndiContext().get(JndiScope.module).put("module/ModuleName", webModule.getName());
+        
+        String moduleName =  webModule.getName();
+        
+        if (earContext.getSubModuleNames().contains(moduleName)){
+            log.warn("Duplicated moduleName: '"+moduleName +"' is found ! deployer will rename
it to: '"+moduleName +
+                    "_duplicated' , please check your modules in application to make sure
they don't share the same name");
+            moduleName = moduleName +"_duplicated";
+            earContext.getSubModuleNames().add(moduleName);
+        }   
+        
+        earContext.getSubModuleNames().add(moduleName);
+        webModule.getJndiContext().get(JndiScope.module).put("module/ModuleName", moduleName);
+
+        
         if (!webApp.isMetadataComplete()) {
             // Create a classfinder and populate it for the naming builder(s). The absence
of a
             // classFinder in the module will convey whether metadata-complete is set (or
not)

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=1137888&r1=1137887&r2=1137888&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Tue Jun 21 07:22:59 2011
@@ -64,6 +64,7 @@ import org.apache.geronimo.gbean.Referen
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.j2ee.deployment.AppClientModule;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
@@ -1145,13 +1146,18 @@ public class EjbModuleBuilder implements
         // add enc
         String moduleName = module.getName();
         
-        if( module.getJndiScope(JndiScope.module).get("module/ModuleName")== moduleName){
-            log.warn("Duplicated moduleName:'"+moduleName +"' is found ! deployer will rename
it to:'"+moduleName +
-                    "_duplicated', please check your modules in application to make sure
they don't share the same name");
+        if (earContext.getSubModuleNames().contains(moduleName)){
+            log.warn("Duplicated moduleName: '"+moduleName +"' is found ! deployer will rename
it to: '"+moduleName +
+                    "_duplicated' , please check your modules in application to make sure
they don't share the same name");
             moduleName = moduleName +"_duplicated";
+            earContext.getSubModuleNames().add(moduleName);
+        }
+        
+        if (!(module.getParentModule() instanceof WebModule) && !(module.getParentModule()
instanceof AppClientModule)) {
+            earContext.getSubModuleNames().add(moduleName);
+            module.getJndiScope(JndiScope.module).put("module/ModuleName", moduleName);
         }
         
-        module.getJndiScope(JndiScope.module).put("module/ModuleName", moduleName);
         ejbDeploymentBuilder.buildEnc();
 
         Set<GBeanData> gBeanDatas = earContext.getConfiguration().findGBeanDatas(Collections.singleton(new
AbstractNameQuery(PersistenceUnitGBean.class.getName())));



Mime
View raw message