geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r348017 - in /geronimo/trunk: assemblies/j2ee-tomcat-server/src/var/config/ configs/tomcat/src/plan/ modules/assembly/ modules/assembly/src/plan/ modules/tomcat/ modules/tomcat/src/java/org/apache/geronimo/tomcat/util/ modules/tomcat/src/re...
Date Mon, 21 Nov 2005 23:33:43 GMT
Author: djencks
Date: Mon Nov 21 15:33:27 2005
New Revision: 348017

URL: http://svn.apache.org/viewcvs?rev=348017&view=rev
Log:
GERONIMO-1213 install tomcat default dirs using a gbean, not jelly script

Added:
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/util/DirectoryInitializationGBean.java
    geronimo/trunk/modules/tomcat/src/resources/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/
      - copied from r345461, geronimo/trunk/modules/tomcat/src/var/ROOT/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/WEB-INF/
      - copied from r347962, geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/geronimo-logo.png
      - copied unchanged from r347962, geronimo/trunk/modules/tomcat/src/var/ROOT/geronimo-logo.png
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/geronimo-power.gif
      - copied unchanged from r347962, geronimo/trunk/modules/tomcat/src/var/ROOT/geronimo-power.gif
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/index.jsp
      - copied unchanged from r347962, geronimo/trunk/modules/tomcat/src/var/ROOT/index.jsp
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/tomcat-power.gif
      - copied unchanged from r347962, geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat-power.gif
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/ROOT/tomcat.gif
      - copied unchanged from r347962, geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat.gif
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/conf/
    geronimo/trunk/modules/tomcat/src/resources/META-INF/var/catalina/conf/web.xml
      - copied unchanged from r345461, geronimo/trunk/modules/tomcat/src/var/web.xml
Removed:
    geronimo/trunk/modules/tomcat/src/var/ROOT/
    geronimo/trunk/modules/tomcat/src/var/web.xml
Modified:
    geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml
    geronimo/trunk/configs/tomcat/src/plan/plan.xml
    geronimo/trunk/modules/assembly/maven.xml
    geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml
    geronimo/trunk/modules/tomcat/maven.xml

Modified: geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml?rev=348017&r1=348016&r2=348017&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml (original)
+++ geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml Mon Nov 21 15:33:27
2005
@@ -57,6 +57,7 @@
         </gbean>
     </configuration>
     <configuration name="geronimo/cars/tomcat-${pom.currentVersion}.car">
+        <gbean name="TomcatResources"/>
         <gbean name="TomcatWebConnector">
             <attribute name="host">${PlanServerHostname}</attribute>
             <attribute name="port">${PlanHTTPPortPrimary}</attribute>

Modified: geronimo/trunk/configs/tomcat/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/configs/tomcat/src/plan/plan.xml?rev=348017&r1=348016&r2=348017&view=diff
==============================================================================
--- geronimo/trunk/configs/tomcat/src/plan/plan.xml (original)
+++ geronimo/trunk/configs/tomcat/src/plan/plan.xml Mon Nov 21 15:33:27 2005
@@ -26,6 +26,15 @@
                configId="${pom.groupId}/cars/${pom.artifactId}-${pom.currentVersion}.car"
     >
 
+    <gbean name="TomcatResources" class="org.apache.geronimo.tomcat.util.DirectoryInitializationGBean">
+        <!-- copies tomcat initialization files into specified location -->
+        <attribute name="path">var/catalina</attribute>
+        <reference name="ServerInfo">
+            <module>geronimo/cars/j2ee-system-${pom.currentVersion}.car</module>
+            <name>ServerInfo</name>
+        </reference>
+    </gbean>
+
     <!-- david jencks is not convinced that this gbean should be in this plan and thinks
it might
     belong in the console plan -->
     <gbean name="TomcatWebManager" class="org.apache.geronimo.tomcat.TomcatManagerImpl">
@@ -121,6 +130,10 @@
         <reference name="TomcatValveChain">
             <name>FirstValve</name>
         </reference>
