geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r509770 - in /geronimo/server/trunk/modules: geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/ geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ geronimo-jetty6-builder/src/main/java/org/apache...
Date Tue, 20 Feb 2007 21:58:36 GMT
Author: djencks
Date: Tue Feb 20 13:58:35 2007
New Revision: 509770

URL: http://svn.apache.org/viewvc?view=rev&rev=509770
Log:
GERONIMO-2816 related. Move  the NamingBuilder.buildEnvironment late enough so a classloader
is available for help with annotation procesing.  Intermediate patch to coordinate work.

Modified:
    geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
    geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
    geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SecurityConfigTest.java
    geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SpecSecurityParsingTest.java

Modified: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Tue Feb 20 13:58:35 2007
@@ -250,8 +250,6 @@
             idBuilder.resolve(serverEnvironment, new File(moduleFile.getName()).getName(),
"jar");
         }
 
-        namingBuilders.buildEnvironment(appClient, gerAppClient, clientEnvironment);
-
         if (earName == null) {
             earName = naming.createRootName(serverEnvironment.getConfigId(), NameFactory.NULL,
NameFactory.J2EE_APPLICATION);
         }
@@ -466,6 +464,8 @@
     }
 
     public void initContext(EARContext earContext, Module clientModule, ClassLoader cl) throws
DeploymentException {
+        namingBuilders.buildEnvironment(clientModule.getSpecDD(), clientModule.getVendorDD(),
clientModule.getEnvironment());
+
         AppClientModule appClientModule = ((AppClientModule) clientModule);
         for (Iterator resources = appClientModule.getResourceModules().iterator(); resources.hasNext();)
{
             ConnectorModule connectorModule = (ConnectorModule) resources.next();

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
Tue Feb 20 13:58:35 2007
@@ -21,6 +21,7 @@
 import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.HashMap;
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.deployment.DeploymentContext;
@@ -40,7 +41,7 @@
 
 
     public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName,
Environment serverEnvironment, Environment clientEnvironment, JarFile moduleFile, String targetPath,
XmlObject specDD, XmlObject vendorDD, String originalSpecDD, Collection resourceModules) {
-        super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD,
vendorDD, originalSpecDD, null);
+        super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD,
vendorDD, originalSpecDD, null, new HashMap());
         this.clientEnvironment = clientEnvironment;
         this.appClientName = appClientName;
         this.resourceModules = resourceModules;

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
Tue Feb 20 13:58:35 2007
@@ -20,6 +20,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.jar.JarFile;
+import java.util.HashMap;
 
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.gbean.AbstractName;
@@ -32,7 +33,7 @@
  */
 public class ConnectorModule extends Module {
     public ConnectorModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD)
{
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, null);
+        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, null, new HashMap());
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Tue Feb 20 13:58:35 2007
@@ -156,6 +156,7 @@
                 serviceBuilders,
                 kernel.getNaming());
     }
+
     public EARConfigBuilder(Environment defaultEnvironment,
             AbstractNameQuery transactionManagerAbstractName,
             AbstractNameQuery connectionTrackerAbstractName,
@@ -186,8 +187,8 @@
                 new SingleElementCollection(connectorConfigBuilder),
                 new SingleElementCollection(activationSpecInfoLocator),
                 new SingleElementCollection(appClientConfigBuilder),
-                securityBuilder == null? Collections.EMPTY_SET: Collections.singleton(securityBuilder),
-                serviceBuilder == null? Collections.EMPTY_SET: Collections.singleton(serviceBuilder),
+                securityBuilder == null ? Collections.EMPTY_SET : Collections.singleton(securityBuilder),
+                serviceBuilder == null ? Collections.EMPTY_SET : Collections.singleton(serviceBuilder),
                 naming);
     }
 
@@ -302,9 +303,9 @@
                 XmlObject xmlObject = XmlBeansUtil.parse(specDD);
                 application = convertToApplicationSchema(xmlObject).getApplication();
             } catch (XmlException e) {
-            	throw new DeploymentException("Could not parse application.xml", e);
+                throw new DeploymentException("Could not parse application.xml", e);
             } catch (Exception e) {
-            	//ee5 spec allows optional application.xml, continue with application == null
+                //ee5 spec allows optional application.xml, continue with application ==
null
             }
         }
 
