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 voidclose()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()StringgetScriptBodyByDisplayPath(String displayPath)StringgetScriptBodyByDisplayPath(String displayPath, ScriptPathLoaderState state)Get the specified script at the specified state.StringgetScriptBodyByRelativePath(String relativePath)StringgetScriptBodyByRelativePath(String relativePath, ScriptPathLoaderState state)Get the specified script at the specified state.ScriptPathLoaderStategetState()Get the current state of thisScriptPathLoader.voidlock()Acquire a read lock.voidrefresh()Refresh the loader internally.voidunlock()Release a previously acquired read lock.
-
Constructor Details
-
Method Details
-
getLoaders
-
lock
public void lock()Description copied from interface:ScriptPathLoaderAcquire 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:
lockin interfaceScriptPathLoader
-
unlock
public void unlock()Description copied from interface:ScriptPathLoaderRelease a previously acquired read lock.- Specified by:
unlockin interfaceScriptPathLoader
-
getAvailableScriptDisplayPaths
- Specified by:
getAvailableScriptDisplayPathsin interfaceScriptPathLoader- Returns:
- The display paths currently available from this loader.
-
getScriptBodyByDisplayPath
- Specified by:
getScriptBodyByDisplayPathin 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:
getScriptBodyByRelativePathin 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:ScriptPathLoaderGets the display paths available from this loader when it was in the specifiedstate.- Specified by:
getAvailableScriptDisplayPathsin 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:ScriptPathLoaderGet the specified script at the specified state.- Specified by:
getScriptBodyByDisplayPathin 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:ScriptPathLoaderGet the specified script at the specified state.- Specified by:
getScriptBodyByRelativePathin 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:ScriptPathLoaderGet the current state of thisScriptPathLoader.- Specified by:
getStatein interfaceScriptPathLoader- Returns:
- A
ScriptPathLoaderStateor null if this loader is stateless.
-
refresh
public void refresh()Description copied from interface:ScriptPathLoaderRefresh the loader internally. Will respect existing read locks.- Specified by:
refreshin interfaceScriptPathLoader
-
close
public void close()Description copied from interface:ScriptPathLoaderFree resources associated with this loader.- Specified by:
closein interfaceScriptPathLoader
-