Interface ScriptingManager


  • public interface ScriptingManager
    ScriptingManager. Defines the operations that can be performed on scripts. Scripts are stored in a dedicated cache.
    Since:
    7.2
    Author:
    Tristan Tarrant
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addScript​(java.lang.String name, java.lang.String script)
      Adds a new named script.
      java.lang.String getScript​(java.lang.String scriptName)
      Retrieves the source code of an existing script.
      java.util.Set<java.lang.String> getScriptNames()
      Retrieves names of all available scripts.
      void removeScript​(java.lang.String name)
      Removes a script.
      <T> java.util.concurrent.CompletableFuture<T> runScript​(java.lang.String scriptName)
      Runs a named script
      <T> java.util.concurrent.CompletableFuture<T> runScript​(java.lang.String scriptName, TaskContext context)
      Runs a named script using the specified TaskContext
    • Method Detail

      • addScript

        void addScript​(java.lang.String name,
                       java.lang.String script)
        Adds a new named script.
        Parameters:
        name - the name of the script. The name should contain an extension identifying its language
        script - the source of the script
      • removeScript

        void removeScript​(java.lang.String name)
        Removes a script.
        Parameters:
        name - the name of the script ro remove
      • runScript

        <T> java.util.concurrent.CompletableFuture<T> runScript​(java.lang.String scriptName)
        Runs a named script
        Parameters:
        scriptName - The name of the script to run. Use addScript(String, String) to add a script
        Returns:
        a CompletableFuture which will return the result of the script execution
      • runScript

        <T> java.util.concurrent.CompletableFuture<T> runScript​(java.lang.String scriptName,
                                                                TaskContext context)
        Runs a named script using the specified TaskContext
        Parameters:
        scriptName - The name of the script to run. Use addScript(String, String) to add a script
        context - A TaskContext within which the script will be executed
        Returns:
        a CompletableFuture which will return the result of the script execution
      • getScript

        java.lang.String getScript​(java.lang.String scriptName)
        Retrieves the source code of an existing script.
        Parameters:
        scriptName - The name of the script
        Returns:
        the source code of the script
      • getScriptNames

        java.util.Set<java.lang.String> getScriptNames()
        Retrieves names of all available scripts.
        Returns:
        Set containing names of available scripts.