stephenh 2002/09/27 18:18:51
Modified: src/java/org/apache/torque/task TorqueDataModelTask.java
Log:
Now mapping torque.xxx.yyy properties to xxxYyy so that templates like the OJB
MainRepository.vm can get to the database settings information (which are of the
torque.database.xxx form).
Revision Changes Path
1.21 +18 -4
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java
Index: TorqueDataModelTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TorqueDataModelTask.java 15 Sep 2002 03:16:57 -0000 1.20
+++ TorqueDataModelTask.java 28 Sep 2002 01:18:51 -0000 1.21
@@ -60,6 +60,7 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -401,7 +402,12 @@
* Override Texen's context properties to map the
* torque.xxx properties (including defaults set by the
* org/apache/torque/defaults.properties) to just xxx.
- *
+ *
+ * <p>
+ * Also, move xxx.yyy properties to xxxYyy as Velocity
+ * doesn't like the xxx.yyy syntax.
+ * </p>
+ *
* @param file the file to read the properties from
*/
public void setContextProperties(String file)
@@ -415,9 +421,17 @@
String key = (String) i.next();
if (key.startsWith("torque."))
{
- contextProperties.setProperty(
- key.substring("torque.".length()),
- env.get(key));
+ String newKey = key.substring("torque.".length());
+ int j = newKey.indexOf(".");
+ while (j != -1)
+ {
+ newKey =
+ newKey.substring(0, j)
+ + StringUtils.capitalise(newKey.substring(j + 1));
+ j = newKey.indexOf(".");
+ }
+
+ contextProperties.setProperty(newKey, env.get(key));
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>