@ThreadSafe public class DatasetCollectionManager extends java.lang.Object implements CollectionManager
| Modifier and Type | Class and Description |
|---|---|
class |
DatasetCollectionManager.TriggerEvent |
static interface |
DatasetCollectionManager.TriggerListener |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CATALOG |
protected java.lang.String |
collectionName |
protected DateExtractor |
dateExtractor |
static java.lang.String |
PROTO |
static java.lang.String |
RESCAN |
| Modifier | Constructor and Description |
|---|---|
protected |
DatasetCollectionManager() |
|
DatasetCollectionManager(FeatureCollectionConfig config,
java.util.Formatter errlog) |
|
DatasetCollectionManager(java.lang.String recheckS)
For retrofitting to Aggregation
Must also call addDirectoryScan one or more times
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDirectoryScan(java.lang.String dirName,
java.lang.String suffix,
java.lang.String regexpPatternString,
java.lang.String subdirsS,
java.lang.String olderS,
java.lang.Object auxInfo)
Add a directory scan to the collection
|
void |
addEventListener(DatasetCollectionManager.TriggerListener l) |
void |
close()
release any resources
|
static void |
enableMetadataManager() |
java.util.Date |
extractRunDate(MFile mfile)
Use the date extractor to extract the date from the filename
|
java.lang.String |
getCollectionName() |
CollectionSpecParser |
getCollectionSpecParser() |
java.util.List<MFile> |
getFiles()
Get the current collection of MFile, since last scan or rescan.
|
long |
getLastChanged()
Get the last time files changed
|
long |
getLastScanned()
Get the last time scanned
|
byte[] |
getMetadata(MFile file,
java.lang.String key) |
double |
getOlderThanFilterInSecs() |
int |
getProtoIndex() |
TimeUnit |
getRecheck()
Get how often to rescan
|
java.lang.String |
getRoot()
Get common root of all MFiles in the collection - may be null
|
boolean |
hasDateExtractor() |
protected boolean |
hasScans() |
boolean |
isRescanNeeded()
Compute if rescan is needed, based on the recheckEvery parameter.
|
static DatasetCollectionManager |
open(java.lang.String collection,
java.lang.String olderThan,
java.util.Formatter errlog) |
void |
putMetadata(MFile file,
java.lang.String key,
byte[] value) |
void |
removeEventListener(DatasetCollectionManager.TriggerListener l) |
boolean |
rescan()
Rescan the collection.
|
boolean |
rescanIfNeeded() |
void |
resetProto() |
void |
scan(CancelTask cancelTask)
Scan the directory(ies) and create MFile objects.
|
protected void |
scan(java.util.Map<java.lang.String,MFile> map,
CancelTask cancelTask) |
static void |
setController(MController _controller)
Set the MController used by scan.
|
void |
setDateExtractor(DateExtractor dateExtractor) |
java.lang.String |
toString() |
public static final java.lang.String CATALOG
public static final java.lang.String RESCAN
public static final java.lang.String PROTO
protected java.lang.String collectionName
protected DateExtractor dateExtractor
public DatasetCollectionManager(FeatureCollectionConfig config, java.util.Formatter errlog)
protected DatasetCollectionManager()
public DatasetCollectionManager(java.lang.String recheckS)
recheckS - a undunit time unit, specifying how often to rscanpublic static void enableMetadataManager()
public static void setController(MController _controller)
_controller - use this MControllerpublic static DatasetCollectionManager open(java.lang.String collection, java.lang.String olderThan, java.util.Formatter errlog) throws java.io.IOException
java.io.IOExceptionpublic void close()
CollectionManagerclose in interface CollectionManagerpublic void setDateExtractor(DateExtractor dateExtractor)
public void addDirectoryScan(java.lang.String dirName,
java.lang.String suffix,
java.lang.String regexpPatternString,
java.lang.String subdirsS,
java.lang.String olderS,
java.lang.Object auxInfo)
dirName - scan this directorysuffix - require this suffix (overriddden by regexp), may be nullregexpPatternString - if present, use this reqular expression to filter files , may be nullsubdirsS - if "true", descend into subdirectories, may be nullolderS - udunit time unit - files must be older than this amount of time (now - lastModified > olderTime), may be null
// * @param dateFormatString dateFormatMark string, may be nullauxInfo - attach this object to any MFile found by this scanpublic java.lang.String getCollectionName()
getCollectionName in interface CollectionManagerpublic java.lang.String getRoot()
CollectionManagergetRoot in interface CollectionManagerpublic CollectionSpecParser getCollectionSpecParser()
public double getOlderThanFilterInSecs()
public TimeUnit getRecheck()
getRecheck in interface CollectionManagerpublic long getLastScanned()
getLastScanned in interface CollectionManagerpublic long getLastChanged()
getLastChanged in interface CollectionManagerpublic void scan(CancelTask cancelTask) throws java.io.IOException
scan in interface CollectionManagercancelTask - allow user to canceljava.io.IOException - if io errorpublic boolean rescanIfNeeded()
throws java.io.IOException
java.io.IOExceptionprotected boolean hasScans()
public boolean isRescanNeeded()
isRescanNeeded in interface CollectionManagerpublic boolean rescan()
throws java.io.IOException
rescan in interface CollectionManagerjava.io.IOException - on I/O errorpublic java.util.List<MFile> getFiles()
getFiles in interface CollectionManagerpublic java.util.Date extractRunDate(MFile mfile)
CollectionManagerextractRunDate in interface CollectionManagermfile - extract from herepublic boolean hasDateExtractor()
protected void scan(java.util.Map<java.lang.String,MFile> map, CancelTask cancelTask) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getProtoIndex()
public void resetProto()
resetProto in interface CollectionManagerpublic void addEventListener(DatasetCollectionManager.TriggerListener l)
public void removeEventListener(DatasetCollectionManager.TriggerListener l)
public void putMetadata(MFile file, java.lang.String key, byte[] value)
putMetadata in interface CollectionManagerpublic byte[] getMetadata(MFile file, java.lang.String key)
getMetadata in interface CollectionManager