geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r381704 [1/2] - in /geronimo/branches/1.1: assemblies/j2ee-tomcat-server/ assemblies/j2ee-tomcat-server/src/var/config/ configs/jsp-examples-tomcat/src/plan/ configs/servlets-examples-tomcat/src/plan/ configs/tomcat-deployer/src/plan/ modul...
Date Tue, 28 Feb 2006 16:55:47 GMT
Author: djencks
Date: Tue Feb 28 08:55:41 2006
New Revision: 381704

URL: http://svn.apache.org/viewcvs?rev=381704&view=rev
Log:
Fix tomcat to use configuration classloader.  Move some common code into AbstractWebModuleBuilder.

Modified:
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
    geronimo/branches/1.1/configs/jsp-examples-tomcat/src/plan/plan.xml
    geronimo/branches/1.1/configs/servlets-examples-tomcat/src/plan/plan.xml
    geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml
    geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
    geronimo/branches/1.1/modules/web-builder/project.xml
    geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml Tue Feb 28 08:55:41 2006
@@ -181,7 +181,7 @@
                 <geronimo.assemble>install</geronimo.assemble>
             </properties>
         </dependency>
-<!--deployers-->
+<!-- deployers -->
         <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-gbean-deployer</artifactId>
@@ -193,7 +193,7 @@
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
-            <artifactId>hot-deployer</artifactId>
+            <artifactId>j2ee-deployer</artifactId>
             <type>car</type>
             <version>${pom.currentVersion}</version>
             <properties>
@@ -202,7 +202,7 @@
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
-            <artifactId>j2ee-deployer</artifactId>
+            <artifactId>hot-deployer</artifactId>
             <type>car</type>
             <version>${pom.currentVersion}</version>
             <properties>
@@ -218,7 +218,7 @@
                 <geronimo.assemble>install</geronimo.assemble>
             </properties>
         </dependency>
-<!--applications-->
+<!-- applications -->
         <dependency>
             <groupId>geronimo</groupId>
             <artifactId>ldap-demo-tomcat</artifactId>
@@ -266,6 +266,24 @@
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
+            <artifactId>webconsole-tomcat_geronimo-console-framework-${pom.currentVersion}.war</artifactId>
+            <type>car</type>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <geronimo.assemble>install</geronimo.assemble>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>webconsole-tomcat_geronimo-console-standard-${pom.currentVersion}.war</artifactId>
+            <type>car</type>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <geronimo.assemble>install</geronimo.assemble>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
             <artifactId>jmxdebug-tomcat</artifactId>
             <type>car</type>
             <version>${pom.currentVersion}</version>
@@ -302,6 +320,15 @@
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
+            <artifactId>daytrader-derby-tomcat_daytrader-web-${pom.currentVersion}.war</artifactId>
+            <type>car</type>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <geronimo.assemble>install</geronimo.assemble>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
             <artifactId>daytrader-derby-tomcat-streamer-client</artifactId>
             <type>car</type>
             <version>${daytrader_version}</version>
@@ -321,6 +348,7 @@
             </properties>
         </dependency>
 
+
         <!-- lib dependencies -->
         <dependency>
             <groupId>cglib</groupId>
@@ -1270,12 +1298,12 @@
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
-            <artifactId>geronimo-jetty</artifactId>
+            <artifactId>geronimo-tomcat</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
-            <artifactId>geronimo-jetty-builder</artifactId>
+            <artifactId>geronimo-tomcat-builder</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
         <dependency>

Modified: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml Tue Feb 28 08:55:41 2006
@@ -43,6 +43,12 @@
             <attribute name="args">-ORBInitRef, NameService=corbaloc::${PlanCOSNamingHost}:${PlanCOSNamingPort}/NameService</attribute>
         </gbean>
     </configuration>
+    <configuration name="geronimo/system-database/${pom.currentVersion}/car">
+        <gbean name="DerbyNetwork">
+            <attribute name="host">${PlanServerHostname}</attribute>
+            <attribute name="port">${PlanDerbyPort}</attribute>
+        </gbean>
+    </configuration>
     <configuration name="geronimo/activemq-broker/${pom.currentVersion}/car">
         <gbean name="ActiveMQ.tcp.default">
             <attribute name="host">${PlanServerHostname}</attribute>
@@ -50,12 +56,6 @@
         </gbean>
     </configuration>
     <configuration name="geronimo/activemq/${pom.currentVersion}/car"/>
-    <configuration name="geronimo/system-database/${pom.currentVersion}/car">
-        <gbean name="DerbyNetwork">
-            <attribute name="host">${PlanServerHostname}</attribute>
-            <attribute name="port">${PlanDerbyPort}</attribute>
-        </gbean>
-    </configuration>
     <configuration name="geronimo/directory/${pom.currentVersion}/car">
         <gbean name="geronimo.server:name=DirectoryService">
             <attribute name="host">${PlanServerHostname}</attribute>
@@ -101,9 +101,12 @@
     <configuration name="geronimo/servlets-examples-tomcat/${pom.currentVersion}/car"/>
     <configuration name="geronimo/jsp-examples-tomcat/${pom.currentVersion}/car"/>
     <configuration name="geronimo/webconsole-tomcat/${pom.currentVersion}/car"/>
+    <configuration name="geronimo/webconsole-tomcat_geronimo-console-framework-${pom.currentVersion}.war/${pom.currentVersion}/car"/>
+    <configuration name="geronimo/webconsole-tomcat_geronimo-console-standard-${pom.currentVersion}.war/${pom.currentVersion}/car"/>
     <configuration name="geronimo/uddi-tomcat/${pom.currentVersion}/car"/>
     <configuration name="geronimo/jmxdebug-tomcat/${pom.currentVersion}/car"/>
     <configuration name="geronimo/daytrader-derby-tomcat/${pom.currentVersion}/car"/>
+    <configuration name="geronimo/daytrader-derby-tomcat_daytrader-web-${pom.currentVersion}.war/${pom.currentVersion}/car"/>
     <configuration name="geronimo/remote-deploy-tomcat/${pom.currentVersion}/car"/>
     <configuration name="geronimo/hot-deployer/${pom.currentVersion}/car" />
 </attributes>

Modified: geronimo/branches/1.1/configs/jsp-examples-tomcat/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/jsp-examples-tomcat/src/plan/plan.xml?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/jsp-examples-tomcat/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/jsp-examples-tomcat/src/plan/plan.xml Tue Feb 28 08:55:41 2006
@@ -20,8 +20,19 @@
 
 <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"
 
-    >
+        >
 
     <context-root>/jsp-examples</context-root>
     <context-priority-classloader>false</context-priority-classloader>
+    <security-realm-name>geronimo-properties-realm</security-realm-name>
+    <security>
+        <default-principal>
+            <principal name="anonymous" class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"/>
+        </default-principal>
+        <role-mappings>
+            <role role-name="tomcat">
+                <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
+            </role>
+        </role-mappings>
+    </security>
 </web-app>

Modified: geronimo/branches/1.1/configs/servlets-examples-tomcat/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/servlets-examples-tomcat/src/plan/plan.xml?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/servlets-examples-tomcat/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/servlets-examples-tomcat/src/plan/plan.xml Tue Feb 28 08:55:41 2006
@@ -24,4 +24,15 @@
 
     <context-root>/servlets-examples</context-root>
     <context-priority-classloader>false</context-priority-classloader>
+    <security-realm-name>geronimo-properties-realm</security-realm-name>
+    <security>
+        <default-principal>
+            <principal name="anonymous" class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" />
+        </default-principal>
+        <role-mappings>
+            <role role-name="tomcat">
+                <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" />
+            </role>
+        </role-mappings>
+    </security>
 </web-app>

Modified: geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml Tue Feb 28 08:55:41 2006
@@ -27,9 +27,6 @@
             <module>${pom.groupId}/j2ee-deployer/${pom.currentVersion}/car</module>
             <name>WebServiceBuilder</name>
         </reference>
-        <reference name="Repository">
-            <gbean-name>*:name=Repository,*</gbean-name>
-        </reference>
         <xml-attribute name="defaultEnvironment">
             <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
                 <dependencies>

Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Tue Feb 28 08:55:41 2006
@@ -150,7 +150,6 @@
     private final List defaultWelcomeFiles;
     private final Integer defaultSessionTimeoutSeconds;
 
