avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty JettySevak.java
Date Sun, 22 Sep 2002 21:39:13 GMT
hammant     2002/09/22 14:39:12

  Modified:    sevak    build.xml catalina.xml jo.xml
               sevak/src/java/org/apache/avalon/apps/sevak/blocks/jo
                        JoSevak.java
  Added:       sevak    jetty.xml
               sevak/lib/jetty-jars Readme
               sevak/src/demo/conf jetty-assembly.xml jetty-config.xml
                        jetty-environment.xml
               sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty
                        JettySevak.java
  Log:
  Start of Jetty compatability
  
  Revision  Changes    Path
  1.13      +28 -1     jakarta-avalon-apps/sevak/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/sevak/build.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- build.xml	22 Sep 2002 09:49:25 -0000	1.12
  +++ build.xml	22 Sep 2002 21:39:12 -0000	1.13
  @@ -59,6 +59,7 @@
      
     <property name="tomcat.jars.dir" value="${lib.dir}/tomcat-jars"/>
     <property name="jo.jars.dir" value="${lib.dir}/jo-jars"/>
  +  <property name="jetty.jars.dir" value="${lib.dir}/jetty-jars"/>
   
   
     <path id="project.class.path">
  @@ -75,7 +76,10 @@
       </fileset>    
       <fileset dir="${jo.jars.dir}">
         <include name="*.jar" />
  -    </fileset>        
  +    </fileset> 
  +    <fileset dir="${jetty.jars.dir}">
  +      <include name="*.jar" />
  +    </fileset>     
     </path>
   
     <path id="tools.class.path">
  @@ -139,6 +143,7 @@
     
       <available classpathref="project.class.path" classname="org.apache.catalina.Engine"
property="catalina.present"/>
       <available classpathref="project.class.path" classname="com.tagtraum.jo.JoServletService"
property="jo.present"/>
  +    <available classpathref="project.class.path" classname="org.mortbay.jetty.Server"
property="jetty.present"/>
       
       <available classpathref="project.class.path" classname="xdoclet.DocletTask" property="xdoclet.present"/>
   
  @@ -157,6 +162,7 @@
         <classpath refid="project.class.path" />
         <exclude name="org/apache/avalon/apps/sevak/blocks/jo/**" unless="jo.present"/>
         <exclude name="org/apache/avalon/apps/sevak/blocks/catalina/**" unless="catalina.present"/>
  +      <exclude name="org/apache/avalon/apps/sevak/blocks/jetty/**" unless="jetty.present"/>
       </javac>
   
       <copy todir="${build.classes}">
  @@ -177,6 +183,7 @@
     
       <mkdir dir="${build.xdoclet}/catalina"/>
       <mkdir dir="${build.xdoclet}/jo"/>
  +    <mkdir dir="${build.xdoclet}/jetty"/>
     
       <taskdef name="phoenix-blocks"
                classname="org.apache.avalon.phoenix.tools.xdoclet.PhoenixXDoclet"
  @@ -202,6 +209,16 @@
         <manifest manifestFile="manifest.mf" />
       </phoenix-blocks>
   
  +    <phoenix-blocks
  +        destdir="${build.xdoclet}/jetty"
  +        classpathref="project.class.path">
  +      <fileset dir="${java.dir}">
  +        <include name="org/apache/avalon/apps/sevak/blocks/jetty/**/*.java" />
  +      </fileset>
  +      <blockinfo/>
  +      <manifest manifestFile="manifest.mf" />
  +    </phoenix-blocks>
  +
   
     </target>
   
  @@ -243,6 +260,16 @@
         </fileset>
         <fileset dir="${build.xdoclet}/jo">
           <include name="org/apache/avalon/apps/sevak/blocks/jo/**/*.xinfo"/>
  +      </fileset>
  +    </jar>
  +
  +    <jar jarfile="${build.lib}/sevak-jetty.jar"
  +         manifest="${build.xdoclet}/jetty/manifest.mf">
  +      <fileset dir="${build.classes}">
  +        <include name="org/apache/avalon/apps/sevak/blocks/jetty/**"/>
  +      </fileset>
  +      <fileset dir="${build.xdoclet}/jetty">
  +        <include name="org/apache/avalon/apps/sevak/blocks/jetty/**/*.xinfo"/>
         </fileset>
       </jar>
   
  
  
  
  1.3       +9 -8      jakarta-avalon-apps/sevak/catalina.xml
  
  Index: catalina.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/sevak/catalina.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- catalina.xml	22 Sep 2002 09:49:25 -0000	1.2
  +++ catalina.xml	22 Sep 2002 21:39:12 -0000	1.3
  @@ -9,7 +9,7 @@
     <!-- set up properties -->
     <property file="${user.home}/build.properties"/>
     <property file="${user.home}/.ant.properties"/>
  -  <property file="${basedir}/ant.properties"/>
  +  <property file="${basedir}/.ant.properties"/>
     <property file="${basedir}/../ant.properties"/>
     <property file="${basedir}/default.properties"/>
     <property file="${basedir}/../default.properties"/>
  @@ -59,6 +59,7 @@
     
     <!-- Tomcat Stuff -->
     <property name="catalina-version" value="4.1.10"/>
  +  <property name="catalina-zip-suffix" value=""/>
     <property name="catalina-dir-suffix" value=""/>
     
     <property name="tomcat.jars.dir" value="${lib.dir}/tomcat-jars"/>
  @@ -98,7 +99,7 @@
     <!-- Check Presense Of Tomcat 4.0 jars -->
     <target name="checkCatalinaJars">
       <condition property="catalina.present">
  -      <available file="catalina-download/catalina-${catalina-version}.zip"/>
  +      <available file="catalina-download/catalina-${catalina-version}${catalina-zip-suffix}.zip"/>
       </condition>
   
     </target>
  @@ -123,8 +124,8 @@
       <mkdir dir="${lib.dir}"/>
       <mkdir dir="${tomcat.jars.dir}"/>
   
  -    <get src="http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v${catalina-version}${catalina-dir-suffix}/bin/jakarta-tomcat-${catalina-version}.zip"

  -    dest="catalina-download/catalina-${catalina-version}.zip" 
  +    <get src="http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v${catalina-version}${catalina-dir-suffix}/bin/jakarta-tomcat-${catalina-version}${catalina-zip-suffix}.zip"

  +    dest="catalina-download/catalina-${catalina-version}${catalina-zip-suffix}.zip" 
       verbose="true"
       usetimestamp="true"/>
       
  @@ -155,12 +156,12 @@
       />
   
   
  -    <unzip src="catalina-download/catalina-${catalina-version}.zip" dest="catalina-download"
