public void generate(Writer writer, Map model) throws TemplateGenerationException {
VelocityContext context = new VelocityContext(model);
try {
engine.evaluate(context, writer, resource.getDescription(), new InputStreamReader(resource.getInputStream(), encoding));
} catch (IOException ioe) {
throw new TemplateGenerationException("Could not generate velocity template for resource '" +
resource.getDescription() + "'", ioe);
}
}