-    private final Kernel kernel;
     private static final String JETTY_NAMESPACE = JettyWebAppDocument.type.getDocumentElementName().getNamespaceURI();
 
     public JettyModuleBuilder(Environment defaultEnvironment,
@@ -164,6 +163,7 @@
                               Object pojoWebServiceTemplate,
                               WebServiceBuilder webServiceBuilder,
                               Kernel kernel) throws GBeanNotFoundException {
+        super(kernel);
         this.defaultEnvironment = defaultEnvironment;
         this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? new Integer(30 * 60) : defaultSessionTimeoutSeconds;
         this.defaultContextPriorityClassloader = defaultContextPriorityClassloader;
@@ -173,7 +173,6 @@
         this.defaultFilterMappings = defaultFilterMappings;
         this.pojoWebServiceTemplate = getGBeanData(kernel, pojoWebServiceTemplate);
         this.webServiceBuilder = webServiceBuilder;
-        this.kernel = kernel;
 
         //todo locale mappings
 
@@ -188,15 +187,7 @@
         return kernel.getGBeanData(templateName);
     }
 
-    public Module createModule(File plan, JarFile moduleFile) throws DeploymentException {
-        return createModule(plan, moduleFile, "war", null, true, null);
-    }
-
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo);
-    }
-
-    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot) throws DeploymentException {
+    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -243,6 +234,12 @@
             Artifact configID = new Artifact(Artifact.DEFAULT_GROUP_ID, contextRoot, "1", "car");
             environment.setConfigId(configID);
         }
+        boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
+        if (jettyWebApp.isSetContextPriorityClassloader()) {
+            contextPriorityClassLoader = jettyWebApp.getContextPriorityClassloader();
+        }
+        //TODO decide if we should eliminate this flag as redundant w/environment setting.
+        environment.setInverseClassLoading(contextPriorityClassLoader);
 
         Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
 
@@ -258,25 +255,6 @@
         return new WebModule(standAlone, environment, moduleFile, targetPath, webApp, jettyWebApp, specDD, contextRoot, portMap, JETTY_NAMESPACE);
     }
 
-    /**
-     * Some servlets will have multiple url patterns.  However, webservice servlets
-     * will only have one, which is what this method is intended for.
-     *
-     * @param webApp
-     * @param contextRoot
-     */
-    private Map buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
-        contextRoot = "/" + contextRoot;
-        Map map = new HashMap();
-        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
-        for (int j = 0; j < servletMappings.length; j++) {
-            ServletMappingType servletMapping = servletMappings[j];
-            String servletName = servletMapping.getServletName().getStringValue().trim();
-            map.put(servletName, contextRoot + servletMapping.getUrlPattern().getStringValue().trim());
-        }
-        return map;
-    }
-
     JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String targetPath, WebAppType webApp) throws DeploymentException {
         XmlObject rawPlan = null;
         try {
@@ -321,37 +299,6 @@
         }
     }
 
-    private String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone, JarFile moduleFile, String targetPath) {
-
-        if (webApp != null && webApp.getId() != null) {
-            return webApp.getId();
-        }
-
-        if (isStandAlone) {
-            // default configId is based on the moduleFile name
-            return trimPath(new File(moduleFile.getName()).getName());
-        }
-
-        // default configId is based on the module uri from the application.xml
-        return trimPath(targetPath);
-    }
-
-    private String trimPath(String path) {
-
-        if (path == null) {
-            return null;
-        }
-
-        if (path.endsWith(".war")) {
-            path = path.substring(0, path.length() - 4);
-        }
-        if (path.endsWith("/")) {
-            path = path.substring(0, path.length() - 1);
-        }
-
-        return path;
-    }
-
     private JettyWebAppType createDefaultPlan(String contextRoot) {
         JettyWebAppType jettyWebApp = JettyWebAppType.Factory.newInstance();
         jettyWebApp.setContextRoot(contextRoot);
@@ -359,79 +306,6 @@
         return jettyWebApp;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException {
-        EARContext moduleContext;
-        if (module.isStandAlone()) {
-            moduleContext = earContext;
-        } else {
-            Environment environment = module.getEnvironment();
-            Artifact earConfigId = earContext.getConfigID();
-            Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
-            environment.setConfigId(configId);
-            File configurationDir = null;
-            try {
-                configurationDir = configurationStore.createNewConfigurationDir(environment.getConfigId());
-            } catch (ConfigurationAlreadyExistsException e) {
-                throw new DeploymentException(e);                
-            }
-
-            // construct the web app deployment context... this is the same class used by the ear context
-            try {
-
-                moduleContext = new EARContext(configurationDir,
-                        environment,
-                        ConfigurationModuleType.WAR,
-                        kernel,
-                        earContext.getJ2EEApplicationName(),
-                        earContext.getTransactionContextManagerObjectName(),
-                        earContext.getConnectionTrackerObjectName(),
-                        earContext.getTransactedTimerName(),
-                        earContext.getNonTransactedTimerName(),
-                        earContext.getCORBAGBeanObjectName(),
-                        earContext.getRefContext());
-            } catch (Exception e) {
-                DeploymentUtil.recursiveDelete(configurationDir);
-                throw new DeploymentException("Could not create a deployment context for the web app", e);
-            }
-            //TODO this is extremely fishy
-            //Add the ear parent here since it can't be loaded by any config store.
-            environment.addImport(earConfigId);
-        }
-        module.setEarContext(moduleContext);
-
-        try {
-            URI baseDir = URI.create(module.getTargetPath() + "/");
-
-            // add the warfile's content to the configuration
-            JarFile warFile = module.getModuleFile();
-            Enumeration entries = warFile.entries();
-            while (entries.hasMoreElements()) {
-                ZipEntry entry = (ZipEntry) entries.nextElement();
-                URI targetPath = baseDir.resolve(new URI(null, entry.getName(), null));
-                if (entry.getName().equals("WEB-INF/web.xml")) {
-                    moduleContext.addFile(targetPath, module.getOriginalSpecDD());
-                } else if (entry.getName().startsWith("WEB-INF/lib") && entry.getName().endsWith(".jar")) {
-                    moduleContext.addInclude(targetPath, warFile, entry);
-                } else if (entry.getName().equals("WEB-INF/classes/")) {
-                    moduleContext.addInclude(targetPath, warFile, entry);
-                } else {
-                    moduleContext.addFile(targetPath, warFile, entry);
-                }
-            }
-
-            // add the manifest classpath entries declared in the war to the class loader
-            // we have to explicitly add these since we are unpacking the web module
-            // and the url class loader will not pick up a manifest from an unpacked dir
-            moduleContext.addManifestClassPath(warFile, URI.create(module.getTargetPath()));
-
-        } catch (IOException e) {
-            throw new DeploymentException("Problem deploying war", e);
-        } catch (URISyntaxException e) {
-            throw new DeploymentException("Could not construct URI for location of war entry", e);
-        }
-
-    }
-
     public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
         EARContext moduleContext = module.getEarContext();
         WebAppType webApp = (WebAppType) module.getSpecDD();
@@ -467,14 +341,6 @@
         WebAppType webApp = (WebAppType) webModule.getSpecDD();
         JettyWebAppType jettyWebApp = (JettyWebAppType) webModule.getVendorDD();
 
-        boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
-        if (jettyWebApp.isSetContextPriorityClassloader()) {
-            contextPriorityClassLoader = jettyWebApp.getContextPriorityClassloader();
-        }
-        //TODO set inverseclassloading from contextprioritycl.
-        // construct the webClassLoader
-//        ClassLoader webClassLoader = getWebClassLoader(moduleContext, webModule, moduleClassLoader, contextPriorityClassLoader);
-
         GbeanType[] gbeans = jettyWebApp.getGbeanArray();
         ServiceConfigBuilder.addGBeans(gbeans, moduleClassLoader, moduleJ2eeContext, moduleContext);
 
@@ -511,11 +377,11 @@
 
             //session manager
             webModuleData.setAttribute("sessionManager", jettyWebApp.getSessionManager());
-            
+
             //Add dependencies on managed connection factories and ejbs in this app
             //This is overkill, but allows for people not using java:comp context (even though we don't support it)
             //and sidesteps the problem of circular references between ejbs.
-            Set dependencies = findGBeanDependencies(moduleContext);
+            Set dependencies = findGBeanDependencies(earContext);
             webModuleData.getDependencies().addAll(dependencies);
 
             webModuleData.setAttribute("componentContext", compContext);
@@ -933,13 +799,6 @@
         addUnmappedJSPPermissions(securityRoles, rolePermissions);
     }
 