/>
  +    <unzip src="catalina-download/catalina-${catalina-version}${catalina-zip-suffix}.zip"
dest="catalina-download" />
       
       <delete file="${tomcat.jars.dir}/*.jar"/>
       
       <copy todir="${tomcat.jars.dir}" flatten="true">
  -      <fileset dir="catalina-download/jakarta-tomcat-${catalina-version}">
  +      <fileset dir="catalina-download/jakarta-tomcat-${catalina-version}${catalina-zip-suffix}">
           <include  name="**/bin/*.jar"/>
           <include  name="**/lib/*.jar"/>
         </fileset>
  @@ -201,9 +202,9 @@
         </lib>
         
   
  -      <zipfileset dir="catalina-download/jakarta-tomcat-${catalina-version}/webapps"
prefix="webapps"/>
  +      <zipfileset dir="catalina-download/jakarta-tomcat-${catalina-version}${catalina-zip-suffix}/webapps"
prefix="webapps"/>
         
  -      <zipfileset dir="catalina-download/jakarta-tomcat-${catalina-version}/conf" prefix="conf">
  +      <zipfileset dir="catalina-download/jakarta-tomcat-${catalina-version}${catalina-zip-suffix}/conf"
prefix="conf">
           <include name="tomcat-users.xml"/>
         </zipfileset>
   
  
  
  
  1.3       +1 -4      jakarta-avalon-apps/sevak/jo.xml
  
  Index: jo.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/sevak/jo.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jo.xml	22 Sep 2002 09:49:25 -0000	1.2
  +++ jo.xml	22 Sep 2002 21:39:12 -0000	1.3
  @@ -107,10 +107,7 @@
         <echo>* 'get-jo' in the main  *</echo>
         <echo>* build.xml build file  *</echo>    
         <echo>* to download three and *</echo>
  -      <echo>* a half Mb of Jo! for  *</echo>
  -      <echo>* the servlet API and   *</echo>
  -      <echo>* to give EOB WAR file  *</echo>
  -      <echo>* capability.           *</echo>
  +      <echo>* a half Mb of Jo!      *</echo>
         <echo>*************************</echo>   
         
         <fail message="Jo needed. See above."/>   
  
  
  
  1.1                  jakarta-avalon-apps/sevak/jetty.xml
  
  Index: jetty.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project default="main" basedir=".">
  
  <!-- ==========================================================================================
       PROPERTY SETUP
       ==========================================================================================
