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 classFileStoreDataSet.LeafInfo
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringcacheRootPathstatic java.lang.StringDAYprotected java.util.ArrayList<java.io.File>exclusionListprotected booleanfileGranularitystatic java.lang.StringHOURprotected java.util.ArrayList<FileStoreDataSet.LeafInfo>leafDirsstatic java.lang.StringMONTHprotected java.io.Filerootprotected FileStoreDataSet.LeafInfo[]sortedLeafDirsstatic java.lang.StringWEEKstatic java.lang.StringYEAR
-
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 longcomputeDirectorySize(java.io.File dir)protected static longcomputeTimeOffset(java.lang.String unit, int interval)voiddelete(boolean echo)protected voiddeleteFiles(java.io.File dir, java.util.List<java.io.File> exclusions, long timeBoundary, boolean echo)voiddeleteOutOfScopeFiles(java.lang.String unit, int interval, boolean echo)protected static voidfindLeaves(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()longgetLastModified()java.lang.StringgetName()longgetOutOfScopeSize(java.lang.String unit, int interval)java.lang.StringgetPath()longgetSize()booleanisFileGranularity()protected static booleanisNumeric(java.lang.String s)Determines if a string contains only digits.protected static booleanisSingleDataSet(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.voidsetExclusions(java.lang.Iterable<? extends java.io.File> exclusions)voidsetFileGranularity(boolean fileGranularity)protected voidupdate()
-
-
-
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 returnstrueif 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:
trueif 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:
trueifscontains only digits.
-
-