Interface ScriptEngineManager
@NonNullByDefault
public interface ScriptEngineManager
The ScriptEngineManager provides the ability to load and unload scripts.
- Author:
- Simon Merschjohann - Initial contribution, Scott Rushworth - changed parameter names when implementing
ScriptModuleTypeProvider
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener that is notified when a ScriptEngineFactory is added or removed@Nullable ScriptEngineContainercreateScriptEngine(String scriptType, String engineIdentifier) Creates a new ScriptEngine used to execute scripts, ScriptActions or ScriptConditionsbooleanisSupported(String scriptType) Checks if the supplied file extension or MimeType is supported by the existing ScriptEngineFactoriesbooleanloadScript(String engineIdentifier, InputStreamReader scriptData) Loads a script and initializes its scope variablesvoidremoveEngine(String engineIdentifier) Unloads the ScriptEngine loaded with the engineIdentifiervoidRemove a listener that is notified when a ScriptEngineFactory is added or removed
-
Method Details
-
createScriptEngine
Creates a new ScriptEngine used to execute scripts, ScriptActions or ScriptConditions- Parameters:
scriptType- a file extension (script) or MimeType (ScriptAction or ScriptCondition)engineIdentifier- the unique identifier for the ScriptEngine (script file path or UUID)- Returns:
- ScriptEngineContainer or null
-
loadScript
Loads a script and initializes its scope variables- Parameters:
engineIdentifier- the unique identifier for the ScriptEngine (script file path or UUID)scriptData- the content of the script- Returns:
trueif the script was successfully loaded,falseotherwise
-
removeEngine
Unloads the ScriptEngine loaded with the engineIdentifier- Parameters:
engineIdentifier- the unique identifier for the ScriptEngine (script file path or UUID)
-
isSupported
Checks if the supplied file extension or MimeType is supported by the existing ScriptEngineFactories- Parameters:
scriptType- a file extension (script) or MimeType (ScriptAction or ScriptCondition)- Returns:
- true, if supported, else false
-
addFactoryChangeListener
Add a listener that is notified when a ScriptEngineFactory is added or removed- Parameters:
listener- an object that implementsScriptEngineManager.FactoryChangeListener
-
removeFactoryChangeListener
Remove a listener that is notified when a ScriptEngineFactory is added or removed- Parameters:
listener- an object that implementsScriptEngineManager.FactoryChangeListener
-