Package com.dtolabs.rundeck.core.storage
Class TreeStorageManager
- java.lang.Object
-
- com.dtolabs.rundeck.core.storage.TreeStorageManager
-
- All Implemented Interfaces:
StorageManager
public class TreeStorageManager extends java.lang.Object implements StorageManager
Storage Manager implementation backed by StorageTree
-
-
Constructor Summary
Constructors Constructor Description TreeStorageManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(StorageManagerListener listener)Receive notification of changesorg.rundeck.storage.api.Resource<ResourceMeta>createFileResource(java.lang.String path, java.io.InputStream input, java.util.Map<java.lang.String,java.lang.String> meta)Create new resource, fails if it existsstatic TreeStorageManagercreateFromStorageTree(StorageTree storageTree)booleandeleteAllFileResources(java.lang.String root)Recursively delete all files from the root pathbooleandeleteFileResource(java.lang.String path)delete a resourcebooleanexistsDirResource(java.lang.String path)booleanexistsFileResource(java.lang.String path)org.rundeck.storage.api.Resource<ResourceMeta>getFileResource(java.lang.String path)Return config file contentsjava.util.List<java.lang.String>listDirPaths(java.lang.String path)List the full paths of file resources in the directory at the given pathjava.util.List<java.lang.String>listDirPaths(java.lang.String path, java.lang.String pattern)List the full paths of file and dir resources in the directory at the given path, dir resources will end with "/"longloadFileResource(java.lang.String path, java.io.OutputStream output)Read the contents of a file at the path into the outputstreamvoidremoveListener(StorageManagerListener listener)Remove a listenerorg.rundeck.storage.api.Resource<ResourceMeta>updateFileResource(java.lang.String path, java.io.InputStream input, java.util.Map<java.lang.String,java.lang.String> meta)Update existing resource, fails if it does not existorg.rundeck.storage.api.Resource<ResourceMeta>writeFileResource(java.lang.String path, java.io.InputStream input, java.util.Map<java.lang.String,java.lang.String> meta)Write to a resource, create if it does not exist
-
-
-
Method Detail
-
addListener
public void addListener(StorageManagerListener listener)
Description copied from interface:StorageManagerReceive notification of changes- Specified by:
addListenerin interfaceStorageManager
-
removeListener
public void removeListener(StorageManagerListener listener)
Description copied from interface:StorageManagerRemove a listener- Specified by:
removeListenerin interfaceStorageManager
-
existsFileResource
public boolean existsFileResource(java.lang.String path)
- Specified by:
existsFileResourcein interfaceStorageManager- Returns:
- true if a file exists at the path
-
existsDirResource
public boolean existsDirResource(java.lang.String path)
- Specified by:
existsDirResourcein interfaceStorageManager- Returns:
- true if a dir exists at the path
-
listDirPaths
public java.util.List<java.lang.String> listDirPaths(java.lang.String path)
List the full paths of file resources in the directory at the given path- Specified by:
listDirPathsin interfaceStorageManager- Parameters:
path- path directory path
-
listDirPaths
public java.util.List<java.lang.String> listDirPaths(java.lang.String path, java.lang.String pattern)List the full paths of file and dir resources in the directory at the given path, dir resources will end with "/"- Specified by:
listDirPathsin interfaceStorageManager- Parameters:
path- path directory pathpattern- pattern match
-
getFileResource
public org.rundeck.storage.api.Resource<ResourceMeta> getFileResource(java.lang.String path)
Return config file contents- Specified by:
getFileResourcein interfaceStorageManager- Parameters:
path-
-
loadFileResource
public long loadFileResource(java.lang.String path, java.io.OutputStream output) throws java.io.IOExceptionDescription copied from interface:StorageManagerRead the contents of a file at the path into the outputstream- Specified by:
loadFileResourcein interfaceStorageManager- Returns:
- number of bytes copied
- Throws:
java.io.IOException
-
updateFileResource
public org.rundeck.storage.api.Resource<ResourceMeta> updateFileResource(java.lang.String path, java.io.InputStream input, java.util.Map<java.lang.String,java.lang.String> meta)
Update existing resource, fails if it does not exist- Specified by:
updateFileResourcein interfaceStorageManager- Parameters:
path- pathinput- streammeta- metadata- Returns:
- resource
-
createFileResource
public org.rundeck.storage.api.Resource<ResourceMeta> createFileResource(java.lang.String path, java.io.InputStream input, java.util.Map<java.lang.String,java.lang.String> meta)
Create new resource, fails if it exists- Specified by:
createFileResourcein interfaceStorageManager- Parameters:
path- pathinput- streammeta- metadata- Returns:
- resource
-
writeFileResource
public org.rundeck.storage.api.Resource<ResourceMeta> writeFileResource(java.lang.String path, java.io.InputStream input, java.util.Map<java.lang.String,java.lang.String> meta)
Write to a resource, create if it does not exist- Specified by:
writeFileResourcein interfaceStorageManager- Parameters:
path- pathinput- streammeta- metadata- Returns:
- resource
-
deleteFileResource
public boolean deleteFileResource(java.lang.String path)
delete a resource- Specified by:
deleteFileResourcein interfaceStorageManager- Parameters:
path- path- Returns:
- true if file was deleted or does not exist
-
deleteAllFileResources
public boolean deleteAllFileResources(java.lang.String root)
Recursively delete all files from the root path- Specified by:
deleteAllFileResourcesin interfaceStorageManager- Parameters:
root- root path- Returns:
- true if successful
-
createFromStorageTree
public static TreeStorageManager createFromStorageTree(StorageTree storageTree)
-
-