public EmailTemplate() {
ftlCfg = new Configuration(new Version(FREEMARKER_VERSION));
try {
// Check if templates are located from disk or if we are loading default ones.
String templatesDir = System.getenv(EmailPlugin.HAWKULAR_ALERTS_TEMPLATES);
templatesDir = templatesDir == null ? System.getProperty(EmailPlugin.HAWKULAR_ALERTS_TEMPLATES_PROPERY)
: templatesDir;
boolean templatesFromDir = false;
if (templatesDir != null) {
File fileDir = new File(templatesDir);
if (fileDir.exists()) {
ftlCfg.setDirectoryForTemplateLoading(fileDir);
templatesFromDir = true;
}
}
if (!templatesFromDir) {
ftlCfg.setClassForTemplateLoading(this.getClass(), "/");
}
ftlTemplatePlain = ftlCfg.getTemplate(DEFAULT_TEMPLATE_PLAIN, DEFAULT_LOCALE);
ftlTemplateHtml = ftlCfg.getTemplate(DEFAULT_TEMPLATE_HTML, DEFAULT_LOCALE);
} catch (IOException e) {
log.debug(e.getMessage(), e);
throw new RuntimeException("Cannot initialize templates on email plugin: " + e.getMessage());
}
}
EmailTemplate.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:hawkular-alerts
作者:
评论列表
文章目录