ovidiu      02/04/09 17:44:54

  Modified:    
src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap
                        ContinueNode.java
  Log:
  Allow passing parameters in <map:continue>.
  
  Revision  Changes    Path
  1.3       +23 -2     
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/ContinueNode.java
  
  Index: ContinueNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/ContinueNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContinueNode.java 9 Apr 2002 05:36:57 -0000       1.2
  +++ ContinueNode.java 10 Apr 2002 00:44:54 -0000      1.3
  @@ -1,5 +1,7 @@
   package org.apache.cocoon.components.treeprocessor.sitemap;
   
  +import java.util.ArrayList;
  +import java.util.List;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
  @@ -20,6 +22,7 @@
     implements Configurable, Composable
   {
     protected String continuationId;
  +  protected List parameters;
     protected MapStackResolver continuationIdResolver;
     protected ComponentManager manager;
   
  @@ -31,9 +34,20 @@
     public void configure(Configuration config)
       throws ConfigurationException
     {
  +    parameters = new ArrayList();
  +
  +    Configuration[] params = config.getChildren("parameter");
  +    for (int i = 0; i < params.length; i++) {
  +      Configuration param = params[i];
  +      String name = param.getAttribute("name", null);
  +      String value = param.getAttribute("value", null);
  +      parameters.add(new Interpreter.Argument(name, value));
  +    }
  +
       try {
  +      // The continuation id should would need to be resolved at all
  +      // times, but who knows...
         if (MapStackResolver.needsResolve(continuationId)) {
  -        // This should happen all the time, but who knows...
           this.continuationIdResolver
             = MapStackResolver.getResolver(continuationId);
         }
  @@ -51,6 +65,13 @@
     public boolean invoke(Environment env, InvokeContext context)
         throws Exception
     {
  +    List params = null;
  +
  +    // Resolve parameters
  +    if (this.parameters != null)
  +      params = CallFunctionNode.resolveList(this.parameters,
  +                                            context.getMapStack());
  +
       String contId = continuationId;
   
       if (continuationIdResolver != null) {
  @@ -69,7 +90,7 @@
       Interpreter interpreter = (Interpreter)selector.select(language);
   
       try {
  -      interpreter.handleContinuation(contId, env, context);
  +      interpreter.handleContinuation(contId, params, env, context);
       }
       finally {
         selector.release((Component)interpreter);
  
  
  

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