use of freemarker.template.Configuration in project intellij-plugins by StepicOrg.
the class Templater method initConfig.
private static void initConfig() {
config = new Configuration(Configuration.VERSION_2_3_23);
config.setClassLoaderForTemplateLoading(Templater.class.getClassLoader(), "/templates");
}
use of freemarker.template.Configuration in project zm-mailbox by Zimbra.
the class SoapApiChangeLog method writeChangelog.
private void writeChangelog() throws IOException, TemplateException {
File templateDirFile = new File(templateDir, CHANGELOG_TEMPLATE_SUBDIR);
Configuration config = new Configuration();
config.setDirectoryForTemplateLoading(templateDirFile);
config.setObjectWrapper(new BeansWrapper());
fmTemplate = config.getTemplate(TEMPLATE_FILE);
File of = new File(outputDir, OUTPUT_FILE);
FileWriter out = new FileWriter(of);
try {
fmTemplate.process(changelogDataModel, out);
} finally {
try {
out.close();
} catch (Exception e) {
// worst case scenario...clean-up quietly
}
}
}
use of freemarker.template.Configuration in project jangaroo-tools by CoreMedia.
the class ExmlComponentClassGenerator method generateClass.
public void generateClass(final ExmlModel model, final Writer output) throws IOException, TemplateException {
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(ExmlComponentClassModel.class, "/");
cfg.setObjectWrapper(new DefaultObjectWrapper());
Template template = cfg.getTemplate("/net/jangaroo/exml/templates/exml_component_class.ftl");
ExmlComponentClassModel exmlComponentClassModel = new ExmlComponentClassModel(model);
Environment env = template.createProcessingEnvironment(exmlComponentClassModel, output);
env.setOutputEncoding(Exmlc.OUTPUT_CHARSET);
env.process();
}
use of freemarker.template.Configuration in project jangaroo-tools by CoreMedia.
the class ExmlConfigClassGenerator method generateClass.
private static void generateClass(final ConfigClass configClass, final Writer output) throws IOException, TemplateException {
if (configClass.getSuperClassName() == null) {
throw new ExmlcException("Config class " + configClass.getFullName() + "'s super class name is null!");
}
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(ConfigClass.class, "/");
cfg.setObjectWrapper(new DefaultObjectWrapper());
Template template = cfg.getTemplate("/net/jangaroo/exml/templates/exml_config_class.ftl");
Environment env = template.createProcessingEnvironment(configClass, output);
env.setOutputEncoding(Exmlc.OUTPUT_CHARSET);
env.process();
}
use of freemarker.template.Configuration in project jangaroo-tools by CoreMedia.
the class ExmlConfigPackageXsdGenerator method generateXsdFile.
public void generateXsdFile(final Collection<ConfigClass> configClasses, String configClassPackage, final Writer output) throws IOException, TemplateException {
ExmlConfigPackage suite = new ExmlConfigPackage(configClasses, configClassPackage);
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(ExmlConfigPackage.class, "/");
cfg.setObjectWrapper(new DefaultObjectWrapper());
Template template = cfg.getTemplate("/net/jangaroo/exml/templates/exml_config_package_xsd.ftl");
Environment env = template.createProcessingEnvironment(suite, output);
env.setOutputEncoding(Exmlc.OUTPUT_CHARSET);
env.process();
}
Aggregations