jvanzyl 01/08/30 06:28:53
Modified: test/texen-classpath/jar-contents Control.vm book.vm
Log:
- grabbing a properties file in the same way that torque does by
using $generator.templatePath and making sure templates using this
method work from a JAR file.
these are hacks for now because i didn't have the foresight to see
that torque would eventually be used completely from a JAR. we have
to deprecate the use of $generator.templatePath but these hacks work
around them being in templates for now. i want torque to work in JAR
files but i don't want to change the templates.
Revision Changes Path
1.4 +9 -0 jakarta-velocity/test/texen-classpath/jar-contents/Control.vm
Index: Control.vm
===================================================================
RCS file: /home/cvs/jakarta-velocity/test/texen-classpath/jar-contents/Control.vm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Control.vm 2001/08/29 16:41:53 1.3
+++ Control.vm 2001/08/30 13:28:53 1.4
@@ -12,5 +12,14 @@
#set ( $props = $properties.load("test.props") )
+## This is to test a properties file that was once taken from
+## the file system but is now taken from a JAR. We have to
+## deprecate the use of $generator.TemplatePath if we want
+## templates to work the same way from JARs and the file
+## system. I have a hack in PropsUtil right now to deal
+## with it.
+
+#set ( $props2 = $properties.load("$generator.TemplatePath/test.props") )
+
#set ( $sourceFile = "book.txt" )
$generator.parse("book.vm",$sourceFile)
1.2 +9 -0 jakarta-velocity/test/texen-classpath/jar-contents/book.vm
Index: book.vm
===================================================================
RCS file: /home/cvs/jakarta-velocity/test/texen-classpath/jar-contents/book.vm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- book.vm 2001/08/29 16:41:53 1.1
+++ book.vm 2001/08/30 13:28:53 1.2
@@ -1,6 +1,15 @@
This is the book of the week:
+Props retrieved using new method:
+
Title: $props.get("title")
Author: $props.get("author")
Publisher: $props.get("publisher")
ISBN: $props.get("isbn")
+
+Props retrieved using old method:
+
+Title: $props2.get("title")
+Author: $props2.get("author")
+Publisher: $props2.get("publisher")
+ISBN: $props2.get("isbn")