You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@apache.org on 2001/09/09 23:49:12 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTIdentifier.java ASTMethod.java ASTReference.java AbstractExecutor.java GetExecutor.java PropertyExecutor.java

geirm       01/09/09 14:49:12

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTIdentifier.java ASTMethod.java ASTReference.java
                        AbstractExecutor.java GetExecutor.java
                        PropertyExecutor.java
  Log:
  Final bit of change for seperable runtime instances, also brings
  introspection into the instance (as all other resources are...)
  
  Revision  Changes    Path
  1.14      +3 -3      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
  
  Index: ASTIdentifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ASTIdentifier.java	2001/08/07 21:56:30	1.13
  +++ ASTIdentifier.java	2001/09/09 21:49:11	1.14
  @@ -80,7 +80,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: ASTIdentifier.java,v 1.13 2001/08/07 21:56:30 geirm Exp $ 
  + * @version $Id: ASTIdentifier.java,v 1.14 2001/09/09 21:49:11 geirm Exp $ 
    */
   public class ASTIdentifier extends SimpleNode
   {
  @@ -137,11 +137,11 @@
           
           AbstractExecutor executor;
   
  -        executor = new PropertyExecutor(data, identifier);
  +        executor = new PropertyExecutor(rsvc, data, identifier);
   
           if (executor.isAlive() == false)
           {
  -            executor = new GetExecutor(data, identifier);
  +            executor = new GetExecutor( rsvc, data, identifier);
           }
           
           return executor;
  
  
  
  1.20      +2 -2      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
  
  Index: ASTMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ASTMethod.java	2001/08/07 21:56:30	1.19
  +++ ASTMethod.java	2001/09/09 21:49:11	1.20
  @@ -84,7 +84,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: ASTMethod.java,v 1.19 2001/08/07 21:56:30 geirm Exp $ 
  + * @version $Id: ASTMethod.java,v 1.20 2001/09/09 21:49:11 geirm Exp $ 
    */
   public class ASTMethod extends SimpleNode
   {
  @@ -145,7 +145,7 @@
           for (int j = 0; j < paramCount; j++)
               params[j] = jjtGetChild(j + 1).value(context);
    
  -        Method m = Introspector.getMethod( data, methodName, params);
  +        Method m = rsvc.getIntrospector().getMethod( data, methodName, params);
   
           return m;
       }
  
  
  
  1.37      +3 -3      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ASTReference.java	2001/08/11 18:58:07	1.36
  +++ ASTReference.java	2001/09/09 21:49:11	1.37
  @@ -85,7 +85,7 @@
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph Reck</a>
    * @author <a href="mailto:kjohnson@transparent.com>Kent Johnson</a>
  - * @version $Id: ASTReference.java,v 1.36 2001/08/11 18:58:07 geirm Exp $ 
  + * @version $Id: ASTReference.java,v 1.37 2001/09/09 21:49:11 geirm Exp $ 
   */
   public class ASTReference extends SimpleNode
   {
  @@ -407,7 +407,7 @@
   
               try
               {
  -                m = Introspector.getMethod( c, "set" + identifier, params);
  +                m = rsvc.getIntrospector().getMethod( c, "set" + identifier, params);
   
                   if (m == null)
                   {
  @@ -428,7 +428,7 @@
                       sb.setCharAt( 3 ,  Character.toLowerCase( sb.charAt( 3 ) ) );
                   }
                  
  -                m = Introspector.getMethod( c, sb.toString(), params);
  +                m = rsvc.getIntrospector().getMethod( c, sb.toString(), params);
   
                   if (m == null)
                   {
  
  
  
  1.9       +5 -1      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java
  
  Index: AbstractExecutor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractExecutor.java	2001/04/20 23:20:20	1.8
  +++ AbstractExecutor.java	2001/09/09 21:49:11	1.9
  @@ -61,16 +61,20 @@
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.exception.MethodInvocationException;
   
  +import org.apache.velocity.runtime.RuntimeServices;
  +
   /**
    * Abstract class that is used to execute an arbitrary
    * method that is in introspected. This is the superclass
    * for the GetExecutor and PropertyExecutor.
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: AbstractExecutor.java,v 1.8 2001/04/20 23:20:20 dlr Exp $
  + * @version $Id: AbstractExecutor.java,v 1.9 2001/09/09 21:49:11 geirm Exp $
    */
   public abstract class AbstractExecutor
   {
  +    protected RuntimeServices rsvc = null;
  +    
       /**
        * Method to be executed.
        */
  
  
  
  1.5       +7 -3      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/GetExecutor.java
  
  Index: GetExecutor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/GetExecutor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GetExecutor.java	2001/04/18 12:25:28	1.4
  +++ GetExecutor.java	2001/09/09 21:49:11	1.5
  @@ -61,6 +61,9 @@
   import java.lang.reflect.InvocationTargetException;
   import org.apache.velocity.exception.MethodInvocationException;
   
  +import org.apache.velocity.runtime.RuntimeServices;
  +
  +
   /**
    * Executor that simply tries to execute a get(key)
    * operation. This will try to find a get(key) method
  @@ -69,7 +72,7 @@
    * the case.
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: GetExecutor.java,v 1.4 2001/04/18 12:25:28 geirm Exp $
  + * @version $Id: GetExecutor.java,v 1.5 2001/09/09 21:49:11 geirm Exp $
    */
   public class GetExecutor extends AbstractExecutor
   {
  @@ -82,11 +85,12 @@
       /**
        * Default constructor.
        */
  -    public GetExecutor(Class c, String key)
  +    public GetExecutor( RuntimeServices r, Class c, String key)
           throws Exception
       {
  +        rsvc = r;
           args[0] = key;
  -        method = Introspector.getMethod(c, "get", args);
  +        method = rsvc.getIntrospector().getMethod(c, "get", args);
       }
   
       /**
  
  
  
  1.11      +7 -3      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java
  
  Index: PropertyExecutor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PropertyExecutor.java	2001/08/11 18:58:07	1.10
  +++ PropertyExecutor.java	2001/09/09 21:49:11	1.11
  @@ -62,6 +62,8 @@
   import org.apache.velocity.app.event.EventCartridge;
   import org.apache.velocity.context.InternalContextAdapter;
   
  +import org.apache.velocity.runtime.RuntimeServices;
  +
   /**
    * Returned the value of object property when executed.
    */
  @@ -69,8 +71,10 @@
   {
       private String methodUsed = null;
   
  -    public PropertyExecutor(Class c, String property)
  +    public PropertyExecutor( RuntimeServices r, Class c, String property)
       {
  +        rsvc = r;
  +        
           /*
            * Not using the Introspector here because
            * it can't deal with methods that have
  @@ -82,7 +86,7 @@
               methodUsed = "get" + property;
               
               Object[] params = {  };
  -            method = Introspector.getMethod( c, methodUsed, params);
  +            method = rsvc.getIntrospector().getMethod( c, methodUsed, params);
              
               if (method == null)
               {
  @@ -124,7 +128,7 @@
                   methodUsed = sb.toString();
                                  
                   Object[] params = {  };
  -                method = Introspector.getMethod( c, methodUsed, params);
  +                method = rsvc.getIntrospector().getMethod( c, methodUsed, params);
                   
                   if (method == null)
                   {