-    private void addUnmappedJSPPermissions(Set securityRoles, Map rolePermissions) {
-        for (Iterator iter = securityRoles.iterator(); iter.hasNext();) {
-            String roleName = (String) iter.next();
-            addPermissionToRole(roleName, new WebRoleRefPermission("", roleName), rolePermissions);
-        }
-    }
-
     private void addServlet(ObjectName webModuleName,
                             JarFile moduleFile,
                             ServletType previousServlet,
@@ -1021,249 +880,11 @@
             servletData.setAttribute("runAsRole", servletType.getRunAs().getRoleName().getStringValue().trim());
         }
 
-        //WebRoleRefPermissions
-        SecurityRoleRefType[] securityRoleRefTypeArray = servletType.getSecurityRoleRefArray();
-        Set unmappedRoles = new HashSet(securityRoles);
-        for (int j = 0; j < securityRoleRefTypeArray.length; j++) {
-            SecurityRoleRefType securityRoleRefType = securityRoleRefTypeArray[j];
-            String roleName = securityRoleRefType.getRoleName().getStringValue().trim();
-            String roleLink = securityRoleRefType.getRoleLink().getStringValue().trim();
-            //jacc 3.1.3.2
-            /*   The name of the WebRoleRefPermission must be the servlet-name in whose
-            * context the security-role-ref is defined. The actions of the  WebRoleRefPermission
-            * must be the value of the role-name (that is the  reference), appearing in the security-role-ref.
-            * The deployment tools must  call the addToRole method on the PolicyConfiguration object to add the
-            * WebRoleRefPermission object resulting from the translation to the role
-            * identified in the role-link appearing in the security-role-ref.
-            */
-            addPermissionToRole(roleLink, new WebRoleRefPermission(servletName, roleName), rolePermissions);
-            unmappedRoles.remove(roleName);
-        }
-        for (Iterator iterator = unmappedRoles.iterator(); iterator.hasNext();) {
-            String roleName = (String) iterator.next();
-            addPermissionToRole(roleName, new WebRoleRefPermission(servletName, roleName), rolePermissions);
-        }
-//        servletData.setAttribute("webRoleRefPermissions", webRoleRefPermissions);
+        processRoleRefPermissions(servletType, securityRoles, rolePermissions);
 
         earContext.addGBean(servletData);
     }
 
