use of org.beetl.core.statement.Program in project beetl2.0 by javamonkey.
the class GroupTemplate method loadScriptTemplate.
private Template loadScriptTemplate(String key, ResourceLoader loader) {
Program program = (Program) this.programCache.get(key);
if (program == null) {
synchronized (key) {
if (program == null) {
Resource resource = loader.getResource(key);
program = this.loadScript(resource);
this.programCache.set(key, program);
return new Template(this, program, this.conf);
}
}
}
if (resourceLoader.isModified(program.rs)) {
synchronized (key) {
Resource resource = loader.getResource(key);
program = this.loadScript(resource);
this.programCache.set(key, program);
}
}
return new Template(this, program, this.conf);
}
use of org.beetl.core.statement.Program in project beetl2.0 by javamonkey.
the class GroupTemplate method loadScript.
private Program loadScript(Resource res) {
try {
Reader scriptReader = res.openReader();
Program program = engine.createProgram(res, scriptReader, Collections.EMPTY_MAP, System.getProperty("line.separator"), this);
return program;
} catch (BeetlException ex) {
ErrorGrammarProgram ep = new ErrorGrammarProgram(res, this, System.getProperty("line.separator"));
ex.pushResource(res);
ep.setException(ex);
return ep;
}
}
Aggregations