use of com.serotonin.m2m2.module.ScriptEngineDefinition in project ma-core-public by MangoAutomation.
the class ScriptService method getScriptEngine.
private ScriptAndEngine getScriptEngine(MangoScript script) {
ScriptEngine engine;
ScriptEngineDefinition definition;
if (script instanceof CompiledMangoScript) {
engine = ((CompiledMangoScript) script).compiled.getEngine();
definition = definitionForFactory(engine.getFactory());
} else {
ScriptEngineFactory factory = getFactoryByName(script.getEngineName());
definition = definitionForFactory(factory);
engine = definition.createEngine(factory, script);
}
PermissionHolder user = Common.getUser();
permissionService.ensurePermission(user, definition.requiredPermission());
permissionService.hasSupersetOfRoles(user, script);
return new ScriptAndEngine(script, definition, engine);
}
Aggregations