+        <dependency>
+            <type>GBean</type>
+            <name>TomcatResources</name>
+        </dependency>
     </gbean>
 
     <gbean name="TomcatAccessLogManager" class="org.apache.geronimo.tomcat.TomcatLogManagerImpl">

Modified: geronimo/trunk/modules/assembly/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/maven.xml?rev=348017&r1=348016&r2=348017&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/maven.xml (original)
+++ geronimo/trunk/modules/assembly/maven.xml Mon Nov 21 15:33:27 2005
@@ -192,10 +192,10 @@
             file="${project.root}/modules/directory/src/var/directory.xml"/>
 
         <!-- Add tomcat files -->
-        <ant:copy todir="${geronimo.assembly.dir}/var/catalina/conf"
-            file="${project.root}/modules/tomcat/src/var/web.xml"/>
-        <ant:copy todir="${geronimo.assembly.dir}/var/catalina/ROOT">
-            <ant:fileset dir="${project.root}/modules/tomcat/src/var/ROOT"/>
+<!--        <ant:copy todir="${geronimo.assembly.dir}/var/catalina/"-->
+<!--            file="${project.root}/modules/tomcat/src/var/web.xml"/>-->
+        <ant:copy todir="${geronimo.assembly.dir}/var/catalina">
+            <ant:fileset dir="${project.root}/modules/tomcat/src/var"/>
         </ant:copy>
 
         <!-- Load the repository -->
@@ -360,15 +360,15 @@
             deployerGBean="geronimo.deployer:name=Deployer,J2EEApplication=null,J2EEModule=org/apache/geronimo/OfflineDeployer,j2eeType=Deployer,J2EEServer=deployer"
             deploymentFactory="org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl"
             />
-    	
+
     	    <bootstrap:shutdown
     	            shutdownJar="${geronimo.assembly.dir}/bin/shutdown.jar"
     	            shutdownClassPath="${deploy.classpath}"
     	            />
-    	
+
         <!-- build the system configuration and server.jar -->
         <ant:echo file="${basedir}/target/deploy-commands">package --classPath "${server.classpath}"
--mainClass org.apache.geronimo.system.main.Daemon --endorsedDirs lib/endorsed --extensionDirs
lib/ext --install target/plan/system-plan.xml ${geronimo.assembly.dir}/bin/server.jar${line.separator}</ant:echo>
-        
+
         <!-- build the RMINaming configuration -->
         <ant:echo file="${basedir}/target/deploy-commands" append="true"
              message="distribute target/plan/naming-server-plan.xml${line.separator}" />
@@ -385,13 +385,13 @@
 
         <ant:echo file="${basedir}/target/deploy-commands" append="true"
              message="distribute target/plan/j2ee-tomcat-plan.xml${line.separator}" />
-       
+
         <ant:echo file="${basedir}/target/deploy-commands" append="true"
              message="distribute target/plan/j2ee-runtime-deployer-plan.xml${line.separator}"
/>
 
         <ant:echo file="${basedir}/target/deploy-commands" append="true"
              message="distribute ${basedir}/target/plan/j2ee-jetty-runtime-deployer-plan.xml${line.separator}"
/>
-        
+
         <ant:echo file="${basedir}/target/deploy-commands" append="true"
              message="distribute ${basedir}/target/plan/j2ee-tomcat-runtime-deployer-plan.xml${line.separator}"
/>
 
@@ -400,7 +400,7 @@
 
         <ant:echo file="${basedir}/target/deploy-commands" append="true"
              message="distribute target/plan/j2ee-client-plan.xml${line.separator}" />
-        
+
         <!-- to debug this deployer call, include these jvmargs right after the -ea arg
         <ant:jvmarg value="-Xdebug"/>
         <ant:jvmarg value="-Xnoagent"/>

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml?rev=348017&r1=348016&r2=348017&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml Mon Nov 21 15:33:27 2005
@@ -94,6 +94,15 @@
         <uri>commons-el/jars/commons-el-${commons_el_version}.jar</uri>
     </dependency>
 
