* @return Velocity engine initialized to read the template directory.
*/
private VelocityEngine getEngine(String templateDir) {
if (!this.engines.containsKey(templateDir)) {
try {
VelocityEngine engine = new VelocityEngine();
engine.setProperty("resource.loader", "file");
engine.setProperty("file.resource.loader.class", GaeVelocityResourceLoader.class.getCanonicalName());
engine.setProperty("file.resource.loader.path", templateDir);
engine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.Log4JLogChute");
engine.setProperty("runtime.log.logsystem.log4j.logger", LOGGER.getName());
engine.setProperty("runtime.references.strict", "true");
engine.init();
this.engines.put(templateDir, engine);
} catch (Exception e) {
throw new CedarRuntimeException("Failed to initialize Velocity engine: " + e.getMessage(), e);
}
}