You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cr...@apache.org on 2002/09/09 15:25:41 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/reading ComposerReader.java DatabaseReader.java JSPReader.java

crafterm    2002/09/09 06:25:41

  Modified:    .        changes.xml
               src/java/org/apache/cocoon/reading DatabaseReader.java
                        JSPReader.java
  Added:       src/java/org/apache/cocoon/reading ComposerReader.java
  Log:
  Added new ComposerReader class and refactored several existing readers to
  use it. Also removed some unneeded implements/imports.
  PR: 12122
  
  Revision  Changes    Path
  1.242     +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.241
  retrieving revision 1.242
  diff -u -r1.241 -r1.242
  --- changes.xml	7 Sep 2002 01:46:33 -0000	1.241
  +++ changes.xml	9 Sep 2002 13:25:38 -0000	1.242
  @@ -14,6 +14,7 @@
     <person name="Donald Ball" email="balld@apache.org" id="DB"/>
     <person name="Nicola Ken Barozzi" email="nicolaken@apache.org" id="NKB"/>     
     <person name="Ross Burton" email="rossb@apache.org" id="RB"/>
  +  <person name="Marcus Crafter" email="crafterm@apache.org" id="MC"/>
     <person name="David Crossley" email="crossley@apache.org" id="DC"/>
     <person name="Torsten Curdt" email="tcurdt@apache.org" id="TC"/>
     <person name="Gerhard Froehlich" email="froehlich@apache.org" id="GF"/>
  @@ -39,6 +40,9 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="MC" type="add" fixes-bug="12122">
  +    Added new ComposerReader class with various Reader refactorings.
  +  </action>
     <action dev="OP" type="update">
       Don't explicitly redirect to the cocoon:/ pipeline in
       AbstractInterpreter.forwardTo(), do it instead in
  
  
  
  1.10      +5 -8      xml-cocoon2/src/java/org/apache/cocoon/reading/DatabaseReader.java
  
  Index: DatabaseReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/reading/DatabaseReader.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DatabaseReader.java	4 Jun 2002 09:42:02 -0000	1.9
  +++ DatabaseReader.java	9 Sep 2002 13:25:40 -0000	1.10
  @@ -51,7 +51,6 @@
   package org.apache.cocoon.reading;
   
   import org.apache.avalon.excalibur.datasource.DataSourceComponent;
  -import org.apache.avalon.excalibur.pool.Poolable;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.*;
   import org.apache.avalon.framework.configuration.Configurable;
  @@ -87,8 +86,8 @@
    * @version CVS $Id$
    */
   public class DatabaseReader
  -   extends AbstractReader
  -   implements Composable, Configurable, Disposable, CacheableProcessingComponent, Poolable {
  +   extends ComposerReader
  +   implements Configurable, Disposable, CacheableProcessingComponent {
       private ComponentSelector dbselector;
       private String dsn;
       private long lastModified = System.currentTimeMillis();
  @@ -98,14 +97,12 @@
       private boolean doCommit = false;
       private boolean defaultCache = true;
   
  -    private ComponentManager manager;
  -
       /**
        * Compose the object so that we get the <code>Component</code>s we need from
        * the <code>ComponentManager</code>.
        */
  -    public void compose(ComponentManager manager) throws ComponentException {
  -        this.manager = manager;
  +    public void compose(final ComponentManager manager) throws ComponentException {
  +        super.compose(manager);
           this.dbselector = (ComponentSelector) manager.lookup(DataSourceComponent.ROLE + "Selector");
       }
   
  
  
  
  1.7       +2 -12     xml-cocoon2/src/java/org/apache/cocoon/reading/JSPReader.java
  
  Index: JSPReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/reading/JSPReader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JSPReader.java	7 Jun 2002 13:15:09 -0000	1.6
  +++ JSPReader.java	9 Sep 2002 13:25:40 -0000	1.7
  @@ -58,10 +58,6 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  -import org.apache.avalon.excalibur.pool.Poolable;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
  -
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.jsp.JSPEngine;
   import org.apache.cocoon.environment.Context;
  @@ -76,13 +72,7 @@
    * @author <a href="mailto:kpiroumian@flagship.ru">Konstantin Piroumian</a>
    * @version CVS $Id$
    */
  -public class JSPReader extends AbstractReader implements Composable, Poolable {
  -
  -    private ComponentManager manager;
  -
  -    public void compose (ComponentManager manager) {
  -        this.manager = manager;
  -    }
  +public class JSPReader extends ComposerReader {
   
       /**
        * Generates the output from JSP page.
  
  
  
  1.1                  xml-cocoon2/src/java/org/apache/cocoon/reading/ComposerReader.java
  
  Index: ComposerReader.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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 Cocoon" 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 (INCLU-
   DING, 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 and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.reading;
  
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  
  /**
   * The <code>ComposerReader</code> will allow any <code>Reader</code>
   * that extends this to access SitemapComponents.
   *
   * @author <a href="mailto:crafterm@apache.org">Marcus Crafter</a>
   * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
   * @version CVS $Id: ComposerReader.java,v 1.1 2002/09/09 13:25:40 crafterm Exp $
   */
  public abstract class ComposerReader extends AbstractReader
      implements Composable {
  
      /** The component manager instance */
      protected ComponentManager manager;
  
      /**
       * Set the current <code>ComponentManager</code> instance used by this
       * <code>Composable</code>.
       */
      public void compose(final ComponentManager manager) throws ComponentException {
          this.manager = manager;
      }
  }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org