@@ -353,9 +354,9 @@
         LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
         try {
             addModules(earFile, application, gerApplication, moduleLocations, modules, environment,
earName, idBuilder);
-            if(application == null && modules.isEmpty()) {
-            	//if no application.xml and no modules detected, return null for stand-alone
module processing
-            	return null;
+            if (application == null && modules.isEmpty()) {
+                //if no application.xml and no modules detected, return null for stand-alone
module processing
+                return null;
             }
         } catch (Throwable e) {
             // close all the modules
@@ -429,7 +430,7 @@
                 XmlBeansUtil.validateDD(result);
                 return (ApplicationDocument) result;
             }
-            
+
             // otherwise assume DTD
             SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE,
schemaLocationURL, version);
             cursor.toStartDoc();
@@ -452,8 +453,8 @@
     public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder)
throws IOException, DeploymentException {
         ApplicationInfo applicationInfo = (ApplicationInfo) plan;
         Artifact test = applicationInfo.getEnvironment().getConfigId();
-        if(!test.isResolved()) {
-            throw new IllegalStateException("Module ID should be fully resolved by now (not
"+test+")");
+        if (!test.isResolved()) {
+            throw new IllegalStateException("Module ID should be fully resolved by now (not
" + test + ")");
         }
         return test;
     }
@@ -497,9 +498,9 @@
             // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
             Set moduleLocations = applicationInfo.getModuleLocations();
             if (ConfigurationModuleType.EAR == applicationType && earFile != null)
{
-            	//get the value of the library-directory element in spec DD
-            	ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
-            	String libDir = getLibraryDirectory(specDD);
+                //get the value of the library-directory element in spec DD
+                ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
+                String libDir = getLibraryDirectory(specDD);
                 for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();)
{
                     ZipEntry entry = e.nextElement();
                     String entryName = entry.getName();
@@ -511,11 +512,11 @@
                             break;
                         }
                     }
-                    if(libDir != null && entry.getName().startsWith(libDir) &&
entry.getName().endsWith(".jar")) {
-            			NestedJarFile library = new NestedJarFile(earFile, entry.getName());
+                    if (libDir != null && entry.getName().startsWith(libDir) &&
entry.getName().endsWith(".jar")) {
+                        NestedJarFile library = new NestedJarFile(earFile, entry.getName());
                         earContext.addIncludeAsPackedJar(URI.create(entry.getName()), library);
-                    } else if(addEntry) {
-                    	earContext.addFile(URI.create(entry.getName()), earFile, entry);
+                    } else if (addEntry) {
+                        earContext.addFile(URI.create(entry.getName()), earFile, entry);
                     }
                 }
             }
@@ -595,10 +596,10 @@
         } catch (DeploymentException e) {
             cleanupContext(earContext, configurationDir);
             throw e;
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             cleanupContext(earContext, configurationDir);
             throw e;
-        } catch(Error e) {
+        } catch (Error e) {
             cleanupContext(earContext, configurationDir);
             throw e;
         } finally {
@@ -608,17 +609,17 @@
             }
         }
     }
-    
-	private String getLibraryDirectory(ApplicationType specDD) {
-		if(specDD == null || !specDD.isSetLibraryDirectory()) {
-			//value 'lib' is used if element not set or ear does not contain a dd
-			return "lib";
-		}
-		
-		//only set if not empty value, empty value implies no library directory
-		String value = specDD.getLibraryDirectory().getStringValue();
-		return value.trim().length() > 0 ? value : null;
-	}
+
+    private String getLibraryDirectory(ApplicationType specDD) {
+        if (specDD == null || !specDD.isSetLibraryDirectory()) {
+            //value 'lib' is used if element not set or ear does not contain a dd
+            return "lib";
+        }
+
+        //only set if not empty value, empty value implies no library directory
+        String value = specDD.getLibraryDirectory().getStringValue();
+        return value.trim().length() > 0 ? value : null;
+    }
 
     private void cleanupContext(EARContext earContext, File configurationDir) {
         List<ConfigurationData> configurations = new ArrayList<ConfigurationData>();
@@ -642,17 +643,16 @@
         }
     }
 
