ovidiu      02/03/14 12:25:07

  Modified:    
src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap
                        ScriptNode.java
  Log:
  Implement Contextualizable to be able to read the script file from the
  WAR app.
  
  Revision  Changes    Path
  1.3       +15 -6     
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/ScriptNode.java
  
  Index: ScriptNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/ScriptNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScriptNode.java   14 Mar 2002 03:52:04 -0000      1.2
  +++ ScriptNode.java   14 Mar 2002 20:25:07 -0000      1.3
  @@ -1,11 +1,8 @@
   package org.apache.cocoon.components.treeprocessor.sitemap;
   
   
  -
  -
  -
  -
  -
  +//import org.apache.avalon.framework.context.Context;
  +import java.io.InputStream;
   import java.util.List;
   import java.util.Map;
   import org.apache.avalon.framework.activity.Initializable;
  @@ -13,6 +10,9 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.avalon.framework.component.Composable;
  +import org.apache.avalon.framework.context.ContextException;
  +import org.apache.avalon.framework.context.Contextualizable;
  +import org.apache.cocoon.Constants;
   import org.apache.cocoon.components.flow.Interpreter;
   import org.apache.cocoon.components.treeprocessor.AbstractProcessingNode;
   import org.apache.cocoon.components.treeprocessor.CategoryNode;
  @@ -20,14 +20,16 @@
   import org.apache.cocoon.components.treeprocessor.MapStackResolver;
   import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
   import org.apache.cocoon.components.treeprocessor.ProcessingNode;
  +import org.apache.cocoon.environment.Context;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.sitemap.PatternException;
   
   public class ScriptNode extends AbstractProcessingNode
  -    implements Composable, Initializable
  +  implements Composable, Initializable, Contextualizable
   {
     String source;
     String language;
  +  Context context;
   
     public ScriptNode(String source, String language)
     {
  @@ -56,6 +58,12 @@
       return true;
     }
   
  +  public void contextualize(org.apache.avalon.framework.context.Context context)
  +    throws ContextException
  +  {
  +    this.context = (Context)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  +  }
  +
     /**
      * This method is the only chance a ScriptNode object has a chance
      * to know about its environment and do something useful (since
  @@ -73,6 +81,7 @@
           = (ComponentSelector)manager.lookup(Interpreter.ROLE);
         // Obtain the Interpreter instance for this language
         Interpreter interpreter = (Interpreter)selector.select(language);
  +      InputStream in = context.getResourceAsStream(source);
       }
       catch (ComponentException ex) {
         System.out.println("ScriptNode: Couldn't read the source file "
  
  
  

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