-->
  
    <!-- set up properties -->
    <property file="${user.home}/build.properties"/>
    <property file="${user.home}/.ant.properties"/>
    <property file="${basedir}/ant.properties"/>
    <property file="${basedir}/../ant.properties"/>
    <property file="${basedir}/default.properties"/>
    <property file="${basedir}/../default.properties"/>
    <property file="${basedir}/../cocoon.properties"/>
  
  
    <!-- Set the installation variables for Cornerstone/Phoenix -->
    <property name="phoenix.home" value="../../jakarta-avalon-phoenix/dist"/>
    <property name="install.dir" value="${phoenix.home}/apps"/>
  
    <!-- Set the properties for intermediate directory -->
    <property name="build.dir" value="build"/>
    <property name="build.lib" value="${build.dir}/lib"/>
    <property name="build.xdoclet" value="${build.dir}/xdoclet"/>
    <property name="build.src" value="${build.dir}/src"/>  
    <property name="build.classes" value="${build.dir}/classes"/>
    <property name="build.javadocs" value="${build.dir}/javadocs"/>  
    <property name="build.docs" value="${build.dir}/docs"/>
    <property name="build.context" value="${build.dir}/documentation"/>  
    <property name="build.xdocs" value="${build.context}/content/xdocs"/>
    
    <!-- Sevak specific properties for building -->
    <property name="build.reports" value="${build.dir}/reports"/>
    <property name="build.demoClasses" value="${build.dir}/demoClasses"/> 
    <property name="build.demoXdoclet" value="${build.dir}/demoXdoclet"/>
  
  
    <!-- Set the properties for source directories -->
    <property name="src.dir" value="src"/>
    <property name="java.dir" value="${src.dir}/java"/>
    <property name="manifest.dir" value="${src.dir}/manifest"/>
    <property name="conf.dir" value="${src.dir}/conf"/>
    <property name="context.dir" value="../../jakarta-avalon/src/documentation"/>  
    <property name="xdocs.dir" value="${src.dir}/xdocs"/>  
    <property name="tools.dir" location="../../jakarta-avalon/tools"/>
     
    <property name="junit.jar" value="${tools.dir}/lib/junit-3.7.jar"/>
    <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>  
    <property name="dist.base" value="dist"/>
    <property name="do.checkstyle" value="true"/>
  
    <property name="lib.dir" value="lib"/>
    <property name="test.dir" value="${src.dir}/test"/>
    <property name="demo.dir" value="${src.dir}/demo"/>
    <property name="java.demo.dir" value="${demo.dir}/java"/>
    <property name="conf.demo.dir" value="${demo.dir}/conf"/>  
    
  
    
    <!-- Jetty stuff -->
    <property name ="jetty.rel"    value="4.1.0RC6"/>
    
    <property name="jetty.jars.dir" value="${lib.dir}/jetty-jars"/>
  
    <path id="project.class.path">
      <pathelement path="${java.class.path}" />
      <pathelement path="${build.classes}" />
      <fileset dir="../common/lib">
        <include name="*.jar" />
      </fileset>
      <fileset dir="../common/lib/xdoclet">
        <include name="*.jar" />
      </fileset>    
      <fileset dir="${jetty.jars.dir}">
        <include name="*.jar" />
      </fileset>       
    </path>
  
    <path id="tools.class.path">
      <pathelement location="${junit.jar}"/>
      <pathelement location="${tools.jar}"/>
      <fileset dir="${tools.dir}/lib"/>
      <fileset dir="${tools.dir}/ext"/>
    </path>
  
    <path id="test.class.path">
      <fileset dir="../common/lib">
        <include name="**/*.jar" />
      </fileset>
      <pathelement path="${build.lib}/sevak-api.jar"/>
    </path>
    
    <taskdef name="sar" classname="org.apache.avalon.phoenix.tools.tasks.Sar">
      <classpath refid="project.class.path" />
    </taskdef>
  
    <target name="checkJettyJars">
      <condition property="jetty.present">
        <available file="jetty-download/jetty-${jetty.rel}.zip"/>
      </condition>
  
    </target>
  
    <target name="checkNeccesaryJars" depends="checkJettyJars" unless="jetty.present">
        <echo>****************************</echo>
        <echo>* Please execute target    *</echo>
        <echo>* 'get-jetty' in the main  *</echo>
        <echo>* build.xml build file     *</echo>    
        <echo>* to download six mega-    *</echo>
        <echo>* bytes of Jetty from      *</echo>
        <echo>* Sourceforge              *</echo>
        <echo>****************************</echo>   
        
        <fail message="Jetty needed. See above."/>   
  
    </target>
  
      
    <target name="get-jetty">
      
      <mkdir  dir="jetty-download"/>
      
      <get src="http://unc.dl.sourceforge.net/sourceforge/jetty/Jetty-${jetty.rel}.zip"

    	dest="jetty-download/Jetty-${jetty.rel}.zip" 
    	verbose="true"
    	usetimestamp="true"/>
    	
      <unzip src="jetty-download/Jetty-${jetty.rel}.zip" dest="jetty-download/Jetty-${jetty.rel}"