-    private boolean cleanupConfigurationDir(File configurationDir)
-    {
+    private boolean cleanupConfigurationDir(File configurationDir) {
         LinkedList<String> cannotBeDeletedList = new LinkedList<String>();
 
-        if (!DeploymentUtil.recursiveDelete(configurationDir,cannotBeDeletedList)) {
+        if (!DeploymentUtil.recursiveDelete(configurationDir, cannotBeDeletedList)) {
             // Output a message to help user track down file problem
             log.warn("Unable to delete " + cannotBeDeletedList.size() +
                     " files while recursively deleting directory "
                     + configurationDir + LINE_SEP +
-                    "The first file that could not be deleted was:" + LINE_SEP + "  "+
-                    ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "")
);
+                    "The first file that could not be deleted was:" + LINE_SEP + "  " +
+                    (!cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : ""));
             return false;
         }
         return true;
@@ -669,8 +669,8 @@
         try {
             mapVendorPlans(gerApplication, altVendorDDs, earFile);
             if (earFile != null) {
-            	if(application != null) {
-            		ModuleType[] moduleTypes = application.getModuleArray();
+                if (application != null) {
+                    ModuleType[] moduleTypes = application.getModuleArray();
 
                     //get a set containing all of the files in the ear that are actually
modules
                     for (ModuleType moduleXml : moduleTypes) {
@@ -737,77 +737,77 @@
                         modules.add(module);
                     }
                 } else {
-            		//no application.xml available, must inspect ear to locate and process modules
-            		Enumeration<JarEntry> entries = earFile.entries();
-            		while (entries.hasMoreElements()) {
-            			ModuleBuilder builder;
-            			Object moduleContextInfo = null;
-            			String moduleTypeName;
-            			ZipEntry entry = entries.nextElement();
-            			if(entry.getName().endsWith(".war")) {
-            				if (getWebConfigBuilder() == null) {
-            					throw new DeploymentException("Cannot deploy web application; No war deployer
defined: " + entry.getName());
-            				}
-            				builder = getWebConfigBuilder();
-            				moduleTypeName = "a war";
-            				moduleContextInfo = entry.getName().split(".war")[0];
-            			} else if(entry.getName().endsWith(".rar")) {
-            				if (getConnectorConfigBuilder() == null) {
-            					throw new DeploymentException("Cannot deploy resource adapter; No rar deployer
defined: " + entry.getName());
-            				}
-            				builder = getConnectorConfigBuilder();
-            				moduleTypeName = "a connector";
-            			} else if(entry.getName().endsWith(".jar") && !isLibraryEntry(application,
entry)) {
-            				try {
-            					NestedJarFile moduleFile = new NestedJarFile(earFile, entry.getName());
-            					if(moduleFile.getEntry("META-INF/application-client.xml") != null) {
-            						if (getAppClientConfigBuilder() == null) {
-            							throw new DeploymentException("Cannot deploy app client; No app client
deployer defined: " + entry.getName());
-            						}
-            						builder = getAppClientConfigBuilder();
-            						moduleTypeName = "an application client";
-            					} else if(moduleFile.getEntry("META-INF/ejb-jar.xml") != null) {
-            						builder = getEjbConfigBuilder();
-            						if (builder == null) {
-            							throw new DeploymentException("Cannot deploy ejb application; No ejb deployer
defined: " + entry.getName());
-            						}
-            						moduleTypeName = "an EJB";
-            					} else {
-            						continue;
-            					}
-            					//TODO if no ejb-jar.xml inspect classes for EJB component annotations to
identify as EJBJar module
-            				} catch (IOException e) {
-            					throw new DeploymentException("Invalid moduleFile: " + entry.getName(),
e);
-            				}
-            			} else {
-            				continue;
-            			}
-
-            			moduleLocations.add(entry.getName());
-
-            			NestedJarFile moduleFile;
-            			try {
-            				moduleFile = new NestedJarFile(earFile, entry.getName());
-            			} catch (IOException e) {
-            				throw new DeploymentException("Invalid moduleFile: " + entry.getName(), e);
-            			}
-
-            			Module module = builder.createModule(altVendorDDs.get(entry.getName()),
-            					moduleFile,
-            					entry.getName(),
-            					null,
-            					environment,
-            					moduleContextInfo,
-            					earName,
-            					naming, idBuilder);
-
-            			if (module == null) {
-            				throw new DeploymentException("Module was not " + moduleTypeName + ": " +
entry.getName());
-            			}
-
-            			modules.add(module);
-            		}
-            	}
+                    //no application.xml available, must inspect ear to locate and process
modules
+                    Enumeration<JarEntry> entries = earFile.entries();
+                    while (entries.hasMoreElements()) {
+                        ModuleBuilder builder;
+                        Object moduleContextInfo = null;
+                        String moduleTypeName;
+                        ZipEntry entry = entries.nextElement();
+                        if (entry.getName().endsWith(".war")) {
+                            if (getWebConfigBuilder() == null) {
+                                throw new DeploymentException("Cannot deploy web application;
No war deployer defined: " + entry.getName());
+                            }
+                            builder = getWebConfigBuilder();
+                            moduleTypeName = "a war";
+                            moduleContextInfo = entry.getName().split(".war")[0];
+                        } else if (entry.getName().endsWith(".rar")) {
+                            if (getConnectorConfigBuilder() == null) {
+                                throw new DeploymentException("Cannot deploy resource adapter;
No rar deployer defined: " + entry.getName());
+                            }
+                            builder = getConnectorConfigBuilder();
+                            moduleTypeName = "a connector";
+                        } else if (entry.getName().endsWith(".jar") && !isLibraryEntry(application,
entry)) {
+                            try {
+                                NestedJarFile moduleFile = new NestedJarFile(earFile, entry.getName());
+                                if (moduleFile.getEntry("META-INF/application-client.xml")
!= null) {
+                                    if (getAppClientConfigBuilder() == null) {
+                                        throw new DeploymentException("Cannot deploy app
client; No app client deployer defined: " + entry.getName());
+                                    }
+                                    builder = getAppClientConfigBuilder();
+                                    moduleTypeName = "an application client";
+                                } else if (moduleFile.getEntry("META-INF/ejb-jar.xml") !=
null) {
+                                    builder = getEjbConfigBuilder();
+                                    if (builder == null) {
+                                        throw new DeploymentException("Cannot deploy ejb
application; No ejb deployer defined: " + entry.getName());
+                                    }
+                                    moduleTypeName = "an EJB";
+                                } else {
+                                    continue;
+                                }
+                                //TODO if no ejb-jar.xml inspect classes for EJB component
annotations to identify as EJBJar module
+                            } catch (IOException e) {
+                                throw new DeploymentException("Invalid moduleFile: " + entry.getName(),
e);
+                            }
+                        } else {
+                            continue;
+                        }
+
+                        moduleLocations.add(entry.getName());
+
+                        NestedJarFile moduleFile;
+                        try {
+                            moduleFile = new NestedJarFile(earFile, entry.getName());
+                        } catch (IOException e) {
+                            throw new DeploymentException("Invalid moduleFile: " + entry.getName(),
e);
+                        }
+
+                        Module module = builder.createModule(altVendorDDs.get(entry.getName()),
+                                moduleFile,
+                                entry.getName(),
+                                null,
+                                environment,
+                                moduleContextInfo,
+                                earName,
+                                naming, idBuilder);
+
+                        if (module == null) {
+                            throw new DeploymentException("Module was not " + moduleTypeName
+ ": " + entry.getName());
+                        }
+
+                        modules.add(module);
+                    }
+                }
             }
 
             //all the modules in the geronimo plan should have been found by now.
@@ -914,14 +914,14 @@
             }
         }
     }
-    
-	private boolean isLibraryEntry(ApplicationType application, ZipEntry entry) {
-		String libDir = getLibraryDirectory(application);
-		if(libDir != null && entry.getName().startsWith(libDir)) {
-			return true;
-		}
-		return false;
-	}
+
+    private boolean isLibraryEntry(ApplicationType application, ZipEntry entry) {
+        String libDir = getLibraryDirectory(application);
+        if (libDir != null && entry.getName().startsWith(libDir)) {
+            return true;
+        }
+        return false;
+    }
 
     private void mapVendorPlans(GerApplicationType gerApplication, Map<String, Object>
altVendorDDs, JarFile earFile) throws DeploymentException {
         //build map from module path to alt vendor dd
@@ -959,15 +959,15 @@
     }
 
     private URL getAltSpecDDURL(JarFile earFile, ModuleType moduleXml) throws DeploymentException
{
-		if (moduleXml != null && moduleXml.isSetAltDd()) {
-			try {
-				return DeploymentUtil.createJarURL(earFile, moduleXml.getAltDd().getStringValue());
-			} catch (MalformedURLException e) {
-				throw new DeploymentException("Invalid alt sped dd url: " + moduleXml.getAltDd().getStringValue(),
e);
-			}
-		}
-		return null;
-	}
+        if (moduleXml != null && moduleXml.isSetAltDd()) {
+            try {
+                return DeploymentUtil.createJarURL(earFile, moduleXml.getAltDd().getStringValue());
+            } catch (MalformedURLException e) {
+                throw new DeploymentException("Invalid alt sped dd url: " + moduleXml.getAltDd().getStringValue(),
e);
+            }
+        }
+        return null;
+    }
 
     private ModuleBuilder getBuilder(Module module) throws DeploymentException {
         if (module instanceof EJBModule) {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
Tue Feb 20 13:58:35 2007
@@ -33,11 +33,9 @@
  */
 public class EJBModule extends Module {
     private AbstractName moduleCmpEngineName;
-    private final Map sharedContext;
 
     public EJBModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
Map sharedContext) {
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, null);
-        this.sharedContext = sharedContext;
+        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, null, sharedContext);
     }
 
     public ConfigurationModuleType getType() {
@@ -56,8 +54,5 @@
         this.moduleCmpEngineName = moduleCmpEngineName;
     }
 
-    public Map getSharedContext() {
-        return sharedContext;
-    }
 }
 

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
Tue Feb 20 13:58:35 2007
@@ -17,6 +17,7 @@
 package org.apache.geronimo.j2ee.deployment;
 
 import java.util.jar.JarFile;
+import java.util.Map;
 import java.net.URI;
 
 import org.apache.xmlbeans.XmlObject;
@@ -45,8 +46,9 @@
 
     private EARContext earContext;
     private EARContext rootEarContext;
+    protected final Map sharedContext;
 
-    protected Module(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
String namespace) {
+    protected Module(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
String namespace, Map sharedContext) {
         assert targetPath != null: "targetPath is null";
         assert moduleName != null: "moduleName is null";
 
@@ -69,6 +71,7 @@
         }
 
         targetPathURI = URI.create(targetPath + "/");
+        this.sharedContext = sharedContext;
     }
 
     public abstract ConfigurationModuleType getType();
@@ -155,5 +158,9 @@
 
     public void setRootEarContext(EARContext rootEarContext) {
         this.rootEarContext = rootEarContext;
+    }
+
+    public Map getSharedContext() {
+        return sharedContext;
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
Tue Feb 20 13:58:35 2007
@@ -29,12 +29,10 @@
  */
 public class WebModule extends Module {
     private final String contextRoot;
-    private final Map sharedContext;
 
     public WebModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
String contextRoot, Map sharedContext, String namespace) {
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, namespace);
+        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, namespace, sharedContext);
         this.contextRoot = contextRoot;
-        this.sharedContext = sharedContext;
     }
 
     public String getContextRoot() {
@@ -43,10 +41,6 @@
 
     public ConfigurationModuleType getType() {
         return ConfigurationModuleType.WAR;
-    }
-
-    public Map getSharedContext() {
-        return sharedContext;
     }
 
 }

Modified: geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
Tue Feb 20 13:58:35 2007
@@ -129,7 +129,6 @@
     private final Collection defaultFilterMappings;
     private final GBeanData pojoWebServiceTemplate;
 
-    private final Collection webServiceBuilder;
     protected final NamespaceDrivenBuilderCollection clusteringBuilders;
 
     private final List defaultWelcomeFiles;
@@ -153,7 +152,7 @@
             NamingBuilder namingBuilders,
             ResourceEnvironmentSetter resourceEnvironmentSetter,
             Kernel kernel) throws GBeanNotFoundException {
-        super(kernel, securityBuilders, serviceBuilders, namingBuilders, resourceEnvironmentSetter);
+        super(kernel, securityBuilders, serviceBuilders, namingBuilders, resourceEnvironmentSetter,
webServiceBuilder);
         this.defaultEnvironment = defaultEnvironment;
         this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? new
Integer(30 * 60) : defaultSessionTimeoutSeconds;
         this.jettyContainerObjectName = jettyContainerName;
@@ -162,7 +161,6 @@
         this.defaultFilters = defaultFilters;
         this.defaultFilterMappings = defaultFilterMappings;
         this.pojoWebServiceTemplate = getGBeanData(kernel, pojoWebServiceTemplate);
-        this.webServiceBuilder = webServiceBuilder;
         this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders,
GerClusteringDocument.type.getDocumentElementName());
 
         //todo locale mappings
@@ -233,8 +231,6 @@
             clusteringBuilders.buildEnvironment(jettyWebApp, environment);
         }
 
-        getNamingBuilders().buildEnvironment(webApp, jettyWebApp, 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) {
@@ -242,13 +238,6 @@
         }
         idBuilder.resolve(environment, warName, "war");
 
-        Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
-
-        Map sharedContext = new HashMap();
-        for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();) {
-            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
-            serviceBuilder.findWebServices(moduleFile, false, servletNameToPathMap, environment,
sharedContext);
-        }
         AbstractName moduleName;
         if (earName == null) {
             earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL,
NameFactory.J2EE_APPLICATION);
@@ -257,7 +246,7 @@
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
-        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, jettyWebApp, specDD, contextRoot, sharedContext, JETTY_NAMESPACE);
+        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, jettyWebApp, specDD, contextRoot, new HashMap(), JETTY_NAMESPACE);
     }
 
     JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String
