return null;
}
protected static ScriptEngine createScriptEngine(String language) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = null;
// some script names has alias
String[] names = getScriptNames(language);
for (String name : names) {
try {
engine = manager.getEngineByName(name);
if (engine != null) {
break;
}
} catch (NoClassDefFoundError ex) {
LOG.error("Cannot load the scriptEngine for " + name + ", the exception is " + ex
+ ", please ensure correct JARs is provided on classpath.");
}
}
if (engine == null) {
engine = checkForOSGiEngine(language);
}
if (engine == null) {
throw new IllegalArgumentException("No script engine could be created for: " + language);
}
if (isPython(language)) {
ScriptContext context = engine.getContext();
context.setAttribute("com.sun.script.jython.comp.mode", "eval", ScriptContext.ENGINE_SCOPE);
}
return engine;
}