You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2016/07/17 23:33:11 UTC

svn commit: r1753137 [1/4] - in /velocity/engine/trunk/velocity-engine-core/src: main/java/org/apache/velocity/ main/java/org/apache/velocity/app/ main/java/org/apache/velocity/app/event/ main/java/org/apache/velocity/app/event/implement/ main/java/org...

Author: cbrisson
Date: Sun Jul 17 23:33:09 2016
New Revision: 1753137

URL: http://svn.apache.org/viewvc?rev=1753137&view=rev
Log:
[engine] keep macros in defining templates (applied reviewed patch from VELOCITY-797, fixes VELOCITY-797 and VELOCITY-776); plus some code cleaning that was in the patch

Added:
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/RenderVelocityTemplateTest.java
    velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/mergethis.vm
Modified:
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/Velocity.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventCartridge.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventHandlerUtil.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/EscapeReference.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalHousekeepingContext.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/exception/ParseErrorException.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/ParserPoolImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroManager.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/BlockMacro.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Break.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Define.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Evaluate.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Macro.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Scope.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/contrib/For.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/TemplateParseException.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTBlock.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComment.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscape.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTObjectArray.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTOrNode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTTextblock.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/BooleanPropertyExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/GetExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapGetExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapSetExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/Node.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PublicFieldExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PutExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPublicFieldExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ContentResource.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCache.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManager.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/util/StringResourceRepositoryImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/visitor/BaseVisitor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/visitor/NodeViewMode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ArrayIterator.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ClassUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/DuckType.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/EnumerationIterator.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/StringUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/Introspector.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/IntrospectorBase.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/IntrospectorCacheImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectPublicFields.java
    velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/io/UnicodeInputStreamTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ArithmeticTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ArrayMethodsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BuiltInEventHandlerTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommentsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ContextSafetyTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/EncodingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/EvaluateTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/EventHandlingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/FilteredEventHandlingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ForeachTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/GetAsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IncludeErrorTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IncludeEventHandlingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IndexTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/InfoTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/InlineScopeVMTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IntrospectionCacheDataTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/Introspector2TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/Introspector3TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IntrospectorTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/InvalidEventHandlerTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroCommentsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroDefaultArgTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MethodCacheKeyTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MethodInvocationExceptionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MethodOverloadingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MiscTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MultipleFileResourcePathTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/NumberMethodCallsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseExceptionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ParserTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceCachingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ScopeTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/SecureIntrospectionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/SetTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StopDirectiveTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StrictForeachTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StrictReferenceTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestSuite.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TestBaseTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/UberspectorTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/UnicodeEscapeTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/VelocimacroTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/VelocityAppTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/WrappedExceptionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/VelTools66TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity537TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity544TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity580TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity627TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity62TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity644TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity682TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity709TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity727TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity728TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity729TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity742TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity753TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity758TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity785TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingDirective.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/TestContext.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/TestLogger.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/sql/BaseSQLTest.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/sql/HsqlDB.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/sql/HsqlDataSource.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ChainedUberspectorsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ClassMapTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/UberspectImplTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/view/TemplateNodeView.java

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java Sun Jul 17 23:33:09 2016
@@ -19,15 +19,6 @@ package org.apache.velocity;
  * under the License.
  */
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.List;
-
 import org.apache.velocity.context.Context;
 import org.apache.velocity.context.InternalContextAdapterImpl;
 import org.apache.velocity.exception.MethodInvocationException;
@@ -43,6 +34,15 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.runtime.resource.ResourceManager;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * This class is used for controlling all template
  * operations. This class uses a parser created
@@ -73,6 +73,7 @@ public class Template extends Resource
      */
     private String scopeName = "template";
     private boolean provideScope = false;
+    private Map<String, Object> macros = new ConcurrentHashMap(17, 0.7f);
 
     private VelocityException errorCondition = null;
 
@@ -85,6 +86,15 @@ public class Template extends Resource
     }
 
     /**
+     * get the map of all macros defined by this template
+     * @return macros map
+     */
+    public Map<String, Object> getMacros()
+    {
+        return macros;
+    }
+
+    /**
      *  gets the named resource as a stream, parses and inits
      *
      * @return true if successful
@@ -132,7 +142,7 @@ public class Template extends Resource
             try
             {
                 BufferedReader br = new BufferedReader( reader );
-                data = rsvc.parse( br, name);
+                data = rsvc.parse( br, this);
                 initDocument();
                 return true;
             }
@@ -294,7 +304,8 @@ public class Template extends Resource
             /**
              * Set the macro libraries
              */