targetPath, WebAppType webApp) throws DeploymentException {
@@ -317,7 +306,6 @@
 //        GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
 
 //        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.");

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Tue Feb 20 13:58:35 2007
@@ -230,9 +230,6 @@
             idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
         }
 
-        if (ejbModule.getEjbJar().getAssemblyDescriptor() != null) {
-            namingBuilder.buildEnvironment(null, null, environment);
-        }
 
         Map sharedContext = new HashMap();
 
@@ -329,6 +326,9 @@
         }
         module.setEarContext(moduleContext);
         module.setRootEarContext(earContext);
+        if (((EjbModule)module).getEjbJar().getAssemblyDescriptor() != null) {
+            namingBuilder.buildEnvironment(null, null, module.getEnvironment());
+        }
         for (ModuleBuilderExtension builder : moduleBuilderExtensions) {
             try {
                 builder.installModule(earFile, earContext, module, configurationStores, targetConfigurationStore,
repository);

Modified: geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Tue Feb 20 13:58:35 2007
@@ -94,8 +94,6 @@
     private final Environment defaultEnvironment;
     private final AbstractNameQuery tomcatContainerName;
 
-    private final Collection webServiceBuilder;
-
     private static final String TOMCAT_NAMESPACE = TomcatWebAppDocument.type.getDocumentElementName().getNamespaceURI();
 
     public TomcatModuleBuilder(Environment defaultEnvironment,
@@ -106,11 +104,10 @@
             NamingBuilder namingBuilders,
             ResourceEnvironmentSetter resourceEnvironmentSetter,
             Kernel kernel) {
-        super(kernel, securityBuilders, serviceBuilders, namingBuilders, resourceEnvironmentSetter);
+        super(kernel, securityBuilders, serviceBuilders, namingBuilders, resourceEnvironmentSetter,
webServiceBuilder);
         this.defaultEnvironment = defaultEnvironment;
 
         this.tomcatContainerName = tomcatContainerName;
-        this.webServiceBuilder = webServiceBuilder;
     }
 
     protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL
specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
@@ -186,13 +183,6 @@
         }
         idBuilder.resolve(environment, warName, "war");
 
-        Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
-
-        Map sharedContext = new HashMap();
-        for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();) {
-            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
-            serviceBuilder.findWebServices(moduleFile, false, servletNameToPathMap, environment,
sharedContext);
-        }
         AbstractName moduleName;
         if (earName == null) {
             earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL,
NameFactory.J2EE_APPLICATION);
@@ -201,7 +191,7 @@
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
-        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, tomcatWebApp, specDD, contextRoot, sharedContext, TOMCAT_NAMESPACE);
+        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, tomcatWebApp, specDD, contextRoot, new HashMap(), TOMCAT_NAMESPACE);
     }
 
 

