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 void
addListener(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 TreeStorageManager
createFromStorageTree(StorageTree storageTree)
boolean
deleteAllFileResources(java.lang.String root)
Recursively delete all files from the root pathboolean
deleteFileResource(java.lang.String path)
delete a resourceboolean
existsDirResource(java.lang.String path)
boolean
existsFileResource(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 "/"long
loadFileResource(java.lang.String path, java.io.OutputStream output)
Read the contents of a file at the path into the outputstreamvoid
removeListener(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:StorageManager
Receive notification of changes- Specified by:
addListener
in interfaceStorageManager
-
removeListener
public void removeListener(StorageManagerListener listener)
Description copied from interface:StorageManager
Remove a listener- Specified by:
removeListener
in interfaceStorageManager
-
existsFileResource
public boolean existsFileResource(java.lang.String path)
- Specified by:
existsFileResource
in interfaceStorageManager
- Returns:
- true if a file exists at the path
-
existsDirResource
public boolean existsDirResource(java.lang.String path)
- Specified by:
existsDirResource
in 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:
listDirPaths
in 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:
listDirPaths
in 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:
getFileResource
in interfaceStorageManager
- Parameters:
path
-
-
loadFileResource
public long loadFileResource(java.lang.String path, java.io.OutputStream output) throws java.io.IOException
Description copied from interface:StorageManager
Read the contents of a file at the path into the outputstream- Specified by:
loadFileResource
in 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:
updateFileResource
in 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:
createFileResource
in 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:
writeFileResource
in interfaceStorageManager
- Parameters:
path
- pathinput
- streammeta
- metadata- Returns:
- resource
-
deleteFileResource
public boolean deleteFileResource(java.lang.String path)
delete a resource- Specified by:
deleteFileResource
in 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:
deleteAllFileResources
in interfaceStorageManager
- Parameters:
root
- root path- Returns:
- true if successful
-
createFromStorageTree
public static TreeStorageManager createFromStorageTree(StorageTree storageTree)
-
-