-            ica.setMacroLibraries(macroLibraries);
+            List libTemplates = new ArrayList();
+            ica.setMacroLibraries(libTemplates);
 
             if (macroLibraries != null)
             {
@@ -305,7 +316,8 @@ public class Template extends Resource
                      */
                     try
                     {
-                        rsvc.getTemplate((String) macroLibraries.get(i));
+                        Template t = rsvc.getTemplate((String) macroLibraries.get(i));
+                        libTemplates.add(t);
                     }
                     catch (ResourceNotFoundException re)
                     {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity;
  * under the License.    
  */
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.velocity.context.AbstractContext;
 import org.apache.velocity.context.Context;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *  General purpose implementation of the application Context
  *  interface for general application use.  This class should

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java Sun Jul 17 23:33:09 2016
@@ -19,10 +19,11 @@ package org.apache.velocity.app;
  * under the License.    
  */
 
+import org.apache.velocity.util.ClassUtils;
+
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
-import org.apache.velocity.util.ClassUtils;
 
 /**
  *  <p>

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/Velocity.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/Velocity.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/Velocity.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/Velocity.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,6 @@ package org.apache.velocity.app;
  * under the License.
  */
 
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.velocity.Template;
 import org.apache.velocity.context.Context;
@@ -34,6 +28,11 @@ import org.apache.velocity.exception.Res
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.RuntimeSingleton;
 import org.apache.velocity.util.ExtProperties;
+import org.slf4j.Logger;
+
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Properties;
 
 /**
  * This class provides  services to the application

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,6 @@ package org.apache.velocity.app;
  * under the License.
  */
 
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.velocity.Template;
 import org.apache.velocity.context.Context;
@@ -34,6 +28,11 @@ import org.apache.velocity.exception.Res
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.RuntimeInstance;
 import org.apache.velocity.util.ExtProperties;
+import org.slf4j.Logger;
+
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Properties;
 
 /**
  * <p>

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventCartridge.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventCartridge.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventCartridge.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventCartridge.java Sun Jul 17 23:33:09 2016
@@ -19,17 +19,17 @@ package org.apache.velocity.app.event;
  * under the License.    
  */
 
+import org.apache.velocity.context.Context;
+import org.apache.velocity.context.InternalEventContext;
+import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.util.RuntimeServicesAware;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.velocity.context.Context;
-import org.apache.velocity.context.InternalEventContext;
-import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.util.RuntimeServicesAware;
-
 /**
  * Stores the event handlers. Event handlers can be assigned on a per
  * VelocityEngine instance basis by specifying the class names in the

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventHandlerUtil.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventHandlerUtil.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventHandlerUtil.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/EventHandlerUtil.java Sun Jul 17 23:33:09 2016
@@ -19,13 +19,13 @@ package org.apache.velocity.app.event;
  * under the License.    
  */
 
-import java.util.Iterator;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.util.introspection.Info;
 
+import java.util.Iterator;
+
 
 /**
  * Calls on request all registered event handlers for a particular event. Each

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/EscapeReference.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/EscapeReference.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/EscapeReference.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/EscapeReference.java Sun Jul 17 23:33:09 2016
@@ -19,13 +19,13 @@ package org.apache.velocity.app.event.im
  * under the License.
  */
 
-import java.util.regex.PatternSyntaxException;
-
 import org.apache.velocity.app.event.ReferenceInsertionEventHandler;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.util.RuntimeServicesAware;
 import org.apache.velocity.util.StringUtils;
 
+import java.util.regex.PatternSyntaxException;
+
 /**
  * Base class for escaping references.  To use it, override the following methods:
  * <DL>

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,13 @@ package org.apache.velocity.app.event.im
  * under the License.    
  */
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import org.apache.velocity.app.event.MethodExceptionEventHandler;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.util.RuntimeServicesAware;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 /**
  * Simple event handler that renders method exceptions in the page
  * rather than throwing the exception.  Useful for debugging.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,6 @@ package org.apache.velocity.app.event.im
  * under the License.    
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.velocity.app.event.InvalidReferenceEventHandler;
 import org.apache.velocity.context.Context;
 import org.apache.velocity.exception.ParseErrorException;
@@ -29,6 +26,9 @@ import org.apache.velocity.runtime.Runti
 import org.apache.velocity.util.RuntimeServicesAware;
 import org.apache.velocity.util.introspection.Info;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Use this event handler to flag invalid references.  Since this 
  * is intended to be used for a specific request, this should be

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.context;
  * under the License.    
  */
 
-import java.util.List;
-
 import org.apache.velocity.app.event.EventCartridge;
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.util.introspection.IntrospectionCacheData;
 
+import java.util.List;
+
 /**
  * This is an abstract internal-use-only context implementation to be
  * used as a subclass for other internal-use-only contexts that wrap

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,14 @@ package org.apache.velocity.context;
  * under the License.    
  */
 
-import java.util.HashMap;
-import java.util.Stack;
-import java.util.List;
-
 import org.apache.velocity.app.event.EventCartridge;
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.util.introspection.IntrospectionCacheData;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Stack;
+
 /**
  *  class to encapsulate the 'stuff' for internal operation of velocity.
  *  We use the context as a thread-safe storage : we take advantage of the

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalHousekeepingContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalHousekeepingContext.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalHousekeepingContext.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalHousekeepingContext.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,8 @@ package org.apache.velocity.context;
  * under the License.    
  */
 
-import org.apache.velocity.util.introspection.IntrospectionCacheData;
-
 import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.util.introspection.IntrospectionCacheData;
 
 import java.util.List;
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/exception/ParseErrorException.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/exception/ParseErrorException.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/exception/ParseErrorException.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/exception/ParseErrorException.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.exception;
  * under the License.    
  */
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import org.apache.velocity.runtime.parser.ParseException;
-import org.apache.velocity.util.introspection.Info;
 import org.apache.velocity.util.StringUtils;
+import org.apache.velocity.util.introspection.Info;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  *  Application-level exception thrown when a resource of any type

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/ParserPoolImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/ParserPoolImpl.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/ParserPoolImpl.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/ParserPoolImpl.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,9 @@ package org.apache.velocity.runtime;
  * under the License.    
  */
 
+import org.apache.velocity.runtime.parser.CharStream;
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.util.SimplePool;
-import org.apache.velocity.runtime.parser.CharStream;
 
 /**
  * This wraps the original parser SimplePool class.  It also handles

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java Sun Jul 17 23:33:09 2016
@@ -24,8 +24,8 @@ import org.apache.velocity.exception.Met
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 
-import java.io.Writer;
 import java.io.IOException;
+import java.io.Writer;
 
 /**
  *  This interface characterize objects other than ASTNodes that can be rendered

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java Sun Jul 17 23:33:09 2016
@@ -19,22 +19,6 @@ package org.apache.velocity.runtime;
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.Writer;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.velocity.Template;
 import org.apache.velocity.app.event.EventCartridge;
@@ -52,7 +36,6 @@ import org.apache.velocity.exception.Tem
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.directive.Directive;
 import org.apache.velocity.runtime.directive.Macro;
-import org.apache.velocity.runtime.directive.VelocimacroProxy;
 import org.apache.velocity.runtime.directive.Scope;
 import org.apache.velocity.runtime.directive.StopCommand;
 import org.apache.velocity.runtime.parser.ParseException;
@@ -70,6 +53,21 @@ import org.apache.velocity.util.introspe
 import org.apache.velocity.util.introspection.LinkingUberspector;
 import org.apache.velocity.util.introspection.Uberspect;
 import org.apache.velocity.util.introspection.UberspectLoggable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 /**
  * This is the Runtime system for Velocity. It is the
@@ -539,7 +537,7 @@ public class RuntimeInstance implements
      * the case with Turbine.
      *
      * @param  configuration
-     * @deprecated use {@link setConfiguration(ExtProperties)}
+     * @deprecated use {@link #setConfiguration(ExtProperties)}
      */
     public @Deprecated void setConfiguration( ExtendedProperties configuration)
     {
@@ -1221,54 +1219,12 @@ public class RuntimeInstance implements
      *  PARSER_POOL_SIZE property appropriately for their
      *  application.  We will revisit this.
      *
-     * @param string String to be parsed
-     * @param templateName name of the template being parsed
-     * @return A root node representing the template as an AST tree.
-     * @throws ParseException When the string could not be parsed as a template.
-     * @since 1.6
-     */
-    public SimpleNode parse(String string, String templateName)
-        throws ParseException
-    {
-        return parse(new StringReader(string), templateName);
-    }
-
-    /**
-     * Parse the input and return the root of
-     * AST node structure.
-     * <br><br>
-     *  In the event that it runs out of parsers in the
-     *  pool, it will create and let them be GC'd
-     *  dynamically, logging that it has to do that.  This
-     *  is considered an exceptional condition.  It is
-     *  expected that the user will set the
-     *  PARSER_POOL_SIZE property appropriately for their
-     *  application.  We will revisit this.
-     *
-     * @param reader Reader retrieved by a resource loader
-     * @param templateName name of the template being parsed
-     * @return A root node representing the template as an AST tree.
-     * @throws ParseException When the template could not be parsed.
-     */
-    public SimpleNode parse(Reader reader, String templateName)
-        throws ParseException
-    {
-        /*
-         *  do it and dump the VM namespace for this template
-         */
-        return parse(reader, templateName, true);
-    }
-
-    /**
-     *  Parse the input and return the root of the AST node structure.
-     *
      * @param reader Reader retrieved by a resource loader
-     * @param templateName name of the template being parsed
-     * @param dumpNamespace flag to dump the Velocimacro namespace for this template
+     * @param template template being parsed
      * @return A root node representing the template as an AST tree.
      * @throws ParseException When the template could not be parsed.
      */
-    public SimpleNode parse(Reader reader, String templateName, boolean dumpNamespace)
+    public SimpleNode parse(Reader reader, Template template)
         throws ParseException
     {
         requireInitialization();
@@ -1292,21 +1248,14 @@ public class RuntimeInstance implements
 
         try
         {
-            /*
-             *  dump namespace if we are told to.  Generally, you want to
-             *  do this - you don't in special circumstances, such as
-             *  when a VM is getting init()-ed & parsed
-             */
-            if (dumpNamespace)
-            {
-                dumpVMNamespace(templateName);
-            }
-            return parser.parse(reader, templateName);
+            return parser.parse(reader, template);
         }
         finally
         {
             if (keepParser)
             {
+                /* drop the parser Template reference to allow garbage collection */
+                parser.currentTemplate = null;
                 parserPool.put(parser);
             }
 
@@ -1323,6 +1272,9 @@ public class RuntimeInstance implements
      * Renders the input string using the context into the output writer.
      * To be used when a template is dynamically constructed, or want to use
      * Velocity as a token replacer.
+     * <br>
+     * Note! Macros defined in evaluate() calls are not persisted in memory so next evaluate() call
+     * does not know about macros defined during previous calls.
      *
      * @param context context to use in rendering input string
      * @param out  Writer in which to render the output
@@ -1347,6 +1299,9 @@ public class RuntimeInstance implements
      * Renders the input reader using the context into the output writer.
      * To be used when a template is dynamically constructed, or want to
      * use Velocity as a token replacer.
+     * <br>
+     * Note! Macros defined in evaluate() calls are not persisted in memory so next evaluate() call
+     * does not know about macros defined during previous calls.
      *
      * @param context context to use in rendering input string
      * @param writer  Writer in which to render the output
@@ -1370,9 +1325,11 @@ public class RuntimeInstance implements
         }
 
         SimpleNode nodeTree = null;
+        Template t = new Template();
+        t.setName(logTag);
         try
         {
-            nodeTree = parse(reader, logTag);
+            nodeTree = parse(reader, t);
         }
         catch (ParseException pex)
         {
@@ -1504,6 +1461,9 @@ public class RuntimeInstance implements
      * and places the rendered stream into the writer.
      * <br>
      * Note : currently only accepts args to the VM if they are in the context.
+     * <br>
+     * Note: only macros in the global context can be called. This method doesn't find macros defined by
+     * templates during previous mergeTemplate calls if Velocity.VM_PERM_INLINE_LOCAL has been enabled.
      *
      * @param vmName name of Velocimacro to call
      * @param logTag string to be used for template name in case of error. if null,
@@ -1537,8 +1497,8 @@ public class RuntimeInstance implements
             params = new String[0];
         }
 
-        /* does the VM exist? */
-        if (!isVelocimacro(vmName, logTag))
+        /* does the VM exist? (only global scope is scanned so this doesn't find inline macros in templates) */
+        if (!isVelocimacro(vmName, null))
         {
             String msg = "RuntimeInstance.invokeVelocimacro() : VM '" + vmName
                          + "' is not registered.";
@@ -1713,91 +1673,49 @@ public class RuntimeInstance implements
      * Returns the appropriate VelocimacroProxy object if vmName
      * is a valid current Velocimacro.
      *
-     * @param vmName Name of velocimacro requested
-     * @param templateName Name of the template that contains the velocimacro.
-     * @return The requested VelocimacroProxy.
-     * @since 1.6
-     */
-    public Directive getVelocimacro(String vmName, String templateName)
-    {
-        return vmFactory.getVelocimacro( vmName, templateName );
-    }
-
-    /**
-     * Returns the appropriate VelocimacroProxy object if vmName
-     * is a valid current Velocimacro.
-     *
      * @param vmName  Name of velocimacro requested
-     * @param templateName Name of the namespace.
-     * @param renderingTemplate Name of the template we are currently rendering. This
+     * @param renderingTemplate Template we are currently rendering. This
      *    information is needed when VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL setting is true
      *    and template contains a macro with the same name as the global macro library.
-     *
-     * @since Velocity 1.6
+     * @param template Template which acts as the host for the macro
      *
      * @return VelocimacroProxy
      */
-    public Directive getVelocimacro(String vmName, String templateName, String renderingTemplate)
+    public Directive getVelocimacro(String vmName, Template renderingTemplate, Template template)
     {
-        return vmFactory.getVelocimacro( vmName, templateName, renderingTemplate );
+        return vmFactory.getVelocimacro(vmName, renderingTemplate, template);
     }
 
     /**
-     * Return a list of VelocimacroProxies that are defined by the given
-     * template name.
-     */
-    public List<VelocimacroProxy> getVelocimacros(String templateName)
-    {
-        return vmFactory.getVelocimacros(templateName);
-    }
-
-
-    /**
      * Adds a new Velocimacro. Usually called by Macro only while parsing.
      *
-     * Called by org.apache.velocity.runtime.directive.processAndRegister
-     *
      * @param name  Name of velocimacro
      * @param macro  root AST node of the parsed macro
      * @param macroArgs  Array of macro arguments, containing the
      *        #macro() arguments and default values.  the 0th is the name.
-     * @param sourceTemplate
-     *
-     * @since Velocity 1.6
+     * @param definingTemplate Template containing the source of the macro
      *
      * @return boolean  True if added, false if rejected for some
      *                  reason (either parameters or permission settings)
      */
     public boolean addVelocimacro( String name,
-                                          Node macro,
-                                          List<Macro.MacroArg> macroArgs,
-                                          String sourceTemplate )
+                                   Node macro,
+                                   List<Macro.MacroArg> macroArgs,
+                                   Template definingTemplate)
     {
-        return vmFactory.addVelocimacro(name.intern(), macro,  macroArgs,  sourceTemplate);
+        return vmFactory.addVelocimacro(name.intern(), macro, macroArgs, definingTemplate);
     }
 
-
     /**
      *  Checks to see if a VM exists
      *
      * @param vmName Name of the Velocimacro.
-     * @param templateName Template on which to look for the Macro.
+     * @param template Template on which to look for the Macro.
      * @return True if VM by that name exists, false if not
      */
-    public boolean isVelocimacro( String vmName, String templateName )
-    {
-        return vmFactory.isVelocimacro(vmName.intern(), templateName);
-    }
-
-    /**
-     * tells the vmFactory to dump the specified namespace.  This is to support
-     * clearing the VM list when in inline-VM-local-scope mode
-     * @param namespace Namespace to dump.
-     * @return True if namespace was dumped successfully.
-     */
-    public boolean dumpVMNamespace(String namespace)
+    public boolean isVelocimacro(String vmName, Template template)
     {
-        return vmFactory.dumpVMNamespace( namespace );
+        return vmFactory.isVelocimacro(vmName.intern(), template);
     }
 
     /* --------------------------------------------------------------------

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,6 @@ package org.apache.velocity.runtime;
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.List;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.velocity.Template;
 import org.apache.velocity.app.event.EventCartridge;
@@ -44,6 +36,13 @@ import org.apache.velocity.runtime.resou
 import org.apache.velocity.util.ExtProperties;
 import org.apache.velocity.util.introspection.Introspector;
 import org.apache.velocity.util.introspection.Uberspect;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.List;
+import java.util.Properties;
 
 
 /**
@@ -166,14 +165,6 @@ public interface RuntimeServices
     public void init(String configurationFile);
 
     /**
-     * Wraps the String in a StringReader and passes it off to
-     * {@link #parse(Reader,String)}.
-     * @since 1.6
-     */
-    public SimpleNode parse(String string, String templateName)
-        throws ParseException;
-
-    /**
      * Parse the input and return the root of
      * AST node structure.
      * <br><br>
@@ -186,23 +177,11 @@ public interface RuntimeServices
      *  application.  We will revisit this.
      *
      * @param reader inputstream retrieved by a resource loader
-     * @param templateName name of the template being parsed
-     * @return The AST representing the template.
-     * @throws ParseException
-     */
-    public  SimpleNode parse( Reader reader, String templateName )
-        throws ParseException;
-
-    /**
-     *  Parse the input and return the root of the AST node structure.
-     *
-     * @param reader inputstream retrieved by a resource loader
-     * @param templateName name of the template being parsed
-     * @param dumpNamespace flag to dump the Velocimacro namespace for this template
+     * @param template template being parsed
      * @return The AST representing the template.
      * @throws ParseException
      */
-    public SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
+    public  SimpleNode parse( Reader reader, Template template )
         throws ParseException;
 
     /**
@@ -353,26 +332,14 @@ public interface RuntimeServices
      * is a valid current Velocimacro.
      *
      * @param vmName  Name of velocimacro requested
-     * @param templateName Name of the namespace.
-     * @return VelocimacroProxy
-     */
-    public Directive getVelocimacro( String vmName, String templateName  );
-    
-    /**
-     * Returns the appropriate VelocimacroProxy object if strVMname
-     * is a valid current Velocimacro.
-     *
-     * @param vmName  Name of velocimacro requested
-     * @param templateName Name of the namespace.
-     * @param renderingTemplate Name of the template we are currently rendering. This
+     * @param renderingTemplate Template we are currently rendering. This
      *    information is needed when VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL setting is true
      *    and template contains a macro with the same name as the global macro library.
-     * 
-     * @since Velocity 1.6
-     * 
+     * @param template current template
+     *
      * @return VelocimacroProxy
      */
-    public Directive getVelocimacro( String vmName, String templateName, String renderingTemplate  );
+    public Directive getVelocimacro(String vmName, Template renderingTemplate, Template template);
 
     /**
      * Adds a new Velocimacro. Usually called by Macro only while parsing.
@@ -381,35 +348,25 @@ public interface RuntimeServices
      * @param macro  root AST node of the parsed macro
      * @param macroArgs  Array of macro arguments, containing the
      *        #macro() arguments and default values.  the 0th is the name.
-     * @param sourceTemplate
-     * 
-     * @since Velocity 1.6
-     *                   
+     * @param definingTemplate template containing macro definition
+     *
      * @return boolean  True if added, false if rejected for some
      *                  reason (either parameters or permission settings)
      */
     public boolean addVelocimacro( String name,
-                                          Node macro,
-                                          List<Macro.MacroArg> macroArgs,
-                                          String sourceTemplate );
-                                          
-                                          
+                                   Node macro,
+                                   List<Macro.MacroArg> macroArgs,
+                                   Template definingTemplate );
+
+
     /**
      *  Checks to see if a VM exists
      *
      * @param vmName  Name of velocimacro
-     * @param templateName
+     * @param template Template "namespace"
      * @return boolean  True if VM by that name exists, false if not
      */
-    public boolean isVelocimacro( String vmName, String templateName );
-
-    /**
-     *  tells the vmFactory to dump the specified namespace.  This is to support
-     *  clearing the VM list when in inline-VM-local-scope mode
-     * @param namespace
-     * @return True if the Namespace was dumped.
-     */
-    public boolean dumpVMNamespace( String namespace );
+    public boolean isVelocimacro(String vmName, Template template);
 
     /**
      * String property accessor method to hide the configuration implementation

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,6 @@ package org.apache.velocity.runtime;
  * under the License.
  */
 
-import java.io.Reader;
-import java.util.List;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.velocity.Template;
 import org.apache.velocity.app.event.EventCartridge;
@@ -39,6 +33,11 @@ import org.apache.velocity.runtime.resou
 import org.apache.velocity.util.ExtProperties;
 import org.apache.velocity.util.introspection.Introspector;
 import org.apache.velocity.util.introspection.Uberspect;
+import org.slf4j.Logger;
+
+import java.io.Reader;
+import java.util.List;
+import java.util.Properties;
 
 /**
  * This is the Runtime system for Velocity. It is the
@@ -144,7 +143,7 @@ public class RuntimeSingleton implements
      */
     public static void setProperty(String key, Object value)
     {
-        ri.setProperty( key, value );
+        ri.setProperty(key, value);
     }
 
     /**
@@ -177,7 +176,7 @@ public class RuntimeSingleton implements
      */
     public static void setConfiguration( ExtProperties configuration)
     {
-        ri.setConfiguration( configuration );
+        ri.setConfiguration(configuration);
     }
 
     /**
@@ -202,7 +201,7 @@ public class RuntimeSingleton implements
      */
     public static void addProperty(String key, Object value)
     {
-        ri.addProperty( key, value );
+        ri.addProperty(key, value);
     }
 
     /**
@@ -268,35 +267,18 @@ public class RuntimeSingleton implements
      *  application.  We will revisit this.
      *
      * @param reader Reader retrieved by a resource loader
-     * @param templateName name of the template being parsed
+     * @param template Template being parsed
      * @return A root node representing the template as an AST tree.
      * @throws ParseException When the template could not be parsed.
-     * @see RuntimeInstance#parse(Reader, String)
+     * @see RuntimeInstance#parse(Reader, Template)
      */
-    public static SimpleNode parse( Reader reader, String templateName )
+    public static SimpleNode parse( Reader reader, Template template )
         throws ParseException
     {
-        return ri.parse( reader, templateName );
+        return ri.parse(reader, template);
     }
 
     /**
-     *  Parse the input and return the root of the AST node structure.
-     *
-     * @param reader Reader retrieved by a resource loader
-     * @param templateName name of the template being parsed
-     * @param dumpNamespace flag to dump the Velocimacro namespace for this template
-     * @return A root node representing the template as an AST tree.
-     * @throws ParseException When the template could not be parsed.
-     * @see RuntimeInstance#parse(Reader, String, boolean)
-     */
-    public static SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
-        throws ParseException
-    {
-        return ri.parse( reader, templateName, dumpNamespace );
-    }
-
-
-    /**
      * Returns a <code>Template</code> from the resource manager.
      * This method assumes that the character encoding of the
      * template is set by the <code>input.encoding</code>
@@ -313,7 +295,7 @@ public class RuntimeSingleton implements
     public static Template getTemplate(String name)
         throws ResourceNotFoundException, ParseErrorException
     {
-        return ri.getTemplate( name );
+        return ri.getTemplate(name);
     }
 
     /**
@@ -331,7 +313,7 @@ public class RuntimeSingleton implements
     public static Template getTemplate(String name, String  encoding)
         throws ResourceNotFoundException, ParseErrorException
     {
-        return ri.getTemplate( name, encoding );
+        return ri.getTemplate(name, encoding);
     }
 
     /**
@@ -349,7 +331,7 @@ public class RuntimeSingleton implements
     public static ContentResource getContent(String name)
         throws ResourceNotFoundException, ParseErrorException
     {
-        return ri.getContent( name );
+        return ri.getContent(name);
     }
 
     /**
@@ -367,7 +349,7 @@ public class RuntimeSingleton implements
     public static ContentResource getContent( String name, String encoding )
         throws ResourceNotFoundException, ParseErrorException
     {
-        return ri.getContent( name, encoding );
+        return ri.getContent(name, encoding);
     }
 
 
@@ -383,7 +365,7 @@ public class RuntimeSingleton implements
      */
     public static String getLoaderNameForResource( String resourceName )
     {
-        return ri.getLoaderNameForResource( resourceName );
+        return ri.getLoaderNameForResource(resourceName);
     }
 
 
@@ -411,7 +393,7 @@ public class RuntimeSingleton implements
      */
     public static String getString( String key, String defaultValue)
     {
-        return ri.getString( key, defaultValue );
+        return ri.getString(key, defaultValue);
     }
 
     /**
@@ -423,9 +405,22 @@ public class RuntimeSingleton implements
      * @return The requested VelocimacroProxy.
      * @see RuntimeInstance#getVelocimacro(String, String)
      */
-    public static Directive getVelocimacro( String vmName, String templateName  )
+
+    /**
+     * Returns the appropriate VelocimacroProxy object if strVMname
+     * is a valid current Velocimacro.
+     *
+     * @param vmName  Name of velocimacro requested
+     * @param renderingTemplate Template we are currently rendering. This
+     *    information is needed when VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL setting is true
+     *    and template contains a macro with the same name as the global macro library.
+     * @param template current template
+     *
+     * @return VelocimacroProxy
+     */
+    public static Directive getVelocimacro(String vmName, Template renderingTemplate, Template template)
     {
-        return ri.getVelocimacro( vmName, templateName );
+        return ri.getVelocimacro(vmName, renderingTemplate, template);
     }
 
     /**
@@ -435,41 +430,24 @@ public class RuntimeSingleton implements
      * @param macro  root AST node of the parsed macro
      * @param macroArgs  Array of macro arguments, containing the
      *        #macro() arguments and default values.  the 0th is the name.
-     * @param sourceTemplate The template from which the macro is requested.
-     * @return boolean  True if added, false if rejected for some
-     *                  reason (either parameters or permission settings)
-     * @see RuntimeInstance#addVelocimacro(String, Node, List, String)
-     * @since 1.6
+     * @param definingTemplate Templaite containing the definition of the macro.
      */
     public static boolean addVelocimacro(String name, Node macro,
-                                         List<Macro.MacroArg> macroArgs, String sourceTemplate)
+                                         List<Macro.MacroArg> macroArgs, Template definingTemplate)
     {
-        return ri.addVelocimacro(name, macro, macroArgs, sourceTemplate);
+        return ri.addVelocimacro(name, macro, macroArgs, definingTemplate);
     }
 
     /**
      *  Checks to see if a VM exists
      *
      * @param vmName Name of the Velocimacro.
-     * @param templateName Template on which to look for the Macro.
+     * @param template Template on which to look for the Macro.
      * @return True if VM by that name exists, false if not
-     * @see RuntimeInstance#isVelocimacro(String, String)
-     */
-    public static boolean isVelocimacro( String vmName, String templateName )
-    {
-        return ri.isVelocimacro( vmName, templateName );
-    }
-
-    /**
-     * tells the vmFactory to dump the specified namespace.  This is to support
-     * clearing the VM list when in inline-VM-local-scope mode
-     * @param namespace Namespace to dump.
-     * @return True if namespace was dumped successfully.
-     * @see RuntimeInstance#dumpVMNamespace(String)
      */
-    public static boolean dumpVMNamespace( String namespace )
+    public static boolean isVelocimacro(String vmName, Template template)
     {
-        return ri.dumpVMNamespace( namespace );
+        return ri.isVelocimacro(vmName, template);
     }
 
     /* --------------------------------------------------------------------

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java Sun Jul 17 23:33:09 2016
@@ -19,23 +19,20 @@ package org.apache.velocity.runtime;
  * under the License.
  */
 
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.Template;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.directive.Directive;
 import org.apache.velocity.runtime.directive.Macro;
 import org.apache.velocity.runtime.directive.VelocimacroProxy;
-import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.node.Node;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
 
 /**
  *  VelocimacroFactory.java
@@ -318,101 +315,16 @@ public class VelocimacroFactory
     /**
      * Adds a macro to the factory.
      *
-     * addVelocimacro(String, Node, String[] argArray, String) should be used internally
-     * instead of this.
-     *
-     * @param name Name of the Macro to add.
-     * @param macroBody String representation of the macro.
-     * @param macroArgs  Array of macro arguments, containing the
-     *        #macro() arguments and default values.  the 0th is the name.
-     * @param sourceTemplate Source template from which the macro gets registered.
-     *
-     * @return true if Macro was registered successfully.
-     */
-    public boolean addVelocimacro(String name, String macroBody,
-            List<Macro.MacroArg> macroArgs, String sourceTemplate)
-    {
-        /*
-         * maybe we should throw an exception, maybe just tell
-         * the caller like this...
-         *
-         * I hate this : maybe exceptions are in order here...
-         * They definitely would be if this was only called by directly
-         * by users, but Velocity calls this internally.
-         */
-        if (name == null || macroBody == null || macroArgs == null ||
-            sourceTemplate == null)
-        {
-            String msg = "VM '"+name+"' addition rejected : ";
-            if (name == null)
-            {
-                msg += "name";
-            }
-            else if (macroBody == null)
-            {
-                msg += "macroBody";
-            }
-            else if (macroArgs == null)
-            {
-                msg += "argArray";
-            }
-            else
-            {
-                msg += "sourceTemplate";
-            }
-            msg += " argument was null";
-            log.error(msg);
-            throw new NullPointerException(msg);
-        }
-
-        /*
-         *  see if the current ruleset allows this addition
-         */
-
-        if (!canAddVelocimacro(name, sourceTemplate))
-        {
-            return false;
-        }
-
-        synchronized (this)
-        {
-            try
-            {
-                Node macroRootNode = rsvc.parse(new StringReader(macroBody), sourceTemplate);
-
-                vmManager.addVM(name, macroRootNode, macroArgs, sourceTemplate, replaceAllowed);
-            }
-            catch (ParseException ex)
-            {
-                // to keep things 1.3 compatible call toString() here
-                throw new RuntimeException(ex.toString());
-            }
-        }
-
-        if (log.isDebugEnabled())
-        {
-            StringBuffer msg = new StringBuffer("added ");
-            Macro.macroToString(msg, macroArgs);
-            msg.append(" : source = ").append(sourceTemplate);
-            log.debug(msg.toString());
-        }
-
-        return true;
-    }
-
-    /**
-     * Adds a macro to the factory.
-     *
      * @param name Name of the Macro to add.
      * @param macroBody root node of the parsed macro AST
      * @param macroArgs  Array of macro arguments, containing the
      *        #macro() arguments and default values.  the 0th is the name.
-     * @param sourceTemplate Source template from which the macro gets registered.
+     * @param definingTemplate template containing the macro definition
      * @return true if Macro was registered successfully.
      * @since 1.6
      */
     public boolean addVelocimacro(String name, Node macroBody,
-            List<Macro.MacroArg> macroArgs, String sourceTemplate)
+            List<Macro.MacroArg> macroArgs, Template definingTemplate)
     {
         // Called by RuntimeInstance.addVelocimacro
 
@@ -425,7 +337,7 @@ public class VelocimacroFactory
          * by users, but Velocity calls this internally.
          */
         if (name == null || macroBody == null || macroArgs == null ||
-            sourceTemplate == null)
+            definingTemplate == null)
         {
             String msg = "VM '"+name+"' addition rejected : ";
             if (name == null)
@@ -453,18 +365,18 @@ public class VelocimacroFactory
          *  see if the current ruleset allows this addition
          */
 
-        if (!canAddVelocimacro(name, sourceTemplate))
+        if (!canAddVelocimacro(name, definingTemplate))
         {
             return false;
         }
 
         synchronized(this)
         {
-            vmManager.addVM(name, macroBody, macroArgs, sourceTemplate, replaceAllowed);
+            vmManager.addVM(name, macroBody, macroArgs, definingTemplate, replaceAllowed);
         }
         if (log.isDebugEnabled())
         {
-            log.debug("added VM {}: source={}", name, sourceTemplate);
+            log.debug("added VM {}: source={}", name, definingTemplate);
         }
         return true;
     }
@@ -475,10 +387,10 @@ public class VelocimacroFactory
      *  to be added
      *
      *  @param name Name of VM to add
-     *  @param sourceTemplate Source template that contains the defintion of the VM
+     *  @param definingTemplate template containing the source of the macro
      *  @return true if it is allowed to be added, false otherwise
      */
-    private synchronized boolean canAddVelocimacro(String name, String sourceTemplate)
+    private synchronized boolean canAddVelocimacro(String name, Template definingTemplate)
     {
         /*
          *  short circuit and do it if autoloader is on, and the
@@ -487,7 +399,7 @@ public class VelocimacroFactory
 
         if (autoReloadLibrary && (macroLibVec != null))
         {
-            if( macroLibVec.contains(sourceTemplate) )
+            if( macroLibVec.contains(definingTemplate.getName()) )
                 return true;
         }
 
@@ -516,7 +428,7 @@ public class VelocimacroFactory
              *
              *  so if we have it, and we aren't allowed to replace, bail
              */
-            if (!replaceAllowed && isVelocimacro(name, sourceTemplate))
+            if (!replaceAllowed && isVelocimacro(name, definingTemplate))
             {
                 /*
                  * Concurrency fix: the log entry was changed to debug scope because it
@@ -535,13 +447,13 @@ public class VelocimacroFactory
     /**
      * Tells the world if a given directive string is a Velocimacro
      * @param vm Name of the Macro.
-     * @param sourceTemplate Source template from which the macro should be loaded.
+     * @param template Source template from which the macro should be loaded.
      * @return True if the given name is a macro.
      */
-    public boolean isVelocimacro(String vm, String sourceTemplate)
+    public boolean isVelocimacro(String vm, Template template)
     {
         // synchronization removed
-        return(vmManager.get(vm, sourceTemplate) != null);
+        return(vmManager.get(vm, null, template) != null);
     }
 
     /**
@@ -549,31 +461,15 @@ public class VelocimacroFactory
      *  behave correctly wrt getting the framework to
      *  dig out the correct # of args
      * @param vmName Name of the Macro.
+     * @param renderingTemplate destination template
      * @param sourceTemplate Source template from which the macro should be loaded.
      * @return A directive representing the Macro.
      */
-     public Directive getVelocimacro(String vmName, String sourceTemplate)
-     {
-        return(getVelocimacro(vmName, sourceTemplate, null));
-     }
-
-     /**
-      * Return a list of VelocimacroProxies that are defined by the given
-      * template name.
-      */
-     public List<VelocimacroProxy> getVelocimacros(String sourceTemplate)
-     {
-       return vmManager.getVelocimacros(sourceTemplate);
-     }
-
-     /**
-      * @since 1.6
-      */
-     public Directive getVelocimacro(String vmName, String sourceTemplate, String renderingTemplate)
+     public Directive getVelocimacro(String vmName, Template renderingTemplate, Template sourceTemplate)
      {
         VelocimacroProxy vp = null;
 
-        vp = vmManager.get(vmName, sourceTemplate, renderingTemplate);
+        vp = vmManager.get(vmName, renderingTemplate, sourceTemplate);
 
         /*
          * if this exists, and autoload is on, we need to check where this VM came from
@@ -660,17 +556,6 @@ public class VelocimacroFactory
     }
 
     /**
-     * tells the vmManager to dump the specified namespace
-     *
-     * @param namespace Namespace to dump.
-     * @return True if namespace has been dumped successfully.
-     */
-    public boolean dumpVMNamespace(String namespace)
-    {
-        return vmManager.dumpNamespace(namespace);
-    }
-
-    /**
      * sets permission to have VMs local in scope to their declaring template note that this is
      * really taken care of in the VMManager class, but we need it here for gating purposes in addVM
      * eventually, I will slide this all into the manager, maybe.