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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener that is notified when a ScriptEngineFactory is added or removed@Nullable ScriptEngineContainer
createScriptEngine
(String scriptType, String engineIdentifier) Creates a new ScriptEngine used to execute scripts, ScriptActions or ScriptConditionsboolean
isSupported
(String scriptType) Checks if the supplied file extension or MimeType is supported by the existing ScriptEngineFactoriesboolean
loadScript
(String engineIdentifier, InputStreamReader scriptData) Loads a script and initializes its scope variablesvoid
removeEngine
(String engineIdentifier) Unloads the ScriptEngine loaded with the engineIdentifiervoid
Remove 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:
true
if the script was successfully loaded,false
otherwise
-
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
-