initializeClassTemplate(template);
}
private void initializeClassTemplate(String template) throws Exception {
VelocityEngine velocityEngine = new VelocityEngine();
try {
// use ClasspathResourceLoader for velocity templates lookup
// if Cayenne URL is not null, load resource from this URL
Properties props = new Properties();
// null logger that will prevent velocity.log from being generated
props.put(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, NullLogSystem.class
.getName());
props.put("resource.loader", "cayenne");
props.put(
"cayenne.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
velocityEngine.init(props);
}
catch (Exception ex) {
throw new RuntimeException("Can't initialize Velocity", ex);
}
pageTemplate = velocityEngine.getTemplate(template);
}