cziegeler    02/05/29 05:02:15

  Modified:    .        changes.xml
               src/java/org/apache/cocoon/components/treeprocessor
                        treeprocessor-builtins.xml
               src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        PipelineNode.java PipelinesNode.java
                        PipelinesNodeBuilder.java
  Added:       src/java/org/apache/cocoon/components
                        SitemapConfigurable.java
  Log:
  Added global parameters to map:pipelines section:
     <map:pipelines>
       <map:global-parameters>
           <map:parameter name="skin" value="cocoon"/>
       </map:global-parameters>
  
       <map:pipeline>
         <map:generate src="doc.xml"/>
         <map:transform src="{skin}.xsl"/>
         <map:serialize/>
       </map:pipeline>
     <map:pipelines>
  
  Started sitemap component configuration stuff
  
  Revision  Changes    Path
  1.176     +4 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.175
  retrieving revision 1.176
  diff -u -r1.175 -r1.176
  --- changes.xml       28 May 2002 13:40:39 -0000      1.175
  +++ changes.xml       29 May 2002 12:02:14 -0000      1.176
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.175 2002/05/28 13:40:39 haul Exp $
  +  $Id: changes.xml,v 1.176 2002/05/29 12:02:14 cziegeler Exp $
   -->
   
   <changes title="History of Changes">
  @@ -38,6 +38,9 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="CZ" type="add">
  +    Added global parameters to map:pipelines section.
  +  </action>
     <action dev="CH" type="update">
      Changed modules to use objectModel instead of just the request object.
     </action>
  
  
  
  1.1                  
xml-cocoon2/src/java/org/apache/cocoon/components/SitemapConfigurable.java
  
  Index: SitemapConfigurable.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
      [EMAIL PROTECTED]
  
   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  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  
  /**
   * Objects implementing this marker interface can get a configuration
   * from the map:pipelines section of the sitemap each time they
   * are looked up.
   *
   * @since @next-version@
   * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
   * @version CVS $Id: SitemapConfigurable.java,v 1.1 2002/05/29 12:02:14 cziegeler 
Exp $
   */
  public interface SitemapConfigurable {
  
      /**
       * Set the <code>Configuration</code>.
       */
      void setSitemapConfiguration(Configuration config)
      throws ConfigurationException;
  }
  
  
  
  1.5       +1 -0      
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml
  
  Index: treeprocessor-builtins.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- treeprocessor-builtins.xml        27 May 2002 12:43:22 -0000      1.4
  +++ treeprocessor-builtins.xml        29 May 2002 12:02:14 -0000      1.5
  @@ -109,6 +109,7 @@
         
         <node name="pipelines" 
builder="org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNodeBuilder">
           <allowed-children>pipeline</allowed-children>
  +        <ignored-children>global-parameters, 
component-configurations</ignored-children>
         </node>
         
         <node name="views" 