/>
        
      <delete file="${jetty.jars.dir}/*.jar"/>      
        
      <copy todir="${jetty.jars.dir}" flatten="true">
        <fileset dir="jetty-download/Jetty-${jetty.rel}">
          <include  name="**/lib/*.jar"/>
        </fileset>
      </copy>
    	
   </target> 
   
   <!-- prepare -->
   <target name="prepare" depends="checkNeccesaryJars" >
   </target>
  
  
   
   <!--- Build Test SAR Archive -->
   <target name="sar" depends="prepare" description="Builds a Demo block which uses Sevak
Service">
   
   
      <ant antfile="build.xml" target="jars"/>
      <ant antfile="build.xml" target="demo-jar"/>
   
      <sar sarfile="${build.lib}/sevak-jetty-demo.sar"
           config="${conf.demo.dir}/jetty-config.xml"
           environment="${conf.demo.dir}/jetty-environment.xml"
           assembly="${conf.demo.dir}/jetty-assembly.xml" >
  
        <lib dir="${build.lib}/">
          <include name="sevak-jetty.jar"/>
          <include name="sevak-demo.jar"/>
          <include name="sevak-api.jar"/>
        </lib>
  
        <lib dir="../../jakarta-avalon-apps/common/lib">
          <include name="cornerstone.jar"/>
        </lib>
      
        <zipfileset dir="jetty-download/Jetty-${jetty.rel}/Jetty-${jetty.rel}/webapps"
