geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1143861 - in /geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment: EARConfigBuilder.java Module.java
Date Thu, 07 Jul 2011 15:00:46 GMT
Author: xuhaihong
Date: Thu Jul  7 15:00:46 2011
New Revision: 1143861

URL: http://svn.apache.org/viewvc?rev=1143861&view=rev
Log:
If init module order is set with true, just move the application client to the last position

Modified:
    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/Module.java

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=1143861&r1=1143860&r2=1143861&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
Thu Jul  7 15:00:46 2011
@@ -545,14 +545,14 @@ public class EARConfigBuilder implements
 
     public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId,
Object plan, JarFile earFile, Collection configurationStores, ArtifactResolver artifactResolver,
ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
         assert plan != null;
-        
+
         if (earFile != null) {
             Manifest mf = earFile.getManifest();
             if (mf != null && mf.getMainAttributes().getValue("Bundle-SymbolicName")
!= null) {
                 log.warn("Application module contains OSGi manifest. The OSGi manifest will
be ignored and the application will be deployed as a regular Java EE application.");
             }
         }
-        
+
         ApplicationInfo applicationInfo = (ApplicationInfo) plan;
 
         EARContext earContext = null;
@@ -595,12 +595,12 @@ public class EARConfigBuilder implements
             boolean initModulesInDDOrder = false;
             if (ConfigurationModuleType.EAR == applicationType && earFile != null)
{
                 //get the value of the library-directory element in spec DD
-                Application specDD = (Application) applicationInfo.getSpecDD();
-                
+                Application specDD = applicationInfo.getSpecDD();
+
                 if (specDD != null && specDD.getInitializeInOrder() != null) {
                     initModulesInDDOrder = specDD.getInitializeInOrder();
                 }
-                
+
                 String libDir = getLibraryDirectory(specDD);
                 Collection<String> libClasspath = applicationInfo.getClassPath();
                 for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();)
{
@@ -613,12 +613,12 @@ public class EARConfigBuilder implements
                             break;
                         }
                     }
-                    
+
                     if (addEntry) {
                         earContext.addFile(URI.create(entry.getName()), earFile, entry);
                     }
                 }
-                
+
                 for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();)
{
                     ZipEntry entry = e.nextElement();
                     String entryName = entry.getName();
@@ -628,26 +628,29 @@ public class EARConfigBuilder implements
                         earContext.addIncludeAsPackedJar(URI.create(entry.getName()), library);
                         libClasspath.add(entry.getName());
                         earContext.addManifestClassPath(library, URI.create(libDir+"/"),
libClasspath);
-                    } 
+                    }
                 }
-                
+
             }
-            
-            
+
+
             for(String classpath:applicationInfo.getClassPath()){
                 earContext.addToClassPath(classpath);
             }
-            
+
             GerApplicationType geronimoApplication = (GerApplicationType) applicationInfo.getVendorDD();
 
             // each module installs it's files into the output context.. this is different
for each module type
-            
+
             List<Module<?,?>> modules = new ArrayList<Module<?,?>>();
             modules.addAll(applicationInfo.getModules());
-            if (!initModulesInDDOrder){
+            if (initModulesInDDOrder){
+                //Per the xsd description, the application client module could be in any
order
+                Collections.sort(modules, new Module.AppClientModuleLastComparator());
+            } else {
                 Collections.sort(modules, new Module.ModulePriorityComparator());
             }
-                
+
             for (Module<?,?> module : modules) {
                 getBuilder(module).installModule(earFile, earContext, module, configurationStores,
targetConfigurationStore, repositories);
             }
@@ -689,11 +692,11 @@ public class EARConfigBuilder implements
             }
 
             if (ConfigurationModuleType.EAR == applicationType) {
-                
+
                 for (ModuleBuilderExtension mbe : BValModuleBuilders) {
                     mbe.initContext(earContext, applicationInfo, earContext.getDeploymentBundle());
-                }                
-                
+                }
+
                 // process persistence unit in EAR library directory
                 for (ModuleBuilderExtension mbe : persistenceUnitBuilders) {
                     mbe.initContext(earContext, applicationInfo, earContext.getDeploymentBundle());

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=1143861&r1=1143860&r2=1143861&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
Thu Jul  7 15:00:46 2011
@@ -65,10 +65,10 @@ 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
@@ -344,7 +344,7 @@ public abstract class Module<T, U> {
         }
         return jndiContext;
     }
-    
+
 
     public static class ModulePriorityComparator implements Comparator<Module<?,?>>
{
 
@@ -352,4 +352,13 @@ public abstract class Module<T, U> {
             return m1.priority - m2.priority;
         }
     }
+
+    public static class AppClientModuleLastComparator implements Comparator<Module<?,
?>> {
+
+        public int compare(Module<?, ?> m1, Module<?, ?> m2) {
+            boolean m1AppClientModule = m1 instanceof AppClientModule;
+            boolean m2AppClientModule = m2 instanceof AppClientModule;
+            return m1AppClientModule && m2AppClientModule ? 0 : (m1AppClientModule
? -1 : 1);
+        }
+    }
 }



Mime
View raw message