ovidiu      02/03/17 22:47:01

  Modified:    
src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap
                        CallFunctionNode.java
  Log:
  Implement Initializable. Set the `resources' on the interpreter in
  initialize(). This is suboptimal as there can be many call function
  nodes in the sitemap tree, but only one setResources on the
  Interpreter is needed.
  
  Revision  Changes    Path
  1.4       +27 -7     
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/CallFunctionNode.java
  
  Index: CallFunctionNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/CallFunctionNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CallFunctionNode.java     15 Mar 2002 23:40:56 -0000      1.3
  +++ CallFunctionNode.java     18 Mar 2002 06:47:01 -0000      1.4
  @@ -23,18 +23,14 @@
   import org.apache.cocoon.sitemap.PatternException;
   
   public class CallFunctionNode extends AbstractProcessingNode
  -  implements Configurable, Composable
  +  implements Configurable, Composable, Initializable
   {
     protected String functionName;
     protected ArrayList parameters;
     protected MapStackResolver resourceResolver;
     protected ComponentManager manager;
  -  String language;
  -
  -  public CallFunctionNode(String funName)
  -  {
  -    functionName = funName;
  -  }
  +  protected CategoryNode resources;
  +  protected String language;
   
     public static List resolveList(List expressions, List mapStack)
       throws PatternException 
  @@ -54,6 +50,17 @@
       return result;
     }
   
  +  public CallFunctionNode(String funName)
  +  {
  +    functionName = funName;
  +  }
  +
  +  public void setResources(CategoryNode resources)
  +    throws Exception
  +  {
  +    this.resources = resources;
  +  }
  +
     /**
      * Obtain the configuration specific to this node type and update
      * the internal state.
  @@ -90,6 +97,19 @@
     public void compose(ComponentManager manager)
     {
       this.manager = manager;
  +  }
  +
  +  public void initialize()
  +    throws Exception
  +  {
  +    InterpreterSelector selector
  +      = (InterpreterSelector)manager.lookup(Interpreter.ROLE);
  +    if (language == null)
  +      language = selector.getDefaultLanguage();
  +    
  +    // Obtain the Interpreter instance for this language
  +    Interpreter interpreter = (Interpreter)selector.select(language);
  +    interpreter.setResources(resources);
     }
   
     public boolean invoke(Environment env, InvokeContext context)
  
  
  

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