public class FileStoreDataSet extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
FileStoreDataSet.LeafInfo |
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
FileStoreDataSet(File root,
String cacheRootPath) |
Modifier and Type | Method and Description |
---|---|
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() |
protected final String cacheRootPath
public static final String DAY
protected boolean fileGranularity
public static final String HOUR
protected ArrayList<FileStoreDataSet.LeafInfo> leafDirs
public static final String MONTH
protected final File root
protected FileStoreDataSet.LeafInfo[] sortedLeafDirs
public static final String WEEK
public static final String YEAR
protected static long computeDirectorySize(File dir)
protected static long computeTimeOffset(String unit, int interval)
public void delete(boolean echo)
protected void deleteFiles(File dir, List<File> exclusions, long timeBoundary, boolean echo)
public void deleteOutOfScopeFiles(String unit, int interval, boolean echo)
protected static void findLeaves(File dir, ArrayList<FileStoreDataSet.LeafInfo> leaves)
public static List<FileStoreDataSet> getDataSets(File cacheRoot)
cacheRoot
- Cache root to search.public long getLastModified()
public String getName()
public long getOutOfScopeSize(String unit, int interval)
public String getPath()
public long getSize()
public boolean isFileGranularity()
protected static boolean isNumeric(String s)
s
- String to test.true
if s
contains only digits.protected static boolean isSingleDataSet(File[] subDirs)
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.subDirs
- List of sub-directories to test.true
if the directories should be treated as a single data set.protected static File[] listDirs(File parent)
parent
- Parent directory to search.parent
.public void setFileGranularity(boolean fileGranularity)
protected void update()