+    <gbean name="TomcatResources" class="org.apache.geronimo.tomcat.util.DirectoryInitializationGBean">
+        <!-- copies tomcat initialization files into specified location -->
+        <attribute name="path">var/catalina</attribute>
+        <reference name="ServerInfo">
+            <module>org/apache/geronimo/System</module>
+            <name>ServerInfo</name>
+        </reference>
+    </gbean>
+
     <!-- david jencks is not convinced that this gbean should be in this plan and thinks
it might
     belong in the console plan -->
     <gbean name="TomcatWebManager" class="org.apache.geronimo.tomcat.TomcatManagerImpl">
@@ -189,6 +198,10 @@
         <reference name="TomcatValveChain">
             <name>FirstValve</name>
         </reference>
+        <dependency>
+            <type>GBean</type>
+            <name>TomcatResources</name>
+        </dependency>
     </gbean>
 
     <gbean name="TomcatAccessLogManager" class="org.apache.geronimo.tomcat.TomcatLogManagerImpl">

Modified: geronimo/trunk/modules/tomcat/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/maven.xml?rev=348017&r1=348016&r2=348017&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/maven.xml (original)
+++ geronimo/trunk/modules/tomcat/maven.xml Mon Nov 21 15:33:27 2005
@@ -54,7 +54,7 @@
         <mkdir dir="${maven.build.dir}/var/catalina"/>
         <mkdir dir="${maven.build.dir}/var/catalina/webapps"/>
         <mkdir dir="${maven.build.dir}/var/catalina/conf"/>
-        <copy todir="${maven.build.dir}/var/catalina/conf" file="src/var/web.xml"/>
+        <copy todir="${maven.build.dir}/var/catalina/conf" file="src/resources/META-INF/var/catalina/conf/web.xml"/>
         <copy todir="${maven.build.dir}/var/catalina/webapps">
             <fileset dir="src/test-resources/deployables">
                 <include name="war1/**"/>

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/util/DirectoryInitializationGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/util/DirectoryInitializationGBean.java?rev=348017&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/util/DirectoryInitializationGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/util/DirectoryInitializationGBean.java
Mon Nov 21 15:33:27 2005
@@ -0,0 +1,105 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.tomcat.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class DirectoryInitializationGBean {
+
+
+    public DirectoryInitializationGBean(String path, ServerInfo serverInfo, ClassLoader classLoader)
throws IOException {
+
+        if (!path.equals("/")) {
+            path = path + "/";
+        }
+
+        URL sourceURL = classLoader.getResource("META-INF/" + path);
+        URLConnection conn = sourceURL.openConnection();
+        JarURLConnection jarConn = (JarURLConnection) conn;
+        JarFile jarFile = jarConn.getJarFile();
+        JarEntry sourceEntry = jarConn.getJarEntry();
+        byte[] buf = new byte[1024 * 8];
+        for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {
+            JarEntry entry = (JarEntry) entries.nextElement();
+            if (entry.getName().startsWith(sourceEntry.getName())) {
+                String entryName = entry.getName();
+                String entryPath = entryName.substring("META-INF/".length());
+                File targetPath = serverInfo.resolve(entryPath);
+                if (!targetPath.exists()) {
+                    if (entry.isDirectory()) {
+                        targetPath.mkdirs();
+                    } else {
+                        InputStream in = jarFile.getInputStream(entry);
+                        try {
+                            OutputStream out = new FileOutputStream(targetPath);
+                            try {
+                                int chunk;
+                                while ((chunk = in.read(buf)) > 0) {
+                                    out.write(buf, 0, chunk);
+                                }
+                            } finally {
+                                out.flush();
+                                out.close();
+                            }
+                        } finally {
+                            in.close();
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(DirectoryInitializationGBean.class,
NameFactory.GERONIMO_SERVICE);
+        infoBuilder.addAttribute("path", String.class, true);
+        infoBuilder.addReference("ServerInfo", ServerInfo.class, NameFactory.GERONIMO_SERVICE);
+        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
+
+        infoBuilder.setConstructor(new String[]{"path", "ServerInfo", "classLoader"});
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}
+
+



Mime
View raw message