public class EmailTemplate
extends Object
Email builder based on freemarker templates.
There are several configuration options for templates location:
1.- Classloader:
There are default templates available at classloader.
- template.html.default_en_US.ftl (For html email)
- template.html.default_en_US.ftl (For plain text email)
(Default templates use en_US locale)
2.- Disk:
If "HAWKULAR_ALERTS_TEMPLATES" system environment is defined or if "hawkular.alerts.templates" system property is
defined with a valid path, the default templates
- template.html.default_en_US.ftl (For html email)
- template.html.default_en_US.ftl (For plain text email)
will be loaded from that path.
(Disk templates use en_US locale as well)
3.- Dynamic templates stored at plugin or action level:
Templates can be modified dynamically and being stored per plugin (shared by all actions) or for an specific action.
Templates text are defined at PluginMessage.getProperties() level.
Plain templates are defined under PluginMessage.getProperties().get("template.plain") property.
Html templates are defined under PluginMessage.getProperties().get("template.html") property.
Dynamic templates supports locale defined by action.
If PluginMessage.getProperties().get("template.locale") is present then specific locale templates are supported at
properties level.
i.e.
We may have a default template at plugin level defined under "template.plain"/"template.html" properties.
But per action basis we want to add a template for Spanish language.
Then for an specific action it will exist a "template.locale" == "es" and the following specific properties will
exist for this action: "template.plain.es"/"template.html.es". Under these properties are defined specific
templates for Spanish language.
- Author:
- Jay Shaughnessy, Lucas Ponce