-    private ComponentPermissions buildSpecSecurityConfig(WebAppType webApp, Set securityRoles, Map rolePermissions) {
-        Map uncheckedPatterns = new HashMap();
-        Map uncheckedResourcePatterns = new HashMap();
-        Map uncheckedUserPatterns = new HashMap();
-        Map excludedPatterns = new HashMap();
-        Map rolesPatterns = new HashMap();
-        Set allSet = new HashSet();   // == allMap.values()
-        Map allMap = new HashMap();   //uncheckedPatterns union excludedPatterns union rolesPatterns.
-
-        SecurityConstraintType[] securityConstraintArray = webApp.getSecurityConstraintArray();
-        for (int i = 0; i < securityConstraintArray.length; i++) {
-            SecurityConstraintType securityConstraintType = securityConstraintArray[i];
-            Map currentPatterns;
-            if (securityConstraintType.isSetAuthConstraint()) {
-                if (securityConstraintType.getAuthConstraint().getRoleNameArray().length == 0) {
-                    currentPatterns = excludedPatterns;
-                } else {
-                    currentPatterns = rolesPatterns;
-                }
-            } else {
-                currentPatterns = uncheckedPatterns;
-            }
-
-            String transport = "";
-            if (securityConstraintType.isSetUserDataConstraint()) {
-                transport = securityConstraintType.getUserDataConstraint().getTransportGuarantee().getStringValue().trim().toUpperCase();
-            }
-
-            WebResourceCollectionType[] webResourceCollectionTypeArray = securityConstraintType.getWebResourceCollectionArray();
-            for (int j = 0; j < webResourceCollectionTypeArray.length; j++) {
-                WebResourceCollectionType webResourceCollectionType = webResourceCollectionTypeArray[j];
-                UrlPatternType[] urlPatternTypeArray = webResourceCollectionType.getUrlPatternArray();
-                for (int k = 0; k < urlPatternTypeArray.length; k++) {
-                    UrlPatternType urlPatternType = urlPatternTypeArray[k];
-                    String url = urlPatternType.getStringValue().trim();
-                    URLPattern pattern = (URLPattern) currentPatterns.get(url);
-                    if (pattern == null) {
-                        pattern = new URLPattern(url);
-                        currentPatterns.put(url, pattern);
-                    }
-
-                    URLPattern allPattern = (URLPattern) allMap.get(url);
-                    if (allPattern == null) {
-                        allPattern = new URLPattern(url);
-                        allSet.add(allPattern);
-                        allMap.put(url, allPattern);
-                    }
-
-                    HttpMethodType[] httpMethodTypeArray = webResourceCollectionType.getHttpMethodArray();
-                    if (httpMethodTypeArray.length == 0) {
-                        pattern.addMethod("");
-                        allPattern.addMethod("");
-                    } else {
-                        for (int l = 0; l < httpMethodTypeArray.length; l++) {
-                            HttpMethodType httpMethodType = httpMethodTypeArray[l];
-                            //TODO is trim OK?
-                            String method = httpMethodType.getStringValue().trim();
-                            pattern.addMethod(method);
-                            allPattern.addMethod(method);
-                        }
-                    }
-                    if (currentPatterns == rolesPatterns) {
-                        RoleNameType[] roleNameTypeArray = securityConstraintType.getAuthConstraint().getRoleNameArray();
-                        for (int l = 0; l < roleNameTypeArray.length; l++) {
-                            RoleNameType roleNameType = roleNameTypeArray[l];
-                            String role = roleNameType.getStringValue().trim();
-                            if (role.equals("*")) {
-                                pattern.addAllRoles(securityRoles);
-                            } else {
-                                pattern.addRole(role);
-                            }
-                        }
-                    }
-
-                    pattern.setTransport(transport);
-                }
-            }
-        }
-
-        PermissionCollection excludedPermissions = new Permissions();
-        PermissionCollection uncheckedPermissions = new Permissions();
-
-        Iterator iter = excludedPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) excludedPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethods();
-
-            excludedPermissions.add(new WebResourcePermission(name, actions));
-            excludedPermissions.add(new WebUserDataPermission(name, actions));
-        }
-
-        iter = rolesPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) rolesPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethods();
-            WebResourcePermission permission = new WebResourcePermission(name, actions);
-
-            for (Iterator names = pattern.getRoles().iterator(); names.hasNext();) {
-                String roleName = (String) names.next();
-                addPermissionToRole(roleName, permission, rolePermissions);
-            }
-        }
-
-        iter = uncheckedPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) uncheckedPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethods();
-
-            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
-        }
-
-        iter = rolesPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) rolesPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethodsWithTransport();
-
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        iter = uncheckedPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) uncheckedPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethodsWithTransport();
-
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        /**
-         * A <code>WebResourcePermission</code> and a <code>WebUserDataPermission</code> must be instantiated for
-         * each <tt>url-pattern</tt> in the deployment descriptor and the default pattern "/", that is not combined
-         * by the <tt>web-resource-collection</tt> elements of the deployment descriptor with ever HTTP method
-         * value.  The permission objects must be contructed using the qualified pattern as their name and with
-         * actions defined by the subset of the HTTP methods that do not occur in combination with the pattern.
-         * The resulting permissions that must be added to the unchecked policy statements by calling the
-         * <code>addToUncheckedPolcy</code> method on the <code>PolicyConfiguration</code> object.
-         */
-        iter = allSet.iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) iter.next();
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getComplementedMethods();
-
-            if (actions.length() == 0) {
-                continue;
-            }
-
-            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        URLPattern pattern = new URLPattern("/");
-        if (!allSet.contains(pattern)) {
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getComplementedMethods();
-
-            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        //Create the uncheckedPermissions for WebResourcePermissions
-        iter = uncheckedResourcePatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            UncheckedItem item = (UncheckedItem) iter.next();
-            String actions = (String) uncheckedResourcePatterns.get(item);
-
-            uncheckedPermissions.add(new WebResourcePermission(item.getName(), actions));
-        }
-        //Create the uncheckedPermissions for WebUserDataPermissions
-        iter = uncheckedUserPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            UncheckedItem item = (UncheckedItem) iter.next();
-            String actions = (String) uncheckedUserPatterns.get(item);
-
-            uncheckedPermissions.add(new WebUserDataPermission(item.getName(), actions));
-        }
-
-        return new ComponentPermissions(excludedPermissions, uncheckedPermissions, rolePermissions);
-
-    }
-
-    private void addPermissionToRole(String roleName, Permission permission, Map rolePermissions) {
-        PermissionCollection permissionsForRole = (PermissionCollection) rolePermissions.get(roleName);
-        if (permissionsForRole == null) {
-            permissionsForRole = new Permissions();
-            rolePermissions.put(roleName, permissionsForRole);
-        }
-        permissionsForRole.add(permission);
-    }
-
-    private void addOrUpdatePattern(Map patternMap, String name, String actions) {
-        UncheckedItem item = new UncheckedItem(name, actions);
-        String existingActions = (String) patternMap.get(item);
-        if (existingActions != null) {
-            patternMap.put(item, actions + "," + existingActions);
-            return;
-        }
-
-        patternMap.put(item, actions);
-    }
-
-    private static Set collectRoleNames(WebAppType webApp) {
-        Set roleNames = new HashSet();
-
-        SecurityRoleType[] securityRoles = webApp.getSecurityRoleArray();
-        for (int i = 0; i < securityRoles.length; i++) {
-            roleNames.add(securityRoles[i].getRoleName().getStringValue().trim());
-        }
-
-        return roleNames;
-    }
-
     private Map buildComponentContext(EARContext earContext, Module webModule, WebAppType webApp, JettyWebAppType jettyWebApp, UserTransaction userTransaction, ClassLoader cl) throws DeploymentException {
         return ENCConfigBuilder.buildComponentContext(earContext,
                 earContext,
@@ -1277,99 +898,6 @@
                 webApp.getMessageDestinationRefArray(),
                 webApp.getServiceRefArray(), jettyWebApp.getServiceRefArray(),
                 cl);
-    }
-
-    private static void check(WebAppType webApp) throws DeploymentException {
-        checkURLPattern(webApp);
-        checkMultiplicities(webApp);
-    }
-
-    private static void checkURLPattern(WebAppType webApp) throws DeploymentException {
-
-        FilterMappingType[] filterMappings = webApp.getFilterMappingArray();
-        for (int i = 0; i < filterMappings.length; i++) {
-            if (filterMappings[i].isSetUrlPattern()) {
-                checkString(filterMappings[i].getUrlPattern().getStringValue().trim());
-            }
-        }
-
-        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
-        for (int i = 0; i < servletMappings.length; i++) {
-            checkString(servletMappings[i].getUrlPattern().getStringValue().trim());
-        }
-
-        SecurityConstraintType[] constraints = webApp.getSecurityConstraintArray();
-        for (int i = 0; i < constraints.length; i++) {
-            WebResourceCollectionType[] collections = constraints[i].getWebResourceCollectionArray();
-            for (int j = 0; j < collections.length; j++) {
-                UrlPatternType[] patterns = collections[j].getUrlPatternArray();
-                for (int k = 0; k < patterns.length; k++) {
-                    checkString(patterns[k].getStringValue().trim());
-                }
-            }
-        }
-    }
-
-    private static void checkString(String pattern) throws DeploymentException {
-        //j2ee_1_4.xsd explicitly requires preserving all whitespace. Do not trim.
-        if (pattern.indexOf(0x0D) >= 0) throw new DeploymentException("<url-pattern> must not contain CR(#xD)");
-        if (pattern.indexOf(0x0A) >= 0) throw new DeploymentException("<url-pattern> must not contain LF(#xA)");
-    }
-
-    private static void checkMultiplicities(WebAppType webApp) throws DeploymentException {
-        if (webApp.getSessionConfigArray().length > 1) throw new DeploymentException("Multiple <session-config> elements found");
-        if (webApp.getJspConfigArray().length > 1) throw new DeploymentException("Multiple <jsp-config> elements found");
-        if (webApp.getLoginConfigArray().length > 1) throw new DeploymentException("Multiple <login-config> elements found");
-    }
-
-    class UncheckedItem {
-        final static int NA = 0x00;
-        final static int INTEGRAL = 0x01;
-        final static int CONFIDENTIAL = 0x02;
-
-        private int transportType = NA;
-        private String name;
-
-        public UncheckedItem(String name, String actions) {
-            setName(name);
-            setTransportType(actions);
-        }
-
-        public boolean equals(Object o) {
-            UncheckedItem item = (UncheckedItem) o;
-            return item.getKey().equals(this.getKey());
-        }
-
-        public String getKey() {
-            return (name + transportType);
-        }
-
-        public int hashCode() {
-            return getKey().hashCode();
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getTransportType() {
-            return transportType;
-        }
-
-        public void setTransportType(String actions) {
-            String[] tokens = actions.split(":", 2);
-            if (tokens.length == 2) {
-                if (tokens[1].equals("INTEGRAL")) {
-                    this.transportType = INTEGRAL;
-                } else if (tokens[1].equals("CONFIDENTIAL")) {
-                    this.transportType = CONFIDENTIAL;
-                }
-            }
-        }
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Tue Feb 28 08:55:41 2006
@@ -37,8 +37,10 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.StoredObject;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
@@ -49,10 +51,8 @@
 import org.apache.geronimo.security.deployment.SecurityBuilder;
 import org.apache.geronimo.security.deployment.SecurityConfiguration;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
-import org.apache.geronimo.security.util.URLPattern;
 import org.apache.geronimo.tomcat.ManagerGBean;
 import org.apache.geronimo.tomcat.RealmGBean;
-import org.apache.geronimo.tomcat.TomcatClassLoader;
 import org.apache.geronimo.tomcat.TomcatWebAppContext;
 import org.apache.geronimo.tomcat.ValveGBean;
 import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
@@ -64,35 +64,21 @@
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppType;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.config.GerTomcatDocument;
-import org.apache.geronimo.xbeans.j2ee.FilterMappingType;
-import org.apache.geronimo.xbeans.j2ee.HttpMethodType;
 import org.apache.geronimo.xbeans.j2ee.MessageDestinationType;
-import org.apache.geronimo.xbeans.j2ee.RoleNameType;
-import org.apache.geronimo.xbeans.j2ee.SecurityConstraintType;
-import org.apache.geronimo.xbeans.j2ee.SecurityRoleRefType;
-import org.apache.geronimo.xbeans.j2ee.SecurityRoleType;
-import org.apache.geronimo.xbeans.j2ee.ServletMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServletType;
-import org.apache.geronimo.xbeans.j2ee.UrlPatternType;
 import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
 import org.apache.geronimo.xbeans.j2ee.WebAppType;
-import org.apache.geronimo.xbeans.j2ee.WebResourceCollectionType;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.security.jacc.WebResourcePermission;
-import javax.security.jacc.WebRoleRefPermission;
-import javax.security.jacc.WebUserDataPermission;
 import javax.transaction.UserTransaction;
 import java.io.File;
-import java.io.FileFilter;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.Permission;
 import java.security.PermissionCollection;
@@ -100,12 +86,10 @@
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
 
 
 /**
@@ -121,31 +105,22 @@
 
     private final WebServiceBuilder webServiceBuilder;
 
-    private final Repository repository;
     private static final String TOMCAT_NAMESPACE = TomcatWebAppDocument.type.getDocumentElementName().getNamespaceURI();
 
     public TomcatModuleBuilder(Environment defaultEnvironment,
                                boolean defaultContextPriorityClassloader,
                                ObjectName tomcatContainerObjectName,
                                WebServiceBuilder webServiceBuilder,
-                               Repository repository) {
+                               Kernel kernel) {
+        super(kernel);
         this.defaultEnvironment = defaultEnvironment;
 
         this.defaultContextPriorityClassloader = defaultContextPriorityClassloader;
         this.tomcatContainerObjectName = tomcatContainerObjectName;
         this.webServiceBuilder = webServiceBuilder;
-        this.repository = repository;
     }
 
-    public Module createModule(File plan, JarFile moduleFile) throws DeploymentException {
-        return createModule(plan, moduleFile, "war", null, true, null);
-    }
-
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo);
-    }
-
-    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot) throws DeploymentException {
+    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -189,47 +164,31 @@
 
         EnvironmentType environmentType = tomcatWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
-        if (environment.getConfigId() == null) {
+        if (!standAlone && environment.getConfigId() == null) {
             Artifact configID = new Artifact(Artifact.DEFAULT_GROUP_ID, contextRoot, "1", "car");
             environment.setConfigId(configID);
         }
+        boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
+        if (tomcatWebApp.isSetContextPriorityClassloader()) {
+            contextPriorityClassLoader = tomcatWebApp.getContextPriorityClassloader();
+        }
+        //TODO decide if we should eliminate this flag as redundant w/environment setting.
+        environment.setInverseClassLoading(contextPriorityClassLoader);
+
+        Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
 
         //look for a webservices dd
         Map portMap = Collections.EMPTY_MAP;
-        //TODO Jeff, please review
-        Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
-        if (webServiceBuilder != null) {
-            try {
-                URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
-                portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile, false, servletNameToPathMap);
-            } catch (MalformedURLException e) {
-                //no descriptor
-            }
+        try {
+            URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
+            portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile, false, servletNameToPathMap);
+        } catch (MalformedURLException e) {
+            //no descriptor
         }
 
-        WebModule module = new WebModule(standAlone, environment, moduleFile, targetPath, webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
-        return module;
+        return new WebModule(standAlone, environment, moduleFile, targetPath, webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
     }
 
-    /**
-     * Some servlets will have multiple url patterns.  However, webservice servlets
-     * will only have one, which is what this method is intended for.
-     *
-     * @param webApp
-     * @param contextRoot
-     * @return map of servlet names to path mapped to them.  Possibly inaccurate except for web services.
-     */
-    private Map buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
-        contextRoot = "/" + contextRoot;
-        Map map = new HashMap();
-        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
-        for (int j = 0; j < servletMappings.length; j++) {
-            ServletMappingType servletMapping = servletMappings[j];
-            String servletName = servletMapping.getServletName().getStringValue().trim();
-            map.put(servletName, contextRoot + servletMapping.getUrlPattern().getStringValue().trim());
-        }
-        return map;
-    }
 
     TomcatWebAppType getTomcatWebApp(Object plan, JarFile moduleFile, boolean standAlone, String targetPath, WebAppType webApp) throws DeploymentException {
         XmlObject rawPlan = null;
@@ -259,7 +218,7 @@
                 log.warn(e);
             }
 
-            TomcatWebAppType tomcatWebApp = null;
+            TomcatWebAppType tomcatWebApp;
             if (rawPlan != null) {
                 XmlObject webPlan = new GenericToSpecificPlanConverter(GerTomcatDocument.type.getDocumentElementName().getNamespaceURI(),
                         TomcatWebAppDocument.type.getDocumentElementName().getNamespaceURI(), "tomcat").convertToSpecificPlan(rawPlan);
@@ -275,37 +234,6 @@
         }
     }
 