Modified: geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
Tue Feb 20 13:58:35 2007
@@ -33,6 +33,7 @@
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
+import java.util.Iterator;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
@@ -56,6 +57,8 @@
 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.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
@@ -105,6 +108,7 @@
     protected final NamespaceDrivenBuilderCollection securityBuilders;
     protected final NamespaceDrivenBuilderCollection serviceBuilders;
     protected final ResourceEnvironmentSetter resourceEnvironmentSetter;
+    protected final Collection webServiceBuilder;
 
     protected final NamingBuilder namingBuilders;
 
@@ -118,12 +122,13 @@
      */
     private static final URI RELATIVE_MODULE_BASE_URI = URI.create("../");
 
-    protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection
serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter)
{
+    protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection
serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter,
Collection webServiceBuilder) {
         this.kernel = kernel;
         this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders, SECURITY_QNAME);
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, SERVICE_QNAME);
         this.namingBuilders = namingBuilders;
         this.resourceEnvironmentSetter = resourceEnvironmentSetter;
+        this.webServiceBuilder = webServiceBuilder;
     }
 
     static {
@@ -655,6 +660,17 @@
         XmlObject[] securityElements = XmlBeansUtil.selectSubstitutionGroupElements(SECURITY_QNAME,
gerWebApp);
         if (securityElements.length > 0 && !hasSecurityRealmName) {
             throw new DeploymentException("You have supplied a security configuration for
web app " + module.getName() + " but no security-realm-name to allow login");
+        }
+        getNamingBuilders().buildEnvironment(module.getSpecDD(), module.getVendorDD(), module.getEnvironment());
+        //this is silly
+        getNamingBuilders().initContext(module.getSpecDD(), gerWebApp, module.getEarContext().getConfiguration(),
earContext.getConfiguration(), module);
+
+        Map servletNameToPathMap = buildServletNameToPathMap((WebAppType) module.getSpecDD(),
((WebModule)module).getContextRoot());
+
+        Map sharedContext = module.getSharedContext();
+        for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();) {
+            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+            serviceBuilder.findWebServices(module.getModuleFile(), false, servletNameToPathMap,
module.getEnvironment(), sharedContext);
         }
         securityBuilders.build(gerWebApp, earContext, module.getEarContext());
         serviceBuilders.build(gerWebApp, earContext, module.getEarContext());

Modified: geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
Tue Feb 20 13:58:35 2007
@@ -21,6 +21,7 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.testsupport.XmlBeansTestSupport;
@@ -127,7 +128,7 @@
     private static class WebModuleBuilder extends AbstractWebModuleBuilder {
 
         protected WebModuleBuilder(Kernel kernel) {
-            super(kernel, null, null, null, null);
+            super(kernel, null, null, null, null, Collections.EMPTY_SET);
         }
 
         protected Module createModule(Object plan, JarFile moduleFile, String targetPath,
URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException {

Modified: geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SecurityConfigTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SecurityConfigTest.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SecurityConfigTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SecurityConfigTest.java
Tue Feb 20 13:58:35 2007
@@ -23,6 +23,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.Collections;
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.common.DeploymentException;
@@ -84,7 +85,7 @@
     private static class WebModuleBuilder extends AbstractWebModuleBuilder {
 
         protected WebModuleBuilder(Kernel kernel) {
-            super(kernel, null, null, null, null);
+            super(kernel, null, null, null, null, Collections.EMPTY_SET);
         }
 
         protected Module createModule(Object plan, JarFile moduleFile,

Modified: geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SpecSecurityParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SpecSecurityParsingTest.java?view=diff&rev=509770&r1=509769&r2=509770
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SpecSecurityParsingTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SpecSecurityParsingTest.java
Tue Feb 20 13:58:35 2007
@@ -26,6 +26,7 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Collections;
 import java.util.jar.JarFile;
 import java.security.PermissionCollection;
 
@@ -45,7 +46,7 @@
 import org.apache.xmlbeans.XmlObject;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class SpecSecurityParsingTest extends TestCase {
 
@@ -73,7 +74,7 @@
     public static class TestWebModuleBuilder extends AbstractWebModuleBuilder {
 
         protected TestWebModuleBuilder() {
-            super(null, null, null, null, null);
+            super(null, null, null, null, null, Collections.EMPTY_SET);
         }
 
         protected Module createModule(Object plan, JarFile moduleFile, String targetPath,
URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException {



Mime
View raw message