Class ScriptManager
java.lang.Object
ecmwf.common.technical.ScriptManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionScriptManager
(long limit, String language) Instantiates a new script manager.ScriptManager
(String language) Instantiates a new script manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close.<T> T
Eval.void
Eval.static <T> T
Exec.static void
Exec.boolean
Checks if a variable exists in the underlying script (e.g. mqtt.message.qos).<T> T
Gets the value, execute it with the provided arguments if it is a function and then cast it to the desired class.Gets the properties.void
Put.void
Put.
-
Field Details
-
LONG_RUNNING_TIME
public static final long LONG_RUNNING_TIMEThe Constant LONG_RUNNING_TIME. -
JS
-
PYTHON
-
-
Constructor Details
-
ScriptManager
Instantiates a new script manager. Uses the requested script engine.- Parameters:
language
- the language
-
ScriptManager
Instantiates a new script manager. Uses the requested script engine with a limit.- Parameters:
limit
- the limitlanguage
- the language
-
-
Method Details
-
exec
public static <T> T exec(Class<T> clazz, String defaultLanguage, String script) throws ScriptException Exec. If no language is specified in the header of the script then the default language is used (e.g. script=js:code or script=python:code).- Type Parameters:
T
- the generic type- Parameters:
clazz
- the clazzdefaultLanguage
- the default languagescript
- the script- Returns:
- the t
- Throws:
ScriptException
- the script exception
-
exec
Exec. If no language is specified in the header of the script then the default language is used (e.g. script=js:code or script=python:code).- Parameters:
defaultLanguage
- the default languagescript
- the script- Throws:
ScriptException
- the script exception
-
eval
Eval.- Type Parameters:
T
- the generic type- Parameters:
clazz
- the clazzscript
- the script- Returns:
- the t
- Throws:
ScriptException
- the script exception
-
eval
Eval.- Parameters:
script
- the script- Throws:
ScriptException
- the script exception
-
put
Put.- Parameters:
key
- the keyvalue
- the value- Throws:
ScriptException
- the script exception
-
put
Put.- Parameters:
context
- the context- Throws:
ScriptException
- the script exception
-
get
Gets the value, execute it with the provided arguments if it is a function and then cast it to the desired class.- Type Parameters:
T
- the generic type- Parameters:
clazz
- the clazzname
- the nameargs
- the args- Returns:
- the t
- Throws:
ScriptException
- the script exception
-
getProperties
Gets the properties. Just for debugging (values are shorten with ...).- Returns:
- the properties
- Throws:
ScriptException
- the script exception
-
exists
Checks if a variable exists in the underlying script (e.g. mqtt.message.qos).- Parameters:
name
- the name- Returns:
- true, if successful
- Throws:
ScriptException
- the script exception
-
close
-