prefix="webapps">
            <include name="**/*"/>
        </zipfileset>
        
        <lib dir="${jetty.jars.dir}">
          <include name="*.jar"/>
        </lib>      
             
  
      </sar>
  
      <!-- Copy build/lib contents to dist/ folder -->
  
      <copy todir="${dist.base}">
        <fileset dir="${build.lib}">
          <include name="**"/>
        </fileset>
      </copy>    
  
   </target>
  
   <target name="install" depends="sar" description="Installs Demo SAR into Phoenix" >

       <echo message="Installing to ${install.dir}" />
      <delete dir="${install.dir}/sevak-jetty-demo-demo" />
      <copy file="${build.lib}/sevak-jetty-demo.sar" todir="${install.dir}" />
    </target>
  
  </project>
  
  
  
  1.2       +2 -2      jakarta-avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jo/JoSevak.java
  
  Index: JoSevak.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jo/JoSevak.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JoSevak.java	22 Sep 2002 09:35:01 -0000	1.1
  +++ JoSevak.java	22 Sep 2002 21:39:12 -0000	1.2
  @@ -44,10 +44,10 @@
    * @phoenix:block
    * @phoenix:service name="org.apache.avalon.apps.sevak.Sevak"
    *
  - * Tomcat Wrapper.
  + * Jo Wrapper.
    *
    *
  - * @see <a href="http://jakarta.apache.org/tomcat">Tomcat Project Page</a>
  + * @see <a href="http://www.tagtraum.com/jo.html">Jo! Project Page</a>
    *
    * @author  Hendrik Schreiber & Paul Hammant
    * @version 1.0
  
  
  
  1.1                  jakarta-avalon-apps/sevak/lib/jetty-jars/Readme
  
  Index: Readme
  ===================================================================
  This directory will contain the jetty jars
  
  
  
  
  1.1                  jakarta-avalon-apps/sevak/src/demo/conf/jetty-assembly.xml
  
  Index: jetty-assembly.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN" 
                    "http://jakarta.apache.org/phoenix/assembly_1_0.dtd">
  
  <assembly>
    <block class="org.apache.avalon.apps.sevak.blocks.jetty.JettySevak" name="sevak"/>
    <block class="org.apache.avalon.apps.sevak.demo.SevakTest" name="sevakTest">
  	<provide name="sevak" role="org.apache.avalon.apps.sevak.Sevak"/>
    </block>
  </assembly>
  
  
  
  1.1                  jakarta-avalon-apps/sevak/src/demo/conf/jetty-config.xml
  
  Index: jetty-config.xml
  ===================================================================
  <?xml version="1.0"?>
  <!--
                                  README!
  
      MODIFY the catalina.home parameter to point to the webapps folder 
  
  -->
  <config>
  
    <sevak>
        <hostname>localhost</hostname>
    </sevak>
    <sevakTest>  
    </sevakTest>
  
  </config>
  
  
  
  1.1                  jakarta-avalon-apps/sevak/src/demo/conf/jetty-environment.xml
  
  Index: jetty-environment.xml
  ===================================================================
  <?xml version="1.0"?>
  <!--
                                  README!
  
      Basic config file that sets up context for server application.
  
  -->
  <environment>
  
      <logs>
  
        <category name="" target="default"
                  priority="DEBUG" />
        <category name="objectstorage" target="objectstorage-target"
                  priority="DEBUG" />
  
        <log-target name="default"
                    location="/logs/avalon-demo.log" />
        <log-target name="objectstorage-target"
                    location="/logs/objectstorage.log" />
      </logs>
  
      <policy>
        <grant code-base="sar:SAR-INF/lib/*">
          <permission class="java.security.AllPermission" />
        </grant>
      </policy>
  
  </environment>
  
  
  
  1.1                  jakarta-avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty/JettySevak.java
  
  Index: JettySevak.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.apps.sevak.blocks.jetty;
  
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.CascadingRuntimeException;
  import org.apache.avalon.apps.sevak.Sevak;
  import org.apache.avalon.apps.sevak.SevakException;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.HashMap;
  
  import org.mortbay.jetty.Server;
  import org.mortbay.jetty.servlet.WebApplicationContext;
  import org.mortbay.util.MultiException;
  
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.avalon.apps.sevak.Sevak"
   *
   * Jetty Wrapper.
   *
   *
   * @see <a href="http://jetty.mortbay.com/">Jetty Project Page</a>
   *
   * @author  Paul Hammant
   * @version 1.0
   */
  public class JettySevak extends AbstractLogEnabled implements Sevak, Startable, Contextualizable,
          Configurable
  {
  
      private Server m_server;
      private String m_hostName;
      private HashMap webapps = new HashMap();
  
  
      public JettySevak()
      {
          m_server = new Server();
      }
  
      public void contextualize(final Context context)
      {
          //this.m_context = (BlockContext) context;
      }
  
      public void configure(final Configuration configuration) throws ConfigurationException
      {
          m_hostName = configuration.getChild("hostname").getValue("localhost");
      }
  
      public final void start()
      {
          try
          {
              m_server.start();
          }
          catch (MultiException e)
          {
              throw new CascadingRuntimeException("Some problem starting Jetty",e);
          }
      }
  
      public void stop()
      {
          try
          {
              m_server.stop();
          }
          catch (InterruptedException e)
          {
              throw new CascadingRuntimeException("Some problem stopping Jetty",e);
          }
      }
  
      //----------------------------------------------------------------------------
      // 'deploy' interface
      //----------------------------------------------------------------------------
      /**
       * @param context context path
       * @param pathToWebAppFolder
       */
      public void deploy(String context, File pathToWebAppFolder) throws SevakException
      {
          try
          {
              WebApplicationContext ctx = m_server.addWebApplication(m_hostName, context,
pathToWebAppFolder.getAbsolutePath());
              webapps.put(context,ctx);
          }
          catch (IOException ioe)
          {
              throw new SevakException("Problem deploying web application in Jetty",ioe);
          }
  
      }
  
      public void undeploy(String context) throws SevakException
      {
          WebApplicationContext ctx = (WebApplicationContext) webapps.get(context);
          ctx.destroy();
          webapps.remove(context);
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message