You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2003/04/05 00:20:51 UTC

cvs commit: avalon-phoenix/examples/testserver/src/manifest test-extension1.mf test-extension2.mf testserver.mf

donaldp     2003/04/04 14:20:51

  Added:       examples/testserver WARNING.txt build.xml
               examples/testserver/src/conf testserver-assembly.xml
                        testserver-config.xml testserver-environment.xml
               examples/testserver/src/java/org/apache/avalon/testserver
                        DummyClass.java PacketPokingTest.java
                        SimpleListener.java SimpleServer.java WARNING.txt
               examples/testserver/src/java/org/apache/avalon/testserver/classes
                        ClassesTest.java
               examples/testserver/src/java/org/apache/avalon/testserver/cltest
                        CLTest.java
               examples/testserver/src/java/org/apache/avalon/testserver/extension1
                        ExtensionTestClass1.java
               examples/testserver/src/java/org/apache/avalon/testserver/extension2
                        ExtensionTestClass2.java
               examples/testserver/src/manifest test-extension1.mf
                        test-extension2.mf testserver.mf
  Log:
  Add in testserver as phoenix example
  
  Revision  Changes    Path
  1.1                  avalon-phoenix/examples/testserver/WARNING.txt
  
  Index: WARNING.txt
  ===================================================================
  Unlike the package name would suggest. This is *not* a simple example. In fact
  it serves as a basic application which features have been added to over time to
  test various features of phoenix. It is recomended you don't look at this demo
  unless you are familiar with Avalon/Phoenix.
  
  
  1.1                  avalon-phoenix/examples/testserver/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="TestServer" default="main" basedir=".">
  
      <!-- set up properties -->
      <property file="${user.home}/build.properties"/>
      <property file="${user.home}/.ant.properties"/>
  
      <property name="name" value="testserver"/>
      <property name="Name" value="TestServer"/>
      <property name="version" value="0.7"/>
  
      <!-- Set the installation variables for Cornerstone/Phoenix -->
      <property name="phoenix.home" value="../../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="gen.dir" value="${build.dir}/gen"/>
      <property name="build.src" value="${build.dir}/src"/>
      <property name="build.classes" value="${build.dir}/classes"/>
  
      <!-- 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="tools.dir" location="../../avalon/tools"/>
  
      <property name="dist.base" value="distributions"/>
  
      <path id="project.class.path">
          <pathelement path="${java.class.path}"/>
          <pathelement path="${build.classes}"/>
          <fileset dir="../common/lib">
              <include name="**/*.jar"/>
          </fileset>
      </path>
  
      <taskdef name="sar" classname="org.apache.avalon.phoenix.tools.tasks.Sar">
          <classpath refid="project.class.path"/>
      </taskdef>
  
      <!-- Compiles project -->
      <target name="compile">
  
          <mkdir dir="${build.classes}"/>
  
          <javac srcdir="${java.dir}"
              destdir="${build.classes}"
              debug="${build.debug}"
              optimize="${build.optimize}"
              deprecation="${build.deprecation}">
              <classpath refid="project.class.path"/>
  
          </javac>
  
          <copy todir="${build.classes}">
              <fileset dir="${java.dir}">
                  <exclude name="**/test/**"/>
                  <exclude name="**/*.java"/>
              </fileset>
          </copy>
  
      </target>
  
  
      <!-- Make .xinfo and manifest automatically for blocks -->
      <target name="phoenix-meta" depends="compile">
  
          <mkdir dir="${gen.dir}"/>
  
          <taskdef name="generatemeta" classname="org.apache.avalon.phoenix.tools.metagenerate.MetaGenerateTask">
              <classpath refid="project.class.path"/>
          </taskdef>
  
          <generatemeta dest="${gen.dir}">
              <fileset dir="${java.dir}">
                  <include name="**/*.java"/>
              </fileset>
          </generatemeta>
  
      </target>
  
      <!-- Jars up project -->
      <target name="jars" depends="phoenix-meta">
  
          <mkdir dir="${build.lib}"/>
  
          <jar jarfile="${build.lib}/testserver.jar"
              manifest="${manifest.dir}/testserver.mf">
              <fileset dir="${build.classes}">
                  <include name="org/apache/avalon/testserver/**"/>
                  <exclude name="org/apache/avalon/testserver/extension1/*"/>
                  <exclude name="org/apache/avalon/testserver/cltest/*"/>
                  <exclude name="org/apache/avalon/testserver/extension2/*"/>
                  <exclude name="org/apache/avalon/testserver/classes/*"/>
              </fileset>
              <fileset dir="${gen.dir}">
                  <include name="**/*.xinfo"/>
              </fileset>
          </jar>
  
          <jar jarfile="${build.lib}/demo-test-extension1.jar"
              basedir="${build.classes}"
              manifest="${manifest.dir}/test-extension1.mf">
              <include name="org/apache/avalon/testserver/extension1/*"/>
          </jar>
  
          <jar jarfile="${build.lib}/demo-test-extension2.jar"
              basedir="${build.classes}"
              manifest="${manifest.dir}/test-extension2.mf">
              <include name="org/apache/avalon/testserver/extension2/*"/>
          </jar>
  
          <jar jarfile="${build.lib}/cltest.jar"
              basedir="${build.classes}">
              <include name="org/apache/avalon/testserver/cltest/*"/>
          </jar>
  
      </target>
  
      <target name="main" depends="sars" description="Default target to generate build products"/>
  
      <target name="sars" depends="jars">
  
          <sar sarfile="${build.lib}/avalon-${name}.sar"
              config="${conf.dir}/testserver-config.xml"
              environment="${conf.dir}/testserver-environment.xml"
              assembly="${conf.dir}/testserver-assembly.xml">
  
              <zipfileset dir="${build.classes}" prefix="SAR-INF/classes">
                  <include name="org/apache/avalon/testserver/classes/*"/>
              </zipfileset>
  
              <zipfileset dir="${build.lib}/" prefix="lib">
                  <include name="cltest.jar"/>
              </zipfileset>
  
              <zipfileset dir="src/java" fullpath="README.txt">
                  <include name="**/WARNING.txt"/>
              </zipfileset>
  
              <lib dir="${build.lib}/">
                  <include name="*.jar"/>
                  <exclude name="demo-test-extension2.jar"/>
                  <exclude name="cltest.jar"/>
              </lib>
  
              <lib dir="../common/lib">
                  <include name="cornerstone.jar"/>
                  <include name="excalibur-thread*.jar"/>
                  <include name="excalibur-pool*.jar"/>
                  <include name="excalibur-io*.jar"/>
                  <include name="excalibur-collections*.jar"/>
              </lib>
  
          </sar>
  
          <mkdir dir="dist"/>
  
          <copy todir="dist">
              <fileset dir="${build.lib}">
                  <include name="**"/>
              </fileset>
          </copy>
  
      </target>
  
  
      <!-- Completely build all dists -->
      <target name="dist" description="Generates the distribution">
  
          <property name="dist.name" value="${Name}-${version}"/>
  
          <mkdir dir="${dist.base}"/>
  
          <antcall target="bin-dist" inheritAll="false">
              <param name="bin.dist.dir" value="${dist.name}"/>
          </antcall>
  
          <zip zipfile="${dist.base}/${dist.name}-bin.zip"
              basedir="${dist.name}/.."
              includes="${dist.name}/**"/>
  
          <tar longfile="gnu" tarfile="${dist.base}/${dist.name}-bin.tar">
              <tarfileset dir="${dist.name}/.." username="avalon" group="avalon">
                  <include name="${dist.name}/**"/>
              </tarfileset>
          </tar>
  
          <gzip zipfile="${dist.base}/${dist.name}-bin.tar.gz"
              src="${dist.base}/${dist.name}-bin.tar"/>
  
          <delete file="${dist.base}/${dist.name}-bin.tar"/>
          <delete dir="${dist.name}"/>
  
          <antcall target="src-dist" inheritAll="false">
              <param name="src.dist.dir" value="${dist.name}"/>
          </antcall>
  
          <zip zipfile="${dist.base}/${dist.name}-src.zip"
              basedir="${dist.name}/.."
              includes="${dist.name}/**">
              <fileset dir="..">
                  <include name="common/lib/avalon-*"/>
                  <include name="common/lib/cornerstone.jar"/>
                  <include name="common/lib/phoenix-*"/>
                  <include name="common/lib/qdox-*"/>
              </fileset>
          </zip>
  
          <tar longfile="gnu" tarfile="${dist.base}/${dist.name}-src.tar">
              <tarfileset dir="${dist.name}/.." mode="755" username="avalon" group="avalon">
                  <include name="${dist.name}/build.sh"/>
              </tarfileset>
              <tarfileset dir="${dist.name}/.." username="avalon" group="avalon">
                  <include name="${dist.name}/**"/>
                  <exclude name="${dist.name}/build.sh"/>
              </tarfileset>
              <tarfileset dir=".." username="avalon" group="avalon">
                  <include name="common/lib/avalon-*"/>
                  <include name="common/lib/cornerstone.jar"/>
                  <include name="common/lib/phoenix-*"/>
                  <include name="common/lib/qdox-*"/>
              </tarfileset>
          </tar>
  
          <gzip zipfile="${dist.base}/${dist.name}-src.tar.gz"
              src="${dist.base}/${dist.name}-src.tar"/>
          <delete file="${dist.base}/${dist.name}-src.tar"/>
          <delete dir="${dist.name}"/>
  
      </target>
  
      <!-- Creates all the .sar files -->
      <target name="bin-dist" depends="main">
  
          <!-- bin.dist.dir usually set before this target is called -->
          <property name="bin.dist.dir" value="dist"/>
          <property name="bin.dist.lib" value="${bin.dist.dir}/lib"/>
  
          <copy file="${build.lib}/avalon-testserver.sar" tofile="${bin.dist.dir}/avalon-testserver-${version}.sar"/>
  
          <chmod dir="${bin.dist.dir}" perm="go-rwx"/>
      </target>
  
      <target name="install" depends="main" description="Installs into Phoenix">
          <!-- <fail message="install.dir not specified." unless="install.dir"/> -->
          <echo message="Installing to ${install.dir}"/>
          <delete dir="${install.dir}/avalon-testserver"/>
          <copy file="${build.lib}/avalon-testserver.sar" todir="${install.dir}"/>
          <copy file="${build.lib}/demo-test-extension2.jar"
              tofile="${phoenix.home}/ext/demo-test-extension2.jar"
              overwrite="true"/>
      </target>
  
      <target name="uninstall" description="Uninstalls from Phoenix">
  
          <!-- <fail message="install.dir not specified." unless="install.dir"/> -->
          <delete dir="${install.dir}/avalon-testserver/"/>
          <delete file="avalon-testserver.sar" dir="${install.dir}"/>
      </target>
  
      <target name="clean" description="Cleans up artifacts from build process">
          <delete dir="${build.dir}"/>
          <delete>
              <fileset dir="." includes="**/*~" defaultexcludes="no"/>
          </delete>
      </target>
  
      <target name="distclean" depends="clean" description="Cleans up all generated files and directories">
          <delete dir="${bin.dist.dir}"/>
          <delete dir="${dist.base}"/>
      </target>
  
  </project>
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/conf/testserver-assembly.xml
  
  Index: testserver-assembly.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
                    "http://jakarta.apache.org/avalon/dtds/phoenix/assembly_1_0.dtd">
  
  <assembly>
  
    <listener class="org.apache.avalon.testserver.SimpleListener"
                    name="simple-listener" />
  
    <!-- The Storage block -->
    <block class="org.apache.avalon.cornerstone.blocks.masterstore.RepositoryManager"
           name="objectstorage" />
  
    <!-- The Packet Manager block -->
    <block class="org.apache.avalon.cornerstone.blocks.packet.DefaultPacketManager"
           name="packet-manager">
      <provide name="thread-manager"
               role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
    </block>
  
    <!-- The ThreadManager block -->
    <block class="org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager"
           name="thread-manager" />
  
    <!-- The Connection Manager block -->
    <block class="org.apache.avalon.cornerstone.blocks.connection.DefaultConnectionManager"
           name="connections">
      <provide name="thread-manager"
               role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
    </block>
  
    <!-- The Socket Manager block -->
    <block class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketManager" name="sockets" />
  
    <!-- The TimeScheduler block -->
    <block class="org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler" name="scheduler">
      <provide name="thread-manager"
               role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
    </block>
  
    <!--                                          -->
    <!-- Below this section are the simple server -->
    <!--                                          -->
  
    <block class="org.apache.avalon.testserver.SimpleServer"
           name="simple-server" >
  
      <!-- The names here must match the names specified for a Block in some conf.xml file.
      The role should be the interface mentioned in the BlockInfo (.xinfo) files  -->
  
  
      <provide name="packet-manager"
               role="org.apache.avalon.cornerstone.services.packet.PacketManager"/>
      <provide name="sockets" role="org.apache.avalon.cornerstone.services.sockets.SocketManager"/>
      <provide name="connections"
               role="org.apache.avalon.cornerstone.services.connection.ConnectionManager" />
      <provide name="objectstorage" role="org.apache.avalon.cornerstone.services.store.Store"/>
      <provide name="scheduler"
               role="org.apache.avalon.cornerstone.services.scheduler.TimeScheduler"/>
    </block>
  
  </assembly>
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/conf/testserver-config.xml
  
  Index: testserver-config.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <config>
  
    <thread-manager>
        <thread-group>
          <name>default</name>
  
          <!-- normal priority == 5, max-priority = 10 -->
          <priority>5</priority>
  
          <!-- are threads deamon threads ? -->
          <is-daemon>false</is-daemon>
  
          <max-threads>40</max-threads>
          <!-- these are ignored at the moment but will be fixed in later revisions -->
          <min-threads>20</min-threads>
          <min-spare-threads>20</min-spare-threads>
        </thread-group>
    </thread-manager>
  
    <!-- The Storage block -->
    <objectstorage>
        <repositories>
          <repository class="org.apache.avalon.cornerstone.blocks.masterstore.File_Persistent_Object_Repository">
            <protocols>
              <protocol>file</protocol>
            </protocols>
            <types>
              <type>OBJECT</type>
            </types>
            <models>
              <model>SYNCHRONOUS</model>
              <model>ASYNCHRONOUS</model>
              <model>CACHE</model>
            </models>
          </repository>
          <repository class="org.apache.avalon.cornerstone.blocks.masterstore.File_Persistent_Stream_Repository">
            <protocols>
              <protocol>file</protocol>
            </protocols>
            <types>
              <type>STREAM</type>
            </types>
            <models>
              <model>SYNCHRONOUS</model>
              <model>ASYNCHRONOUS</model>
              <model>CACHE</model>
            </models>
          </repository>
        </repositories>
    </objectstorage>
  
    <sockets>
        <server-sockets>
          <factory name="plain"
                   class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory" />
        </server-sockets>
  
        <client-sockets>
          <factory name="plain"
                   class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory" />
        </client-sockets>
    </sockets>
  
    <simple-listener>
     <!-- dummy configuration to make sure  listener configure is called-->
    </simple-listener>
  
    <simple-server>
      <!-- Note trailing file searator in destinationURL -->
        <repository destinationURL="file://var/demo/" type="OBJECT" model="SYNCHRONOUS"/>
        <port>4556</port>
    </simple-server>
  
  </config>
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/conf/testserver-environment.xml
  
  Index: testserver-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" />
        <category name="simple-server" target="simple-server" priority="DEBUG" />
        <log-target name="default" location="/logs/avalon-demo.log" />
        <log-target name="objectstorage-target" location="/logs/objectstorage.log" />
        <log-target name="simple-server" location="/logs/simple-server.log" />
      </logs>
  
      <classloaders default="default" version="1.0">
          <predefined name="*system*"/>
  
          <classloader name="default" parent="*system*">
              <entry location="SAR-INF/classes/"/>
              <fileset dir="SAR-INF/lib">
                  <include name="*.jar"/>
              </fileset>
          </classloader>
  
          <classloader name="cltest" parent="*system*">
              <entry location="lib/cltest.jar"/>
          </classloader>
  
      </classloaders>
  
  </environment>
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/DummyClass.java
  
  Index: DummyClass.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver;
  
  import java.io.Serializable;
  
  /**
   * This is a dummy class to test Store. If this is in a seperate bar
   * from the masterstore classes, reading it from disc will throw a
   * ClassNotFoundException.
   *
   * @author Charles Benett <ch...@benett1.demon.co.uk>
   */
  public class DummyClass
      implements Serializable
  {
      private String m_name;
  
      public void setName( final String name )
      {
          m_name = name;
      }
  
      public String getName()
      {
          return m_name;
      }
  }
  
  
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/PacketPokingTest.java
  
  Index: PacketPokingTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver;
  
  import java.net.DatagramPacket;
  import java.net.DatagramSocket;
  import java.net.InetAddress;
  
  /**
   * Test Simpleervers packet-manager
   */
  public class PacketPokingTest
  {
      public static final void main( String[] argv )
          throws Exception
      {
          final DatagramSocket socket = new DatagramSocket();
          socket.connect( InetAddress.getLocalHost(), 5053 );
          final DatagramPacket packet = new DatagramPacket( new byte[ 1 ], 0 );
          socket.send( packet );
      }
  }
  
  
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/SimpleListener.java
  
  Index: SimpleListener.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver;
  
  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.phoenix.ApplicationEvent;
  import org.apache.avalon.phoenix.ApplicationListener;
  import org.apache.avalon.phoenix.BlockEvent;
  
  /**
   * This is a simple block listener to demonstrate deployment.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public class SimpleListener
      implements ApplicationListener, Configurable
  {
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
          System.out.println( "SimpleBlockListener.configure() called!" );
      }
  
      /**
       * Notification that a block has just been added
       * to Server Application.
       *
       * @param event the BlockEvent
       */
      public void blockAdded( final BlockEvent event )
      {
          System.out.println( "Added block '" + event.getName() + "'" );
      }
  
      /**
       * Notification that a block is just about to be
       * removed from Server Application.
       *
       * @param event the BlockEvent
       */
      public void blockRemoved( final BlockEvent event )
      {
      }
  
      public void applicationStarting( ApplicationEvent applicationEvent ) throws Exception
      {
      }
  
      public void applicationStarted()
      {
      }
  
      public void applicationStopping()
      {
      }
  
      public void applicationStopped()
      {
      }
  
      public void applicationFailure( Exception causeOfFailure )
      {
      }
  }
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/SimpleServer.java
  
  Index: SimpleServer.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver;
  
  import java.io.BufferedOutputStream;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.InterruptedIOException;
  import java.io.PrintWriter;
  import java.io.InputStream;
  import java.net.DatagramPacket;
  import java.net.DatagramSocket;
  import java.net.ProtocolException;
  import java.net.ServerSocket;
  import java.net.Socket;
  import java.net.SocketException;
  import java.util.Iterator;
  import java.util.StringTokenizer;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
  import org.apache.avalon.cornerstone.services.connection.ConnectionManager;
  import org.apache.avalon.cornerstone.services.packet.PacketHandler;
  import org.apache.avalon.cornerstone.services.packet.PacketHandlerFactory;
  import org.apache.avalon.cornerstone.services.packet.PacketManager;
  import org.apache.avalon.cornerstone.services.scheduler.PeriodicTimeTrigger;
  import org.apache.avalon.cornerstone.services.scheduler.Target;
  import org.apache.avalon.cornerstone.services.scheduler.TimeScheduler;
  import org.apache.avalon.cornerstone.services.scheduler.TimeTrigger;
  import org.apache.avalon.cornerstone.services.sockets.ServerSocketFactory;
  import org.apache.avalon.cornerstone.services.sockets.SocketManager;
  import org.apache.avalon.cornerstone.services.store.ObjectRepository;
  import org.apache.avalon.cornerstone.services.store.Store;
  import org.apache.avalon.framework.activity.Initializable;
  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.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.avalon.phoenix.BlockContext;
  import org.apache.avalon.testserver.classes.ClassesTest;
  import org.apache.avalon.testserver.extension1.ExtensionTestClass1;
  import org.apache.avalon.testserver.extension2.ExtensionTestClass2;
  
  /**
   * This is a demo block used to demonstrate a simple server using Avalon. The
   * server listens on a port specified in .confs. All commands are one line
   * commands. It understands three commands: PUT, COUNT, LIST.
   * <br>PUT <string> stores the given string on the file system
   * <br>COUNT counts the number of strings stored
   * <br>LIST responds with all the strings, one per line.
   *
   * @phoenix:block
   *
   * @author Charles Benett <ch...@benett1.demon.co.uk>
   * @author Federico Barbieri <fe...@apache.org>
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public class SimpleServer
      extends AbstractLogEnabled
      implements Contextualizable, Serviceable, Configurable, Initializable,
      ConnectionHandlerFactory, ConnectionHandler, Target, PacketHandler, PacketHandlerFactory
  {
      private TimeScheduler m_timeScheduler;
      private Configuration m_configuration;
      private SocketManager m_socketManager;
      private ConnectionManager m_connectionManager;
      private Store m_testStore;
      private ObjectRepository m_repository;
      private PacketManager m_packetManager;
  
      private PrintWriter m_out;
      private int m_count;
      private BlockContext m_context;
  
      public void contextualize( final Context context )
      {
          m_context = (BlockContext)context;
      }
  
      protected final BlockContext getBlockContext()
      {
          return m_context;
      }
  
      /**
       *
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.store.Store"
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.connection.ConnectionManager"
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.sockets.SocketManager"
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.packet.PacketManager"
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.scheduler.TimeScheduler"
       *
       */
      public void service( final ServiceManager serviceManager )
          throws ServiceException
      {
          m_testStore = (Store)serviceManager.lookup( Store.ROLE );
          m_socketManager = (SocketManager)serviceManager.lookup( SocketManager.ROLE );
          m_connectionManager = (ConnectionManager)serviceManager.lookup( ConnectionManager.ROLE );
          m_timeScheduler = (TimeScheduler)serviceManager.lookup( TimeScheduler.ROLE );
          m_packetManager = (PacketManager)serviceManager.lookup( PacketManager.ROLE );
      }
  
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
          m_configuration = configuration;
      }
  
      public void initialize()
          throws Exception
      {
          getLogger().info( "init Demo ..." );
  
          final Configuration repConf = m_configuration.getChild( "repository" );
          getLogger().info( "Want to use repository in:" +
                            repConf.getAttribute( "destinationURL" ) );
          m_repository = (ObjectRepository)m_testStore.select( repConf );
          getLogger().info( "Got repository" );
  
          TimeTrigger trigger = null;
  
          trigger = new PeriodicTimeTrigger( -1, 2 * 1000 );
          m_timeScheduler.addTrigger( "try", trigger, this );
  
          trigger = new PeriodicTimeTrigger( 9 * 1000, -1 );
          m_timeScheduler.addTrigger( "do", trigger, this );
  
          //trigger = new CronTimeTrigger( -1, -1, -1, -1, -1, false );
          //m_timeScheduler.addTrigger( "cron-trigger", trigger, this );
  
          final int port = m_configuration.getChild( "port" ).getValueAsInteger();
          getLogger().info( "Want to open port on:" + port );
  
          final ServerSocketFactory factory =
              m_socketManager.getServerSocketFactory( "plain" );
          final ServerSocket serverSocket = factory.createServerSocket( port );
  
          m_connectionManager.connect( "DemoListener", serverSocket, this );
  
          getLogger().info( "Got socket" );
  
          getLogger().info( "Testing access to Extension in same .sar ..." );
          ExtensionTestClass1.doSomeThing();
          getLogger().info( "...successful test" );
  
          getLogger().info( "Testing access to Extension from central extension repository..." );
          ExtensionTestClass2.doSomeThing();
          getLogger().info( "...successful test" );
  
          getLogger().info( "Creating datagram socket..." );
          final DatagramSocket datagramSocket = new DatagramSocket( 5053 );
          getLogger().info( "...successful" );
  
          getLogger().info( "Connecting datagram socket..." );
          m_packetManager.connect( "udp/5053", datagramSocket, this );
          getLogger().info( "...successful" );
  
          getLogger().info( "Testing a class loaded from SAR-INF/classes..." );
          ClassesTest.doClassesTest();
          getLogger().info( "...successful" );
  
          testResource( "/README.txt" );
          testResource( "README.txt" );
          testResource( "SAR-INF/config.xml" );
          testResource( "SAR-INF/lib/cornerstone.jar" );
  
          getLogger().info( "Testing loading a class from a non-standard ClassLoader tree" );
          final ClassLoader classLoader =
              getBlockContext().getClassLoader( "cltest" );
          try
          {
              classLoader.loadClass( "org.apache.avalon.testserver.cltest.CLTest" );
          }
          catch( final ClassNotFoundException cnfe )
          {
              final String message =
                  "Failed to load class CLTest from cltest classloader";
              throw new Exception( message );
          }
  
          getLogger().info( "...Demo init" );
      }
  
      private void testResource( String resourceName ) throws Exception
      {
          final InputStream resourceAsStream =
              m_context.getResourceAsStream( resourceName );
          if( null == resourceAsStream )
          {
              final String message = "Unable to load resource named: " + resourceName;
              throw new Exception( message );
          }
          else
          {
              final String message =
                  "Loaded resource named " + resourceName +
                  " as " + resourceAsStream;
              System.out.println( message );
          }
      }
  
      /**
       * Construct an appropriate PacketHandler.
       *
       * @return the new PacketHandler
       * @exception Exception if an error occurs
       */
      public PacketHandler createPacketHandler()
          throws Exception
      {
          return this;
      }
  
      /**
       * Handle a datgram packet.
       * This handler is responsible for processing packets as they occur.
       *
       * @param packet the packet
       * @exception IOException if an error reading from socket occurs
       * @exception ProtocolException if an error handling connection occurs
       */
      public void handlePacket( final DatagramPacket packet )
          throws IOException, ProtocolException
      {
          System.out.println( "Pickety pickety pop - got a packet!" );
      }
  
      /**
       * Construct an appropriate ConnectionHandler.
       *
       * @return the new ConnectionHandler
       * @exception Exception if an error occurs
       */
      public ConnectionHandler createConnectionHandler()
          throws Exception
      {
          //Can return this because the ConnectionHandler is thread safe
          return this;
      }
  
      /**
       * Release a previously created ConnectionHandler e.g. for spooling.
       */
      public void releaseConnectionHandler( ConnectionHandler connectionHandler )
      {
      }
  
      /**
       * Handle a connection.
       * This handler is responsible for processing connections as they occur.
       *
       * @param socket the connection
       * @exception IOException if an error reading from socket occurs
       * @exception ProtocolException if an error handling connection occurs
       */
      public void handleConnection( final Socket socket )
          throws IOException, ProtocolException
      {
          String remoteHost = null;
          String remoteIP = null;
  
          try
          {
              final BufferedReader in =
                  new BufferedReader( new InputStreamReader( socket.getInputStream() ), 1024 );
              m_out =
                  new PrintWriter( new BufferedOutputStream( socket.getOutputStream() ), true );
  
              remoteHost = socket.getInetAddress().getHostName();
              remoteIP = socket.getInetAddress().getHostAddress();
  
              getLogger().info( "Connection from " + remoteHost + " ( " + remoteIP + " )" );
  
              //Greet connection
              m_out.println( "Welcome to the Avalon Demo Server!" );
  
              // Handle connection
              while( parseCommand( in.readLine() ) )
              {
                  // timeServer.resetAlarm(this.toString());
              }
  
              //Finish
              m_out.flush();
              socket.close();
          }
          catch( final SocketException se )
          {
              getLogger().info( "Socket to " + remoteHost + " closed remotely." );
          }
          catch( final InterruptedIOException iioe )
          {
              getLogger().info( "Socket to " + remoteHost + " timeout." );
          }
          catch( IOException ioe )
          {
              getLogger().info( "Exception handling socket to " + remoteHost + ":" +
                                ioe.getMessage() );
          }
          catch( final Exception e )
          {
              getLogger().info( "Exception on socket: " + e.getMessage() );
          }
          finally
          {
              try
              {
                  socket.close();
              }
              catch( final IOException ioe )
              {
                  getLogger().error( "Exception closing socket: " + ioe.getMessage() );
              }
          }
      }
  
      public void targetTriggered( final String triggerName )
      {
          if( triggerName.equals( "do" ) )
          {
              try
              {
                  m_timeScheduler.removeTrigger( "try" );
              }
              catch( final Exception e )
              {
                  e.printStackTrace();
              }
          }
  
          System.out.println( "[" + getBlockContext().getName() + "] Target triggered: " + triggerName );
      }
  
      private boolean parseCommand( String command )
          throws Exception
      {
          if( null == command )
          {
              return false;
          }
  
          getLogger().info( "Command received: " + command );
  
          StringTokenizer commandLine = new StringTokenizer( command.trim() );
          int arguments = commandLine.countTokens();
          String argument = null;
          if( 0 == arguments )
          {
              return true;
          }
  
          String fullcommand = command;
          command = commandLine.nextToken();
          if( arguments > 1 )
          {
              argument = fullcommand.substring( command.length() + 1 );
          }
  
          if( command.equalsIgnoreCase( "TEST" ) )
          {
              m_out.println( "You said 'TEST'" );
  
              final DummyClass write = new DummyClass();
              write.setName( argument );
  
              try
              {
                  m_repository.put( argument, write );
              }
              catch( final Exception e )
              {
                  getLogger().warn( "Exception putting into repository: " + e );
              }
  
              m_out.println( "Dummy written, trying for read" );
              try
              {
                  m_repository.list();
              }
              catch( Exception e )
              {
                  getLogger().warn( "Exception reading from repository: " + e, e );
              }
  
              DummyClass read = null;
              try
              {
                  read = (DummyClass)m_repository.get( argument );
              }
              catch( final Exception e )
              {
                  getLogger().warn( "Exception reading from repository: " + e, e );
              }
  
              m_out.println( "Recovered: " + read.getName() );
              return true;
          }
          else if( command.equalsIgnoreCase( "PUT" ) )
          {
              m_out.println( "You said 'PUT'" );
              final String key = "AMsg" + ++m_count;
              m_repository.put( key, argument );
              return true;
          }
          else if( command.equalsIgnoreCase( "LIST" ) )
          {
              m_out.println( "You said 'LIST'" );
  
              final Iterator it = m_repository.list();
  
              while( it.hasNext() )
              {
                  String k = (String)it.next();
                  String txt = (String)m_repository.get( k );
                  m_out.println( "Msg " + k + " was " + txt );
              }
              m_out.println( "That's All folks!" );
              return true;
          }
          else if( command.equalsIgnoreCase( "COUNT" ) )
          {
              m_out.println( "You said 'COUNT'" );
              Iterator it = m_repository.list();
              int c = 0;
  
              while( it.hasNext() )
              {
                  it.next();
                  c = c + 1;
              }
  
              m_out.println( "Number of messages in repository is: " + c );
              return true;
          }
          else
          {
              m_out.println( "Only valid commands are: PUT, LIST or COUNT." );
              return true;
          }
      }
  }
  
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/WARNING.txt
  
  Index: WARNING.txt
  ===================================================================
  Unlike the package name would suggest. This is *not* a simple example. In fact
  it serves as a basic application which features have been added to over time to 
  test various features of phoenix. It is recomended you don't look at this demo 
  unless you are familiar with Avalon/Phoenix.
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/classes/ClassesTest.java
  
  Index: ClassesTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver.classes;
  
  /**
   * This is a class that resides in SAR-INF/classes and used to test
   * classloading from that location.
   */
  public class ClassesTest
  {
      public static void doClassesTest()
      {
          System.out.println( "ClassesTest.doClassesTest()" );
      }
  }
  
  
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/cltest/CLTest.java
  
  Index: CLTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver.cltest;
  
  /**
   * This is a s simple class to test declaration of classloaders
   * in environment.xml
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2003/04/04 22:20:50 $
   */
  public class CLTest
  {
  }
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/extension1/ExtensionTestClass1.java
  
  Index: ExtensionTestClass1.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver.extension1;
  
  import java.io.Serializable;
  
  /**
   * A simple class to test loading an extension that
   * is contained within the .sar.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public class ExtensionTestClass1
      implements Serializable
  {
      public static void doSomeThing()
      {
          System.out.println( "ExtensionTestClass1.doSomeThing()" );
      }
  }
  
  
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/java/org/apache/avalon/testserver/extension2/ExtensionTestClass2.java
  
  Index: ExtensionTestClass2.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.testserver.extension2;
  
  import java.io.Serializable;
  
  /**
   * A simple class to test loading an extension that
   * is contained within the central extension repository.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public class ExtensionTestClass2
      implements Serializable
  {
      public static void doSomeThing()
      {
          System.out.println( "ExtensionTestClass2.doSomeThing()" );
      }
  }
  
  
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/manifest/test-extension1.mf
  
  Index: test-extension1.mf
  ===================================================================
  Manifest-Version: 1.0
  Extension-Name: cornerstone.test.extension
  Specification-Title: Avalon Cornerstone Test Extension
  Specification-Version: 1.1
  Specification-Vendor: Jakarta Apache
  Implementation-Vendor-Id: org.apache.avalon
  Implementation-Vendor: Apache Avalon Project
  Implementation-Version: 1.0.2
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/manifest/test-extension2.mf
  
  Index: test-extension2.mf
  ===================================================================
  Manifest-Version: 1.0
  Extension-Name: cornerstone.test.extension2
  Specification-Title: Avalon Cornerstone Test Extension
  Specification-Version: 1.1
  Specification-Vendor: Jakarta Apache
  Implementation-Vendor-Id: org.apache.avalon
  Implementation-Vendor: Apache Avalon Project
  Implementation-Version: 1.0.2
  
  
  
  
  1.1                  avalon-phoenix/examples/testserver/src/manifest/testserver.mf
  
  Index: testserver.mf
  ===================================================================
  Extension-List: ext1 ext2
  ext1-Extension-Name: cornerstone.test.extension
  ext2-Extension-Name: cornerstone.test.extension2
  
  

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