Package com.illumon.iris.db.util.scripts
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 Summary
Modifier and TypeMethodDescriptionvoid
close()
Free resources associated with this loader.Gets the display paths available from this loader when it was in the specifiedstate
.getScriptBodyByDisplayPath
(String displayPath) default String
getScriptBodyByDisplayPath
(String displayPath, ScriptPathLoaderState state) Get the specified script at the specified state.getScriptBodyByRelativePath
(String relativePath) default String
getScriptBodyByRelativePath
(String relativePath, ScriptPathLoaderState state) Get the specified script at the specified state.default ScriptPathLoaderState
getState()
Get the current state of thisScriptPathLoader
.void
lock()
Acquire a read lock.default ScriptPathLoaderState
Create a stat object from the serialized JSON String provided byScriptPathLoaderState.encodeJSON()
void
refresh()
Refresh the loader internally.void
unlock()
Release a previously acquired read lock.
-
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
- Returns:
- The display paths currently available from this loader.
-
getScriptBodyByDisplayPath
- 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
- 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
Gets the display paths available from this loader when it was in the specifiedstate
.- 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
Get the current state of thisScriptPathLoader
.- Returns:
- A
ScriptPathLoaderState
or null if this loader is stateless.
-
makeState
Create a stat object from the serialized JSON String provided byScriptPathLoaderState.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.
-