-    private String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone, JarFile moduleFile, String targetPath) {
-
-        if (webApp != null && webApp.getId() != null) {
-            return webApp.getId();
-        }
-
-        if (isStandAlone) {
-            // default configId is based on the moduleFile name
-            return trimPath(new File(moduleFile.getName()).getName());
-        }
-
-        // default configId is based on the module uri from the application.xml
-        return trimPath(targetPath);
-    }
-
-    private String trimPath(String path) {
-
-        if (path == null) {
-            return null;
-        }
-
-        if (path.endsWith(".war")) {
-            path = path.substring(0, path.length() - 4);
-        }
-        if (path.endsWith("/")) {
-            path = path.substring(0, path.length() - 1);
-        }
-
-        return path;
-    }
-
     private TomcatWebAppType createDefaultPlan(String path) {
         TomcatWebAppType tomcatWebApp = TomcatWebAppType.Factory.newInstance();
         tomcatWebApp.setContextRoot("/" + path);
@@ -313,45 +241,19 @@
         return tomcatWebApp;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException {
-        TomcatWebAppType tomcatWebApp = (TomcatWebAppType) module.getVendorDD();
-
-        try {
-            URI baseDir = URI.create(module.getTargetPath() + "/");
-
-            // add the warfile's content to the configuration
-            JarFile warFile = module.getModuleFile();
-            Enumeration entries = warFile.entries();
-            while (entries.hasMoreElements()) {
-                ZipEntry entry = (ZipEntry) entries.nextElement();
-                URI targetPath = baseDir.resolve(new URI(null, entry.getName(), null));
-                if (entry.getName().equals("WEB-INF/web.xml")) {
-                    earContext.addFile(targetPath, module.getOriginalSpecDD());
-                } else {
-                    earContext.addFile(targetPath, warFile, entry);
-                }
-            }
-
-            // add the manifest classpath entries declared in the war to the class loader
-            // we have to explicitly add these since we are unpacking the web module
-            // and the url class loader will not pick up a manifiest from an unpacked dir
-            earContext.addManifestClassPath(warFile, URI.create(module.getTargetPath()));
-
-        } catch (IOException e) {
-            throw new DeploymentException("Problem deploying war", e);
-        } catch (URISyntaxException e) {
-            throw new DeploymentException("Could not construct URI for location of war entry", e);
-        }
-
-    }
 
     public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+        EARContext moduleContext = module.getEarContext();
         WebAppType webApp = (WebAppType) module.getSpecDD();
         MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
         TomcatWebAppType gerWebApp = (TomcatWebAppType) module.getVendorDD();
         GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
 
-        ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(), messageDestinations, gerMessageDestinations);
+        ENCConfigBuilder.registerMessageDestinations(moduleContext.getRefContext(), module.getName(), messageDestinations, gerMessageDestinations);
+        if((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
+                !gerWebApp.isSetSecurityRealmName()) {
+            throw new DeploymentException("web.xml includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
+        }
         if (gerWebApp.isSetSecurity()) {
             if (!gerWebApp.isSetSecurityRealmName()) {
                 throw new DeploymentException("You have supplied a security configuration for web app " + module.getName() + " but no security-realm-name to allow login");
@@ -362,26 +264,23 @@
     }
 
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Repository repository) throws DeploymentException {
-        J2eeContext earJ2eeContext = earContext.getJ2eeContext();
+        EARContext moduleContext = module.getEarContext();
+        Configuration knownParent = null;
+        if (!module.isStandAlone()) {
+            knownParent = earContext.getConfiguration(repository, null);
+        }
+        ClassLoader moduleClassLoader = moduleContext.getClassLoader(repository, knownParent);
+        J2eeContext earJ2eeContext = moduleContext.getJ2eeContext();
         J2eeContext moduleJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, NameFactory.WEB_MODULE, module.getName());
         WebModule webModule = (WebModule) module;
 
         WebAppType webApp = (WebAppType) webModule.getSpecDD();
         TomcatWebAppType tomcatWebApp = (TomcatWebAppType) webModule.getVendorDD();
 
-        boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
-        if (tomcatWebApp != null && tomcatWebApp.isSetContextPriorityClassloader()) {
-            contextPriorityClassLoader = tomcatWebApp.getContextPriorityClassloader();
-        }
-        // construct the webClassLoader
-        ClassLoader webClassLoader = getWebClassLoader(earContext, webModule, cl, contextPriorityClassLoader);
-
-        if (tomcatWebApp != null) {
-            GbeanType[] gbeans = tomcatWebApp.getGbeanArray();
-            ServiceConfigBuilder.addGBeans(gbeans, webClassLoader, moduleJ2eeContext, earContext);
-        }
+        GbeanType[] gbeans = tomcatWebApp.getGbeanArray();
+        ServiceConfigBuilder.addGBeans(gbeans, moduleClassLoader, moduleJ2eeContext, moduleContext);
 
-        ObjectName webModuleName = null;
+        ObjectName webModuleName;
         try {
             webModuleName = NameFactory.getModuleName(null, null, null, null, null, moduleJ2eeContext);
         } catch (MalformedObjectNameException e) {
@@ -390,14 +289,14 @@
 
         UserTransaction userTransaction = new OnlineUserTransaction();
         //this may add to the web classpath with enhanced classes.
-        //N.B. we use the ear context which has all the possible objects we could look up.
-        Map compContext = buildComponentContext(earContext, webModule, webApp, tomcatWebApp, userTransaction, webClassLoader);
+        //N.B. we use the ear context which has all the gbeans we could possibly be looking up from this ear.
+        Map compContext = buildComponentContext(earContext, webModule, webApp, tomcatWebApp, userTransaction, moduleClassLoader);
 
         GBeanData webModuleData = new GBeanData(webModuleName, TomcatWebAppContext.GBEAN_INFO);
         try {
-            webModuleData.setReferencePattern("J2EEServer", earContext.getServerObjectName());
-            if (!earContext.getJ2EEApplicationName().equals("null")) {
-                webModuleData.setReferencePattern("J2EEApplication", earContext.getApplicationObjectName());
+            webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerObjectName());
+            if (!moduleContext.getJ2EEApplicationName().equals("null")) {
+                webModuleData.setReferencePattern("J2EEApplication", moduleContext.getApplicationObjectName());
             }
 
             webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
@@ -423,8 +322,6 @@
             //N.B. use earContext not moduleContext
             ENCConfigBuilder.setResourceEnvironment(earContext, webModule.getModuleURI(), rebuilder, webApp.getResourceRefArray(), tomcatWebApp.getResourceRefArray());
 
-            webModuleData.setAttribute("contextPriorityClassLoader", Boolean.valueOf(contextPriorityClassLoader));
-
             webModuleData.setReferencePattern("TransactionContextManager", earContext.getTransactionContextManagerObjectName());
             webModuleData.setReferencePattern("TrackedConnectionAssociator", earContext.getConnectionTrackerObjectName());
             webModuleData.setReferencePattern("Container", tomcatContainerObjectName);
@@ -483,7 +380,7 @@
                             throw new DeploymentException("No web service deployment info for servlet name " + servletName);
                         }
 
-                        StoredObject wsContainer = configurePOJO(webModule.getModuleFile(), portInfo, servletClassName, webClassLoader);
+                        StoredObject wsContainer = configurePOJO(webModule.getModuleFile(), portInfo, servletClassName, cl);
                         webServices.put(servletName, wsContainer);
                     }
                 }
@@ -496,7 +393,7 @@
 
             if (tomcatWebApp.isSetSecurityRealmName()) {
                 if (earContext.getSecurityConfiguration() == null) {
-                     throw new DeploymentException("You have specified a login security realm for the webapp " + webModuleName + " but no security configuration is supplied in the application plan");
+                     throw new DeploymentException("You have specified a <security-realm-name> for the webapp " + webModuleName + " but no <security> configuration (role mapping) is supplied in the Geronimo plan for the web application (or the Geronimo plan for the EAR if the web app is in an EAR)");
                 }
 
                 SecurityHolder securityHolder = new SecurityHolder();
@@ -530,14 +427,12 @@
                 webModuleData.setReferencePattern("RoleDesignateSource", earContext.getJaccManagerName());
             }
 
-            earContext.addGBean(webModuleData);
+            moduleContext.addGBean(webModuleData);
 
             if (!module.isStandAlone()) {
-//TODO finish this configid
-//                ConfigurationData moduleConfigurationData = moduleContext.getConfigurationData();
-//                earContext.addChildConfiguration(moduleConfigurationData);
+                ConfigurationData moduleConfigurationData = moduleContext.getConfigurationData();
+                earContext.addChildConfiguration(moduleConfigurationData);
             }
-
         } catch (DeploymentException de) {
             throw de;
         } catch (Exception e) {
@@ -549,307 +444,16 @@
         return TOMCAT_NAMESPACE;
     }
 
