geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r111563 - in geronimo/trunk: etc modules/assembly modules/assembly/src/plan modules/tomcat modules/tomcat/src/java/org/apache/geronimo/tomcat modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment modules/tomcat/src/plan
Date Sat, 11 Dec 2004 01:02:58 GMT
Author: jlaskowski
Date: Fri Dec 10 17:02:57 2004
New Revision: 111563

URL: http://svn.apache.org/viewcvs?view=rev&rev=111563
Log:
o deployed webapps are given its name as the context name
o Remove hardcoded version of Tomcat - it's dynamically bound to the system-wide value (currently
5.5.4)
o defaultParentId - a configuration parameter of TomcatModuleBuilder GBean

NOTE: tomcat module is dependent on geronimo-jetty-builder


Modified:
   geronimo/trunk/etc/version-info.ent
   geronimo/trunk/modules/assembly/project.xml
   geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
   geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
   geronimo/trunk/modules/tomcat/maven.xml
   geronimo/trunk/modules/tomcat/project.xml
   geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
   geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
   geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml

Modified: geronimo/trunk/etc/version-info.ent
Url: http://svn.apache.org/viewcvs/geronimo/trunk/etc/version-info.ent?view=diff&rev=111563&p1=geronimo/trunk/etc/version-info.ent&r1=111562&p2=geronimo/trunk/etc/version-info.ent&r2=111563
==============================================================================
--- geronimo/trunk/etc/version-info.ent	(original)
+++ geronimo/trunk/etc/version-info.ent	Fri Dec 10 17:02:57 2004
@@ -83,7 +83,7 @@
 <!ENTITY p2psockets-version "1.1.2">
 <!ENTITY regexp-version "1.3">
 <!ENTITY spring-version "1.0.1">
-<!ENTITY tomcat-version "5.0.28">
+<!ENTITY tomcat-version "5.5.4">
 <!ENTITY velocity-version "1.4-rc1">
 <!ENTITY xerces-version "2.6.0">
 <!ENTITY xml-apis-version "1.0.b2">

Modified: geronimo/trunk/modules/assembly/project.xml
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/project.xml?view=diff&rev=111563&p1=geronimo/trunk/modules/assembly/project.xml&r1=111562&p2=geronimo/trunk/modules/assembly/project.xml&r2=111563
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml	(original)
+++ geronimo/trunk/modules/assembly/project.xml	Fri Dec 10 17:02:57 2004
@@ -721,7 +721,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>catalina</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -730,7 +730,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>catalina</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -739,7 +739,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>catalina-optional</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -748,24 +748,6 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>tomcat-coyote</artifactId>
-            <version>5.5.4</version>
-            <url>http://jakarta.apache.org/tomcat/</url>
-            <properties>
-                <repository>true</repository>
-            </properties>
-        </dependency>
-        <dependency>
-            <groupId>tomcat</groupId>
-            <artifactId>tomcat-http</artifactId>
-            <version>5.5.4</version>
-            <url>http://jakarta.apache.org/tomcat/</url>
-            <properties>
-                <repository>true</repository>
-            </properties>
-        </dependency>
-        <dependency>
-            <groupId>tomcat</groupId>
-            <artifactId>jasper-compiler</artifactId>
             <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
@@ -774,7 +756,7 @@
         </dependency>
         <dependency>
             <groupId>tomcat</groupId>
-            <artifactId>jasper-runtime</artifactId>
+            <artifactId>tomcat-http</artifactId>
             <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
@@ -784,7 +766,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>tomcat-util</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -793,7 +775,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>naming-resources</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -802,7 +784,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>servlets-default</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -811,7 +793,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>servlets-invoker</artifactId>
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -855,7 +837,6 @@
                 <repository>true</repository>
             </properties>
         </dependency>
-
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>jasper-compiler-jdt</artifactId>
@@ -864,7 +845,6 @@
                 <repository>true</repository>
             </properties>
         </dependency>
