You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by wg...@apache.org on 2007/10/17 06:50:45 UTC
svn commit: r585370 - in /velocity/texen/trunk/src: changes/changes.xml
java/org/apache/texen/ant/TexenTask.java
Author: wglass
Date: Tue Oct 16 21:50:44 2007
New Revision: 585370
URL: http://svn.apache.org/viewvc?rev=585370&view=rev
Log:
Allow user to override velocity engine properties in TexenTask subclass. TEXEN-14.
Modified:
velocity/texen/trunk/src/changes/changes.xml
velocity/texen/trunk/src/java/org/apache/texen/ant/TexenTask.java
Modified: velocity/texen/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/velocity/texen/trunk/src/changes/changes.xml?rev=585370&r1=585369&r2=585370&view=diff
==============================================================================
--- velocity/texen/trunk/src/changes/changes.xml (original)
+++ velocity/texen/trunk/src/changes/changes.xml Tue Oct 16 21:50:44 2007
@@ -27,6 +27,10 @@
<body>
<release version="1.1" date="in Subversion">
+ <action type="add" dev="wglass" issue="TEXEN-14" due-to="Thomas Fischer">
+ Allow user to specify Velocity properties in subclass of TexenTask.
+ </action>
+
<action type="fix" dev="wglass" issue="TEXEN-1" due-to="Daniel Martin">
Use LRUMap to allow Texen to generate many files without running out of filehandles.
</action>
Modified: velocity/texen/trunk/src/java/org/apache/texen/ant/TexenTask.java
URL: http://svn.apache.org/viewvc/velocity/texen/trunk/src/java/org/apache/texen/ant/TexenTask.java?rev=585370&r1=585369&r2=585370&view=diff
==============================================================================
--- velocity/texen/trunk/src/java/org/apache/texen/ant/TexenTask.java (original)
+++ velocity/texen/trunk/src/java/org/apache/texen/ant/TexenTask.java Tue Oct 16 21:50:44 2007
@@ -448,38 +448,7 @@
try
{
- // Setup the Velocity Runtime.
- if (templatePath != null)
- {
- log("Using templatePath: " + templatePath, Project.MSG_VERBOSE);
- ve.setProperty(
- RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatePath);
- }
-
- if (useClasspath)
- {
- log("Using classpath");
- ve.addProperty(
- VelocityEngine.RESOURCE_LOADER, "classpath");
-
- ve.setProperty(
- "classpath." + VelocityEngine.RESOURCE_LOADER + ".class",
- "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
-
- ve.setProperty(
- "classpath." + VelocityEngine.RESOURCE_LOADER +
- ".cache", useResourceLoaderCache);
-
- ve.setProperty(
- "classpath." + VelocityEngine.RESOURCE_LOADER +
- ".modificationCheckInterval", resourceLoaderModificationCheckInterval);
- }
-
- if (this.logFile != null)
- {
- ve.setProperty(RuntimeConstants.RUNTIME_LOG, this.logFile);
- }
-
+ setVelocityEngineProperties(ve);
ve.init();
// Create the text generator.
@@ -621,6 +590,50 @@
{
return Generator.getInstance();
}
+
+ /**
+ * Set the properties of the velocity engine.
+ * This may be overridden by a subclass.
+ *
+ * @param ve the velocity engine which properties should be set, not null.
+ *
+ * @throws NullPointerException if ve is null.
+ */
+ protected void setVelocityEngineProperties(VelocityEngine ve)
+ {
+ // Setup the Velocity Runtime.
+ if (templatePath != null)
+ {
+ log("Using templatePath: " + templatePath, Project.MSG_VERBOSE);
+ ve.setProperty(
+ RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatePath);
+ }
+
+ if (useClasspath)
+ {
+ log("Using classpath");
+ ve.addProperty(
+ VelocityEngine.RESOURCE_LOADER, "classpath");
+
+ ve.setProperty(
+ "classpath." + VelocityEngine.RESOURCE_LOADER + ".class",
+ "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+
+ ve.setProperty(
+ "classpath." + VelocityEngine.RESOURCE_LOADER +
+ ".cache", useResourceLoaderCache);
+
+ ve.setProperty(
+ "classpath." + VelocityEngine.RESOURCE_LOADER +
+ ".modificationCheckInterval", resourceLoaderModificationCheckInterval);
+ }
+
+ if (this.logFile != null)
+ {
+ ve.setProperty(RuntimeConstants.RUNTIME_LOG, this.logFile);
+ }
+ }
+
/**
* <p>Place useful objects into the initial context.</p>