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 -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free resources associated with this loader.Gets the display paths available from this loader when it was in the specifiedstate.getScriptBodyByDisplayPath(String displayPath) getScriptBodyByDisplayPath(String displayPath, ScriptPathLoaderState state) Get the specified script at the specified state.getScriptBodyByRelativePath(String relativePath) getScriptBodyByRelativePath(String relativePath, ScriptPathLoaderState state) Get the specified script at the specified state.getState()Get the current state of thisScriptPathLoader.voidlock()Acquire a read lock.Create a stat object from the serialized JSON String provided byScriptPathLoaderState.encodeJSON()voidrefresh()Refresh the loader internally.voidunlock()Release a previously acquired read lock.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.util.scripts.ScriptPathLoader
getAvailableScriptRelativePaths
-
Constructor Details
-
MultiScriptPathLoader
-
-
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.
-
getAvailableScriptRelativePaths
- Specified by:
getAvailableScriptRelativePathsin interfaceScriptPathLoader- Returns:
- The relative 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 display paths.
-
getScriptBodyByDisplayPath
public String getScriptBodyByDisplayPath(String displayPath, ScriptPathLoaderState state) throws IOException Description 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 IOException Description 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.
-
makeState
Description copied from interface:ScriptPathLoaderCreate a stat object from the serialized JSON String provided byScriptPathLoaderState.encodeJSON()- Specified by:
makeStatein interfaceScriptPathLoader- Parameters:
stateJSON- the JSON state- Returns:
- the deserialized object from the JSON state
-
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
-