use of freemarker.cache.SoftCacheStorage in project be5 by DevelopmentOnTheEdge.
the class FreemarkerUtils method getConfiguration.
public static Configuration getConfiguration(Project project) {
Configuration config = (Configuration) configTemplate.clone();
config.setCacheStorage(new SoftCacheStorage());
try {
config.setSharedVariable("project", project);
} catch (TemplateModelException e) {
throw new RuntimeException("Unexpected error: " + e, e);
}
FreemarkerScript macroCollection = project.getMacroCollection().optScript(FreemarkerCatalog.MAIN_MACRO_LIBRARY);
if (macroCollection != null) {
config.addAutoInclude(macroCollection.getCompletePath().toString());
}
for (Module module : project.getModules()) {
FreemarkerCatalog collection = module.getMacroCollection();
if (collection != null) {
FreemarkerScript script = collection.optScript(FreemarkerCatalog.MAIN_MACRO_LIBRARY);
if (script != null) {
config.addAutoInclude(script.getCompletePath().toString());
}
}
}
config.setTemplateLoader(new ProjectTemplateLoader(project));
return config;
}
Aggregations