NASA World Wind

gov.nasa.worldwindx.examples.util
Class FileStoreDataSet

java.lang.Object
  extended by gov.nasa.worldwindx.examples.util.FileStoreDataSet

public class FileStoreDataSet
extends Object


Nested Class Summary
protected static class FileStoreDataSet.LeafInfo
           
 
Field Summary
protected  String cacheRootPath
           
static String DAY
           
protected  ArrayList<File> exclusionList
           
protected  boolean fileGranularity
           
static String HOUR
           
protected  ArrayList<FileStoreDataSet.LeafInfo> leafDirs
           
static String MONTH
           
protected  File root
           
protected  FileStoreDataSet.LeafInfo[] sortedLeafDirs
           
static String WEEK
           
static String YEAR
           
 
Constructor Summary
FileStoreDataSet(File root, String cacheRootPath)
           
 
Method Summary
protected static long computeDirectorySize(File dir)
           
protected static long computeTimeOffset(String unit, int interval)
           
 void delete(boolean echo)
           
protected  void deleteFiles(File dir, List<File> exclusions, long timeBoundary, boolean echo)
           
 void deleteOutOfScopeFiles(String unit, int interval, boolean echo)
           
protected static void findLeaves(File dir, ArrayList<FileStoreDataSet.LeafInfo> leaves)
           
static List<FileStoreDataSet> getDataSets(File cacheRoot)
          Find all of the data set directories in a cache root.
 List<File> getExclusions()
           
 long getLastModified()
           
 String getName()
           
 long getOutOfScopeSize(String unit, int interval)
           
 String getPath()
           
 long getSize()
           
 boolean isFileGranularity()
           
protected static boolean isNumeric(String s)
          Determines if a string contains only digits.
protected static boolean isSingleDataSet(File[] subDirs)
          Determines if a list of sub-directories should be treated as a single data set.
protected static File[] listDirs(File parent)
          List all of the sub-directories in a parent directory.
 void setExclusions(Iterable<? extends File> exclusions)
           
 void setFileGranularity(boolean fileGranularity)
           
protected  void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheRootPath

protected final String cacheRootPath

DAY

public static final String DAY
See Also:
Constant Field Values

exclusionList

protected ArrayList<File> exclusionList

fileGranularity

protected boolean fileGranularity

HOUR

public static final String HOUR
See Also:
Constant Field Values

leafDirs

protected ArrayList<FileStoreDataSet.LeafInfo> leafDirs

MONTH

public static final String MONTH
See Also:
Constant Field Values

root

protected final File root

sortedLeafDirs

protected FileStoreDataSet.LeafInfo[] sortedLeafDirs

WEEK

public static final String WEEK
See Also:
Constant Field Values

YEAR

public static final String YEAR
See Also:
Constant Field Values
Constructor Detail

FileStoreDataSet

public FileStoreDataSet(File root,
                        String cacheRootPath)
Method Detail

computeDirectorySize

protected static long computeDirectorySize(File dir)

computeTimeOffset

protected static long computeTimeOffset(String unit,
                                        int interval)

delete

public void delete(boolean echo)

deleteFiles

protected void deleteFiles(File dir,
                           List<File> exclusions,
                           long timeBoundary,
                           boolean echo)

deleteOutOfScopeFiles

public void deleteOutOfScopeFiles(String unit,
                                  int interval,
                                  boolean echo)

findLeaves

protected static void findLeaves(File dir,
                                 ArrayList<FileStoreDataSet.LeafInfo> leaves)

getDataSets

public static List<FileStoreDataSet> getDataSets(File cacheRoot)
Find all of the data set directories in a cache root.

Parameters:
cacheRoot - Cache root to search.
Returns:
List of data sets in the specified cache.

getExclusions

public List<File> getExclusions()

getLastModified

public long getLastModified()

getName

public String getName()

getOutOfScopeSize

public long getOutOfScopeSize(String unit,
                              int interval)

getPath

public String getPath()

getSize

public long getSize()

isFileGranularity

public boolean isFileGranularity()

isNumeric

protected static boolean isNumeric(String s)
Determines if a string contains only digits.

Parameters:
s - String to test.
Returns:
true if s contains only digits.

isSingleDataSet

protected static boolean isSingleDataSet(File[] subDirs)
Determines if a list of sub-directories should be treated as a single data set. This implementation returns true if all of the sub-directories have numeric names. In this case, the numeric directories are most likely used by the cache implementation to group files in a single data set. The numeric directory names do not provide meaningful grouping to the user.

Parameters:
subDirs - List of sub-directories to test.
Returns:
true if the directories should be treated as a single data set.

listDirs

protected static File[] listDirs(File parent)
List all of the sub-directories in a parent directory.

Parameters:
parent - Parent directory to search.
Returns:
All sub-directories under parent.

setExclusions

public void setExclusions(Iterable<? extends File> exclusions)

setFileGranularity

public void setFileGranularity(boolean fileGranularity)

update

protected void update()

NASA World Wind