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
  • Method Details

    • createScriptEngine

      @Nullable ScriptEngineContainer createScriptEngine(String scriptType, String engineIdentifier)
      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

      boolean loadScript(String engineIdentifier, InputStreamReader scriptData)
      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

      void removeEngine(String engineIdentifier)
      Unloads the ScriptEngine loaded with the engineIdentifier
      Parameters:
      engineIdentifier - the unique identifier for the ScriptEngine (script file path or UUID)
    • isSupported

      boolean isSupported(String scriptType)
      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

      void addFactoryChangeListener(ScriptEngineManager.FactoryChangeListener listener)
      Add a listener that is notified when a ScriptEngineFactory is added or removed
      Parameters:
      listener - an object that implements ScriptEngineManager.FactoryChangeListener
    • removeFactoryChangeListener

      void removeFactoryChangeListener(ScriptEngineManager.FactoryChangeListener listener)
      Remove a listener that is notified when a ScriptEngineFactory is added or removed
      Parameters:
      listener - an object that implements ScriptEngineManager.FactoryChangeListener