-    private ClassLoader getWebClassLoader(EARContext earContext, WebModule webModule, ClassLoader cl, boolean contextPriorityClassLoader) throws DeploymentException {
-        getWebClassPath(earContext, webModule);
-        URI[] webClassPath = new URI[0];// webModule.getWebClasspath();
-        URI baseUri = earContext.getBaseDir().toURI();
-        URL baseUrl = null;
-        try {
-            baseUrl = baseUri.resolve(webModule.getTargetPathURI()).toURL();
-        } catch (MalformedURLException e) {
-            throw new DeploymentException("Invalid module location: " + webModule.getTargetPathURI() + ", baseUri: " + baseUri);
-        }
-        URL[] webClassPathURLs = new URL[webClassPath.length];
-        for (int i = 0; i < webClassPath.length; i++) {
-            URI path = baseUri.resolve(webClassPath[i]);
-            try {
-                webClassPathURLs[i] = path.toURL();
-            } catch (MalformedURLException e) {
-                throw new DeploymentException("Invalid web class path element: path=" + path + ", baseUri=" + baseUri);
-            }
-        }
-
-        ClassLoader webClassLoader = new TomcatClassLoader(webClassPathURLs, baseUrl, cl, contextPriorityClassLoader);
-        return webClassLoader;
-    }
-
-    private void addUnmappedJSPPermissions(Set securityRoles, Map rolePermissions) {
-        for (Iterator iter = securityRoles.iterator(); iter.hasNext();) {
-            String roleName = (String) iter.next();
-            addPermissionToRole(roleName, new WebRoleRefPermission("", roleName), rolePermissions);
-        }
-    }
-
-    private void processRoleRefPermissions(ServletType servletType,
-                                           Set securityRoles,
-                                           Map rolePermissions) {
-        String servletName = servletType.getServletName().getStringValue().trim();
-
-        //WebRoleRefPermissions
-        SecurityRoleRefType[] securityRoleRefTypeArray = servletType.getSecurityRoleRefArray();
-        Set unmappedRoles = new HashSet(securityRoles);
-        for (int j = 0; j < securityRoleRefTypeArray.length; j++) {
-            SecurityRoleRefType securityRoleRefType = securityRoleRefTypeArray[j];
-            String roleName = securityRoleRefType.getRoleName().getStringValue().trim();
-            String roleLink = securityRoleRefType.getRoleLink().getStringValue().trim();
-
-            //jacc 3.1.3.2
-            addPermissionToRole(roleLink, new WebRoleRefPermission(servletName, roleName), rolePermissions);
-            unmappedRoles.remove(roleName);
-        }
-        for (Iterator iterator = unmappedRoles.iterator(); iterator.hasNext();) {
-            String roleName = (String) iterator.next();
-            addPermissionToRole(roleName, new WebRoleRefPermission(servletName, roleName), rolePermissions);
-        }
-//       servletData.setAttribute("webRoleRefPermissions", webRoleRefPermissions);
-
-    }
-
-    private ComponentPermissions buildSpecSecurityConfig(WebAppType webApp, Set securityRoles, Map rolePermissions) {
-        Map uncheckedPatterns = new HashMap();
-        Map uncheckedResourcePatterns = new HashMap();
-        Map uncheckedUserPatterns = new HashMap();
-        Map excludedPatterns = new HashMap();
-        Map rolesPatterns = new HashMap();
-        Set allSet = new HashSet();   // == allMap.values()
-        Map allMap = new HashMap();   //uncheckedPatterns union excludedPatterns union rolesPatterns.
-
-        SecurityConstraintType[] securityConstraintArray = webApp.getSecurityConstraintArray();
-        for (int i = 0; i < securityConstraintArray.length; i++) {
-            SecurityConstraintType securityConstraintType = securityConstraintArray[i];
-            Map currentPatterns;
-            if (securityConstraintType.isSetAuthConstraint()) {
-                if (securityConstraintType.getAuthConstraint().getRoleNameArray().length == 0) {
-                    currentPatterns = excludedPatterns;
-                } else {
-                    currentPatterns = rolesPatterns;
-                }
-            } else {
-                currentPatterns = uncheckedPatterns;
-            }
-
-            String transport = "";
-            if (securityConstraintType.isSetUserDataConstraint()) {
-                transport = securityConstraintType.getUserDataConstraint().getTransportGuarantee().getStringValue().trim().toUpperCase();
-            }
-
-            WebResourceCollectionType[] webResourceCollectionTypeArray = securityConstraintType.getWebResourceCollectionArray();
-            for (int j = 0; j < webResourceCollectionTypeArray.length; j++) {
-                WebResourceCollectionType webResourceCollectionType = webResourceCollectionTypeArray[j];
-                UrlPatternType[] urlPatternTypeArray = webResourceCollectionType.getUrlPatternArray();
-                for (int k = 0; k < urlPatternTypeArray.length; k++) {
-                    UrlPatternType urlPatternType = urlPatternTypeArray[k];
-                    //presumably, don't trim
-                    String url = urlPatternType.getStringValue().trim();
-                    URLPattern pattern = (URLPattern) currentPatterns.get(url);
-                    if (pattern == null) {
-                        pattern = new URLPattern(url);
-                        currentPatterns.put(url, pattern);
-                    }
-
-                    URLPattern allPattern = (URLPattern) allMap.get(url);
-                    if (allPattern == null) {
-                        allPattern = new URLPattern(url);
-                        allSet.add(allPattern);
-                        allMap.put(url, allPattern);
-                    }
-
-                    HttpMethodType[] httpMethodTypeArray = webResourceCollectionType.getHttpMethodArray();
-                    if (httpMethodTypeArray.length == 0) {
-                        pattern.addMethod("");
-                        allPattern.addMethod("");
-                    } else {
-                        for (int l = 0; l < httpMethodTypeArray.length; l++) {
-                            HttpMethodType httpMethodType = httpMethodTypeArray[l];
-                            //TODO is trim OK?
-                            String method = httpMethodType.getStringValue().trim();
-                            pattern.addMethod(method);
-                            allPattern.addMethod(method);
-                        }
-                    }
-                    if (currentPatterns == rolesPatterns) {
-                        RoleNameType[] roleNameTypeArray = securityConstraintType.getAuthConstraint().getRoleNameArray();
-                        for (int l = 0; l < roleNameTypeArray.length; l++) {
-                            RoleNameType roleNameType = roleNameTypeArray[l];
-                            String role = roleNameType.getStringValue().trim();
-                            if (role.equals("*")) {
-                                pattern.addAllRoles(securityRoles);
-                            } else {
-                                pattern.addRole(role);
-                            }
-                        }
-                    }
-
-                    pattern.setTransport(transport);
-                }
-            }
-        }
-
-        PermissionCollection excludedPermissions = new Permissions();
-        PermissionCollection uncheckedPermissions = new Permissions();
-
-        Iterator iter = excludedPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) excludedPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethods();
-
-            excludedPermissions.add(new WebResourcePermission(name, actions));
-            excludedPermissions.add(new WebUserDataPermission(name, actions));
-        }
-
-        iter = rolesPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) rolesPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethods();
-            WebResourcePermission permission = new WebResourcePermission(name, actions);
-
-            for (Iterator names = pattern.getRoles().iterator(); names.hasNext();) {
-                String roleName = (String) names.next();
-                addPermissionToRole(roleName, permission, rolePermissions);
-            }
-        }
-
-        iter = uncheckedPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) uncheckedPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethods();
-
-            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
-        }
-
-        iter = rolesPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) rolesPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethodsWithTransport();
-
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        iter = uncheckedPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) uncheckedPatterns.get(iter.next());
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getMethodsWithTransport();
-
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        /**
-         * A <code>WebResourcePermission</code> and a <code>WebUserDataPermission</code> must be instantiated for
-         * each <tt>url-pattern</tt> in the deployment descriptor and the default pattern "/", that is not combined
-         * by the <tt>web-resource-collection</tt> elements of the deployment descriptor with ever HTTP method
-         * value.  The permission objects must be contructed using the qualified pattern as their name and with
-         * actions defined by the subset of the HTTP methods that do not occur in combination with the pattern.
-         * The resulting permissions that must be added to the unchecked policy statements by calling the
-         * <code>addToUncheckedPolcy</code> method on the <code>PolicyConfiguration</code> object.
-         */
-        iter = allSet.iterator();
-        while (iter.hasNext()) {
-            URLPattern pattern = (URLPattern) iter.next();
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getComplementedMethods();
-
-            if (actions.length() == 0) {
-                continue;
-            }
-
-            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        URLPattern pattern = new URLPattern("/");
-        if (!allSet.contains(pattern)) {
-            String name = pattern.getQualifiedPattern(allSet);
-            String actions = pattern.getComplementedMethods();
-
-            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
-            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
-        }
-
-        //Create the uncheckedPermissions for WebResourcePermissions
-        iter = uncheckedResourcePatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            UncheckedItem item = (UncheckedItem) iter.next();
-            String actions = (String) uncheckedResourcePatterns.get(item);
-
-            uncheckedPermissions.add(new WebResourcePermission(item.getName(), actions));
-        }
-        //Create the uncheckedPermissions for WebUserDataPermissions
-        iter = uncheckedUserPatterns.keySet().iterator();
-        while (iter.hasNext()) {
-            UncheckedItem item = (UncheckedItem) iter.next();
-            String actions = (String) uncheckedUserPatterns.get(item);
-
-            uncheckedPermissions.add(new WebUserDataPermission(item.getName(), actions));
-        }
-
-        ComponentPermissions componentPermissions = new ComponentPermissions(excludedPermissions, uncheckedPermissions, rolePermissions);
-        return componentPermissions;
-
-    }
-
-    private void addPermissionToRole(String roleName, Permission permission, Map rolePermissions) {
-        PermissionCollection permissionsForRole = (PermissionCollection) rolePermissions.get(roleName);
-        if (permissionsForRole == null) {
-            permissionsForRole = new Permissions();
-            rolePermissions.put(roleName, permissionsForRole);
-        }
-        permissionsForRole.add(permission);
-    }
-
-    private void addOrUpdatePattern(Map patternMap, String name, String actions) {
-        UncheckedItem item = new UncheckedItem(name, actions);
-        String existingActions = (String) patternMap.get(item);
-        if (existingActions != null) {
-            patternMap.put(item, actions + "," + existingActions);
-            return;
-        }
-
-        patternMap.put(item, actions);
-    }
-
-    private static Set collectRoleNames(WebAppType webApp) {
-        Set roleNames = new HashSet();
-
-        SecurityRoleType[] securityRoles = webApp.getSecurityRoleArray();
-        for (int i = 0; i < securityRoles.length; i++) {
-            roleNames.add(securityRoles[i].getRoleName().getStringValue().trim());
-        }
+    public StoredObject configurePOJO(JarFile moduleFile, Object portInfoObject, String seiClassName, ClassLoader classLoader) throws DeploymentException, IOException {
+        //the reason to configure a gbeandata rather than just fetch the WebServiceContainer is that fetching the WSContainer ties us to that
+        //ws implementation.  By configuring a servlet gbean, you can provide a different servlet for each combination of
+        //web container and ws implementation while assuming almost nothing about their relationship.
 
-        return roleNames;
+        GBeanData fakeData = new GBeanData();
+        webServiceBuilder.configurePOJO(fakeData, moduleFile, portInfoObject, seiClassName, classLoader);
+        return (StoredObject) fakeData.getAttribute("webServiceContainer");
     }
 
-    private static void getWebClassPath(EARContext earContext, WebModule webModule) {
-        File baseDir = earContext.getTargetFile(webModule.getTargetPathURI());
-        File webInfDir = new File(baseDir, "WEB-INF");
-
-        // check for a classes dir
-        File classesDir = new File(webInfDir, "classes");
-        if (classesDir.isDirectory()) {
-//            webModule.addToWebClasspath(webModule.getTargetPathURI().resolve(URI.create("WEB-INF/classes/")));
-        }
-
-        // add all of the libs
-        File libDir = new File(webInfDir, "lib");
-        if (libDir.isDirectory()) {
-            File[] libs = libDir.listFiles(new FileFilter() {
-                public boolean accept(File file) {
-                    return file.isFile() && file.getName().endsWith(".jar");
-                }
-            });
-
-            if (libs != null) {
-                for (int i = 0; i < libs.length; i++) {
-                    File lib = libs[i];
-//                    webModule.addToWebClasspath(webModule.getTargetPathURI().resolve(URI.create("WEB-INF/lib/" + lib.getName())));
-                }
-            }
-        }
-    }
 
     private Map buildComponentContext(EARContext earContext, Module webModule, WebAppType webApp, TomcatWebAppType tomcatWebApp, UserTransaction userTransaction, ClassLoader cl) throws DeploymentException {
         return ENCConfigBuilder.buildComponentContext(earContext,
@@ -865,110 +469,6 @@
                 webApp.getServiceRefArray(), tomcatWebApp.getServiceRefArray(),
                 cl);
     }
-
-    private static void check(WebAppType webApp) throws DeploymentException {
-        checkURLPattern(webApp);
-        checkMultiplicities(webApp);
-    }
-
-    private static void checkURLPattern(WebAppType webApp) throws DeploymentException {
-
-        FilterMappingType[] filterMappings = webApp.getFilterMappingArray();
-        for (int i = 0; i < filterMappings.length; i++) {
-            if (filterMappings[i].isSetUrlPattern()) {
-                checkString(filterMappings[i].getUrlPattern().getStringValue().trim());
-            }
-        }
-
-        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
-        for (int i = 0; i < servletMappings.length; i++) {
-            checkString(servletMappings[i].getUrlPattern().getStringValue().trim());
-        }
-
-        SecurityConstraintType[] constraints = webApp.getSecurityConstraintArray();
-        for (int i = 0; i < constraints.length; i++) {
-            WebResourceCollectionType[] collections = constraints[i].getWebResourceCollectionArray();
-            for (int j = 0; j < collections.length; j++) {
-                UrlPatternType[] patterns = collections[j].getUrlPatternArray();
-                for (int k = 0; k < patterns.length; k++) {
-                    checkString(patterns[k].getStringValue().trim());
-                }
-            }
-        }
-    }
-
-    private static void checkString(String pattern) throws DeploymentException {
-        //j2ee_1_4.xsd explicitly requires preserving all whitespace. Do not trim.
-        if (pattern.indexOf(0x0D) >= 0) throw new DeploymentException("<url-pattern> must not contain CR(#xD)");
-        if (pattern.indexOf(0x0A) >= 0) throw new DeploymentException("<url-pattern> must not contain LF(#xA)");
-    }
-
-    private static void checkMultiplicities(WebAppType webApp) throws DeploymentException {
-        if (webApp.getSessionConfigArray().length > 1) throw new DeploymentException("Multiple <session-config> elements found");
-        if (webApp.getJspConfigArray().length > 1) throw new DeploymentException("Multiple <jsp-config> elements found");
-        if (webApp.getLoginConfigArray().length > 1) throw new DeploymentException("Multiple <login-config> elements found");
-    }
-
-    public StoredObject configurePOJO(JarFile moduleFile, Object portInfoObject, String seiClassName, ClassLoader classLoader) throws DeploymentException, IOException {
-        //the reason to configure a gbeandata rather than just fetch the WebServiceContainer is that fetching the WSContainer ties us to that
-        //ws implementation.  By configuring a servlet gbean, you can provide a different servlet for each combination of
-        //web container and ws implementation while assuming almost nothing about their relationship.
-
-        GBeanData fakeData = new GBeanData();
-        webServiceBuilder.configurePOJO(fakeData, moduleFile, portInfoObject, seiClassName, classLoader);
-        return (StoredObject) fakeData.getAttribute("webServiceContainer");
-    }
-
-    class UncheckedItem {
-        final static int NA = 0x00;
-        final static int INTEGRAL = 0x01;
-        final static int CONFIDENTIAL = 0x02;
-
-        private int transportType = NA;
-        private String name;
-
-        public UncheckedItem(String name, String actions) {
-            setName(name);
-            setTransportType(actions);
-        }
-
-        public boolean equals(Object o) {
-            UncheckedItem item = (UncheckedItem) o;
-            return item.getKey().equals(this.getKey());
-        }
-
-        public String getKey() {
-            return (name + transportType);
-        }
-
-        public int hashCode() {
-            return getKey().hashCode();
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public int getTransportType() {
-            return transportType;
-        }
-
-        public void setTransportType(String actions) {
-            String[] tokens = actions.split(":", 2);
-            if (tokens.length == 2) {
-                if (tokens[1].equals("INTEGRAL")) {
-                    this.transportType = INTEGRAL;
-                } else if (tokens[1].equals("CONFIDENTIAL")) {
-                    this.transportType = CONFIDENTIAL;
-                }
-            }
-        }
-    }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -977,7 +477,7 @@
         infoBuilder.addAttribute("defaultContextPriorityClassloader", boolean.class, true, true);
         infoBuilder.addAttribute("tomcatContainerObjectName", ObjectName.class, true, true);
         infoBuilder.addReference("WebServiceBuilder", WebServiceBuilder.class, NameFactory.MODULE_BUILDER);
-        infoBuilder.addReference("Repository", Repository.class, NameFactory.GERONIMO_SERVICE);
+        infoBuilder.addAttribute("kernel", Kernel.class, false);
         infoBuilder.addInterface(ModuleBuilder.class);
 
         infoBuilder.setConstructor(new String[]{
@@ -985,7 +485,7 @@
             "defaultContextPriorityClassloader",
             "tomcatContainerObjectName",
             "WebServiceBuilder",
-            "Repository"});
+            "kernel"});
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }
 

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Tue Feb 28 08:55:41 2006
@@ -187,6 +187,7 @@
 
         EARContext earContext = createEARContext(outputPath, defaultEnvironment);
         earContext.setJaccManagerName(jaccBeanName);
