new ScriptHelper(this.context, scriptLanguage, resourceManager, contextKey), ScriptContext.ENGINE_SCOPE);
this.scriptEngine = new ScriptEngineManager().getEngineByName(scriptLanguage);
if (scriptEngine instanceof Invocable == false)
{
throw new ReportDataFactoryException(String.format("Query script language '%s' is not usable.", scriptLanguage));
}
this.invocableEngine = (Invocable) scriptEngine;
this.scriptEngine.setContext(this.context);
try
{
this.scriptEngine.eval(script);
}
catch (ScriptException e)
{
throw new ReportDataFactoryException
("DataFactoryScriptingSupport: Failed to initialize local query script: " + queryName, e);
}
try
{
this.invocableEngine.invokeFunction("initQuery");
}
catch (ScriptException e)
{
throw new ReportDataFactoryException
("DataFactoryScriptingSupport: Failed to invoke local init method: " + queryName, e);
}
catch (NoSuchMethodException e)
{
// ignored ..