Interface ScriptPathLoader

All Known Subinterfaces:
StateOverrideScriptPathLoader
All Known Implementing Classes:
ClasspathScriptPathLoader, ConsoleScriptPathLoader, ControllerScriptPathLoader, MultiScriptPathLoader, RemoteScriptLoaderClient, RunLocalScript.LocalScriptPathLoader, ScriptRepository

public interface ScriptPathLoader
An interface that defines a method of loading scripts from some source.
  • Method Details

    • lock

      void lock()
      Acquire a read lock. Use before invoking any of the get* methods, and hold for as long as consistency is required for this loader.
    • unlock

      void unlock()
      Release a previously acquired read lock.
    • getAvailableScriptDisplayPaths

      Set<String> getAvailableScriptDisplayPaths()
      Returns:
      The display paths currently available from this loader.
    • getScriptBodyByDisplayPath

      String getScriptBodyByDisplayPath(String displayPath) throws IOException
      Parameters:
      displayPath - The display path to load a script for.
      Returns:
      The body of the requested script.
      Throws:
      IOException - If a problem occurred reading the script body.
      ImplNote:
      Should be called under a read lock.
    • getScriptBodyByRelativePath

      String getScriptBodyByRelativePath(String relativePath) throws IOException
      Parameters:
      relativePath - The relative path to load a script for.
      Returns:
      The body of the requested script.
      Throws:
      IOException - If a problem occurred reading the script body.
      ImplNote:
      Should be called under a read lock.
    • getAvailableScriptDisplayPaths

      default Set<String> getAvailableScriptDisplayPaths(ScriptPathLoaderState state) throws IOException
      Gets the display paths available from this loader when it was in the specified state.
      Parameters:
      state - The state of the loader to use when retrieving the list.
      Returns:
      A list of all display paths available when the loader was in the specified state.
      Throws:
      IOException - If a problem occurred loading the script.
    • getScriptBodyByDisplayPath

      default String getScriptBodyByDisplayPath(String displayPath, ScriptPathLoaderState state) throws IOException
      Get the specified script at the specified state.
      Parameters:
      displayPath - The display path to the script.
      state - The state of the loader.
      Returns:
      The script at displayPath at the specified state.
      Throws:
      IOException - If a problem occurred loading the script.
    • getScriptBodyByRelativePath

      default String getScriptBodyByRelativePath(String relativePath, ScriptPathLoaderState state) throws IOException
      Get the specified script at the specified state.
      Parameters:
      relativePath - The relative path to the script.
      state - The state of the loader.
      Returns:
      The script at relativePath at the specified state.
      Throws:
      IOException - If a problem occurred loading the script.
    • getState

      default ScriptPathLoaderState getState()
      Get the current state of this ScriptPathLoader.
      Returns:
      A ScriptPathLoaderState or null if this loader is stateless.
    • makeState

      default ScriptPathLoaderState makeState(@NotNull String stateJSON)
      Create a stat object from the serialized JSON String provided by ScriptPathLoaderState.encodeJSON()
      Parameters:
      stateJSON - the JSON state
      Returns:
      the deserialized object from the JSON state
    • refresh

      void refresh()
      Refresh the loader internally. Will respect existing read locks.
    • close

      void close()
      Free resources associated with this loader.