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 10:46:07 UTC
svn commit: r1753054 [1/2] - in /velocity/engine/trunk: src/changes/
velocity-engine-core/src/main/java/org/apache/velocity/app/
velocity-engine-core/src/main/java/org/apache/velocity/runtime/
velocity-engine-core/src/main/java/org/apache/velocity/runt...
Author: cbrisson
Date: Sun Jul 17 10:46:07 2016
New Revision: 1753054
URL: http://svn.apache.org/viewvc?rev=1753054&view=rev
Log:
[engine] remove dependency to commons-collections-3 (except from deprecated classes and methods), use our own ExtProperties class
Added:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
Modified:
velocity/engine/trunk/src/changes/changes.xml
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/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/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/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/ResourceLoader2.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/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java
Modified: velocity/engine/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/changes/changes.xml?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/src/changes/changes.xml (original)
+++ velocity/engine/trunk/src/changes/changes.xml Sun Jul 17 10:46:07 2016
@@ -27,7 +27,12 @@
<body>
<release version="2.0" date="In Subversion">
- <action type="add" dev="cbrusson" issue="VELOCITY-735" due-to="Dishara Wijewardana">
+ <action type="add" dev="cbrisson" issue="VELOCITY-790">
+ Remove dependency upon commons-collections-3 (except at compile-time for deprecated methods and classes
+ which are needed for backward compatibility), use our own ExtProperties object.
+ </action>
+
+ <action type="add" dev="cbrisson" issue="VELOCITY-735" due-to="Dishara Wijewardana">
Add a first implementation for the JSR 223 standard scripting interface.
</action>
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=1753054&r1=1753053&r2=1753054&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 10:46:07 2016
@@ -33,6 +33,7 @@ import org.apache.velocity.exception.Par
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.RuntimeSingleton;
+import org.apache.velocity.util.ExtProperties;
/**
* This class provides services to the application
@@ -112,7 +113,7 @@ public class Velocity implements Runtime
*/
public static void setProperty(String key, Object value)
{
- RuntimeSingleton.setProperty(key,value);
+ RuntimeSingleton.setProperty(key, value);
}
/**
@@ -123,7 +124,7 @@ public class Velocity implements Runtime
*/
public static void addProperty(String key, Object value)
{
- RuntimeSingleton.addProperty(key,value);
+ RuntimeSingleton.addProperty(key, value);
}
/**
@@ -143,9 +144,25 @@ public class Velocity implements Runtime
* is a subset of the parent application's configuration.
*
* @param configuration A configuration object.
+ * @deprecated use {@link setExtendedProperties(ExtProperties)}
*
*/
- public static void setExtendedProperties( ExtendedProperties configuration)
+ public @Deprecated static void setExtendedProperties( ExtendedProperties configuration)
+ {
+ RuntimeSingleton.setConfiguration(configuration);
+ }
+
+ /**
+ * Set an entire configuration at once. This is
+ * useful in cases where the parent application uses
+ * the ExtendedProperties class and the velocity configuration
+ * is a subset of the parent application's configuration.
+ *
+ * @param configuration A configuration object.
+ * @since 2.0
+ *
+ */
+ public static void setExtendedProperties( ExtProperties configuration)
{
RuntimeSingleton.setConfiguration( configuration );
}
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=1753054&r1=1753053&r2=1753054&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 10:46:07 2016
@@ -33,6 +33,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;
/**
* <p>
@@ -130,7 +131,7 @@ public class VelocityEngine implements R
*/
public void setProperty(String key, Object value)
{
- ri.setProperty(key,value);
+ ri.setProperty(key, value);
}
/**
@@ -141,7 +142,7 @@ public class VelocityEngine implements R
*/
public void addProperty(String key, Object value)
{
- ri.addProperty(key,value);
+ ri.addProperty(key, value);
}
/**
@@ -161,9 +162,23 @@ public class VelocityEngine implements R
* is a subset of the parent application's configuration.
*
* @param configuration
+ * @deprecated use {@link setExtendedProperties(ExtProperties)}
+ */
+ public @Deprecated void setExtendedProperties( ExtendedProperties configuration)
+ {
+ ri.setConfiguration(configuration);
+ }
+
+ /**
+ * Set an entire configuration at once. This is
+ * useful in cases where the parent application uses
+ * the ExtendedProperties class and the velocity configuration
+ * is a subset of the parent application's configuration.
*
+ * @param configuration
+ * @since 2.0
*/
- public void setExtendedProperties( ExtendedProperties configuration)
+ public void setExtendedProperties( ExtProperties configuration)
{
ri.setConfiguration( configuration );
}
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=1753054&r1=1753053&r2=1753054&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 10:46:07 2016
@@ -37,7 +37,6 @@ import org.slf4j.LoggerFactory;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.Template;
-import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.app.event.EventHandler;
import org.apache.velocity.app.event.IncludeEventHandler;
@@ -63,6 +62,7 @@ import org.apache.velocity.runtime.parse
import org.apache.velocity.runtime.resource.ContentResource;
import org.apache.velocity.runtime.resource.ResourceManager;
import org.apache.velocity.util.ClassUtils;
+import org.apache.velocity.util.ExtProperties;
import org.apache.velocity.util.RuntimeServicesAware;
import org.apache.velocity.util.StringUtils;
import org.apache.velocity.util.introspection.ChainableUberspector;
@@ -135,7 +135,7 @@ public class RuntimeInstance implements
* These are the properties that are laid down over top
* of the default properties when requested.
*/
- private ExtendedProperties overridingProperties = null;
+ private ExtProperties overridingProperties = null;
/**
* This is a hashtable of initialized directives.
@@ -154,19 +154,19 @@ public class RuntimeInstance implements
/**
* Object that houses the configuration options for
- * the velocity runtime. The ExtendedProperties object allows
+ * the velocity runtime. The ExtProperties object allows
* the convenient retrieval of a subset of properties.
* For example all the properties for a resource loader
- * can be retrieved from the main ExtendedProperties object
+ * can be retrieved from the main ExtProperties object
* using something like the following:
*
- * ExtendedProperties loaderConfiguration =
+ * ExtProperties loaderConfiguration =
* configuration.subset(loaderID);
*
* And a configuration is a lot more convenient to deal
* with then conventional properties objects, or Maps.
*/
- private ExtendedProperties configuration = new ExtendedProperties();
+ private ExtProperties configuration = new ExtProperties();
private ResourceManager resourceManager = null;
@@ -260,7 +260,7 @@ public class RuntimeInstance implements
*/
public synchronized void reset()
{
- this.configuration = new ExtendedProperties();
+ this.configuration = new ExtProperties();
this.encoding = null;
this.evaluateScopeName = "evaluate";
this.eventCartridge = null;
@@ -468,7 +468,7 @@ public class RuntimeInstance implements
{
if (overridingProperties == null)
{
- overridingProperties = new ExtendedProperties();
+ overridingProperties = new ExtProperties();
}
overridingProperties.setProperty(key, value);
@@ -480,10 +480,10 @@ public class RuntimeInstance implements
*/
public void setProperties(String fileName)
{
- ExtendedProperties props = null;
+ ExtProperties props = null;
try
{
- props = new ExtendedProperties(fileName);
+ props = new ExtProperties(fileName);
}
catch (IOException e)
{
@@ -522,8 +522,32 @@ public class RuntimeInstance implements
* the case with Turbine.
*
* @param configuration
+ * @deprecated use {@link setConfiguration(ExtProperties)}
*/
- public void setConfiguration( ExtendedProperties configuration)
+ public @Deprecated void setConfiguration( ExtendedProperties configuration)
+ {
+ if (overridingProperties == null)
+ {
+ overridingProperties = ExtProperties.convertProperties(configuration);
+ }
+ else
+ {
+ overridingProperties.combine(ExtProperties.convertProperties(configuration));
+ }
+ }
+
+ /**
+ * Allow an external system to set an ExtendedProperties
+ * object to use. This is useful where the external
+ * system also uses the ExtendedProperties class and
+ * the velocity configuration is a subset of
+ * parent application's configuration. This is
+ * the case with Turbine.
+ *
+ * @param configuration
+ * @since 2.0
+ */
+ public void setConfiguration( ExtProperties configuration)
{
if (overridingProperties == null)
{
@@ -562,7 +586,7 @@ public class RuntimeInstance implements
{
if (overridingProperties == null)
{
- overridingProperties = new ExtendedProperties();
+ overridingProperties = new ExtProperties();
}
overridingProperties.addProperty(key, value);
@@ -652,11 +676,11 @@ public class RuntimeInstance implements
*/
public void init(Properties p)
{
- setProperties(ExtendedProperties.convertProperties(p));
+ setProperties(ExtProperties.convertProperties(p));
init();
}
- private void setProperties(ExtendedProperties p)
+ private void setProperties(ExtProperties p)
{
if (overridingProperties == null)
{
@@ -678,7 +702,7 @@ public class RuntimeInstance implements
{
try
{
- setProperties(new ExtendedProperties(configurationFile));
+ setProperties(new ExtProperties(configurationFile));
}
catch (IOException e)
{
@@ -1822,7 +1846,7 @@ public class RuntimeInstance implements
* @return Configuration object which houses the Velocity runtime
* properties.
*/
- public ExtendedProperties getConfiguration()
+ public ExtProperties getConfiguration()
{
return configuration;
}
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=1753054&r1=1753053&r2=1753054&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 10:46:07 2016
@@ -41,6 +41,7 @@ import org.apache.velocity.runtime.parse
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.runtime.parser.node.SimpleNode;
import org.apache.velocity.runtime.resource.ContentResource;
+import org.apache.velocity.util.ExtProperties;
import org.apache.velocity.util.introspection.Introspector;
import org.apache.velocity.util.introspection.Uberspect;
@@ -92,10 +93,24 @@ public interface RuntimeServices
* the case with Turbine.
*
* @param configuration
+ * @deprecated use {@link setConfiguration(ExtProperties)}
*/
- public void setConfiguration( ExtendedProperties configuration);
+ public @Deprecated void setConfiguration( ExtendedProperties configuration);
/**
+ * Allow an external system to set an ExtProperties
+ * object to use. This is useful where the external
+ * system also uses the ExtendedProperties class and
+ * the velocity configuration is a subset of
+ * parent application's configuration. This is
+ * the case with Turbine.
+ *
+ * @param configuration
+ * @since 2.0
+ */
+ public void setConfiguration( ExtProperties configuration);
+
+ /**
* 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
@@ -144,7 +159,7 @@ public interface RuntimeServices
/**
* Initialize the Velocity Runtime with the name of
- * ExtendedProperties object.
+ * ExtProperties object.
*
* @param configurationFile
*/
@@ -432,10 +447,10 @@ public interface RuntimeServices
/**
* Return the velocity runtime configuration object.
*
- * @return ExtendedProperties configuration object which houses
+ * @return ExtProperties configuration object which houses
* the velocity runtime properties.
*/
- public ExtendedProperties getConfiguration();
+ public ExtProperties getConfiguration();
/**
* Return the specified application attribute.
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=1753054&r1=1753053&r2=1753054&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 10:46:07 2016
@@ -36,6 +36,7 @@ import org.apache.velocity.runtime.parse
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.runtime.parser.node.SimpleNode;
import org.apache.velocity.runtime.resource.ContentResource;
+import org.apache.velocity.util.ExtProperties;
import org.apache.velocity.util.introspection.Introspector;
import org.apache.velocity.util.introspection.Uberspect;
@@ -155,9 +156,26 @@ public class RuntimeSingleton implements
* the case with Turbine.
*
* @param configuration
+ * @deprecated use {@link #setConfiguration(ExtProperties)}
* @see RuntimeInstance#setConfiguration(ExtendedProperties)
*/
- public static void setConfiguration( ExtendedProperties configuration)
+ public @Deprecated static void setConfiguration( ExtendedProperties configuration)
+ {
+ ri.setConfiguration(configuration);
+ }
+
+ /**
+ * Allow an external system to set an ExtProperties
+ * object to use. This is useful where the external
+ * system also uses the ExtProperties class and
+ * the velocity configuration is a subset of
+ * parent application's configuration. This is
+ * the case with Turbine.
+ *
+ * @param configuration
+ * @see RuntimeInstance#setConfiguration(ExtProperties)
+ */
+ public static void setConfiguration( ExtProperties configuration)
{
ri.setConfiguration( configuration );
}
@@ -227,7 +245,7 @@ public class RuntimeSingleton implements
/**
* Initialize the Velocity Runtime with the name of
- * ExtendedProperties object.
+ * ExtProperties object.
*
* @param configurationFile
* @see RuntimeInstance#init(String)
@@ -518,11 +536,11 @@ public class RuntimeSingleton implements
/**
* Return the velocity runtime configuration object.
*
- * @return ExtendedProperties configuration object which houses
+ * @return ExtProperties configuration object which houses
* the velocity runtime properties.
* @see RuntimeInstance#getConfiguration()
*/
- public static ExtendedProperties getConfiguration()
+ public static ExtProperties getConfiguration()
{
return ri.getConfiguration();
}
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Sun Jul 17 10:46:07 2016
@@ -26,7 +26,6 @@ import java.util.Vector;
import org.slf4j.Logger;
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
@@ -35,6 +34,7 @@ import org.apache.velocity.runtime.Runti
import org.apache.velocity.runtime.resource.loader.ResourceLoader2;
import org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory;
import org.apache.velocity.util.ClassUtils;
+import org.apache.velocity.util.ExtProperties;
import org.apache.velocity.util.StringUtils;
@@ -117,7 +117,7 @@ public class ResourceManagerImpl
* Resource loader can be loaded either via class name or be passed
* in as an instance.
*/
- ExtendedProperties configuration = (ExtendedProperties) it.next();
+ ExtProperties configuration = (ExtProperties) it.next();
String loaderClass = StringUtils.nullTrim(configuration.getString("class"));
ResourceLoader2 loaderInstance = (ResourceLoader2) configuration.get("instance");
@@ -231,7 +231,7 @@ public class ResourceManagerImpl
StringBuffer loaderID = new StringBuffer(loaderName);
loaderID.append(".").append(RuntimeConstants.RESOURCE_LOADER);
- ExtendedProperties loaderConfiguration =
+ ExtProperties loaderConfiguration =
rsvc.getConfiguration().subset(loaderID.toString());
/*
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -23,11 +23,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ClassUtils;
+import org.apache.velocity.util.ExtProperties;
/**
* ClasspathResourceLoader is a simple loader that will load
@@ -83,7 +83,7 @@ public class ClasspathResourceLoader ext
* This is abstract in the base class, so we need it
* @param configuration
*/
- public void init( ExtendedProperties configuration)
+ public void init( ExtProperties configuration)
{
if (log.isTraceEnabled())
{
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -32,10 +32,10 @@ import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.util.ExtProperties;
import org.apache.velocity.util.StringUtils;
/**
@@ -138,9 +138,9 @@ public class DataSourceResourceLoader ex
private DataSource dataSource;
/**
- * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
+ * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.velocity.util.ExtProperties)
*/
- public void init(ExtendedProperties configuration)
+ public void init(ExtProperties configuration)
{
dataSourceName = StringUtils.nullTrim(configuration.getString("resource.datasource"));
tableName = StringUtils.nullTrim(configuration.getString("resource.table"));
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -31,11 +31,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.io.UnicodeInputStream;
import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.util.ExtProperties;
import org.apache.velocity.util.StringUtils;
/**
@@ -64,9 +64,9 @@ public class FileResourceLoader extends
private Map templatePaths = Collections.synchronizedMap(new HashMap());
/**
- * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
+ * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.velocity.util.ExtProperties)
*/
- public void init( ExtendedProperties configuration)
+ public void init( ExtProperties configuration)
{
if (log.isTraceEnabled())
{
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -32,7 +32,7 @@ import org.apache.velocity.exception.Vel
import org.apache.velocity.util.StringUtils;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.velocity.util.ExtProperties;
/**
* <p>
@@ -85,7 +85,7 @@ public class JarResourceLoader extends R
* Called by Velocity to initialize the loader
* @param configuration
*/
- public void init( ExtendedProperties configuration)
+ public void init( ExtProperties configuration)
{
log.trace("JarResourceLoader : initialization starting.");
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -34,6 +34,7 @@ import org.apache.velocity.runtime.resou
import org.apache.velocity.runtime.resource.ResourceCacheImpl;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.util.ExtProperties;
import org.apache.commons.collections.ExtendedProperties;
/**
@@ -49,6 +50,32 @@ import org.apache.commons.collections.Ex
public @Deprecated abstract class ResourceLoader extends ResourceLoader2
{
/**
+ * This initialization is used by all resource
+ * loaders and must be called to set up common
+ * properties shared by all resource loaders
+ *
+ * @param rs
+ * @param configuration
+ * @deprecated use {@link #commonInit(RuntimeServices, ExtProperties)}
+ */
+ public @Deprecated void commonInit(RuntimeServices rs, ExtendedProperties configuration)
+ {
+ commonInit(rs, ExtProperties.convertProperties(configuration));
+ }
+
+ /**
+ * Initialize the template loader with a
+ * a resources class.
+ *
+ * @param configuration
+ * @deprecated use {@link #init(ExtProperties)}
+ */
+ public @Deprecated void init(ExtendedProperties configuration)
+ {
+ init(ExtProperties.convertProperties(configuration));
+ }
+
+ /**
* Get the InputStream that the Runtime will parse
* to create a template.
*
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java Sun Jul 17 10:46:07 2016
@@ -19,7 +19,6 @@ package org.apache.velocity.runtime.reso
* under the License.
*/
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.io.UnicodeInputStream;
@@ -27,6 +26,7 @@ import org.apache.velocity.runtime.Runti
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.runtime.resource.ResourceCacheImpl;
+import org.apache.velocity.util.ExtProperties;
import org.slf4j.Logger;
import java.io.IOException;
@@ -75,7 +75,7 @@ public abstract class ResourceLoader2
* @param rs
* @param configuration
*/
- public void commonInit(RuntimeServices rs, ExtendedProperties configuration)
+ public void commonInit(RuntimeServices rs, ExtProperties configuration)
{
this.rsvc = rs;
this.log = rsvc.getLog();
@@ -133,7 +133,7 @@ public abstract class ResourceLoader2
*
* @param configuration
*/
- public abstract void init(ExtendedProperties configuration);
+ public abstract void init(ExtProperties configuration);
/**
* Get the Reader that the Runtime will parse
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -29,7 +29,6 @@ import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.resource.Resource;
@@ -38,6 +37,7 @@ import org.apache.velocity.runtime.resou
import org.apache.velocity.runtime.resource.util.StringResourceRepositoryImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.util.ClassUtils;
+import org.apache.velocity.util.ExtProperties;
/**
* Resource loader that works with Strings. Users should manually add
@@ -210,9 +210,9 @@ public class StringResourceLoader extend
/**
- * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
+ * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.velocity.util.ExtProperties)
*/
- public void init(final ExtendedProperties configuration)
+ public void init(final ExtProperties configuration)
{
log.trace("StringResourceLoader : initialization starting.");
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java?rev=1753054&r1=1753053&r2=1753054&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java Sun Jul 17 10:46:07 2016
@@ -26,10 +26,10 @@ import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
-import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.util.ExtProperties;
import org.apache.commons.lang3.StringUtils;
/**
@@ -48,9 +48,9 @@ public class URLResourceLoader extends R
private Method[] timeoutMethods;
/**
- * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
+ * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.velocity.util.ExtProperties)
*/
- public void init(ExtendedProperties configuration)
+ public void init(ExtProperties configuration)
{
log.trace("URLResourceLoader : initialization starting.");