geirm       01/01/02 21:28:34

  Modified:    src/java/org/apache/velocity/runtime/directive
                        Directive.java Foreach.java Include.java
                        Literal.java Macro.java Parse.java
                        VelocimacroProxy.java
               src/java/org/apache/velocity/runtime/visitor
                        BaseVisitor.java
  Log:
  No functional change.  New context support.
  
  Revision  Changes    Path
  1.10      +3 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Directive.java
  
  Index: Directive.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Directive.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Directive.java    2000/11/28 04:16:21     1.9
  +++ Directive.java    2001/01/03 05:28:33     1.10
  @@ -57,7 +57,7 @@
   import java.io.Writer;
   import java.io.IOException;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.node.Node;
   
   /**
  @@ -74,7 +74,7 @@
       /**
        * How this directive is to be initialized.
        */
  -    public void init(Context context, Node node) throws Exception
  +    public void init( InternalContextAdapter context, Node node) throws Exception
       {
           int i, k = node.jjtGetNumChildren();
   
  @@ -85,6 +85,6 @@
       /**
        * How this directive is to be rendered 
        */
  -    public abstract boolean render(Context context, Writer writer, Node node)
  +    public abstract boolean render( InternalContextAdapter context, Writer writer, 
Node node)
           throws IOException;
   }        
  
  
  
  1.30      +6 -5      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Foreach.java
  
  Index: Foreach.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Foreach.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Foreach.java      2000/12/20 07:31:40     1.29
  +++ Foreach.java      2001/01/03 05:28:33     1.30
  @@ -65,7 +65,7 @@
   import java.util.Map;
   import java.util.Vector;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.util.ArrayIterator;
   
  @@ -85,7 +85,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  - * @version $Id: Foreach.java,v 1.29 2000/12/20 07:31:40 jvanzyl Exp $
  + * @version $Id: Foreach.java,v 1.30 2001/01/03 05:28:33 geirm Exp $
    */
   public class Foreach extends Directive
   {
  @@ -155,7 +155,8 @@
        *  simple init - init the tree and get the elementKey from
        *  the AST
        */
  -    public void init(Context context, Node node) throws Exception
  +    public void init( InternalContextAdapter context, Node node) 
  +        throws Exception
       {
           super.init( context, node );
   
  @@ -174,7 +175,7 @@
        *  @param node   AST node
        *  @return Iterator to do the dataset
        */
  -    private Iterator getIterator( Context context, Node node )
  +    private Iterator getIterator( InternalContextAdapter context, Node node )
       {
           /*
            *  get our list object, and punt if it's null.
  @@ -276,7 +277,7 @@
       /**
        *  renders the #foreach() block
        */
  -    public boolean render(Context context, Writer writer, Node node)
  +    public boolean render( InternalContextAdapter context, Writer writer, Node node)
           throws IOException
       {        
           /*
  
  
  
  1.14      +4 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Include.java
  
  Index: Include.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Include.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Include.java      2000/12/20 07:34:21     1.13
  +++ Include.java      2001/01/03 05:28:33     1.14
  @@ -57,7 +57,7 @@
   import java.io.Writer;
   import java.io.IOException;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.ParserTreeConstants;
   import org.apache.velocity.runtime.parser.node.Node;
  @@ -95,7 +95,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: Include.java,v 1.13 2000/12/20 07:34:21 jvanzyl Exp $
  + * @version $Id: Include.java,v 1.14 2001/01/03 05:28:33 geirm Exp $
    */
   public class Include extends Directive
   {
  @@ -120,7 +120,7 @@
        *  argument that is appropriate.  Any non appropriate
        *  arguments are logged, but render() continues.
        */
  -    public boolean render(Context context, Writer writer, Node node)
  +    public boolean render( InternalContextAdapter context, Writer writer, Node node)
           throws IOException
       {
           /*
  @@ -161,7 +161,7 @@
        *  @param writer output Writer
        *  @return boolean success or failure.  failures are logged
        */
  -    private boolean renderOutput( Node node, Context context, Writer writer )
  +    private boolean renderOutput( Node node, InternalContextAdapter context, Writer 
writer )
          throws IOException
       {
           String arg = "";
  
  
  
  1.2       +4 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Literal.java
  
  Index: Literal.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Literal.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Literal.java      2000/12/19 08:23:39     1.1
  +++ Literal.java      2001/01/03 05:28:33     1.2
  @@ -56,7 +56,7 @@
   
   import java.io.*;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.node.Node;
   
  @@ -67,7 +67,7 @@
    * that during render().
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: Literal.java,v 1.1 2000/12/19 08:23:39 jvanzyl Exp $
  + * @version $Id: Literal.java,v 1.2 2001/01/03 05:28:33 geirm Exp $
    */
   public class Literal extends Directive
   {
  @@ -93,7 +93,7 @@
        * Store the literal rendition of a node using
        * the Node.literal().
        */
  -    public void init(Context context, Node node) throws Exception
  +    public void init( InternalContextAdapter context, Node node) throws Exception
       {
           literalText = node.jjtGetChild(0).literal();
       }    
  @@ -102,7 +102,7 @@
        * Throw the literal rendition of the block between
        * #literal()/#end into the writer.
        */
  -    public boolean render(Context context, Writer writer, Node node)
  +    public boolean render( InternalContextAdapter context, Writer writer, Node node)
           throws IOException
       {
           writer.write(literalText);
  
  
  
  1.9       +4 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Macro.java
  
  Index: Macro.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Macro.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Macro.java        2000/12/20 07:38:16     1.8
  +++ Macro.java        2001/01/03 05:28:33     1.9
  @@ -58,7 +58,7 @@
   import java.io.IOException;
   import java.util.TreeMap;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
   
   import org.apache.velocity.runtime.parser.node.Node;
   import org.apache.velocity.runtime.parser.Token;
  @@ -82,7 +82,7 @@
    *  macro.  It is used inline in the parser when processing a directive.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  - * @version $Id: Macro.java,v 1.8 2000/12/20 07:38:16 jvanzyl Exp $
  + * @version $Id: Macro.java,v 1.9 2001/01/03 05:28:33 geirm Exp $
    */
   public class Macro extends Directive
   {
  @@ -108,7 +108,7 @@
        *   render() doesn't do anything in the final output rendering.
        *   There is no output from a #macro() directive.
        */
  -    public boolean render(Context context, Writer writer, Node node)
  +    public boolean render( InternalContextAdapter context, Writer writer, Node node)
           throws IOException 
       {
           /*
  @@ -118,7 +118,7 @@
           return true;
       }
    
  -    public void init(Context context, Node node) 
  +    public void init( InternalContextAdapter context, Node node) 
          throws Exception
       {
           /*
  
  
  
  1.13      +4 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Parse.java
  
  Index: Parse.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Parse.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Parse.java        2000/12/20 07:40:00     1.12
  +++ Parse.java        2001/01/03 05:28:33     1.13
  @@ -57,7 +57,8 @@
   import java.io.IOException;
   import java.io.Writer;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
  +
   import org.apache.velocity.Template;
   import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.ParserTreeConstants;
  @@ -83,7 +84,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: Parse.java,v 1.12 2000/12/20 07:40:00 jvanzyl Exp $
  + * @version $Id: Parse.java,v 1.13 2001/01/03 05:28:33 geirm Exp $
    */
   public class Parse extends Directive
   {
  @@ -112,7 +113,7 @@
        *  argument that is appropriate.  Any non appropriate
        *  arguments are logged, but render() continues.
        */
  -    public boolean render(Context context, Writer writer, Node node)
  +    public boolean render( InternalContextAdapter context, Writer writer, Node node)
           throws IOException
       {
           /*
  
  
  
  1.17      +6 -8      
jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
  
  Index: VelocimacroProxy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- VelocimacroProxy.java     2000/12/20 07:41:11     1.16
  +++ VelocimacroProxy.java     2001/01/03 05:28:33     1.17
  @@ -63,7 +63,8 @@
   import java.util.Set;
   import java.util.Iterator;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
  +
   import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.node.Node;
   import org.apache.velocity.runtime.parser.Token;
  @@ -77,7 +78,7 @@
    *   a proxy Directive-derived object to fit with the current directive system
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  - * @version $Id: VelocimacroProxy.java,v 1.16 2000/12/20 07:41:11 jvanzyl Exp $ 
  + * @version $Id: VelocimacroProxy.java,v 1.17 2001/01/03 05:28:33 geirm Exp $ 
    */
   public class VelocimacroProxy extends Directive
   {
  @@ -170,7 +171,7 @@
       /**
        *   Renders the macro using the context
        */
  -    public boolean render(Context context, Writer writer, Node node)
  +    public boolean render( InternalContextAdapter context, Writer writer, Node node)
           throws IOException
       {
           try 
  @@ -185,10 +186,7 @@
                    */
                   if (!init)
                   {
  -                    Context c = new Context();
  -                    c.setCurrentTemplateName( context.getCurrentTemplateName() );
  -                        
  -                    nodeTree.init( c ,null);
  +                    nodeTree.init( context ,null);
                       init = true;
                   }
                   nodeTree.render(context, writer );
  @@ -212,7 +210,7 @@
        *   macro body, renders the macro into an AST, and then inits the AST, so it 
is ready 
        *   for quick rendering.  Note that this is only AST dependant stuff. Not 
context.
        */
  -    public void init(Context context, Node node) 
  +    public void init( InternalContextAdapter context, Node node) 
          throws Exception
       {
           /*
  
  
  
  1.7       +4 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/visitor/BaseVisitor.java
  
  Index: BaseVisitor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/visitor/BaseVisitor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BaseVisitor.java  2000/11/12 06:33:28     1.6
  +++ BaseVisitor.java  2001/01/03 05:28:34     1.7
  @@ -59,7 +59,7 @@
   
   import java.util.Map;
   
  -import org.apache.velocity.Context;
  +import org.apache.velocity.context.InternalContextAdapter;
   
   import org.apache.velocity.runtime.parser.node.*;
   
  @@ -71,17 +71,17 @@
   public abstract class BaseVisitor implements ParserVisitor
   {
       /** Context used during traversal */
  -    protected Context context;
  +    protected InternalContextAdapter context;
       
       /** Writer used as the output sink */
       protected Writer writer;
       
  -    public void setWriter(Writer writer)
  +    public void setWriter( Writer writer )
       {
           this.writer = writer;
       }        
   
  -    public void setContext(Context context)
  +    public void setContext( InternalContextAdapter context)
       {
           this.context = context;
       }
  
  
  

Reply via email to