+        module.setEarContext(earContext);
         ObjectName serverName = earContext.getServerObjectName();
         GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
         start(server);

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java Tue Feb 28 08:55:41 2006
@@ -90,7 +90,7 @@
                         ((KernelAwareReference) value).setKernel(ctx.getKernel());
                     }
                     if (value instanceof ClassLoaderAwareReference) {
-                        ((ClassLoaderAwareReference) value).setClassLoader(ctx.getWebClassLoader());
+                        ((ClassLoaderAwareReference) value).setClassLoader(ctx.getClassLoader());
                     }
                 }
                 enc = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext);
@@ -128,7 +128,7 @@
                  */
                 DefaultPrincipal defaultPrincipal = securityHolder.getDefaultPrincipal();
                 if (defaultPrincipal != null) {
-                    defaultSubject = ConfigurationUtil.generateDefaultSubject(defaultPrincipal, ctx.getWebClassLoader());
+                    defaultSubject = ConfigurationUtil.generateDefaultSubject(defaultPrincipal, ctx.getClassLoader());
                     ContextManager.registerSubject(defaultSubject);
                     SubjectId id = ContextManager.getSubjectId(defaultSubject);
                     defaultSubject.getPrincipals().add(new IdentificationPrincipal(id));

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java Tue Feb 28 08:55:41 2006
@@ -27,7 +27,6 @@
 import org.apache.catalina.Engine;
 import org.apache.catalina.Realm;
 import org.apache.catalina.connector.Connector;
-import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.realm.JAASRealm;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -206,7 +205,7 @@
      * @see org.apache.catalina.Host
      */
     public void addContext(TomcatContext ctx) throws Exception{
-        Context anotherCtxObj = embedded.createContext(ctx.getContextPath(), ctx.getDocBase(), ctx.getWebClassLoader());
+        Context anotherCtxObj = embedded.createContext(ctx.getContextPath(), ctx.getDocBase(), ctx.getClassLoader());
 
         // Set the context for the Tomcat implementation
         ctx.setContext(anotherCtxObj);

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java Tue Feb 28 08:55:41 2006
@@ -46,7 +46,7 @@
     
     public String getVirtualServer();
     
-    public ClassLoader getWebClassLoader();
+    public ClassLoader getClassLoader();
     
     public Map getComponentContext();
 

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=381704&r1=381703&r2=381704&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java Tue Feb 28 08:55:41 2006
@@ -63,7 +63,7 @@
 
     protected final TomcatContainer container;
 
-    private final ClassLoader webClassLoader;
+    private final ClassLoader classLoader;
 
     protected Context context = null;
 
@@ -178,7 +178,7 @@
 
         if (tomcatRealm != null){
             realm = (Realm)tomcatRealm.getInternalObject();
-            if (!(realm instanceof Realm)){
+            if (realm == null){
                 throw new IllegalArgumentException("tomcatRealm must be an instance of org.apache.catalina.Realm.");
             }
         } else{
@@ -223,7 +223,7 @@
 //            urls[i] = classPathEntry.toURL();
 //        }
 
-        this.webClassLoader = classLoader;
+        this.classLoader = classLoader;
 //        new TomcatClassLoader(urls, webAppRootURL, classLoader, contextPriorityClassLoader);
 
         this.kernel = kernel;
@@ -280,8 +280,8 @@
         return virtualServer;
     }
 
-    public ClassLoader getWebClassLoader() {
-        return webClassLoader;
+    public ClassLoader getClassLoader() {
+        return classLoader;
     }
 
     public Kernel getKernel() {
@@ -415,7 +415,7 @@
         container.removeContext(this);
 
         // No more logging will occur for this ClassLoader. Inform the LogFactory to avoid a memory leak.
-        LogFactory.release(webClassLoader);
+//        LogFactory.release(classLoader);
 
         log.debug("TomcatWebAppContext stopped");
     }
@@ -424,7 +424,7 @@
         container.removeContext(this);
 
         // No more logging will occur for this ClassLoader. Inform the LogFactory to avoid a memory leak.
-        LogFactory.release(webClassLoader);
+//        LogFactory.release(classLoader);
 
         log.warn("TomcatWebAppContext failed");
     }



Mime
View raw message