Author: cbrisson
Date: Wed Mar 6 21:19:34 2019
New Revision: 1854947
URL: http://svn.apache.org/viewvc?rev=1854947&view=rev
Log:
[engine] configuration key names refactoring proposal
Added:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
- copied, changed from r1854852,
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/velocity.properties
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroAutoReloadTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity702TestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity747TestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/configuration/compare/output.cmp
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/Template.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
Wed Mar 6 21:19:34 2019
@@ -230,8 +230,7 @@ public class Template extends Resource
((SimpleNode)data).init( ica, rsvc);
- String property =
scopeName+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
- provideScope = rsvc.getBoolean(property, provideScope);
+ provideScope = rsvc.isScopeControlEnabled(scopeName);
}
finally
{
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
Wed Mar 6 21:19:34 2019
@@ -26,6 +26,7 @@ import org.apache.velocity.exception.Par
import org.apache.velocity.exception.ResourceNotFoundException;
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;
@@ -153,7 +154,7 @@ public class VelocityEngine implements R
}
/**
- * Set an entire configuration at once.
+ * Set an entire configuration at once from a Properties configuration
*
* @param configuration
* @since 2.0
@@ -164,6 +165,17 @@ public class VelocityEngine implements R
}
/**
+ * Set an entire configuration at once from a named properties file
+ *
+ * @param propsFilename properties filename
+ * @since 2.1
+ */
+ public void setProperties(String propsFilename)
+ {
+ ri.setProperties(propsFilename);
+ }
+
+ /**
* Get a Velocity Runtime property.
*
* @param key property to retrieve
Added:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java?rev=1854947&view=auto
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java
(added)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java
Wed Mar 6 21:19:34 2019
@@ -0,0 +1,262 @@
+package org.apache.velocity.runtime;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * This class gathers deprecated runtime constants
+ *
+ * @author <a href="mailto:[email protected]">Claude Brisson</a>
+ * @version $$
+ */
+
+@Deprecated
+public interface DeprecatedRuntimeConstants
+{
+ /**
+ * Logging of invalid references.
+ * @deprecated see {@link
RuntimeConstants#RUNTIME_LOG_REFERENCE_LOG_INVALID}
+ */
+ String OLD_RUNTIME_LOG_REFERENCE_LOG_INVALID =
"runtime.log.invalid.references";
+
+ /**
+ * Maximum allowed number of loops.
+ * @deprecated see {@link RuntimeConstants#MAX_NUMBER_LOOPS}
+ */
+ String OLD_MAX_NUMBER_LOOPS = "directive.foreach.maxloops";
+
+ /**
+ * Whether to throw an exception or just skip bad iterables. Default is
true.
+ * @since 1.6
+ * @deprecated see {@link RuntimeConstants#SKIP_INVALID_ITERATOR}
+ */
+ String OLD_SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid";
+
+ /**
+ * An empty object (string, collection) or zero number is false.
+ * @since 2.0
+ * @deprecated see {@link RuntimeConstants#CHECK_EMPTY_OBJECTS}
+ */
+ String OLD_CHECK_EMPTY_OBJECTS = "directive.if.emptycheck";
+
+ /**
+ * Starting tag for error messages triggered by passing a parameter not
allowed in the #include directive. Only string literals,
+ * and references are allowed.
+ * @deprecated see {@link RuntimeConstants#ERRORMSG_START}
+ */
+ String OLD_ERRORMSG_START = "directive.include.output.errormsg.start";
+
+ /**
+ * Ending tag for error messages triggered by passing a parameter not
allowed in the #include directive. Only string literals,
+ * and references are allowed.
+ * @deprecated see {@link RuntimeConstants#ERRORMSG_END}
+ */
+ String OLD_ERRORMSG_END = "directive.include.output.errormsg.end";
+
+ /**
+ * Maximum recursion depth allowed for the #parse directive.
+ * @deprecated see {@link RuntimeConstants#PARSE_DIRECTIVE_MAXDEPTH}
+ */
+ String OLD_PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth";
+
+ /**
+ * Maximum recursion depth allowed for the #define directive.
+ * @deprecated see {@link RuntimeConstants#DEFINE_DIRECTIVE_MAXDEPTH}
+ */
+ String OLD_DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth";
+
+ /**
+ * Vector of custom directives
+ * @deprecated see {@link RuntimeConstants#CUSTOM_DIRECTIVES}
+ */
+ String OLD_CUSTOM_DIRECTIVES = "userdirective";
+
+ /**
+ * The <code>resource.manager.cache.size</code> property specifies the
cache upper bound (if relevant).
+ * @deprecated see {@link
RuntimeConstants#RESOURCE_MANAGER_DEFAULTCACHE_SIZE}
+ */
+ String OLD_RESOURCE_MANAGER_DEFAULTCACHE_SIZE =
"resource.manager.defaultcache.size";
+
+ /**
+ * controls if the finding of a resource is logged.
+ * @deprecated see {@link RuntimeConstants#RESOURCE_MANAGER_LOGWHENFOUND}
+ */
+ String OLD_RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound";
+
+ /**
+ * Key used to retrieve the names of the resource loaders to be used. In a
properties file they may appear as the following:
+ * <p>resource.loader = file,classpath</p>
+ * @deprecated see {@link RuntimeConstants#RESOURCE_LOADERS}
+ */
+ String OLD_RESOURCE_LOADERS = "resource.loader";
+
+ /**
+ * The public handle for setting a path in the FileResourceLoader.
+ * @deprecated see {@link RuntimeConstants#FILE_RESOURCE_LOADER_PATH}
+ */
+ String OLD_FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path";
+
+ /**
+ * The public handle for turning the caching on in the FileResourceLoader.
+ * @deprecated see {@link RuntimeConstants#FILE_RESOURCE_LOADER_CACHE}
+ */
+ String OLD_FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache";
+
+ /**
+ * Resource loader modification check interval property suffix
+ */
+ String OLD_RESOURCE_LOADER_CHECK_INTERVAL = "modificationCheckInterval";
+
+ /**
+ * The <code>eventhandler.referenceinsertion.class</code> property
specifies a list of the
+ * {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler}
implementations to use.
+ * @deprecated see {@link RuntimeConstants#EVENTHANDLER_REFERENCEINSERTION}
+ */
+ String OLD_EVENTHANDLER_REFERENCEINSERTION =
"eventhandler.referenceinsertion.class";
+
+ /**
+ * The <code>eventhandler.methodexception.class</code> property specifies
a list of the
+ * {@link org.apache.velocity.app.event.MethodExceptionEventHandler}
implementations to use.
+ * @deprecated see {@link RuntimeConstants#EVENTHANDLER_METHODEXCEPTION}
+ */
+ String OLD_EVENTHANDLER_METHODEXCEPTION =
"eventhandler.methodexception.class";
+
+ /**
+ * The <code>eventhandler.include.class</code> property specifies a list
of the
+ * {@link org.apache.velocity.app.event.IncludeEventHandler}
implementations to use.
+ * @deprecated see {@link RuntimeConstants#EVENTHANDLER_INCLUDE}
+ */
+ String OLD_EVENTHANDLER_INCLUDE = "eventhandler.include.class";
+
+ /**
+ * The <code>eventhandler.invalidreferences.class</code> property
specifies a list of the
+ * {@link org.apache.velocity.app.event.InvalidReferenceEventHandler}
implementations to use.
+ * @deprecated see {@link RuntimeConstants#EVENTHANDLER_INVALIDREFERENCES}
+ */
+ String OLD_EVENTHANDLER_INVALIDREFERENCES =
"eventhandler.invalidreferences.class";
+
+ /**
+ * Name of local Velocimacro library template.
+ * @deprecated see {@link RuntimeConstants#VM_LIBRARY}
+ */
+ String OLD_VM_LIBRARY = "velocimacro.library";
+
+ /**
+ * Default Velocimacro library template.
+ * @deprecated see {@link RuntimeConstants#VM_LIBRARY_DEFAULT}
+ */
+ String OLD_VM_LIBRARY_DEFAULT = "VM_global_library.vm";
+
+ /**
+ * boolean (true/false) default true: allow inline (in-template) macro
definitions.
+ * @deprecated see {@link RuntimeConstants#VM_PERM_ALLOW_INLINE}
+ */
+ String OLD_VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline";
+
+ /**
+ * boolean (true/false) default false: allow inline (in-template) macro
definitions to replace existing.
+ * @deprecated see {@link
RuntimeConstants#VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL}
+ */
+ String OLD_VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL =
"velocimacro.permissions.allow.inline.to.replace.global";
+
+ /**
+ * Switch for forcing inline macros to be local: default false.
+ * @deprecated see {@link RuntimeConstants#VM_PERM_INLINE_LOCAL}
+ */
+ String OLD_VM_PERM_INLINE_LOCAL =
"velocimacro.permissions.allow.inline.local.scope";
+
+ /**
+ * Specify the maximum depth for macro calls
+ * @since 1.6
+ * @deprecated see {@link RuntimeConstants#VM_MAX_DEPTH}
+ */
+ String OLD_VM_MAX_DEPTH = "velocimacro.max.depth";
+
+ /**
+ * Defines name of the reference that can be used to get the AST block
passed to block macro calls.
+ * @since 1.7
+ * @deprecated see {@link RuntimeConstants#VM_BODY_REFERENCE}
+ */
+ String OLD_VM_BODY_REFERENCE = "velocimacro.body.reference";
+
+ /**
+ * When displaying null or invalid non-quiet references, use the argument
literal reference
+ * instead of the one in the macro block. Defaults to false.
+ * @since 2.1
+ * @deprecated see {@link RuntimeConstants#VM_PRESERVE_ARGUMENTS_LITERALS}
+ */
+ String OLD_VM_PRESERVE_ARGUMENTS_LITERALS =
"velocimacro.preserve.arguments.literals";
+
+ /**
+ * Properties referenced in the template are required to exist the object
+ * @deprecated see {@link RuntimeConstants#RUNTIME_REFERENCES_STRICT}
+ */
+ String OLD_RUNTIME_REFERENCES_STRICT = "runtime.references.strict";
+
+ /**
+ * Indicates we are going to use modified escape behavior in strict mode
+ * @deprecated see {@link
RuntimeConstants#RUNTIME_REFERENCES_STRICT_ESCAPE}
+ */
+ String OLD_RUNTIME_REFERENCES_STRICT_ESCAPE =
"runtime.references.strict.escape";
+
+ /**
+ * key name for uberspector. Multiple classnames can be specified,in which
case uberspectors will be chained.
+ * @deprecated see {@link RuntimeConstants#UBERSPECT_CLASSNAME}
+ */
+ String OLD_UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";
+
+ /**
+ * key for Conversion Manager instance
+ * @deprecated see {@link RuntimeConstants#CONVERSION_HANDLER_INSTANCE}
+ */
+ String OLD_CONVERSION_HANDLER_INSTANCE =
"runtime.conversion.handler.instance";
+
+ /**
+ * Switch for the interpolation facility for string literals.
+ * @deprecated see {@link RuntimeConstants#INTERPOLATE_STRINGLITERALS}
+ */
+ String OLD_INTERPOLATE_STRINGLITERALS =
"runtime.interpolate.string.literals";
+
+ /**
+ * Switch for ignoring nulls in math equations vs throwing exceptions.
+ * @deprecated see {@link RuntimeConstants#STRICT_MATH}
+ */
+ String OLD_STRICT_MATH = "runtime.strict.math";
+
+ /**
+ * Key upon which a context should be accessible within itself
+ * @deprecated see {@link RuntimeConstants#CONTEXT_AUTOREFERENCE_KEY}
+ */
+ String OLD_CONTEXT_AUTOREFERENCE_KEY = "context.autoreference.key";
+
+ /**
+ * Allow dash in identifiers (backward compatibility option)
+ * @since 2.1
+ * @deprecated see {@link RuntimeConstants#PARSER_HYPHEN_ALLOWED}
+ */
+ String OLD_PARSER_HYPHEN_ALLOWED = "parser.allows.dash.in.identifiers";
+
+ /**
+ * Space gobbling mode
+ * @since 2.0
+ * @deprecated see {@link RuntimeConstants#SPACE_GOBBLING}
+ */
+ String OLD_SPACE_GOBBLING = "space.gobbling";
+
+}
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
Wed Mar 6 21:19:34 2019
@@ -28,7 +28,8 @@ package org.apache.velocity.runtime;
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
* @version $Id$
*/
-public interface RuntimeConstants
+
+public interface RuntimeConstants extends DeprecatedRuntimeConstants
{
/*
* ----------------------------------------------------------------------
@@ -51,10 +52,13 @@ public interface RuntimeConstants
String RUNTIME_LOG_NAME = "runtime.log.name";
/** Logging of invalid references. */
- String RUNTIME_LOG_REFERENCE_LOG_INVALID =
"runtime.log.invalid.references";
+ String RUNTIME_LOG_REFERENCE_LOG_INVALID =
"runtime.log.log_invalid_references";
+
+ /** Logging of invalid method calls. */
+ String RUNTIME_LOG_METHOD_CALL_LOG_INVALID =
"runtime.log.log_invalid_method_calls";
/** Whether to use string interning. */
- String RUNTIME_STRING_INTERNING = "runtime.string.interning";
+ String RUNTIME_STRING_INTERNING = "runtime.string_interning";
/*
* ----------------------------------------------------------------------
@@ -67,44 +71,61 @@ public interface RuntimeConstants
*/
/** Maximum allowed number of loops. */
- String MAX_NUMBER_LOOPS = "directive.foreach.maxloops";
+ String MAX_NUMBER_LOOPS = "directive.foreach.max_loops";
/**
* Whether to throw an exception or just skip bad iterables. Default is
true.
* @since 1.6
*/
- String SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid";
+ String SKIP_INVALID_ITERATOR = "directive.foreach.skip_invalid";
/**
* An empty object (string, collection) or zero number is false.
* @since 2.0
*/
- String CHECK_EMPTY_OBJECTS = "directive.if.emptycheck";
+ String CHECK_EMPTY_OBJECTS = "directive.if.empty_check";
/**
* Starting tag for error messages triggered by passing a parameter not
allowed in the #include directive. Only string literals,
* and references are allowed.
*/
- String ERRORMSG_START = "directive.include.output.errormsg.start";
+ String ERRORMSG_START = "directive.include.output_error_start";
/**
* Ending tag for error messages triggered by passing a parameter not
allowed in the #include directive. Only string literals,
* and references are allowed.
*/
- String ERRORMSG_END = "directive.include.output.errormsg.end";
+ String ERRORMSG_END = "directive.include.output_error_end";
/** Maximum recursion depth allowed for the #parse directive. */
- String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth";
+ String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max_depth";
/** Maximum recursion depth allowed for the #define directive. */
- String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth";
+ String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max_depth";
/**
- * Used to suppress various scope control objects.
+ * Used to suppress various scope control objects (property suffix).
* @since 1.7
+ * @deprecated use <code>context.scope_control.<scope_name> =
true/false</code>
+ * @see #CONTEXT_SCOPE_CONTROL
*/
+ @Deprecated
String PROVIDE_SCOPE_CONTROL = "provide.scope.control";
-
+
+ /**
+ * Used to enable or disable a scope control (false by default):
+ * <code>context.scope_control.<scope_name> = true/false</code>
+ * where <i>scope_name</i> is one of: <code>template, evaluate, foreach,
macro, define</code>
+ * or the name of a body macro.
+ * @since 2.1
+ */
+ String CONTEXT_SCOPE_CONTROL = "context.scope_control";
+
+ /**
+ * Vector of custom directives
+ */
+ String CUSTOM_DIRECTIVES = "runtime.custom_directives";
+
/*
* ----------------------------------------------------------------------
* R E S O U R C E M A N A G E R C O N F I G U R A T I O N
@@ -130,7 +151,7 @@ public interface RuntimeConstants
String RESOURCE_MANAGER_CACHE_CLASS = "resource.manager.cache.class";
/** The <code>resource.manager.cache.size</code> property specifies the
cache upper bound (if relevant). */
- String RESOURCE_MANAGER_DEFAULTCACHE_SIZE =
"resource.manager.defaultcache.size";
+ String RESOURCE_MANAGER_DEFAULTCACHE_SIZE =
"resource.manager.cache.default_size";
/*
* ----------------------------------------------------------------------
@@ -139,20 +160,55 @@ public interface RuntimeConstants
*/
/** controls if the finding of a resource is logged. */
- String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound";
+ String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.log_when_found";
/**
* Key used to retrieve the names of the resource loaders to be used. In a
properties file they may appear as the following:
*
* <p>resource.loader = file,classpath</p>
*/
+ String RESOURCE_LOADERS = "resource.loaders";
+
+ /**
+ * Key prefix for a specific resource loader properties
+ *
+ * <p>resource.loader.file.path = ...</p>
+ */
String RESOURCE_LOADER = "resource.loader";
- /** The public handle for setting a path in the FileResourceLoader. */
- String FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path";
+ /** The public handle for setting paths in the FileResourceLoader.
+ * (this constant is used by test cases only)
+ */
+ String FILE_RESOURCE_LOADER_PATH = "resource.loader.file.path";
/** The public handle for turning the caching on in the
FileResourceLoader. */
- String FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache";
+ String FILE_RESOURCE_LOADER_CACHE = "resource.loader.file.cache";
+
+ /**
+ * Resource loader class property suffix
+ */
+ String RESOURCE_LOADER_CLASS = "class";
+
+ /**
+ * Resource loader instance property suffix
+ */
+ String RESOURCE_LOADER_INSTANCE = "instance";
+
+ /**
+ * Resource loader cache property suffix
+ */
+ String RESOURCE_LOADER_CACHE = "cache";
+
+ /**
+ * File resource loader paths property suffix
+ */
+ String RESOURCE_LOADER_PATHS = "path";
+
+ /**
+ * Resource loader modification check interval property suffix
+ */
+ String RESOURCE_LOADER_CHECK_INTERVAL = "modification_check_interval";
+
/*
* ----------------------------------------------------------------------
@@ -164,25 +220,25 @@ public interface RuntimeConstants
* The <code>eventhandler.referenceinsertion.class</code> property
specifies a list of the
* {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler}
implementations to use.
*/
- String EVENTHANDLER_REFERENCEINSERTION =
"eventhandler.referenceinsertion.class";
+ String EVENTHANDLER_REFERENCEINSERTION =
"event_handler.reference_insertion.class";
/**
* The <code>eventhandler.methodexception.class</code> property specifies
a list of the
* {@link org.apache.velocity.app.event.MethodExceptionEventHandler}
implementations to use.
*/
- String EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class";
+ String EVENTHANDLER_METHODEXCEPTION =
"event_handler.method_exception.class";
/**
* The <code>eventhandler.include.class</code> property specifies a list
of the
* {@link org.apache.velocity.app.event.IncludeEventHandler}
implementations to use.
*/
- String EVENTHANDLER_INCLUDE = "eventhandler.include.class";
+ String EVENTHANDLER_INCLUDE = "event_handler.include.class";
/**
* The <code>eventhandler.invalidreferences.class</code> property
specifies a list of the
* {@link org.apache.velocity.app.event.InvalidReferenceEventHandler}
implementations to use.
*/
- String EVENTHANDLER_INVALIDREFERENCES =
"eventhandler.invalidreferences.class";
+ String EVENTHANDLER_INVALIDREFERENCES =
"event_handler.invalid_references.class";
/*
@@ -191,48 +247,45 @@ public interface RuntimeConstants
* ----------------------------------------------------------------------
*/
- /** Name of local Velocimacro library template. */
- String VM_LIBRARY = "velocimacro.library";
+ /** Filename of local Velocimacro library template. */
+ String VM_LIBRARY = "velocimacro.library.path";
/** Default Velocimacro library template. */
- String VM_LIBRARY_DEFAULT = "VM_global_library.vm";
+ String VM_LIBRARY_DEFAULT = "velocimacros.vtl";
/** switch for autoloading library-sourced VMs (for development). */
String VM_LIBRARY_AUTORELOAD = "velocimacro.library.autoreload";
/** boolean (true/false) default true: allow inline (in-template) macro
definitions. */
- String VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline";
+ String VM_PERM_ALLOW_INLINE = "velocimacro.inline.allow";
/** boolean (true/false) default false: allow inline (in-template) macro
definitions to replace existing. */
- String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL =
"velocimacro.permissions.allow.inline.to.replace.global";
+ String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL =
"velocimacro.inline.replace_global";
/** Switch for forcing inline macros to be local: default false. */
- String VM_PERM_INLINE_LOCAL =
"velocimacro.permissions.allow.inline.local.scope";
-
- /** Switch for VM blather: default true. */
- String VM_MESSAGES_ON = "velocimacro.messages.on";
+ String VM_PERM_INLINE_LOCAL = "velocimacro.inline.local_scope";
/** if true, throw an exception for wrong number of arguments **/
String VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict";
/**
+ * When displaying null or invalid non-quiet references, use the argument
literal reference
+ * instead of the one in the macro block. Defaults to false.
+ * @since 2.1
+ **/
+ String VM_PRESERVE_ARGUMENTS_LITERALS =
"velocimacro.arguments.preserve_literals";
+
+ /**
* Specify the maximum depth for macro calls
* @since 1.6
*/
- String VM_MAX_DEPTH = "velocimacro.max.depth";
+ String VM_MAX_DEPTH = "velocimacro.max_depth";
/**
* Defines name of the reference that can be used to get the AST block
passed to block macro calls.
* @since 1.7
*/
- String VM_BODY_REFERENCE = "velocimacro.body.reference";
-
- /**
- * When displaying null or invalid non-quiet references, use the argument
literal reference
- * instead of the one in the macro block. Defaults to false.
- * @since 2.1
- **/
- String VM_PRESERVE_ARGUMENTS_LITERALS =
"velocimacro.preserve.arguments.literals";
+ String VM_BODY_REFERENCE = "velocimacro.body_reference";
/*
* ----------------------------------------------------------------------
@@ -243,12 +296,12 @@ public interface RuntimeConstants
/**
* Properties referenced in the template are required to exist the object
*/
- String RUNTIME_REFERENCES_STRICT = "runtime.references.strict";
+ String RUNTIME_REFERENCES_STRICT = "runtime.strict_mode.enable";
/**
* Indicates we are going to use modified escape behavior in strict mode
*/
- String RUNTIME_REFERENCES_STRICT_ESCAPE =
"runtime.references.strict.escape";
+ String RUNTIME_REFERENCES_STRICT_ESCAPE = "runtime.strict_mode.escape";
/*
* ----------------------------------------------------------------------
@@ -257,13 +310,7 @@ public interface RuntimeConstants
*/
/** key name for uberspector. Multiple classnames can be specified,in
which case uberspectors will be chained. */
- String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";
-
- /** key for Conversion Manager instance */
- String CONVERSION_HANDLER_INSTANCE = "runtime.conversion.handler.instance";
-
- /** key for Conversion Manager class */
- String CONVERSION_HANDLER_CLASS = "runtime.conversion.handler.class";
+ String UBERSPECT_CLASSNAME = "introspector.uberspect";
/** A comma separated list of packages to restrict access to in the
SecureIntrospector. */
String INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages";
@@ -271,6 +318,11 @@ public interface RuntimeConstants
/** A comma separated list of classes to restrict access to in the
SecureIntrospector. */
String INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes";
+ /** key for Conversion Manager class */
+ String CONVERSION_HANDLER_CLASS = "introspector.conversion_handler.class";
+
+ /** key for Conversion Manager instance */
+ String CONVERSION_HANDLER_INSTANCE =
"introspector.conversion_handler.instance";
/*
* ----------------------------------------------------------------------
@@ -279,7 +331,7 @@ public interface RuntimeConstants
*/
/** Switch for the interpolation facility for string literals. */
- String INTERPOLATE_STRINGLITERALS = "runtime.interpolate.string.literals";
+ String INTERPOLATE_STRINGLITERALS = "runtime.interpolate_string_literals";
/** The character encoding for the templates. Used by the parser in
processing the input streams. */
String INPUT_ENCODING = "input.encoding";
@@ -288,10 +340,10 @@ public interface RuntimeConstants
String ENCODING_DEFAULT = "UTF-8";
/** Switch for ignoring nulls in math equations vs throwing exceptions. */
- String STRICT_MATH = "runtime.strict.math";
+ String STRICT_MATH = "runtime.strict_math";
/** Key upon which a context should be accessible within itself */
- String CONTEXT_AUTOREFERENCE_KEY = "context.autoreference.key";
+ String CONTEXT_AUTOREFERENCE_KEY = "context.self_reference_key";
/**
* The <code>parser.pool.class</code> property specifies the name of the
{@link org.apache.velocity.util.SimplePool}
@@ -314,7 +366,7 @@ public interface RuntimeConstants
* Space gobbling mode
* @since 2.0
*/
- String SPACE_GOBBLING = "space.gobbling";
+ String SPACE_GOBBLING = "parser.space_gobbling";
/**
* Space gobbling modes
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Wed Mar 6 21:19:34 2019
@@ -62,12 +62,15 @@ import java.io.StringReader;
import java.io.Writer;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Properties;
+import java.util.Set;
/**
* This is the Runtime system for Velocity. It is the
@@ -174,27 +177,39 @@ public class RuntimeInstance implements
*/
private EventCartridge eventCartridge = null;
- /*
+ /**
* Whether to use string interning
*/
private boolean stringInterning = false;
- /*
- * Settings for provision of root scope for evaluate(...) calls.
+ /**
+ * Scope name for evaluate(...) calls.
*/
private String evaluateScopeName = "evaluate";
- private boolean provideEvaluateScope = false;
- /*
+ /**
+ * Scope names for which to provide scope control objects in the context
+ */
+ private Set<String> enabledScopeControls = new HashSet<String>();
+
+ /**
* Opaque reference to something specified by the
* application for use in application supplied/specified
* pluggable components
*/
private Map applicationAttributes = null;
+
+ /**
+ * Uberspector
+ */
private Uberspect uberSpect;
+
+ /**
+ * Default encoding
+ */
private String defaultEncoding;
- /*
+ /**
* Space gobbling mode
*/
private SpaceGobbling spaceGobbling;
@@ -249,7 +264,7 @@ public class RuntimeInstance implements
initializeParserPool();
initializeIntrospection();
- initializeEvaluateScopeSettings();
+ initializeScopeSettings();
/*
* initialize the VM Factory. It will use the properties
* accessible from Runtime, so keep this here at the end.
@@ -293,7 +308,7 @@ public class RuntimeInstance implements
this.initializing = false;
this.overridingProperties = null;
this.parserPool = null;
- this.provideEvaluateScope = false;
+ this.enabledScopeControls.clear();
this.resourceManager = null;
this.runtimeDirectives = new Hashtable();
this.runtimeDirectivesShared = null;
@@ -697,15 +712,7 @@ public class RuntimeInstance implements
*/
public void init(String configurationFile)
{
- try
- {
- setConfiguration(new ExtProperties(configurationFile));
- }
- catch (IOException e)
- {
- throw new VelocityException("Error reading properties from '"
- + configurationFile + "'", e);
- }
+ setProperties(configurationFile);
init();
}
@@ -1028,7 +1035,7 @@ public class RuntimeInstance implements
* now the user's directives
*/
- String[] userdirective = configuration.getStringArray("userdirective");
+ String[] userdirective =
configuration.getStringArray(CUSTOM_DIRECTIVES);
for (String anUserdirective : userdirective)
{
@@ -1252,10 +1259,19 @@ public class RuntimeInstance implements
}
}
- private void initializeEvaluateScopeSettings()
+ private void initializeScopeSettings()
{
- String property = evaluateScopeName+'.'+PROVIDE_SCOPE_CONTROL;
- provideEvaluateScope = getBoolean(property, provideEvaluateScope);
+ ExtProperties scopes = configuration.subset(CONTEXT_SCOPE_CONTROL);
+ if (scopes != null)
+ {
+ Iterator<String> scopeIterator = scopes.getKeys();
+ while (scopeIterator.hasNext())
+ {
+ String scope = scopeIterator.next();
+ boolean enabled = scopes.getBoolean(scope);
+ if (enabled) enabledScopeControls.add(scope);
+ }
+ }
}
/**
@@ -1395,7 +1411,7 @@ public class RuntimeInstance implements
try
{
- if (provideEvaluateScope)
+ if (isScopeControlEnabled(evaluateScopeName))
{
Object previous = ica.get(evaluateScopeName);
context.put(evaluateScopeName, new Scope(this, previous));
@@ -1426,7 +1442,7 @@ public class RuntimeInstance implements
finally
{
ica.popCurrentTemplateName();
- if (provideEvaluateScope)
+ if (isScopeControlEnabled(evaluateScopeName))
{
Object obj = ica.get(evaluateScopeName);
if (obj instanceof Scope)
@@ -1856,4 +1872,15 @@ public class RuntimeInstance implements
{
return hyphenAllowedInIdentifiers;
}
+
+ /**
+ * Get whether to provide a scope control object for this scope
+ * @param scopeName
+ * @return scope control enabled
+ * @since 2.1
+ */
+ public boolean isScopeControlEnabled(String scopeName)
+ {
+ return enabledScopeControls.contains(scopeName);
+ }
}
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
Wed Mar 6 21:19:34 2019
@@ -469,8 +469,17 @@ public interface RuntimeServices
SpaceGobbling getSpaceGobbling();
/**
- * get whether hyphens are allowed in identifiers
+ * Get whether hyphens are allowed in identifiers
* @return configured boolean flag
+ * @since 2.1
*/
boolean isHyphenAllowedInIdentifiers();
+
+ /**
+ * Get whether to provide a scope control object for this scope
+ * @param scopeName
+ * @return scope control enabled
+ * @since 2.1
+ */
+ boolean isScopeControlEnabled(String scopeName);
}
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
Wed Mar 6 21:19:34 2019
@@ -157,6 +157,17 @@ public class RuntimeSingleton implements
}
/**
+ * Set an entire configuration at once from a named properties file
+ *
+ * @param propsFilename properties filename
+ * @since 2.1
+ */
+ public static void setProperties(String propsFilename)
+ {
+ ri.setProperties(propsFilename);
+ }
+
+ /**
* Add a property to the configuration. If it already
* exists then the value stated here will be added
* to the configuration entry. For example, if
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
Wed Mar 6 21:19:34 2019
@@ -158,7 +158,16 @@ public class VelocimacroFactory
}
else
{
- log.debug("Default library not found.");
+ // try the old default library
+ log.debug("Default library {} not found. Trying old
default library: {}", RuntimeConstants.VM_LIBRARY_DEFAULT,
DeprecatedRuntimeConstants.OLD_VM_LIBRARY_DEFAULT);
+ if
(rsvc.getLoaderNameForResource(RuntimeConstants.OLD_VM_LIBRARY_DEFAULT) != null)
+ {
+ libfiles = RuntimeConstants.OLD_VM_LIBRARY_DEFAULT;
+ }
+ else
+ {
+ log.debug("Old default library {} not found.",
DeprecatedRuntimeConstants.OLD_VM_LIBRARY_DEFAULT);
+ }
}
}
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
Wed Mar 6 21:19:34 2019
@@ -160,8 +160,7 @@ public abstract class Directive implemen
rsvc = rs;
log = rsvc.getLog("directive." + getName());
- String property =
getScopeName()+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
- this.provideScope = rsvc.getBoolean(property, provideScope);
+ provideScope = rsvc.isScopeControlEnabled(getScopeName());
}
/**
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Wed Mar 6 21:19:34 2019
@@ -60,6 +60,7 @@ public class ASTMethod extends SimpleNod
private String methodName = "";
private int paramCount = 0;
+ private boolean logOnInvalid = true;
protected Info uberInfo;
@@ -120,6 +121,7 @@ public class ASTMethod extends SimpleNod
paramCount = jjtGetNumChildren() - 1;
strictRef =
rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false);
+ logOnInvalid =
rsvc.getBoolean(RuntimeConstants.RUNTIME_LOG_METHOD_CALL_LOG_INVALID, true);
cleanupParserAndTokens();
@@ -165,8 +167,8 @@ public class ASTMethod extends SimpleNod
VelMethod method = ClassUtils.getMethod(methodName, params,
paramClasses,
o, context, this, strictRef);
- // warn if method wasn't found (if strictRef is true, then ClassUtils
did thorw an exception)
- if (o != null && method == null)
+ // warn if method wasn't found (if strictRef is true, then ClassUtils
did throw an exception)
+ if (o != null && method == null && logOnInvalid)
{
StringBuilder plist = new StringBuilder();
for (int i = 0; i < params.length; i++)
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
Wed Mar 6 21:19:34 2019
@@ -34,7 +34,6 @@ import org.apache.commons.lang3.StringUt
import org.slf4j.Logger;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
@@ -117,8 +116,8 @@ public class ResourceManagerImpl
* in as an instance.
*/
- String loaderClass =
StringUtils.trim(configuration.getString("class"));
- ResourceLoader loaderInstance = (ResourceLoader)
configuration.get("instance");
+ String loaderClass =
StringUtils.trim(configuration.getString(RuntimeConstants.RESOURCE_LOADER_CLASS));
+ ResourceLoader loaderInstance = (ResourceLoader)
configuration.get(RuntimeConstants.RESOURCE_LOADER_INSTANCE);
if (loaderInstance != null)
{
@@ -209,7 +208,7 @@ public class ResourceManagerImpl
*/
private void assembleResourceLoaderInitializers()
{
- Vector resourceLoaderNames =
rsvc.getConfiguration().getVector(RuntimeConstants.RESOURCE_LOADER);
+ Vector resourceLoaderNames =
rsvc.getConfiguration().getVector(RuntimeConstants.RESOURCE_LOADERS);
for (ListIterator<String> it = resourceLoaderNames.listIterator();
it.hasNext(); )
{
@@ -223,8 +222,8 @@ public class ResourceManagerImpl
*/
String loaderName = StringUtils.trim(it.next());
it.set(loaderName);
- StringBuilder loaderID = new StringBuilder(loaderName);
- loaderID.append(".").append(RuntimeConstants.RESOURCE_LOADER);
+ StringBuilder loaderID = new StringBuilder();
+
loaderID.append(RuntimeConstants.RESOURCE_LOADER).append('.').append(loaderName);
ExtProperties loaderConfiguration =
rsvc.getConfiguration().subset(loaderID.toString());
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
Wed Mar 6 21:19:34 2019
@@ -21,6 +21,7 @@ package org.apache.velocity.runtime.reso
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ExtProperties;
@@ -72,7 +73,7 @@ public class FileResourceLoader extends
{
log.trace("FileResourceLoader: initialization starting.");
- paths.addAll( configuration.getVector("path") );
+ paths.addAll(
configuration.getVector(RuntimeConstants.RESOURCE_LOADER_PATHS) );
// trim spaces from all paths
for (ListIterator<String> it = paths.listIterator(); it.hasNext(); )
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
Wed Mar 6 21:19:34 2019
@@ -21,6 +21,7 @@ package org.apache.velocity.runtime.reso
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ExtProperties;
@@ -91,7 +92,7 @@ public class JarResourceLoader extends R
{
log.trace("JarResourceLoader: initialization starting.");
- List paths = configuration.getList("path");
+ List paths =
configuration.getList(RuntimeConstants.RESOURCE_LOADER_PATHS);
if (paths != null)
{
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
Wed Mar 6 21:19:34 2019
@@ -92,23 +92,23 @@ public abstract class ResourceLoader
try
{
- isCachingOn = configuration.getBoolean("cache", false);
+ isCachingOn =
configuration.getBoolean(RuntimeConstants.RESOURCE_LOADER_CACHE, false);
}
catch (Exception e)
{
isCachingOn = false;
- String msg = "Exception parsing cache setting: " +
configuration.getString("cache");
+ String msg = "Exception parsing cache setting: " +
configuration.getString(RuntimeConstants.RESOURCE_LOADER_CACHE);
log.error(msg, e);
throw new VelocityException(msg, e);
}
try
{
- modificationCheckInterval =
configuration.getLong("modificationCheckInterval", 0);
+ modificationCheckInterval =
configuration.getLong(RuntimeConstants.RESOURCE_LOADER_CHECK_INTERVAL, 0);
}
catch (Exception e)
{
modificationCheckInterval = 0;
- String msg = "Exception parsing modificationCheckInterval setting:
" + configuration.getString("modificationCheckInterval");
+ String msg = "Exception parsing modificationCheckInterval setting:
" + RuntimeConstants.RESOURCE_LOADER_CHECK_INTERVAL;
log.error(msg, e);
throw new VelocityException(msg, e);
}
@@ -119,7 +119,7 @@ public abstract class ResourceLoader
className = ResourceCacheImpl.class.getName();
try
{
- className = configuration.getString("class", className);
+ className =
configuration.getString(RuntimeConstants.RESOURCE_LOADER_CLASS, className);
}
catch (Exception e)
{
Added:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java?rev=1854947&view=auto
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java
(added)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java
Wed Mar 6 21:19:34 2019
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.velocity.util;
+
+
+import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.DeprecatedRuntimeConstants;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class extends ExtProperties to handle deprecated propery key names.
+ * @since 2.1
+ * @version $Revision: $
+ * @version $Id: DeprecationAwareExtProperties.java$
+ *
+ * @author <a href="mailto:[email protected]">Claude Brisson</a>
+ * @deprecated it will disappear along with deprecated key names in 3.0.
+ */
+@Deprecated
+public class DeprecationAwareExtProperties extends Hashtable<String, Object>
+{
+ /**
+ * Logger used to log the use of deprecated properties names
+ */
+ protected static Logger logger = LoggerFactory.getLogger("deprecation");
+
+ /**
+ * Emit a warning in the log for adeprecated property name
+ */
+ protected void warnDeprecated(String oldName, String newName)
+ {
+ if (warned.add(oldName))
+ {
+ logger.warn("configuration key '{}' has been deprecated in favor
of '{}'", oldName, newName);
+ }
+ }
+
+ /**
+ * Translate if needed a deprecated key into its replacement key, and emit
a warning for deprecated keys
+ * @param key provided key
+ * @return translated key
+ */
+ protected String translateKey(String key)
+ {
+ // check for a replacement key
+ String replacement = propertiesReplacementMap.get(key);
+ if (replacement != null)
+ {
+ warnDeprecated(key, replacement);
+ return replacement;
+ }
+ // check for a resource loader property
+ int i = key.indexOf(".resource.loader.");
+ if (i != -1)
+ {
+ replacement = "resource.loader." + key.substring(0, i + 1) +
key.substring(i + 17);
+ warnDeprecated(key, replacement);
+ return replacement;
+ }
+ // check for a control scope property
+ if (key.endsWith(".provide.scope.control"))
+ {
+ replacement = RuntimeConstants.CONTEXT_SCOPE_CONTROL + "." +
key.substring(0, key.length() - 22);
+ warnDeprecated(key, replacement);
+ return replacement;
+ }
+ // looks good
+ return key;
+ }
+
+ /**
+ * Property getter which checks deprecated property keys
+ * @param key provided key
+ * @return found value under this key or under the corresponding
deprecated one, if any
+ */
+ public Object get(String key)
+ {
+ return super.get(translateKey(key));
+ }
+
+ /**
+ * Property setter which checks deprecated property keys
+ * @param key provided key
+ * @param value provided value
+ * @return previous found value, if any
+ */
+ public Object put(String key, Object value)
+ {
+ return super.put(translateKey(key), value);
+ }
+
+ /**
+ * Property getter which checks deprecated property keys
+ * @param key provided key
+ * @return found value under this key or under the corresponding
deprecated one, if any
+ */
+ public boolean containsKey(String key)
+ {
+ return super.containsKey(translateKey(key));
+ }
+
+ /**
+ * Set of old property names for which a warning has already been emitted
+ */
+ private Set<String> warned = new HashSet<String>();
+
+ /**
+ * Property keys replacement map, from old key name to new key name
+ */
+ static private Map<String, String> propertiesReplacementMap = new
HashMap();
+
+ static
+ {
+ {
+ try
+ {
+ Field oldFields[] =
DeprecatedRuntimeConstants.class.getDeclaredFields();
+ for (Field oldField : oldFields)
+ {
+ String name = oldField.getName();
+ if (!name.startsWith("OLD_")) throw new
VelocityException("Could not initialize property keys deprecation map because
DeprecatedRuntimeConstants." + name + " field isn't properly named");
+ if (oldField.getType() != String.class) continue;
+ String oldValue = (String)oldField.get(null);
+ if (oldValue == null) throw new VelocityException("Could
not initialize property keys deprecation map because
DeprecatedRuntimeConstants." + name + " field isn't initialized");
+ name = name.substring(4);
+ Field newField =
RuntimeConstants.class.getDeclaredField(name);
+ String newValue = (String)newField.get(null);
+ if (newValue == null) throw new VelocityException("Could
not initialize property keys deprecation map because RuntimeConstants." + name
+ " field isn't initialized");
+ if (!newValue.equals(oldValue))
+ {
+ propertiesReplacementMap.put(oldValue, newValue);
+ }
+ }
+ }
+ catch (IllegalAccessException | NoSuchFieldException e)
+ {
+ throw new VelocityException("Could not initialize property
keys deprecation map", e);
+ }
+ }
+ }
+
+}
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
Wed Mar 6 21:19:34 2019
@@ -30,7 +30,6 @@ import java.nio.charset.StandardCharsets
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -151,9 +150,9 @@ import java.util.Vector;
* @author <a href="mailto:[email protected]">Henning P. Schmiedehausen</a>
* @author <a href="mailto:[email protected]">Claude Brisson</a>
*/
-public class ExtProperties extends Hashtable<String,Object>
+@SuppressWarnings("deprecation")
+public class ExtProperties extends DeprecationAwareExtProperties
{
-
/**
* Default configurations repository.
*/
@@ -212,7 +211,7 @@ public class ExtProperties extends Hasht
* you wish to perform operations with configuration
* information in a particular order.
*/
- protected ArrayList keysAsListed = new ArrayList();
+ protected ArrayList<String> keysAsListed = new ArrayList<String>();
protected final static String START_TOKEN="${";
protected final static String END_TOKEN="}";
@@ -791,7 +790,7 @@ public class ExtProperties extends Hasht
// safety check
if (!containsKey(key))
{
- keysAsListed.add(key);
+ keysAsListed.add(translateKey(key));
}
put(key, value);
}
@@ -832,7 +831,7 @@ public class ExtProperties extends Hasht
// brand new key - store in keysAsListed to retain order
if (!containsKey(key))
{
- keysAsListed.add(key);
+ keysAsListed.add(translateKey(key));
}
put(key, value);
}
@@ -930,6 +929,7 @@ public class ExtProperties extends Hasht
*/
public void clearProperty(String key)
{
+ key = translateKey(key);
if (containsKey(key))
{
// we also need to rebuild the keysAsListed or else
@@ -952,7 +952,7 @@ public class ExtProperties extends Hasht
*
* @return an Iterator over the keys
*/
- public Iterator getKeys()
+ public Iterator<String> getKeys()
{
return keysAsListed.iterator();
}
@@ -964,16 +964,16 @@ public class ExtProperties extends Hasht
* @param prefix the prefix to match
* @return an Iterator of keys that match the prefix
*/
- public Iterator getKeys(String prefix)
+ public Iterator<String> getKeys(String prefix)
{
- Iterator keys = getKeys();
- ArrayList matchingKeys = new ArrayList();
+ Iterator<String> keys = getKeys();
+ ArrayList<String> matchingKeys = new ArrayList();
while (keys.hasNext())
{
- Object key = keys.next();
+ String key = keys.next();
- if (key instanceof String && ((String) key).startsWith(prefix))
+ if (key.startsWith(prefix))
{
matchingKeys.add(key);
}
@@ -2085,5 +2085,4 @@ public class ExtProperties extends Hasht
}
return c;
}
-
}
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
Wed Mar 6 21:19:34 2019
@@ -19,7 +19,7 @@
# This controls whether invalid references are logged.
# ----------------------------------------------------------------------------
-runtime.log.invalid.references = true
+runtime.log.log_invalid_references = true
# ----------------------------------------------------------------------------
# T E M P L A T E E N C O D I N G
@@ -32,7 +32,7 @@ input.encoding=UTF-8
# ----------------------------------------------------------------------------
# Set to true to optimize memory, to false to optimize speed
-runtime.string.interning = true
+runtime.string_interning = true
# ----------------------------------------------------------------------------
# F O R E A C H P R O P E R T I E S
@@ -41,7 +41,7 @@ runtime.string.interning = true
# is -1, which means there is no limit.
# ----------------------------------------------------------------------------
-directive.foreach.maxloops = -1
+directive.foreach.max_loops = -1
# ----------------------------------------------------------------------------
# I F P R O P E R T I E S
@@ -50,7 +50,7 @@ directive.foreach.maxloops = -1
# as long as zero numbers, do evaluate to false.
# ----------------------------------------------------------------------------
-directive.if.emptycheck = true
+directive.if.empty_check = true
# ----------------------------------------------------------------------------
# I N C L U D E P R O P E R T I E S
@@ -59,14 +59,14 @@ directive.if.emptycheck = true
# is governed.
# ----------------------------------------------------------------------------
-directive.include.output.errormsg.start = <!-- include error :
-directive.include.output.errormsg.end = see error log -->
+directive.include.output_errormsg_start = <!-- include error :
+directive.include.output_errormsg_end = see error log -->
# ----------------------------------------------------------------------------
# P A R S E P R O P E R T I E S
# ----------------------------------------------------------------------------
-directive.parse.max.depth = 10
+directive.parse.max_depth = 10
# ----------------------------------------------------------------------------
# S C O P E P R O P E R T I E S
@@ -77,12 +77,12 @@ directive.parse.max.depth = 10
# for most of these is false. Note that <bodymacroname> should be replaced by
# name of macros that take bodies for which you want to suppress the scope.
# ----------------------------------------------------------------------------
-# template.provide.scope.control = false
-# evaluate.provide.scope.control = false
-foreach.provide.scope.control = true
-# macro.provide.scope.control = false
-# define.provide.scope.control = false
-# <bodymacroname>.provide.scope.control = false
+# context.scope_control.template = false
+# context.scope_control.evaluate = false
+context.scope_control.foreach = true
+# context.scope_control.macro = false
+# context.scope_control.define = false
+# context.scope_control.<bodymacroname> = false
# ----------------------------------------------------------------------------
# T E M P L A T E L O A D E R S
@@ -91,13 +91,13 @@ foreach.provide.scope.control = true
#
# ----------------------------------------------------------------------------
-resource.loader = file
+resource.loaders = file
-file.resource.loader.description = Velocity File Resource Loader
-file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
-file.resource.loader.path = .
-file.resource.loader.cache = false
-file.resource.loader.modificationCheckInterval = 2
+resource.loader.file.description = Velocity File Resource Loader
+resource.loader.file.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
+resource.loader.file.path = .
+resource.loader.file.cache = false
+resource.loader.file.modification_check_interval = 2
# ----------------------------------------------------------------------------
# VELOCIMACRO PROPERTIES
@@ -108,10 +108,10 @@ file.resource.loader.modificationCheckIn
# ----------------------------------------------------------------------------
# velocimacro.library = VM_global_library.vm
-velocimacro.permissions.allow.inline = true
-velocimacro.permissions.allow.inline.to.replace.global = false
-velocimacro.permissions.allow.inline.local.scope = false
-velocimacro.max.depth = 20
+velocimacro.inline.allow = true
+velocimacro.inline.replace_global = false
+velocimacro.inline.local_scope = false
+velocimacro.max_depth = 20
# ----------------------------------------------------------------------------
# VELOCIMACRO STRICT MODE
@@ -129,7 +129,7 @@ velocimacro.arguments.strict = false
# Defines name of the reference that can be used to render the AST block
passed to
# block macro call as an argument inside a macro.
# ----------------------------------------------------------------------------
-velocimacro.body.reference=bodyContent
+velocimacro.body_reference=bodyContent
# ----------------------------------------------------------------------------
# VELOCIMACRO PRESERVE ARGUMENTS LITERALS
@@ -138,7 +138,7 @@ velocimacro.body.reference=bodyContent
# which is not quiet, it will print the provided literal reference instead
# of the one found in the body of the macro
# ----------------------------------------------------------------------------
-velocimacro.preserve.arguments.literals = false
+velocimacro.arguments.preserve_literals = false
# ----------------------------------------------------------------------------
@@ -151,7 +151,7 @@ velocimacro.preserve.arguments.literals
# or if the object is null. When this property is true then property
# 'directive.set.null.allowed' is also set to true.
# ----------------------------------------------------------------------------
-runtime.references.strict = false
+runtime.references.strict.enable = false
# ----------------------------------------------------------------------------
# INTERPOLATION
@@ -159,7 +159,7 @@ runtime.references.strict = false
# turn off and on interpolation of references and directives in string
# literals. ON by default :)
# ----------------------------------------------------------------------------
-runtime.interpolate.string.literals = true
+runtime.interpolate_string_literals = true
# ----------------------------------------------------------------------------
@@ -190,10 +190,10 @@ parser.pool.size = 20
# class property is actually a comma-separated list of classes (which will
# be called in order).
# ----------------------------------------------------------------------------
-# eventhandler.referenceinsertion.class =
-# eventhandler.nullset.class =
-# eventhandler.methodexception.class =
-# eventhandler.include.class =
+# event_handler.reference_insertion.class =
+# event_handler.invalid_reference.class =
+# event_handler.method_exception.class =
+# event_handler.include.class =
# ----------------------------------------------------------------------------
@@ -202,7 +202,7 @@ parser.pool.size = 20
# Allows alternative introspection and all that can of worms brings.
# ----------------------------------------------------------------------------
-runtime.introspector.uberspect =
org.apache.velocity.util.introspection.UberspectImpl
+introspector.uberspect = org.apache.velocity.util.introspection.UberspectImpl
# ----------------------------------------------------------------------------
# CONVERSION HANDLER
@@ -210,8 +210,8 @@ runtime.introspector.uberspect = org.apa
# Sets the data types Conversion Handler used by the default uberspector
# ----------------------------------------------------------------------------
-runtime.conversion.handler.class =
org.apache.velocity.util.introspection.TypeConversionHandlerImpl
-
+introspector.conversion_handler.class =
org.apache.velocity.util.introspection.TypeConversionHandlerImpl
+1
# ----------------------------------------------------------------------------
# SECURE INTROSPECTOR
@@ -247,7 +247,7 @@ introspector.restrict.classes = java.lan
# Possible values: none, bc (aka Backward Compatible), lines, structured
# ----------------------------------------------------------------------------
-space.gobbling = lines
+parser.space_gobbling = lines
# ----------------------------------------------------------------------------
# HYPHEN IN IDENTIFIERS
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
Wed Mar 6 21:19:34 2019
@@ -29,7 +29,6 @@ import org.apache.velocity.runtime.resou
import org.apache.velocity.test.misc.TestLogger;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
@@ -72,7 +71,7 @@ public abstract class BaseTestCase exten
ret.setProperty(RuntimeConstants.RUNTIME_LOG_INSTANCE, log);
// use string resource loader by default, instead of file
- ret.setProperty(RuntimeConstants.RESOURCE_LOADER, "file,string");
+ ret.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file,string");
ret.addProperty("string.resource.loader.class",
StringResourceLoader.class.getName());
ret.addProperty("string.resource.loader.repository.name",
stringRepoName);
ret.addProperty("string.resource.loader.repository.static", "false");
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
Wed Mar 6 21:19:34 2019
@@ -80,7 +80,7 @@ public class ClasspathResourceTestCase e
assureResultsDirectoryExists(RESULTS_DIR);
Velocity.reset();
- Velocity.setProperty(Velocity.RESOURCE_LOADER, "classpath");
+ Velocity.setProperty(Velocity.RESOURCE_LOADERS, "classpath");
/*
* I don't think I should have to do this, these should
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
Wed Mar 6 21:19:34 2019
@@ -87,10 +87,10 @@ public class CommonsExtPropTestCase exte
showIterator(result, c.getKeys());
message(result, "Testing retrieval of CSV values ...");
- showVector(result, c.getVector("resource.loader"));
+ showVector(result, c.getVector("resource.loaders"));
message(result, "Testing subset(prefix).getKeys() ...");
- ExtProperties subset = c.subset("file.resource.loader");
+ ExtProperties subset = c.subset("resource.loader.file");
showIterator(result, subset.getKeys());
message(result, "Testing getVector(prefix) ...");
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
Wed Mar 6 21:19:34 2019
@@ -96,7 +96,7 @@ public class ExceptionTestCase extends B
throws Exception
{
ve = new VelocityEngine();
- ve.setProperty(RuntimeConstants.RESOURCE_LOADER,"except");
+ ve.setProperty(RuntimeConstants.RESOURCE_LOADERS,"except");
ve.setProperty("except.resource.loader.class",ExceptionGeneratingResourceLoader.class.getName());
try
{
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroAutoReloadTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroAutoReloadTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroAutoReloadTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroAutoReloadTestCase.java
Wed Mar 6 21:19:34 2019
@@ -55,7 +55,7 @@ public class MacroAutoReloadTestCase ext
engine.setProperty(RuntimeConstants.RUNTIME_LOG_INSTANCE, log);
// use file resource loader
- engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "file,string");
+ engine.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file,string");
engine.addProperty("file.resource.loader.path", RELOAD_TEMPLATE_PATH);
engine.addProperty("velocimacro.library", "macros2.vtl");
engine.addProperty("velocimacro.library.autoreload", "true");
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java
Wed Mar 6 21:19:34 2019
@@ -76,7 +76,7 @@ public class MacroForwardDefineTestCase
// use Velocity.setProperty (instead of properties file) so that we
can use actual instance of log
Velocity.reset();
- Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER,"file");
+ Velocity.setProperty(RuntimeConstants.RESOURCE_LOADERS,"file");
Velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
FILE_RESOURCE_LOADER_PATH );
Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID,"true");
Modified:
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff
==============================================================================
---
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java
(original)
+++
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java
Wed Mar 6 21:19:34 2019
@@ -90,40 +90,42 @@ public class MultiLoaderTestCase extends
Velocity.reset();
- Velocity.setProperty(Velocity.RESOURCE_LOADER, "file");
+ Velocity.setProperty(Velocity.RESOURCE_LOADERS, "file");
Velocity.setProperty(
Velocity.FILE_RESOURCE_LOADER_PATH, FILE_RESOURCE_LOADER_PATH);
- Velocity.addProperty(Velocity.RESOURCE_LOADER, "classpath");
+ Velocity.addProperty(Velocity.RESOURCE_LOADERS, "classpath");
- Velocity.addProperty(Velocity.RESOURCE_LOADER, "jar");
+ Velocity.addProperty(Velocity.RESOURCE_LOADERS, "jar");
/*
* Set up the classpath loader.
*/
Velocity.setProperty(
- "classpath." + Velocity.RESOURCE_LOADER + ".class",
-
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+ Velocity.RESOURCE_LOADER + ".classpath.class",
+
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
Velocity.setProperty(
- "classpath." + Velocity.RESOURCE_LOADER + ".cache", "false");
+ Velocity.RESOURCE_LOADER + ".classpath.cache",
+ "false");
Velocity.setProperty(
- "classpath." + Velocity.RESOURCE_LOADER +
".modificationCheckInterval",
- "2");
+ Velocity.RESOURCE_LOADER +
".classpath.modification_check_interval",
+ "2");
/*
* setup the Jar loader
*/
Velocity.setProperty(
- "jar." + Velocity.RESOURCE_LOADER + ".class",
-
"org.apache.velocity.runtime.resource.loader.JarResourceLoader");
+ Velocity.RESOURCE_LOADER + ".jar.class",
+ "org.apache.velocity.runtime.resource.loader.JarResourceLoader");
- Velocity.setProperty( "jar." + Velocity.RESOURCE_LOADER + ".path",
- "jar:file:" + FILE_RESOURCE_LOADER_PATH +
"/test2.jar" );
+ Velocity.setProperty(
+ Velocity.RESOURCE_LOADER + ".jar.path",
+ "jar:file:" + FILE_RESOURCE_LOADER_PATH + "/test2.jar" );
Velocity.setProperty(