org.rundeck.storage.conf
Class TreeStack<T extends ContentMeta>

java.lang.Object
  extended by org.rundeck.storage.impl.StringToPathTree<T>
      extended by org.rundeck.storage.impl.BaseDelegateTree<T>
          extended by org.rundeck.storage.impl.DelegateTree<T>
              extended by org.rundeck.storage.conf.TreeStack<T>
All Implemented Interfaces:
Tree<T>

public class TreeStack<T extends ContentMeta>
extends DelegateTree<T>

tree that uses an ordered list of TreeHandlers to determine which underlying storage to use, and falls back to a delegate if there is no match


Constructor Summary
TreeStack(java.util.List<? extends SelectiveTree<T>> treeHandlerList, Tree<T> delegate)
           
 
Method Summary
 Resource<T> createResource(Path path, T content)
          Create a resource
 boolean deleteResource(Path path)
          Delete a resource at a path
 Resource<T> getPath(Path path)
          Return the resource or directory at the path
 Resource<T> getResource(Path path)
          Return the resource at the path
 boolean hasDirectory(Path path)
          Return true if a directory at the path exists
static boolean hasParentPath(Path path, SelectiveTree<?> tree)
           
 boolean hasPath(Path path)
          Return true if the path exists
 boolean hasResource(Path path)
          Return true if a resource at the path exists
 java.util.Set<Resource<T>> listDirectory(Path path)
          Return the set of resources at the directory path
 java.util.Set<Resource<T>> listDirectoryResources(Path path)
          Return the set of non-directory resources at the directory path
 java.util.Set<Resource<T>> listDirectorySubdirs(Path path)
          Return the set of sub directory resources within the directory path
static boolean matchesPath(Path path, SelectiveTree<?> tree)
           
 Resource<T> updateResource(Path path, T content)
          Update an existing resource
 
Methods inherited from class org.rundeck.storage.impl.BaseDelegateTree
getDelegate, setDelegate
 
Methods inherited from class org.rundeck.storage.impl.StringToPathTree
createResource, deleteResource, getPath, getResource, hasDirectory, hasPath, hasResource, listDirectory, listDirectoryResources, listDirectorySubdirs, updateResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rundeck.storage.api.Tree
createResource, deleteResource, getPath, getResource, hasDirectory, hasPath, hasResource, listDirectory, listDirectoryResources, listDirectorySubdirs, updateResource
 

Constructor Detail

TreeStack

public TreeStack(java.util.List<? extends SelectiveTree<T>> treeHandlerList,
                 Tree<T> delegate)
Method Detail

getResource

public Resource<T> getResource(Path path)
Description copied from interface: Tree
Return the resource at the path

Specified by:
getResource in interface Tree<T extends ContentMeta>
Overrides:
getResource in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
Resource

getPath

public Resource<T> getPath(Path path)
Description copied from interface: Tree
Return the resource or directory at the path

Specified by:
getPath in interface Tree<T extends ContentMeta>
Overrides:
getPath in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
Resource or directory

listDirectoryResources

public java.util.Set<Resource<T>> listDirectoryResources(Path path)
Description copied from interface: Tree
Return the set of non-directory resources at the directory path

Specified by:
listDirectoryResources in interface Tree<T extends ContentMeta>
Overrides:
listDirectoryResources in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
set of resources

listDirectory

public java.util.Set<Resource<T>> listDirectory(Path path)
Description copied from interface: Tree
Return the set of resources at the directory path

Specified by:
listDirectory in interface Tree<T extends ContentMeta>
Overrides:
listDirectory in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
set of resources

listDirectorySubdirs

public java.util.Set<Resource<T>> listDirectorySubdirs(Path path)
Description copied from interface: Tree
Return the set of sub directory resources within the directory path

Specified by:
listDirectorySubdirs in interface Tree<T extends ContentMeta>
Overrides:
listDirectorySubdirs in class DelegateTree<T extends ContentMeta>
Parameters:
path - directory path
Returns:
set of subdirectories

deleteResource

public boolean deleteResource(Path path)
Description copied from interface: Tree
Delete a resource at a path

Specified by:
deleteResource in interface Tree<T extends ContentMeta>
Overrides:
deleteResource in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
true if the resource was deleted

createResource

public Resource<T> createResource(Path path,
                                  T content)
Description copied from interface: Tree
Create a resource

Specified by:
createResource in interface Tree<T extends ContentMeta>
Overrides:
createResource in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
the resource

updateResource

public Resource<T> updateResource(Path path,
                                  T content)
Description copied from interface: Tree
Update an existing resource

Specified by:
updateResource in interface Tree<T extends ContentMeta>
Overrides:
updateResource in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
the resource

hasPath

public boolean hasPath(Path path)
Description copied from interface: Tree
Return true if the path exists

Specified by:
hasPath in interface Tree<T extends ContentMeta>
Overrides:
hasPath in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
true if it exists

matchesPath

public static boolean matchesPath(Path path,
                                  SelectiveTree<?> tree)

hasParentPath

public static boolean hasParentPath(Path path,
                                    SelectiveTree<?> tree)

hasResource

public boolean hasResource(Path path)
Description copied from interface: Tree
Return true if a resource at the path exists

Specified by:
hasResource in interface Tree<T extends ContentMeta>
Overrides:
hasResource in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
true if a resource exists

hasDirectory

public boolean hasDirectory(Path path)
Description copied from interface: Tree
Return true if a directory at the path exists

Specified by:
hasDirectory in interface Tree<T extends ContentMeta>
Overrides:
hasDirectory in class DelegateTree<T extends ContentMeta>
Parameters:
path - path
Returns:
true if the path is a directory