geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1126451 - in /geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment: AppClientModule.java ConnectorModule.java EARConfigBuilder.java EJBModule.java Module.java WebModule.java
Date Mon, 23 May 2011 11:45:53 GMT
Author: genspring
Date: Mon May 23 11:45:53 2011
New Revision: 1126451

URL: http://svn.apache.org/viewvc?rev=1126451&view=rev
Log:
GERONIMO-5968 To support module priority so that we could control the sub-modules handling
sequence during the deployment process.

A, add priority for modules.
  1, ConnectorModule
  2, EjbModule
  3, WebModule
  4, AppClientModule
B, Sort modules before the building.

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java?rev=1126451&r1=1126450&r2=1126451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
Mon May 23 11:45:53 2011
@@ -56,6 +56,7 @@ public class AppClientModule extends Mod
         this.serverEnvironment = serverEnvironment;
         this.appClientName = appClientName;
         this.mainClassName = mainClassName;
+        super.priority = 9;
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java?rev=1126451&r1=1126450&r2=1126451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
Mon May 23 11:45:53 2011
@@ -42,6 +42,7 @@ public class ConnectorModule<T, U> exten
                            Module parentModule) {
         super(standAlone, moduleName, name, environment, moduleFile, 
               targetPath, specDD, vendorDD, originalSpecDD, null, jndiContext, parentModule);
+        super.priority = 3;
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=1126451&r1=1126450&r2=1126451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Mon May 23 11:45:53 2011
@@ -620,7 +620,12 @@ public class EARConfigBuilder implements
             GerApplicationType geronimoApplication = (GerApplicationType) applicationInfo.getVendorDD();
 
             // each module installs it's files into the output context.. this is different
for each module type
-            for (Module module : applicationInfo.getModules()) {
+            
+            List<Module<?,?>> modules = new ArrayList<Module<?,?>>();
+            modules.addAll(applicationInfo.getModules());
+            Collections.sort(modules, new Module.ModulePriorityComparator());
+                
+            for (Module<?,?> module : modules) {
                 getBuilder(module).installModule(earFile, earContext, module, configurationStores,
targetConfigurationStore, repositories);
             }
             //push the module classpaths into the appropriate ear context
@@ -629,7 +634,7 @@ public class EARConfigBuilder implements
             earContext.flush();
             earContext.initializeConfiguration();
 
-            for (Module module : applicationInfo.getModules()) {
+            for (Module<?,?> module : modules) {
                 if (earContext != module.getEarContext()) {
                     module.getEarContext().initializeConfiguration();
                 }
@@ -642,7 +647,7 @@ public class EARConfigBuilder implements
             if (ConfigurationModuleType.EAR == applicationType) {
                 namingBuilders.initContext(applicationInfo.getSpecDD(), applicationInfo.getVendorDD(),
applicationInfo);
             }
-            for (Module module : applicationInfo.getModules()) {
+            for (Module<?,?> module : modules) {
                 if (createPlanMode.get()) {
                     try {
                         getBuilder(module).initContext(earContext, module, bundle);
@@ -712,7 +717,7 @@ public class EARConfigBuilder implements
             AbstractName appJndiName = naming.createChildName(earContext.getModuleName(),
"ApplicationJndi", "ApplicationJndi");
             earContext.getGeneralData().put(EARContext.APPLICATION_JNDI_NAME_KEY, appJndiName);
             // each module can now add it's GBeans
-            for (Module module : applicationInfo.getModules()) {
+            for (Module<?,?> module : modules) {
                 if (createPlanMode.get()) {
                     try {
                         getBuilder(module).addGBeans(earContext, module, bundle, repositories);
@@ -754,8 +759,7 @@ public class EARConfigBuilder implements
             cleanupContext(earContext);
             throw e;
         } finally {
-            for (Object module1 : applicationInfo.getModules()) {
-                Module module = (Module) module1;
+            for (Module<?,?> module : applicationInfo.getModules()) {
                 module.close();
             }
         }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java?rev=1126451&r1=1126450&r2=1126451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
Mon May 23 11:45:53 2011
@@ -44,6 +44,7 @@ public class EJBModule<U> extends Module
                      Module parentModule) {
         super(standAlone, moduleName, name, environment, moduleFile, 
               targetPath, specDD, vendorDD, originalSpecDD, null, jndiContext, parentModule);
+        super.priority = 5;
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?rev=1126451&r1=1126450&r2=1126451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
Mon May 23 11:45:53 2011
@@ -17,6 +17,7 @@
 package org.apache.geronimo.j2ee.deployment;
 
 import java.net.URI;
+import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
@@ -64,6 +65,16 @@ public abstract class Module<T, U> {
 
     private final Map<JndiKey, Map<String, Object>> jndiContext;
     private final Module<?, ?> parentModule;
+    
+    /*
+     * The Modules should be sorted with following sequence:
+     * 
+     * 1, ConnectorModule
+     * 2, EJBModule
+     * 3, WebModule
+     * 4, AppClientModule
+     */
+    protected int priority = 5;
 
     protected Module(boolean standAlone,
                      AbstractName moduleName,
@@ -333,4 +344,12 @@ public abstract class Module<T, U> {
         }
         return jndiContext;
     }
+    
+
+    public static class ModulePriorityComparator implements Comparator<Module<?,?>>
{
+
+        public int compare(Module<?,?> m1, Module<?,?> m2) {
+            return m1.priority - m2.priority;
+        }
+    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java?rev=1126451&r1=1126450&r2=1126451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
Mon May 23 11:45:53 2011
@@ -51,6 +51,7 @@ public class WebModule extends Module<We
                      Module parentModule) {
         this(standAlone, moduleName, name, environment, new DeployableJarFile(moduleFile),
              targetPath, specDD, vendorDD, originalSpecDD, contextRoot, namespace, jndiContext,
parentModule);
+        super.priority = 7;
     }
     
     public WebModule(boolean standAlone,



Mime
View raw message