-
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>jasper-runtime</artifactId>

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml?view=diff&rev=111563&p1=geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml&r1=111562&p2=geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml&r2=111563
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml	(original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml	Fri Dec 10 17:02:57 2004
@@ -90,13 +90,13 @@
         <uri>geronimo/jars/geronimo-tomcat-${geronimo_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/catalina-5.5.4.jar</uri>
+        <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/naming-resources-5.5.4.jar</uri>
+        <uri>tomcat/jars/naming-resources-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-util-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-util-${tomcat_version}.jar</uri>
     </dependency>
    -->
     <dependency>
@@ -193,7 +193,9 @@
 <!-- the tomcat module's requirement
    - uncomment it to run Apache Tomcat as a web container
    -
-    <gbean name="geronimo.deployer:role=ModuleBuilder,type=Web,config=org/apache/geronimo/J2EEDeployer"
class="org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder"/>
+    <gbean name="geronimo.deployer:role=ModuleBuilder,type=Web,config=org/apache/geronimo/J2EEDeployer"
class="org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder">
+        <attribute name="defaultParentId">org/apache/geronimo/Server</attribute>
+    </gbean>
    -->
 
     <gbean name="geronimo.deployer:role=DefaultServlet,config=org/apache/geronimo/J2EEDeployer,name=StaticContent"
class="org.apache.geronimo.jetty.JettyServletHolder">

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml?view=diff&rev=111563&p1=geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml&r1=111562&p2=geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml&r2=111563
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml	(original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml	Fri Dec 10 17:02:57 2004
@@ -78,28 +78,28 @@
         <uri>geronimo/jars/geronimo-tomcat-${geronimo_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/catalina-5.5.4.jar</uri>
+        <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/catalina-optional-5.5.4.jar</uri>
+        <uri>tomcat/jars/catalina-optional-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-coyote-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-coyote-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-http-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-http-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-util-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-util-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/naming-resources-5.5.4.jar</uri>
+        <uri>tomcat/jars/naming-resources-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/servlets-default-5.5.4.jar</uri>
+        <uri>tomcat/jars/servlets-default-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/servlets-invoker-5.5.4.jar</uri>
+        <uri>tomcat/jars/servlets-invoker-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
         <uri>commons-beanutils/jars/commons-beanutils-1.6.1.jar</uri>

Modified: geronimo/trunk/modules/tomcat/maven.xml
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/maven.xml?view=diff&rev=111563&p1=geronimo/trunk/modules/tomcat/maven.xml&r1=111562&p2=geronimo/trunk/modules/tomcat/maven.xml&r2=111563
==============================================================================
--- geronimo/trunk/modules/tomcat/maven.xml	(original)
+++ geronimo/trunk/modules/tomcat/maven.xml	Fri Dec 10 17:02:57 2004
@@ -46,10 +46,18 @@
         <attainGoal name="build"/>
     </goal>
 
+<!-- It doesn't work - Invalid geronimo-service.xml file during assembly
 	<preGoal name="jar:jar">
 		<mkdir dir="${maven.build.dest}/META-INF"/>
-		<copy todir="${maven.build.dest}/META-INF/geronimo-service.xml" file="src/plan/tomcat-plan.xml"/>
+
+        <j:set var="planName" value="tomcat-plan.xml"/>
+        <echo>Preprocessing ${planName}</echo>
+        <velocity:merge
+            basedir="src/plan"
+            template="tomcat-plan.xml"
+            name="${maven.build.dest}/META-INF/geronimo-service.xml"/>
 	</preGoal>
+-->
 
 </project>
 

Modified: geronimo/trunk/modules/tomcat/project.xml
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/project.xml?view=diff&rev=111563&p1=geronimo/trunk/modules/tomcat/project.xml&r1=111562&p2=geronimo/trunk/modules/tomcat/project.xml&r2=111563
==============================================================================
--- geronimo/trunk/modules/tomcat/project.xml	(original)
+++ geronimo/trunk/modules/tomcat/project.xml	Fri Dec 10 17:02:57 2004
@@ -47,6 +47,25 @@
     <!-- ============ -->
 
     <dependencies>
+		<!-- temporary solution until appropriate xmlbeans code is ready -->
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-jetty-builder</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <!-- Used for preprocessing our plans -->
+        <dependency>
+            <groupId>commons-jelly</groupId>
+            <artifactId>commons-jelly-tags-velocity</artifactId>
+            <version>&jelly-velocity-tags-version;</version>
+        </dependency>
+        <dependency>
+            <groupId> velocity</groupId>
+            <artifactId>velocity</artifactId>
+            <version>&velocity-version;</version>
+        </dependency>
+
         <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-common</artifactId>
@@ -96,9 +115,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>catalina</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -111,9 +128,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>catalina-optional</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -122,9 +137,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>tomcat-coyote</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -133,9 +146,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>tomcat-http</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -144,9 +155,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>jasper-compiler</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -155,9 +164,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>jasper-runtime</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -166,9 +173,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>tomcat-util</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -177,9 +182,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>naming-resources</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -188,9 +191,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>servlets-default</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -199,9 +200,7 @@
         <dependency>
             <groupId>tomcat</groupId>
             <artifactId>servlets-invoker</artifactId>
-            <!-- Don't want to break the other modules that rely on the libs -->
-            <!--version>&tomcat-version;</version-->
-            <version>5.5.4</version>
+            <version>&tomcat-version;</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>
                 <repository>true</repository>
@@ -291,12 +290,4 @@
             </properties>
         </dependency>
     </dependencies>
-
-    <build>
-        <unitTest>
-           <includes>
-                <include>**/*Test.java</include>
-            </includes>                
-        </unitTest>
-    </build>
 </project>

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?view=diff&rev=111563&p1=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java&r1=111562&p2=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java&r2=111563
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
Fri Dec 10 17:02:57 2004
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.tomcat;
 
-import mx4j.log.FileLogger;
-
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Host;

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&rev=111563&p1=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java&r1=111562&p2=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java&r2=111563
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Fri Dec 10 17:02:57 2004
@@ -48,6 +48,8 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.tomcat.TomcatWebAppContext;
+import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppDocument;
+import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppType;
 import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
 import org.apache.geronimo.xbeans.j2ee.WebAppType;
 import org.apache.xmlbeans.XmlException;
@@ -58,10 +60,14 @@
  */
 public class TomcatModuleBuilder implements ModuleBuilder {
 
+    private final URI defaultParentId;
+
     private static final Log log = LogFactory.getLog(TomcatModuleBuilder.class);
 
-    public TomcatModuleBuilder() {
+    public TomcatModuleBuilder(URI defaultParentId) {
         log.debug("TomcatModuleBuilder()");
+
+        this.defaultParentId = defaultParentId;
     }
 
     public String addGBeans(EARContext earContext, Module module, ClassLoader cl) throws
DeploymentException {
@@ -131,15 +137,31 @@
             return null;
         }
 
-        WebModule module = null;
+        // parse vendor dd
+        JettyWebAppType jettyWebApp = getJettyWebApp(plan, moduleFile, false, "war", webApp);
+
+        // get the ids from either the application plan or for a stand alone module from
the specific deployer
+        URI configId = null;
         try {
-            long randomName = System.currentTimeMillis();
-            module = new WebModule(false, new URI("org/apache/geronimo/" + randomName), new
URI(
-                    "org/apache/geronimo/Server"), moduleFile, "war", null, null, null);
-            module.setContextRoot("/" + randomName);
+            configId = new URI(jettyWebApp.getConfigId());
         } catch (URISyntaxException e) {
-            throw new DeploymentException(e);
+            throw new DeploymentException("Invalid configId " + jettyWebApp.getConfigId(),
e);
+        }
+
+        URI parentId = null;
+        if (jettyWebApp.isSetParentId()) {
+            try {
+                parentId = new URI(jettyWebApp.getParentId());
+            } catch (URISyntaxException e) {
+                throw new DeploymentException("Invalid parentId " + jettyWebApp.getParentId(),
e);
+            }
+        } else {
+            parentId = defaultParentId;
         }
+
+        WebModule module = new WebModule(false, configId, parentId, moduleFile, "war", webApp,
jettyWebApp, specDD);
+        module.setContextRoot(jettyWebApp.getContextRoot());
+
         return module;
     }
 
@@ -190,6 +212,76 @@
         }
     }
 
+    JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String
targetPath, WebAppType webApp) throws DeploymentException {
+        JettyWebAppType jettyWebApp = null;
+        try {
+            // load the geronimo-jetty.xml from either the supplied plan or from the earFile
+            try {
+                if (plan instanceof XmlObject) {
+                    jettyWebApp = (JettyWebAppType) SchemaConversionUtils.getNestedObjectAsType((XmlObject)
plan,
+                            "web-app",
+                            JettyWebAppType.type);
+                } else {
+                    JettyWebAppDocument jettyWebAppdoc = null;
+                    if (plan != null) {
+                        jettyWebAppdoc = JettyWebAppDocument.Factory.parse((File) plan);
+                    } else {
+                        URL path = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/geronimo-jetty.xml");
+                        jettyWebAppdoc = JettyWebAppDocument.Factory.parse(path);
+                    }
+                    if (jettyWebAppdoc != null) {
+                        jettyWebApp = jettyWebAppdoc.getWebApp();
+                    }
+                }
+            } catch (IOException e) {
+            }
+
+            // if we got one extract and validate it otherwise create a default one
+            if (jettyWebApp != null) {
+                jettyWebApp = (JettyWebAppType) SchemaConversionUtils.convertToGeronimoNamingSchema(jettyWebApp);
+                jettyWebApp = (JettyWebAppType) SchemaConversionUtils.convertToGeronimoSecuritySchema(jettyWebApp);
+                SchemaConversionUtils.validateDD(jettyWebApp);
+            } else {
+                String path;
+                if (standAlone) {
+                    // default configId is based on the moduleFile name
+                    path = new File(moduleFile.getName()).getName();
+                } else {
+                    // default configId is based on the module uri from the application.xml
+                    path = targetPath;
+                }
+                jettyWebApp = createDefaultPlan(path, webApp);
+            }
+        } catch (XmlException e) {
+            throw new DeploymentException("xml problem", e);
+        }
+        return jettyWebApp;
+    }
+
+    private JettyWebAppType createDefaultPlan(String path, WebAppType webApp) {
+        String id = webApp.getId();
+        if (id == null) {
+            id = path;
+            if (id.endsWith(".war")) {
+                id = id.substring(0, id.length() - 4);
+            }
+            if (id.endsWith("/")) {
+                id = id.substring(0, id.length() - 1);
+            }
+        }
+
+        JettyWebAppType jettyWebApp = JettyWebAppType.Factory.newInstance();
+
+        // set the parentId, configId and context root
+        jettyWebApp.setParentId(defaultParentId.toString());
+        if (null != webApp.getId()) {
+            id = webApp.getId();
+        }
+        jettyWebApp.setConfigId(id);
+        jettyWebApp.setContextRoot(id);
+        return jettyWebApp;
+    }
+
     private static URI[] getWebClassPath(EARContext earContext, WebModule webModule) {
         LinkedList webClassPath = new LinkedList();
         File baseDir = earContext.getTargetFile(URI.create(webModule.getTargetPath() + "/"));
@@ -224,7 +316,10 @@
 
     static {
         GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(TomcatModuleBuilder.class);
+        infoBuilder.addAttribute("defaultParentId", URI.class, true);
         infoBuilder.addInterface(ModuleBuilder.class);
+
+        infoBuilder.setConstructor(new String[]{"defaultParentId"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Modified: geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml?view=diff&rev=111563&p1=geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml&r1=111562&p2=geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml&r2=111563
==============================================================================
--- geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml	(original)
+++ geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml	Fri Dec 10 17:02:57 2004
@@ -1,5 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
 
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!-- $Rev: 111453 $ $Date: 2004-12-10 01:46:37 +0100 (Fri, 10 Dec 2004) $ -->
+
+<!--
+Configuration for the Apache Tomcat web container
+-->
 <configuration
     xmlns="http://geronimo.apache.org/xml/ns/deployment"
     parentId="org/apache/geronimo/System"
@@ -16,31 +37,31 @@
         <uri>geronimo-spec/jars/geronimo-spec-j2ee-1.4-rc3.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/catalina-5.5.4.jar</uri>
+        <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/jasper-compiler-5.5.4.jar</uri>
+        <uri>tomcat/jars/jasper-compiler-${jasper_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/jasper-runtime-5.5.4.jar</uri>
+        <uri>tomcat/jars/jasper-runtime-${jasper_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-coyote-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-coyote-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-http-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-http-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/tomcat-util-5.5.4.jar</uri>
+        <uri>tomcat/jars/tomcat-util-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/naming-resources-5.5.4.jar</uri>
+        <uri>tomcat/jars/naming-resources-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/servlets-default-5.5.4.jar</uri>
+        <uri>tomcat/jars/servlets-default-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>tomcat/jars/servlets-invoker-5.5.4.jar</uri>
+        <uri>tomcat/jars/servlets-invoker-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
         <uri>commons-beanutils/jars/commons-beanutils-1.6.1.jar</uri>

Mime
View raw message