Class TreeStorageManager

  • All Implemented Interfaces:
    StorageManager

    public class TreeStorageManager
    extends java.lang.Object
    implements StorageManager
    Storage Manager implementation backed by StorageTree
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(StorageManagerListener listener)
      Receive notification of changes
      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
      static TreeStorageManager createFromStorageTree​(StorageTree storageTree)  
      boolean deleteAllFileResources​(java.lang.String root)
      Recursively delete all files from the root path
      boolean deleteFileResource​(java.lang.String path)
      delete a resource
      boolean 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 contents
      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
      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 "/"
      long loadFileResource​(java.lang.String path, java.io.OutputStream output)
      Read the contents of a file at the path into the outputstream
      void removeListener​(StorageManagerListener listener)
      Remove a listener
      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
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TreeStorageManager

        public TreeStorageManager()
    • Method Detail

      • existsFileResource

        public boolean existsFileResource​(java.lang.String path)
        Specified by:
        existsFileResource in interface StorageManager
        Returns:
        true if a file exists at the path
      • existsDirResource

        public boolean existsDirResource​(java.lang.String path)
        Specified by:
        existsDirResource in interface StorageManager
        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 interface StorageManager
        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 interface StorageManager
        Parameters:
        path - path directory path
        pattern - pattern match
      • getFileResource

        public org.rundeck.storage.api.Resource<ResourceMeta> getFileResource​(java.lang.String path)
        Return config file contents
        Specified by:
        getFileResource in interface StorageManager
        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 interface StorageManager
        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 interface StorageManager
        Parameters:
        path - path
        input - stream
        meta - 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 interface StorageManager
        Parameters:
        path - path
        input - stream
        meta - 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 interface StorageManager
        Parameters:
        path - path
        input - stream
        meta - metadata
        Returns:
        resource
      • deleteFileResource

        public boolean deleteFileResource​(java.lang.String path)
        delete a resource
        Specified by:
        deleteFileResource in interface StorageManager
        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 interface StorageManager
        Parameters:
        root - root path
        Returns:
        true if successful