jvanzyl 01/03/14 14:03:24
Modified: src/java/org/apache/velocity/anakia AnakiaTask.java
Log:
- start of the conversion of anakia using the Velocity app class
- removal of some dead code. where the props file and template path
are null an attempt was made to init the runtime but it was never
reached because a BuildException would be thrown earlier in the code.
Revision Changes Path
1.21 +9 -11
jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java
Index: AnakiaTask.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- AnakiaTask.java 2001/03/12 21:45:08 1.20
+++ AnakiaTask.java 2001/03/14 22:03:19 1.21
@@ -75,6 +75,7 @@
import org.jdom.output.XMLOutputter;
import org.apache.velocity.Template;
+import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.Runtime;
import org.apache.velocity.util.StringUtils;
@@ -92,7 +93,7 @@
* <a href="http://jakarta.apache.org/velocity/anakia.html">Website</a>.
*
* @author <a href="[EMAIL PROTECTED]">Jon S. Stevens</a>
- * @version $Id: AnakiaTask.java,v 1.20 2001/03/12 21:45:08 jon Exp $
+ * @version $Id: AnakiaTask.java,v 1.21 2001/03/14 22:03:19 jvanzyl Exp $
*/
public class AnakiaTask extends MatchingTask
{
@@ -287,21 +288,18 @@
try
{
- // initialize Velocity
- if (velocityPropertiesFile == null)
+ if (velocityPropertiesFile != null)
{
- Runtime.init();
+ Velocity.init(velocityPropertiesFile.getAbsolutePath());
}
- else
- {
- Runtime.init(velocityPropertiesFile.getAbsolutePath());
- }
- // override the templatePath if it exists
- if (templatePath != null && templatePath.length() > 0)
+ else if (templatePath != null && templatePath.length() > 0)
{
- Runtime.setSourceProperty(Runtime.FILE_RESOURCE_LOADER_PATH,
+ Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH,
templatePath);
+
+ Velocity.init();
}
+
// get the last modification of the VSL stylesheet
styleSheetLastModified = Runtime.getTemplate(style).getLastModified();