Author: jlaskowski Date: Tue Dec 14 09:58:01 2004 New Revision: 111847 URL: http://svn.apache.org/viewcvs?view=rev&rev=111847 Log: o Add tomcat module to multiproject goals o assembly builds org/apache/geronimo/Tomcat configuration o Simplify the steps to activate Apache Tomcat (less files to modify) o CATALINA_HOME and listen port are TomcatContainer attributes
NOTE: All webapps are assigned with org/apache/geronimo/Tomcat as their parent configuration (overwrites geronimo-jetty.xml) NOTE: Tomcat HTTP Connector listens to 8090 port (to avoid any interferences with Jetty HttpConnector) Added: geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml (contents, props changed) Modified: geronimo/trunk/modules/assembly/maven.xml 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/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 geronimo/trunk/project.properties Modified: geronimo/trunk/modules/assembly/maven.xml Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/maven.xml?view=diff&rev=111847&p1=geronimo/trunk/modules/assembly/maven.xml&r1=111846&p2=geronimo/trunk/modules/assembly/maven.xml&r2=111847 ============================================================================== --- geronimo/trunk/modules/assembly/maven.xml (original) +++ geronimo/trunk/modules/assembly/maven.xml Tue Dec 14 09:58:01 2004 @@ -315,6 +315,16 @@ <ant:arg value="distribute"/> <ant:arg value="target/plan/j2ee-client-plan.xml"/> </ant:java> + + <!-- build the J2EEServer with Apache Tomcat (as the web container) configuration --> + <ant:echo>Building Apache Tomcat server configuration</ant:echo> + <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true"> + <ant:jvmarg value="-ea"/> + <ant:arg value="distribute"/> + <ant:arg value="target/plan/j2ee-server-tomcat-plan.xml"/> + </ant:java> + + <ant:copy todir="${distDir}/var/catalina/conf" file="${project.root}/modules/tomcat/src/var/web.xml"/> <!-- build the Demo configuration --> <ant:echo>Building demo website configuration</ant:echo> @@ -331,8 +341,6 @@ <ant:arg value="distribute"/> <ant:arg value="${maven.repo.local}/geronimo/wars/geronimo-jmxdebug-${pom.currentVersion}.war"/> </ant:java> - - <ant:copy todir="${distDir}/var/catalina/conf" file="${project.root}/modules/tomcat/src/var/web.xml"/> </goal> Modified: geronimo/trunk/modules/assembly/project.xml Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/project.xml?view=diff&rev=111847&p1=geronimo/trunk/modules/assembly/project.xml&r1=111846&p2=geronimo/trunk/modules/assembly/project.xml&r2=111847 ============================================================================== --- geronimo/trunk/modules/assembly/project.xml (original) +++ geronimo/trunk/modules/assembly/project.xml Tue Dec 14 09:58:01 2004 @@ -591,11 +591,7 @@ <client>true</client> <deploy>true</deploy> <clideployer>true</clideployer> -<!-- the tomcat module's requirement - - uncomment it to run Apache Tomcat as a web container - - <repository>true</repository> - --> </properties> </dependency> @@ -702,9 +698,6 @@ <repository>true</repository> </properties> </dependency> -<!-- the tomcat module's requirement - - uncomment it to run Apache Tomcat as a web container - - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-tomcat</artifactId> @@ -821,7 +814,6 @@ <repository>true</repository> </properties> </dependency> - --> <!-- for jsps --> <dependency> 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=111847&p1=geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml&r1=111846&p2=geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml&r2=111847 ============================================================================== --- geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml (original) +++ geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml Tue Dec 14 09:58:01 2004 @@ -83,22 +83,6 @@ <dependency> <uri>geronimo/jars/geronimo-jetty-${geronimo_version}.jar</uri> </dependency> -<!-- the tomcat module's requirement - - uncomment it to run Apache Tomcat as a web container - - - <dependency> - <uri>geronimo/jars/geronimo-tomcat-${geronimo_version}.jar</uri> - </dependency> - <dependency> - <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri> - </dependency> - <dependency> - <uri>tomcat/jars/naming-resources-${tomcat_version}.jar</uri> - </dependency> - <dependency> - <uri>tomcat/jars/tomcat-util-${tomcat_version}.jar</uri> - </dependency> - --> <dependency> <uri>geronimo/jars/geronimo-naming-${geronimo_version}.jar</uri> </dependency> @@ -190,11 +174,24 @@ <reference name="SecurityService">geronimo.deployer:type=SecurityService</reference> <attribute name="defaultServlets">geronimo.deployer:role=DefaultServlet,config=org/apache/geronimo/J2EEDeployer,*</attribute> </gbean> -<!-- the tomcat module's requirement - - uncomment it to run Apache Tomcat as a web container + +<!-- + - Uncomment it to deploy webapps to Apache Tomcat - + <dependency> + <uri>geronimo/jars/geronimo-tomcat-${geronimo_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/naming-resources-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/tomcat-util-${tomcat_version}.jar</uri> + </dependency> <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> + <attribute name="defaultParentId">org/apache/geronimo/Tomcat</attribute> </gbean> --> 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=111847&p1=geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml&r1=111846&p2=geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml&r2=111847 ============================================================================== --- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml (original) +++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml Tue Dec 14 09:58:01 2004 @@ -268,11 +268,6 @@ <!-- default WAR container using Jetty --> <gbean name="geronimo.server:type=WebContainer,container=Jetty" class="org.apache.geronimo.jetty.JettyContainerImpl"/> -<!-- the tomcat module's requirement - - uncomment it to run Apache Tomcat as a web container - - - <gbean name="geronimo.server:type=WebContainer,container=Tomcat" class="org.apache.geronimo.tomcat.TomcatContainer"/> - --> <gbean name="geronimo.server:type=RequestLog,container=Jetty" class="org.apache.geronimo.jetty.requestlog.NCSARequestLog"> <reference name="JettyContainer">geronimo.server:type=WebContainer,container=Jetty</reference> <reference name="ServerInfo">geronimo.system:role=ServerInfo</reference> Added: geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml?view=auto&rev=111847 ============================================================================== --- (empty file) +++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml Tue Dec 14 09:58:01 2004 @@ -0,0 +1,99 @@ +<?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: 111627 $ $Date: 2004-12-12 03:15:11 +0100 (Sun, 12 Dec 2004) $ --> + +<!-- +Configuration for the main ring of a Geronimo server. + +This configuration should contain those services normally provided +by the server. +--> +<configuration + xmlns="http://geronimo.apache.org/xml/ns/deployment" + configId="org/apache/geronimo/Tomcat" + parentId="org/apache/geronimo/Server" + > + + <dependency> + <uri>geronimo/jars/geronimo-tomcat-${geronimo_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/catalina-optional-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/tomcat-coyote-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/tomcat-http-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/tomcat-util-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/naming-resources-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/servlets-default-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/servlets-invoker-${tomcat_version}.jar</uri> + </dependency> + <dependency> + <uri>commons-beanutils/jars/commons-beanutils-1.6.1.jar</uri> + </dependency> + <dependency> + <uri>commons-collections/jars/commons-collections-2.1.jar</uri> + </dependency> + <dependency> + <uri>commons-digester/jars/commons-digester-1.6.jar</uri> + </dependency> + <dependency> + <uri>commons-el/jars/commons-el-1.0.jar</uri> + </dependency> + <dependency> + <uri>commons-modeler/jars/commons-modeler-1.1.jar</uri> + </dependency> + <dependency> + <uri>regexp/jars/regexp-1.3.jar</uri> + </dependency> + <dependency> + <uri>mx4j/jars/mx4j-2.0.1.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/jasper-compiler-${jasper_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/jasper-compiler-jdt-${jasper_version}.jar</uri> + </dependency> + <dependency> + <uri>tomcat/jars/jasper-runtime-${jasper_version}.jar</uri> + </dependency> + <dependency> + <uri>commons-el/jars/commons-el-${commons_el_version}.jar</uri> + </dependency> + + <gbean name="geronimo.server:type=WebContainer,container=Tomcat" class="org.apache.geronimo.tomcat.TomcatContainer"> + <attribute name="catalinaHome">var/catalina</attribute> + <attribute name="port">8090</attribute> + </gbean> + +</configuration> Modified: geronimo/trunk/modules/tomcat/maven.xml Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/maven.xml?view=diff&rev=111847&p1=geronimo/trunk/modules/tomcat/maven.xml&r1=111846&p2=geronimo/trunk/modules/tomcat/maven.xml&r2=111847 ============================================================================== --- geronimo/trunk/modules/tomcat/maven.xml (original) +++ geronimo/trunk/modules/tomcat/maven.xml Tue Dec 14 09:58:01 2004 @@ -16,12 +16,6 @@ limitations under the License. --> -<!DOCTYPE project [ -<!ENTITY % locator SYSTEM "file:locator.ent"> -%locator; -%versions; -]> - <!-- $Rev: 46019 $ $Date: 2004-09-14 11:56:06 +0200 (Tue, 14 Sep 2004) $ --> <project default="default" @@ -60,4 +54,3 @@ --> </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=111847&p1=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java&r1=111846&p2=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java&r2=111847 ============================================================================== --- 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 Tue Dec 14 09:58:01 2004 @@ -43,12 +43,19 @@ /** * The default value of CATALINA_HOME variable */ - private static final String CATALINA_HOME = "var/catalina"; - + private static final String DEFAULT_CATALINA_HOME = "var/catalina"; + + /** + * The default port the HTTP connector listens to + * + * TODO: Move it to another GBean, e.g. HTTPConnector + */ + private static final int DEFAULT_HTTP_CONNECTOR_PORT = 8090; + /** * Work directory */ - private static final String WORK_DIR = "work"; + private static final String WORK_DIR = "work"; /** * Reference to the org.apache.catalina.Embedded embedded. @@ -80,11 +87,25 @@ private Context defaultContext; /** + * The port Tomcat's HTTP Connector listens to + * + * TODO: Make it a part of the Listener GBean + */ + private int port; + + // Required as it's referenced by deployed webapps + public TomcatContainer(){ + setCatalinaHome(DEFAULT_CATALINA_HOME); + setPort(DEFAULT_HTTP_CONNECTOR_PORT); + } + + /** * GBean constructor (invoked dynamically when the gbean is declared in a * plan) */ - public TomcatContainer() { - System.setProperty("catalina.home", CATALINA_HOME); + public TomcatContainer(String catalinaHome, int port) { + setCatalinaHome(catalinaHome); + setPort(port); } public void doFail() { @@ -133,7 +154,7 @@ // desired. After you customize this Host, add it to the corresponding // Engine with engine.addChild(host). host = embedded.createHost("localhost", ""); - // TODO: Make it that gbean's attribute or tomcatwebappcontext's one + // TODO: Make it the gbean's attribute or tomcatwebappcontext's one ((StandardHost) host).setWorkDir(WORK_DIR); engine.addChild(host); @@ -161,7 +182,7 @@ // Create an HTTP/1.1 connector manually connector = new Connector("HTTP/1.1"); - connector.setPort(8080); + connector.setPort(this.getPort()); // 8. Call addConnector() to attach this Connector to the set of defined // Connectors for this object. The added Connector will use the most @@ -193,8 +214,10 @@ */ public void addContext(Context ctx) { // TODO: Rethink what we're doing here - // The param - ctx - extends StandardContext, but at the same time we don't leverage it. - // TomcatContainer creates it again - so in fact there're two classes for the same thing. + // The param - ctx - extends StandardContext, but at the same time we + // don't leverage it. + // TomcatContainer creates it again - so in fact there're two classes + // for the same thing. // The question comes up what do we get from having the // TomcatWebAppContext class extend Tomcat's StandardContext? Context anotherCtxObj = embedded.createContext(ctx.getPath(), ctx.getDocBase()); @@ -206,10 +229,27 @@ embedded.removeContext(ctx); } + public void setCatalinaHome(String catalinaHome) { + System.setProperty("catalina.home", catalinaHome); + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + public static final GBeanInfo GBEAN_INFO; static { GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Tomcat Web Container", TomcatContainer.class); + + infoFactory.setConstructor(new String[] { "catalinaHome", "port" }); + + infoFactory.addAttribute("catalinaHome", String.class, true); + infoFactory.addAttribute("port", int.class, true); infoFactory.addOperation("addContext", new Class[] { Context.class }); infoFactory.addOperation("removeContext", new Class[] { Context.class }); 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=111847&p1=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java&r1=111846&p2=geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java&r2=111847 ============================================================================== --- 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 Tue Dec 14 09:58:01 2004 @@ -65,7 +65,7 @@ private static final Log log = LogFactory.getLog(TomcatModuleBuilder.class); public TomcatModuleBuilder(URI defaultParentId) { - log.debug("TomcatModuleBuilder()"); + log.debug("TomcatModuleBuilder(" + defaultParentId + ")"); this.defaultParentId = defaultParentId; } @@ -140,7 +140,8 @@ // 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 + // get the ids from either the application plan or for a stand alone + // module from the specific deployer URI configId = null; try { configId = new URI(jettyWebApp.getConfigId()); @@ -159,6 +160,13 @@ parentId = defaultParentId; } + // for now, every webapps will get defaultParentId which is + // org/apache/geronimo/Tomcat + // TODO: Create a general WebModuleBuilder and hand over deploying a + // webapp to Jetty- or TomcatModuleBuilder based on parentId. + log.warn("Assigning defaultParentId [" + defaultParentId + "] to webapp [" + configId + "]"); + parentId = defaultParentId; + WebModule module = new WebModule(false, configId, parentId, moduleFile, "war", webApp, jettyWebApp, specDD); module.setContextRoot(jettyWebApp.getContextRoot()); @@ -212,15 +220,16 @@ } } - JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String targetPath, WebAppType webApp) throws DeploymentException { + 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 + // 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); + "web-app", JettyWebAppType.type); } else { JettyWebAppDocument jettyWebAppdoc = null; if (plan != null) { @@ -236,7 +245,8 @@ } catch (IOException e) { } - // if we got one extract and validate it otherwise create a default one + // 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); @@ -247,7 +257,8 @@ // 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 + // default configId is based on the module uri from the + // application.xml path = targetPath; } jettyWebApp = createDefaultPlan(path, webApp); @@ -319,7 +330,7 @@ infoBuilder.addAttribute("defaultParentId", URI.class, true); infoBuilder.addInterface(ModuleBuilder.class); - infoBuilder.setConstructor(new String[]{"defaultParentId"}); + 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=111847&p1=geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml&r1=111846&p2=geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml&r2=111847 ============================================================================== --- geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml (original) +++ geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml Tue Dec 14 09:58:01 2004 @@ -89,6 +89,9 @@ <uri>xerces/jars/xercesImpl-2.6.0.jar</uri> </dependency> - <gbean name="geronimo.server:type=WebContainer,container=Tomcat" class="org.apache.geronimo.tomcat.TomcatContainer"/> + <gbean name="geronimo.server:type=WebContainer,container=Tomcat" class="org.apache.geronimo.tomcat.TomcatContainer"> + <attribute name="catalinaHome">var/catalina</attribute> + <attribute name="port">8090</attribute> + </gbean> </configuration> Modified: geronimo/trunk/project.properties Url: http://svn.apache.org/viewcvs/geronimo/trunk/project.properties?view=diff&rev=111847&p1=geronimo/trunk/project.properties&r1=111846&p2=geronimo/trunk/project.properties&r2=111847 ============================================================================== --- geronimo/trunk/project.properties (original) +++ geronimo/trunk/project.properties Tue Dec 14 09:58:01 2004 @@ -52,7 +52,6 @@ tranql/*/project.xml maven.multiproject.excludes=\ -modules/tomcat/project.xml,\ itests/*/project.xml,\ openejb/modules/connector/project.xml,\ openejb/modules/webadmin/project.xml