Package com.illumon.iris.db.util.scripts
Class MultiScriptPathLoader<LOADER_TYPE extends ScriptPathLoader>
java.lang.Object
com.illumon.iris.db.util.scripts.MultiScriptPathLoader<LOADER_TYPE>
- All Implemented Interfaces:
ScriptPathLoader
public class MultiScriptPathLoader<LOADER_TYPE extends ScriptPathLoader> extends Object implements ScriptPathLoader
A
ScriptPathLoader
that will load paths from multiple underlying loaders.-
Constructor Summary
Constructors Constructor Description MultiScriptPathLoader(List<LOADER_TYPE> loaders)
-
Method Summary
Modifier and Type Method Description void
close()
Free resources associated with this loader.Set<String>
getAvailableScriptDisplayPaths()
Set<String>
getAvailableScriptDisplayPaths(ScriptPathLoaderState state)
Gets the display paths available from this loader when it was in the specifiedstate
.List<LOADER_TYPE>
getLoaders()
String
getScriptBodyByDisplayPath(String displayPath)
String
getScriptBodyByDisplayPath(String displayPath, ScriptPathLoaderState state)
Get the specified script at the specified state.String
getScriptBodyByRelativePath(String relativePath)
String
getScriptBodyByRelativePath(String relativePath, ScriptPathLoaderState state)
Get the specified script at the specified state.ScriptPathLoaderState
getState()
Get the current state of thisScriptPathLoader
.void
lock()
Acquire a read lock.void
refresh()
Refresh the loader internally.void
unlock()
Release a previously acquired read lock.
-
Constructor Details
-
Method Details
-
getLoaders
-
lock
public void lock()Description copied from interface:ScriptPathLoader
Acquire a read lock. Use before invoking any of the get* methods, and hold for as long as consistency is required for this loader.- Specified by:
lock
in interfaceScriptPathLoader
-
unlock
public void unlock()Description copied from interface:ScriptPathLoader
Release a previously acquired read lock.- Specified by:
unlock
in interfaceScriptPathLoader
-
getAvailableScriptDisplayPaths
- Specified by:
getAvailableScriptDisplayPaths
in interfaceScriptPathLoader
- Returns:
- The display paths currently available from this loader.
-
getScriptBodyByDisplayPath
- Specified by:
getScriptBodyByDisplayPath
in interfaceScriptPathLoader
- 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.
-
getScriptBodyByRelativePath
- Specified by:
getScriptBodyByRelativePath
in interfaceScriptPathLoader
- 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.
-
getAvailableScriptDisplayPaths
Description copied from interface:ScriptPathLoader
Gets the display paths available from this loader when it was in the specifiedstate
.- Specified by:
getAvailableScriptDisplayPaths
in interfaceScriptPathLoader
- 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
public String getScriptBodyByDisplayPath(String displayPath, ScriptPathLoaderState state) throws IOExceptionDescription copied from interface:ScriptPathLoader
Get the specified script at the specified state.- Specified by:
getScriptBodyByDisplayPath
in interfaceScriptPathLoader
- 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
public String getScriptBodyByRelativePath(String relativePath, ScriptPathLoaderState state) throws IOExceptionDescription copied from interface:ScriptPathLoader
Get the specified script at the specified state.- Specified by:
getScriptBodyByRelativePath
in interfaceScriptPathLoader
- 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
Description copied from interface:ScriptPathLoader
Get the current state of thisScriptPathLoader
.- Specified by:
getState
in interfaceScriptPathLoader
- Returns:
- A
ScriptPathLoaderState
or null if this loader is stateless.
-
refresh
public void refresh()Description copied from interface:ScriptPathLoader
Refresh the loader internally. Will respect existing read locks.- Specified by:
refresh
in interfaceScriptPathLoader
-
close
public void close()Description copied from interface:ScriptPathLoader
Free resources associated with this loader.- Specified by:
close
in interfaceScriptPathLoader
-