use of org.springframework.integration.scripting.ScriptingException in project spring-integration by spring-projects.
the class AbstractScriptExecutor method executeScript.
@Override
public Object executeScript(ScriptSource scriptSource, Map<String, Object> variables) {
Object result;
try {
String script = scriptSource.getScriptAsString();
Date start = new Date();
if (this.logger.isDebugEnabled()) {
this.logger.debug("executing script: " + script);
}
Bindings bindings = null;
if (variables != null && variables.size() > 0) {
bindings = new SimpleBindings(variables);
result = this.scriptEngine.eval(script, bindings);
} else {
result = this.scriptEngine.eval(script);
}
result = postProcess(result, this.scriptEngine, script, bindings);
if (this.logger.isDebugEnabled()) {
this.logger.debug("script executed in " + (new Date().getTime() - start.getTime()) + " ms");
}
} catch (Exception e) {
throw new ScriptingException(e.getMessage(), e);
}
return result;
}
Aggregations