org.rundeck.storage.data.file
Class FileTreeUtil

java.lang.Object
  extended by org.rundeck.storage.data.file.FileTreeUtil

public class FileTreeUtil
extends java.lang.Object

Utility to create FileTree and manage paths.


Constructor Summary
FileTreeUtil()
           
 
Method Summary
static
<T extends ContentMeta>
FileTree<T>
forRoot(java.io.File root, ContentFactory<T> factory)
           
static Path pathForFileInRoot(java.io.File rootDir, java.io.File file)
          Return a storage Path given a file within a given root dir
static Path pathForRelativeFilepath(java.lang.String filepath)
          Return a storage path given a relative file path string, using the native file path separator.
static Path pathForRelativeFilepath(java.lang.String filepath, java.lang.String separator)
          Return a storage path given a relative file path string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTreeUtil

public FileTreeUtil()
Method Detail

forRoot

public static <T extends ContentMeta> FileTree<T> forRoot(java.io.File root,
                                                          ContentFactory<T> factory)

pathForFileInRoot

public static Path pathForFileInRoot(java.io.File rootDir,
                                     java.io.File file)
Return a storage Path given a file within a given root dir

Parameters:
rootDir - root dir to use
file - file
Returns:
sub path corresponding to the file
Throws:
java.lang.IllegalArgumentException - if the file is not within the root

pathForRelativeFilepath

public static Path pathForRelativeFilepath(java.lang.String filepath)
Return a storage path given a relative file path string, using the native file path separator.

Parameters:
filepath - file path with native file separator
Returns:
storage path

pathForRelativeFilepath

public static Path pathForRelativeFilepath(java.lang.String filepath,
                                           java.lang.String separator)
Return a storage path given a relative file path string

Parameters:
filepath - file path with given separator
separator - separator string
Returns:
storage path