Class FileStoreDataSet
- java.lang.Object
-
- gov.nasa.worldwindx.examples.util.FileStoreDataSet
-
public class FileStoreDataSet extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
FileStoreDataSet.LeafInfo
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
cacheRootPath
static java.lang.String
DAY
protected java.util.ArrayList<java.io.File>
exclusionList
protected boolean
fileGranularity
static java.lang.String
HOUR
protected java.util.ArrayList<FileStoreDataSet.LeafInfo>
leafDirs
static java.lang.String
MONTH
protected java.io.File
root
protected FileStoreDataSet.LeafInfo[]
sortedLeafDirs
static java.lang.String
WEEK
static java.lang.String
YEAR
-
Constructor Summary
Constructors Constructor Description FileStoreDataSet(java.io.File root, java.lang.String cacheRootPath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static long
computeDirectorySize(java.io.File dir)
protected static long
computeTimeOffset(java.lang.String unit, int interval)
void
delete(boolean echo)
protected void
deleteFiles(java.io.File dir, java.util.List<java.io.File> exclusions, long timeBoundary, boolean echo)
void
deleteOutOfScopeFiles(java.lang.String unit, int interval, boolean echo)
protected static void
findLeaves(java.io.File dir, java.util.ArrayList<FileStoreDataSet.LeafInfo> leaves)
static java.util.List<FileStoreDataSet>
getDataSets(java.io.File cacheRoot)
Find all of the data set directories in a cache root.java.util.List<java.io.File>
getExclusions()
long
getLastModified()
java.lang.String
getName()
long
getOutOfScopeSize(java.lang.String unit, int interval)
java.lang.String
getPath()
long
getSize()
boolean
isFileGranularity()
protected static boolean
isNumeric(java.lang.String s)
Determines if a string contains only digits.protected static boolean
isSingleDataSet(java.io.File[] subDirs)
Determines if a list of sub-directories should be treated as a single data set.protected static java.io.File[]
listDirs(java.io.File parent)
List all of the sub-directories in a parent directory.void
setExclusions(java.lang.Iterable<? extends java.io.File> exclusions)
void
setFileGranularity(boolean fileGranularity)
protected void
update()
-
-
-
Field Detail
-
HOUR
public static final java.lang.String HOUR
- See Also:
- Constant Field Values
-
DAY
public static final java.lang.String DAY
- See Also:
- Constant Field Values
-
WEEK
public static final java.lang.String WEEK
- See Also:
- Constant Field Values
-
MONTH
public static final java.lang.String MONTH
- See Also:
- Constant Field Values
-
YEAR
public static final java.lang.String YEAR
- See Also:
- Constant Field Values
-
root
protected final java.io.File root
-
cacheRootPath
protected final java.lang.String cacheRootPath
-
fileGranularity
protected boolean fileGranularity
-
exclusionList
protected java.util.ArrayList<java.io.File> exclusionList
-
leafDirs
protected java.util.ArrayList<FileStoreDataSet.LeafInfo> leafDirs
-
sortedLeafDirs
protected FileStoreDataSet.LeafInfo[] sortedLeafDirs
-
-
Method Detail
-
update
protected void update()
-
isFileGranularity
public boolean isFileGranularity()
-
setFileGranularity
public void setFileGranularity(boolean fileGranularity)
-
getPath
public java.lang.String getPath()
-
getName
public java.lang.String getName()
-
getExclusions
public java.util.List<java.io.File> getExclusions()
-
setExclusions
public void setExclusions(java.lang.Iterable<? extends java.io.File> exclusions)
-
getSize
public long getSize()
-
getOutOfScopeSize
public long getOutOfScopeSize(java.lang.String unit, int interval)
-
getLastModified
public long getLastModified()
-
deleteOutOfScopeFiles
public void deleteOutOfScopeFiles(java.lang.String unit, int interval, boolean echo)
-
deleteFiles
protected void deleteFiles(java.io.File dir, java.util.List<java.io.File> exclusions, long timeBoundary, boolean echo)
-
delete
public void delete(boolean echo)
-
computeTimeOffset
protected static long computeTimeOffset(java.lang.String unit, int interval)
-
findLeaves
protected static void findLeaves(java.io.File dir, java.util.ArrayList<FileStoreDataSet.LeafInfo> leaves)
-
computeDirectorySize
protected static long computeDirectorySize(java.io.File dir)
-
getDataSets
public static java.util.List<FileStoreDataSet> getDataSets(java.io.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.
-
listDirs
protected static java.io.File[] listDirs(java.io.File parent)
List all of the sub-directories in a parent directory.- Parameters:
parent
- Parent directory to search.- Returns:
- All sub-directories under
parent
.
-
isSingleDataSet
protected static boolean isSingleDataSet(java.io.File[] subDirs)
Determines if a list of sub-directories should be treated as a single data set. This implementation returnstrue
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.
-
isNumeric
protected static boolean isNumeric(java.lang.String s)
Determines if a string contains only digits.- Parameters:
s
- String to test.- Returns:
true
ifs
contains only digits.
-
-