You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/02/02 12:20:13 UTC

cvs commit: jakarta-turbine-3/src/java/org/apache/turbine TurbineXmlConfig.java TurbineConfig.java

epugh       2004/02/02 03:20:13

  Modified:    src/java/org/apache/turbine TurbineConfig.java
  Added:       src/java/org/apache/turbine TurbineXmlConfig.java
  Log:
  Port of TurbineXmlConfig from T2.3..
  
  Revision  Changes    Path
  1.9       +6 -6      jakarta-turbine-3/src/java/org/apache/turbine/TurbineConfig.java
  
  Index: TurbineConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/TurbineConfig.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TurbineConfig.java	31 Jan 2004 01:34:50 -0000	1.8
  +++ TurbineConfig.java	2 Feb 2004 11:20:13 -0000	1.9
  @@ -123,19 +123,19 @@
       public static final String PROPERTIES_KEY = "properties";
   
       /** Enables output of debug messages (compile time option). */
  -    private final static boolean DEBUG = false;
  +    protected final static boolean DEBUG = false;
   
       /** Filenames are looked up in this directory. */
  -    private File root;
  +    protected File root;
   
       /** Servlet container (or emulator) attributes. */
  -    private Map attributes;
  +    protected Map attributes;
   
       /** Turbine servlet initialization parameters. */
  -    private Map initParams;
  +    protected Map initParams;
   
       /** The Turbine servlet instance used for initialization. */
  -    private Turbine turbine;
  +    protected Turbine turbine;
   
       /**
        * This is the general form of the constructor. You can provide
  
  
  
  1.1                  jakarta-turbine-3/src/java/org/apache/turbine/TurbineXmlConfig.java
  
  Index: TurbineXmlConfig.java
  ===================================================================
  package org.apache.turbine;
  
  /* ====================================================================
   * 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 java.util.HashMap;
  import java.util.Hashtable;
  import java.util.Map;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * A class used for initalization of Turbine without a servlet container.
   *
   * If you need to use Turbine outside of a servlet container, you can
   * use this class for initalization of the Turbine servlet.<br>
   *
   * <blockquote><code><pre>
   * TurbineConfig config = new TurbineXmlConfig(".", "/conf/TurbineConfiguration.xml");
   * </pre></code></blockquote>
   *
   * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
   * @version $Id: TurbineXmlConfig.java,v 1.1 2004/02/02 11:20:13 epugh Exp $
   */
  public class TurbineXmlConfig extends TurbineConfig
  {
      private static final Log log = LogFactory.getLog(TurbineXmlConfig.class);
  
      /**
       * Servlet initialization parameter name for the path to
       * TurbineConfiguration.xml file used by Turbine
       */
      public static final String CONFIGURATION_PATH_KEY = "configuration";
  
     
      /**
       * This is the general form of the constructor. You can provide
       * a path to search for files, and a name-value map of init
       * parameters.
       *
       * <p> For the list of recognized init parameters, see
       * {@link org.apache.turbine.Turbine} class.
       *
       * @param path The web application root (i.e. the path for file lookup).
       * @param attributes Servlet container (or emulator) attributes.
       * @param initParams Global (i.e. psuedo-context wide)
       * initialization parameters.
       */
      public TurbineXmlConfig(String path, Map attributes, Map initParams)
      {
          super(path, attributes, initParams);
      }
  
      /**
       * @see #TurbineConfig(String path, Map attributes, Map initParams)
       */
      public TurbineXmlConfig(String path, Map initParams)
      {
          this(path, new Hashtable(0), initParams);
      }
  
      /**
       * This is a specialized constructor that allows to configure
       * Turbine easiliy in the common setups.
       *
       * @param path The web application root (i.e. the path for file lookup).
       * @param properties the relative path to TurbineResources.properties file
       */
      public TurbineXmlConfig(String path, String properties)
      {
          this(path, new HashMap(1));
          initParams.put(CONFIGURATION_PATH_KEY, properties);
      }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org