Package org.yamcs.algorithms
Class ScriptAlgorithmExecutorFactory
java.lang.Object
org.yamcs.algorithms.ScriptAlgorithmExecutorFactory
- All Implemented Interfaces:
AlgorithmExecutorFactory
Handles the creation of algorithm executors for script algorithms for a given language and scriptEngine (currently
javascript or python are supported).
Each algorithm is created as a function in the scriptEngine. There might be multiple executors for the same algorithm: for example in the command verifier there will be one algorithm executor for each command. However there will be only one function created in the script engine.
-
Constructor Summary
ConstructorDescriptionScriptAlgorithmExecutorFactory
(ScriptEngineManager scriptEngineManager, String language, List<String> libraryNames) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generateFunctionCode
(String functionName, CustomAlgorithm algorithmDef) Returns all the languages supported by this factory.makeExecutor
(CustomAlgorithm calg, AlgorithmExecutionContext execCtx) Creates a new executor for the algorithm running in the execution context
-
Constructor Details
-
ScriptAlgorithmExecutorFactory
public ScriptAlgorithmExecutorFactory(ScriptEngineManager scriptEngineManager, String language, List<String> libraryNames)
-
-
Method Details
-
makeExecutor
public ScriptAlgorithmExecutor makeExecutor(CustomAlgorithm calg, AlgorithmExecutionContext execCtx) Description copied from interface:AlgorithmExecutorFactory
Creates a new executor for the algorithm running in the execution context- Specified by:
makeExecutor
in interfaceAlgorithmExecutorFactory
- Parameters:
calg
- - the algorithm definitionexecCtx
- - the algorithm execution context- Returns:
-
generateFunctionCode
-
getLanguages
Description copied from interface:AlgorithmExecutorFactory
Returns all the languages supported by this factory. Used in order to not create new factories for the same language with different names (e.g. JavaScript and ECMAScript)- Specified by:
getLanguages
in interfaceAlgorithmExecutorFactory
- Returns:
-