You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2002/06/27 00:46:02 UTC

cvs commit: jakarta-commons-sandbox/pattern default.properties build.xml LICENSE

scolebourne    2002/06/26 15:46:01

  Added:       pattern/src/java/org/apache/commons/pattern/factory
                        FactoryException.java FactoryUtils.java
                        Factory.java
               pattern  default.properties build.xml LICENSE
  Log:
  Initial checkin
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/pattern/src/java/org/apache/commons/pattern/factory/FactoryException.java
  
  Index: FactoryException.java
  ===================================================================
  package org.apache.commons.pattern.factory;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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/>.
   */
  
  import org.apache.commons.lang.exception.NestableRuntimeException;
  
  /**
   * Exception thrown when the a Factory cannot create the object as requested.
   * If required, a root cause error can be wrapped within this one.
   *
   * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
   * @version $Id:  $
   */
  public class FactoryException extends NestableRuntimeException {
  
      /**
       * Constructs a new <code>FactoryException</code> without specified
       * detail message.
       */
      public FactoryException() {
          super();
      }
  
      /**
       * Constructs a new <code>FactoryException</code> with specified
       * detail message.
       *
       * @param msg  the error message.
       */
      public FactoryException(String msg) {
          super(msg);
      }
  
      /**
       * Constructs a new <code>FactoryException</code> with specified
       * nested <code>Throwable</code> root cause.
       *
       * @param rootCause  the exception or error that caused this exception
       *                   to be thrown.
       */
      public FactoryException(Throwable rootCause) {
          super(rootCause);
      }
  
      /**
       * Constructs a new <code>FactoryException</code> with specified
       * detail message and nested <code>Throwable</code> root cause.
       *
       * @param msg        the error message.
       * @param rootCause  the exception or error that caused this exception
       *                   to be thrown.
       */
      public FactoryException(String msg, Throwable rootCause) {
          super(msg, rootCause);
      }
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/pattern/src/java/org/apache/commons/pattern/factory/FactoryUtils.java
  
  Index: FactoryUtils.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FactoryUtils.java,v 1.1 2002/05/29 02:57:41 arron Exp $
   * $Revision: 1.1 $
   * $Date: 2002/05/29 02:57:41 $
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", 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 names without prior written
   *    permission of the Apache Group.
   *
   * 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.commons.pattern.factory;
  
  import java.io.Serializable;
  import java.lang.reflect.Constructor;
  import java.lang.reflect.InvocationTargetException;
  import java.lang.reflect.Method;
  
  import org.apache.commons.lang.Serialization;
  import org.apache.commons.lang.SerializationException;
  
  /**
   * <code>FactoryUtils</code> provides reference implementations and utilities
   * for the Factory pattern interface.
   *
   * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
   * @version $Id:  $
   */
  public class FactoryUtils {
      
      private static final Factory NULL_FACTORY = new ConstantFactory(null);
  
      /** 
       * Creates a Factory that will return null each time the factory is used.
       *
       * @return the factory.
       */
      public static Factory nullFactory() {
          return NULL_FACTORY;
      }
  
      /** 
       * Creates a Factory that will return the same object each time the factory
       * is used. No check is made that the object is immutable. In general, only
       * immutable objects should use the constant factory. Mutable objects should
       * use the prototype factory.
       *
       * @param constantToReturn  the constant object to return each time in the factory
       * @return the factory.
       */
      public static Factory constantFactory(Object constantToReturn) {
          return new ConstantFactory(constantToReturn);
      }
  
      /** 
       * Creates a Factory that will return a clone of the same prototype object
       * each time the factory is used. The prototype will be cloned using one of these
       * techniques (in order):
       * <ul>
       * <li>public clone method
       * <li>public copy constructor
       * <li>serialization clone
       * <ul>
       *
       * @param constantToReturn  the constant object to return each time in the factory
       * @return the factory.
       * @throws IllegalArgumentException if the prototype is null
       * @throws IllegalArgumentException if the prototype cannot be cloned
       */
      public static Factory prototypeFactory(Object prototype) {
          if (prototype == null) {
              throw new IllegalArgumentException("PrototypeFactory: The prototype must not be null");
          }
          // TODO: move to cloneable pattern
          try {
              prototype.getClass().getMethod("clone", null);
              return new PrototypeCloneFactory(prototype);
              
          } catch (NoSuchMethodException ex) {
              try {
                  prototype.getClass().getConstructor(new Class[] {prototype.getClass()});
                  return new ReflectionFactory(prototype.getClass(),
                      new Class[] {prototype.getClass()}, new Object[] {prototype});
                  
              } catch (NoSuchMethodException ex2) {
                  if (prototype instanceof Serializable) {
                      return new PrototypeSerializationFactory((Serializable) prototype);
                  }
              }
          }
          throw new IllegalArgumentException("PrototypeFactory: The prototype must be cloneable");
      }
  
      /** 
       * Creates a Factory that can create objects of a specific type using
       * a no-args constructor.
       *
       * @param classToInstantiate  the Class to instantiate each time in the factory
       * @return the factory.
       * @throws IllegalArgumentException if the classToInstantiate is null
       */
      public static Factory reflectionFactory(Class classToInstantiate) {
          return new ReflectionFactory(classToInstantiate);
      }
  
      /** 
       * Creates a Factory that can create objects of a specific type using
       * the arguments specified to this method.
       *
       * @param classToInstantiate  the Class to instantiate each time in the factory
       * @param paramTypes  parameter types for the constructor
       * @param args  the arguments to pass to the constructor
       * @return the factory.
       * @throws IllegalArgumentException if the classToInstantiate is null
       * @throws IllegalArgumentException if the paramTypes and args don't match
       * @throws IllegalArgumentException if the constructor doesn't exist
       */
      public static Factory reflectionFactory(
              Class classToInstantiate, Class[] paramTypes, Object[] args) {
          return new ReflectionFactory(classToInstantiate, paramTypes, args);
      }
  
      // ConstantFactory
      //----------------------------------------------------------------------------------
      
      /**
       * ConstantFactory returns the same instance each time.
       */
      private static class ConstantFactory implements Factory, Serializable {
          
          private final Object iConstant;
          
          /**
           * Constructor to store constant
           */
          private ConstantFactory(Object constant) {
              super();
              iConstant = constant;
          }
          
          /**
           * Always return constant
           */
          public Object create() {
              return iConstant;
          }
          
      }
      
      
      // PrototypeCloneFactory
      //----------------------------------------------------------------------------------
      
      /**
       * PrototypeCloneFactory creates objects by copying a prototype using the clone method.
       */
      private static class PrototypeCloneFactory implements Factory, Serializable {
          
          private final Object iPrototype;
          private transient Method iCloneMethod;
          
          /**
           * Constructor to store prototype
           */
          private PrototypeCloneFactory(Object prototype) {
              super();
              if (prototype == null) {
                  throw new IllegalArgumentException("PrototypeCloneFactory: The prototype must not be null");
              }
              iPrototype = prototype;
              
              findCloneMethod();
          }
  
          /**
           * Find the Clone method for the class specified.
           */
          private void findCloneMethod() {
              try {
                  iCloneMethod = iPrototype.getClass().getMethod("clone", null);
                  
              } catch (NoSuchMethodException ex) {
                  throw new IllegalArgumentException("PrototypeCloneFactory: The clone method must exist and be public ");
              }
          }
          
          /**
           * Return clone of prototype
           */
          public Object create() {
              // needed for post-serialization
              if (iCloneMethod == null) {
                  findCloneMethod();
              }
  
              try {
                  return iCloneMethod.invoke(iPrototype, null);
                  
              } catch (IllegalAccessException ex) {
                  throw new FactoryException("ReflectionFactory: Clone method must be public", ex);
              } catch (InvocationTargetException ex) {
                  throw new FactoryException("ReflectionFactory: Clone method threw an exception", ex);
              }
          }
          
      }
      
      
      // PrototypeSerializationFactory
      //----------------------------------------------------------------------------------
      
      /**
       * PrototypeSerializationFactory creates objects by cloning a prototype using serialization.
       */
      private static class PrototypeSerializationFactory implements Factory, Serializable {
          
          private final Serializable iPrototype;
          
          /**
           * Constructor to store prototype
           */
          private PrototypeSerializationFactory(Serializable prototype) {
              super();
              if (prototype == null) {
                  throw new IllegalArgumentException("PrototypeSerializationFactory: The prototype must not be null");
              }
              iPrototype = prototype;
          }
          
          /**
           * Return clone of prototype by serialization
           */
          public Object create() {
              try {
                  return Serialization.clone(iPrototype);
                  
              } catch (SerializationException ex) {
                  throw new FactoryException("PrototypeSerializationFactory: Unable to clone by serialization", ex);
              }
          }
          
      }
      
      
      // ReflectionFactory
      //----------------------------------------------------------------------------------
      
      /**
       * ReflectionFactory creates objects using reflection.
       */
      private static class ReflectionFactory implements Factory, Serializable {
          
          private final Class iClassToInstantiate;
          private final Class[] iParamTypes;
          private final Object[] iArgs;
          private transient Constructor iConstructor = null;
  
          /**
           * Constructor
           */
          public ReflectionFactory(Class classToInstantiate) {
              this(classToInstantiate, null, null);
          }
  
          /* builds the object factory taking all the options needed to provide
           * arguments to a constructor.
           */
          public ReflectionFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) {
              super();
              if (classToInstantiate == null) {
                  throw new IllegalArgumentException("ReflectionFactory: The classToInstantiate must not be null");
              }
              if (((paramTypes == null) && (args != null)) ||
                  ((paramTypes != null) && (args == null)) ||
                  ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {
                  throw new IllegalArgumentException("ReflectionFactory: The paramTypes must match the args");
              }
              
              iClassToInstantiate = classToInstantiate;
              iParamTypes = paramTypes;
              iArgs = args;
              
              findConstructor();
          }
  
          /**
           * Find the Constructor for the class specified.
           */
          private void findConstructor() {
              try {
                  iConstructor = iClassToInstantiate.getConstructor(iParamTypes);
                  
              } catch (NoSuchMethodException ex) {
                  throw new IllegalArgumentException("ReflectionFactory: The constructor must exist and be public ");
              }
          }
          
          /**
           * Create the object using a constructor
           */
          public Object create() {
              // needed for post-serialization
              if (iConstructor == null) {
                  findConstructor();
              }
  
              try {
                  return iConstructor.newInstance(iArgs);
                  
              } catch (InstantiationException ex) {
                  throw new FactoryException("ReflectionFactory: InstantiationException", ex);
              } catch (IllegalAccessException ex) {
                  throw new FactoryException("ReflectionFactory: Constructor must be public", ex);
              } catch (InvocationTargetException ex) {
                  throw new FactoryException("ReflectionFactory: Constructor threw an exception", ex);
              }
          }
      }
  }
  
  
  1.1                  jakarta-commons-sandbox/pattern/src/java/org/apache/commons/pattern/factory/Factory.java
  
  Index: Factory.java
  ===================================================================
  package org.apache.commons.pattern.factory;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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/>.
   */
  
  
  /**
   * <code>Factory</code> defines an interface implemented by classes that
   * create objects.
   *
   * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
   * @version $Id:  $
   */
  public interface Factory {
      
      /**
       * Deserializes a single object from an array of bytes.
       *
       * @return an new object
       * @throws FactoryException (runtime) if the factory cannot create an object
       */
      public Object create();
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/pattern/default.properties
  
  Index: default.properties
  ===================================================================
  # The pathname of the "junit.jar" JAR file
  junit.jar = ${junit.home}/junit-3.7.jar
  
  # The name of this component
  component.name = commons-pattern
  
  # The primary package name of this component
  component.package = org.apache.commons.pattern
  
  # The title of this component
  component.title = Core Pattern Utilities
  
  # The current version number of this component
  component.version = 1.0-dev
  
  # The name that is used to create the jar file
  final.name = ${component.name}-${component.version}
  
  # The base directory for compilation targets
  build.home = target
  
  # The base directory for component configuration files
  conf.home = src/conf
  
  # The base directory for distribution targets
  dist.home = dist
  
  # The base directory for component sources
  source.home = src/java
  
  # The base directory for unit test sources
  test.home = src/test
  
  # Should Java compilations set the 'debug' compiler option?
  compile.debug = true
  
  # Should Java compilations set the 'deprecation' compiler option?
  compile.deprecation = true
  
  # Should Java compilations set the 'optimize' compiler option?
  compile.optimize = true
  
  # Should all tests fail if one does?
  test.failonerror = true
  
  # The test runner to execute
  test.runner = junit.textui.TestRunner
  
  # The location of the lang classes
  lang.classes = ../lang/target/classes
  
  
  
  
  1.1                  jakarta-commons-sandbox/pattern/build.xml
  
  Index: build.xml
  ===================================================================
  <project name="Pattern" default="compile" basedir=".">
  
  
  <!--
          "Pattern" component of the Jakarta Commons Subproject
          $Id: build.xml,v 1.6 2002/03/23 00:43:00 jon Exp $
  -->
  
  
  <!-- ========== Initialize Properties ===================================== -->
  
    <property file="${user.home}/${component.name}.build.properties" /> 
    <property file="${user.home}/build.properties" />
    <property file="${basedir}/build.properties" />
    <property file="${basedir}/default.properties" />
  
  <!-- ========== Construct compile classpath =============================== -->
  
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${lang.classes}"/>
    </path>
  
  <!-- ========== Construct unit test classpath ============================= -->
  
    <path id="test.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${build.home}/tests"/>
      <pathelement location="${junit.jar}"/>
    </path>
  
  <!-- ========== Executable Targets ======================================== -->
  
    <target name="init"
     description="Initialize and evaluate conditionals">
      <echo message="-------- ${component.name} ${component.version} --------"/>
      <filter  token="name"                  value="${component.name}"/>
      <filter  token="package"               value="${component.package}"/>
      <filter  token="version"               value="${component.version}"/>
    </target>
  
  
    <target name="prepare" depends="init"
     description="Prepare build directory">
      <mkdir dir="${build.home}"/>
      <mkdir dir="${build.home}/classes"/>
      <mkdir dir="${build.home}/conf"/>
      <mkdir dir="${build.home}/tests"/>
    </target>
  
  
    <target name="static" depends="prepare"
     description="Copy static files to build directory">
      <tstamp/>
      <copy  todir="${build.home}/conf" filtering="on">
        <fileset dir="${conf.home}" includes="*.MF"/>
      </copy>
    </target>
  
  
    <target name="compile" depends="static"
     description="Compile shareable components">
      <javac  srcdir="${source.home}"
             destdir="${build.home}/classes"
               debug="${compile.debug}"
         deprecation="${compile.deprecation}"
            optimize="${compile.optimize}">
        <classpath refid="compile.classpath"/>
      </javac>
      <copy    todir="${build.home}/classes" filtering="on">
        <fileset dir="${source.home}" excludes="**/*.java"/>
      </copy>
    </target>
  
  
    <target name="compile.tests" depends="compile"
     description="Compile unit test cases">
      <javac  srcdir="${test.home}"
             destdir="${build.home}/tests"
               debug="${compile.debug}"
         deprecation="${compile.deprecation}"
            optimize="${compile.optimize}">
        <classpath refid="test.classpath"/>
      </javac>
      <copy    todir="${build.home}/tests" filtering="on">
        <fileset dir="${test.home}" excludes="**/*.java"/>
      </copy>
    </target>
  
  
    <target name="clean"
     description="Clean build and distribution directories">
      <delete    dir="${build.home}"/>
      <delete    dir="${dist.home}"/>
    </target>
  
  
    <target name="all" depends="clean,compile"
     description="Clean and compile all components"/>
  
  
    <target name="javadoc" depends="compile"
     description="Create component Javadoc documentation">
      <mkdir      dir="${dist.home}"/>
      <mkdir      dir="${dist.home}/docs"/>
      <mkdir      dir="${dist.home}/docs/api"/>
      <javadoc sourcepath="${source.home}"
                  destdir="${dist.home}/docs/api"
             packagenames="org.apache.commons.*"
                   author="true"
                  private="true"
                  version="true"
                 doctitle="&lt;h1&gt;${component.title}&lt;/h1&gt;"
              windowtitle="${component.title} (Version ${component.version})"
                   bottom="Copyright (c) 2001-2002 - Apache Software Foundation">
        <classpath refid="compile.classpath"/>
      </javadoc>
    </target>
  
  
    <target name="dist" depends="compile,javadoc"
     description="Create binary distribution">
      <mkdir      dir="${dist.home}"/>
      <copy      file="LICENSE"
                todir="${dist.home}"/>
      <copy      file="RELEASE-NOTES.txt"
                todir="${dist.home}"/>
      <antcall target="jar"/>
    </target>
  
  
    <target name="jar" depends="compile"
     description="Create jar">
      <mkdir      dir="${dist.home}"/>
      <mkdir      dir="${build.home}/classes/META-INF"/>
      <copy      file="LICENSE"
               tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
      <jar    jarfile="${dist.home}/${final.name}.jar"
              basedir="${build.home}/classes"
             manifest="${build.home}/conf/MANIFEST.MF"/>
    </target>
  
  
    <target name="install-jar" depends="jar"
     description="--> Installs jar file in ${lib.repo}">
      <copy todir="${lib.repo}" filtering="no">
        <fileset dir="${dist.home}">
          <include name="${final.name}.jar"/>
        </fileset>
      </copy>
    </target>
  
  
  <!-- ========== Unit Test Targets ========================================= -->
  
  
    <target name="test"  depends="compile.tests"
     description="Run all unit test cases">
  <!--  add tests as targets above...  -->
    </target>
  
  <!--
    <target name="test.strings" depends="compile.tests">
      <echo message="Running Strings tests ..."/>
      <java classname="${test.runner}" fork="yes"
          failonerror="${test.failonerror}">
        <arg value="org.apache.commons.lang.StringsTest"/>
        <classpath refid="test.classpath"/>
      </java>
    </target>
  -->
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/pattern/LICENSE
  
  Index: LICENSE
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/LICENSE,v 1.1 2002/04/02 16:20:36 morgand Exp $
   * $Revision: 1.1 $
   * $Date: 2002/04/02 16:20:36 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", 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 names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
   */ 
  
  
  
  
  
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>