builder="org.apache.cocoon.components.treeprocessor.CategoryNodeBuilder"/>
  
  
  
  1.8       +2 -2      
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
  
  Index: PipelineNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PipelineNode.java 29 May 2002 08:20:26 -0000      1.7
  +++ PipelineNode.java 29 May 2002 12:02:15 -0000      1.8
  @@ -72,12 +72,12 @@
   import java.util.*;
   
   /**
  - *
  + * Handles &lt;map:pipeline&gt;
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Gianugo Rabellino</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: PipelineNode.java,v 1.7 2002/05/29 08:20:26 cziegeler Exp $
  + * @version CVS $Id: PipelineNode.java,v 1.8 2002/05/29 12:02:15 cziegeler Exp $
    */
   public class PipelineNode
       extends AbstractParentProcessingNode
  
  
  
  1.6       +23 -5     
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java
  
  Index: PipelinesNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PipelinesNode.java        27 May 2002 14:02:30 -0000      1.5
  +++ PipelinesNode.java        29 May 2002 12:02:15 -0000      1.6
  @@ -56,10 +56,10 @@
   
   import org.apache.cocoon.ResourceNotFoundException;
   
  -import org.apache.cocoon.environment.Redirector;
  -
  +import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.ForwardRedirector;
  +import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.components.treeprocessor.SimpleParentProcessingNode;
   import org.apache.cocoon.components.treeprocessor.ProcessingNode;
   import org.apache.cocoon.components.treeprocessor.InvokeContext;
  @@ -72,7 +72,8 @@
    * Handles &lt;map:pipelines&gt;
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Id: PipelinesNode.java,v 1.5 2002/05/27 14:02:30 cziegeler Exp $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  + * @version CVS $Id: PipelinesNode.java,v 1.6 2002/05/29 12:02:15 cziegeler Exp $
    */
   
   public final class PipelinesNode extends SimpleParentProcessingNode
  @@ -84,8 +85,21 @@
   
       private Processor processor;
   
  -    public PipelinesNode(Processor processor) {
  +    private Map globalParameters;
  +
  +    /**
  +     * Constructor
  +     * @param processor               The processor for this sitemap
  +     * @param parameters              Optional global parameters for this sitemap 
(can be null)
  +     * @param componentConfigurations Optional sitemap configurations for components
  +     */
  +    public PipelinesNode(Processor       processor,
  +                         Map             parameters,
  +                         Configuration[] componentConfigurations) {
           this.processor = processor;
  +        // FIXME - we have the parameters and the component configurations
  +        // and now?
  +        this.globalParameters = parameters;
       }
   
       /**
  @@ -137,7 +151,11 @@
               // FIXME : is there any useful information that can be passed as 
top-level parameters,
               //         such as the URI of the mount point ?
   
  -            return invokeNodes(this.children, env, context);
  +            if ( null == this.globalParameters) {
  +                return invokeNodes(this.children, env, context);
  +            } else {
  +                return invokeNodes(this.children, env, context, 
this.globalParameters);
  +            }
   
           } finally {
   
  
  
  
  1.3       +33 -4     
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNodeBuilder.java
  
  Index: PipelinesNodeBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNodeBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PipelinesNodeBuilder.java 27 Mar 2002 15:13:40 -0000      1.2
  +++ PipelinesNodeBuilder.java 29 May 2002 12:02:15 -0000      1.3
  @@ -53,21 +53,50 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.thread.ThreadSafe;
  -
   import org.apache.cocoon.components.treeprocessor.ContainerNodeBuilder;
   import org.apache.cocoon.components.treeprocessor.ProcessingNode;
  +import java.util.HashMap;
  +import java.util.Map;
   
   /**
    * Builds a &lt;map:pipelines&gt;
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Id: PipelinesNodeBuilder.java,v 1.2 2002/03/27 15:13:40 sylvain 
Exp $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  + * @version CVS $Id: PipelinesNodeBuilder.java,v 1.3 2002/05/29 12:02:15 cziegeler 
Exp $
    */
   
   public class PipelinesNodeBuilder extends ContainerNodeBuilder implements 
ThreadSafe {
   
  -    public ProcessingNode buildNode(Configuration config) throws Exception {
  -        PipelinesNode node = new PipelinesNode(this.treeBuilder.getProcessor());
  +    public ProcessingNode buildNode(Configuration config)
  +    throws Exception {
  +        Map parameters = null;
  +        Configuration[] componentConfigs = null;
  +
  +        // check for global paramters
  +        Configuration child = config.getChild("global-parameters", false);
  +        if ( null != child ) {
  +            this.checkNamespace(child);
  +
  +            Configuration[] children = child.getChildren("parameter");
  +            if (children.length != 0) {
  +                parameters = new HashMap();
  +                for (int i = 0; i < children.length; i++) {
  +                    Configuration param = children[i];
  +                    this.checkNamespace(param);
  +                    parameters.put(param.getAttribute("name"), 
param.getAttribute("value"));
  +                }
  +            }
  +        }
  +        // check for component configurations
  +        child = config.getChild("component-configurations", false);
  +        if (child != null) {
  +            this.checkNamespace(child);
  +            componentConfigs = child.getChildren();
  +        }
  +        PipelinesNode node = new PipelinesNode(this.treeBuilder.getProcessor(),
  +                                               parameters,
  +                                               componentConfigs);
           this.treeBuilder.setupNode(node, config);
   
           ProcessingNode[] children = buildChildNodes(config);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to