You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ov...@apache.org on 2002/03/13 20:04:52 UTC

cvs commit: xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap CallNodeBuilder2.java

ovidiu      02/03/13 11:04:52

  Added:       src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap
                        CallNodeBuilder2.java
  Log:
  Call node builder that creates either a CallNode or a CallFunctionNode.
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/CallNodeBuilder2.java
  
  Index: CallNodeBuilder2.java
  ===================================================================
  package org.apache.cocoon.components.treeprocessor.sitemap;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  
  import org.apache.cocoon.components.treeprocessor.AbstractProcessingNodeBuilder;
  import org.apache.cocoon.components.treeprocessor.CategoryNode;
  import org.apache.cocoon.components.treeprocessor.CategoryNodeBuilder;
  import org.apache.cocoon.components.treeprocessor.MapStackResolver;
  import org.apache.cocoon.components.treeprocessor.LinkedProcessingNodeBuilder;
  import org.apache.cocoon.components.treeprocessor.ProcessingNode;
  
  import java.util.*;
  
  public class CallNodeBuilder2 extends CallNodeBuilder
    implements LinkedProcessingNodeBuilder
  {
    protected String functionName;
  
    public ProcessingNode buildNode(Configuration config)
      throws Exception
    {
      this.resourceName = config.getAttribute("resource", null);
      this.functionName = config.getAttribute("function", null);
  
      if (resourceName == null && functionName == null)
        throw new ConfigurationException("<map:call> must have either a 'resource' or a 'function' attribute!");
  
      if (resourceName != null)
        this.node = new CallNode();
      else
        this.node = new CallFunctionNode(functionName);
  
      this.treeBuilder.setupNode(this.node, config);
  
      return this.node;
    }
  
    public void linkNode()
      throws Exception
    {
      if (resourceName != null)
        super.linkNode();
      // else do nothing
    }
  }
  
  
  

----------------------------------------------------------------------
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