|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectthredds.inventory.DatasetCollectionManager
@ThreadSafe public class DatasetCollectionManager
Manage one or more Directory Scanners that find MFiles Keep track of when they need to be rescanned. Used in:
| Nested Class Summary | |
|---|---|
class |
DatasetCollectionManager.TriggerEvent
|
static interface |
DatasetCollectionManager.TriggerListener
|
| Field Summary | |
|---|---|
static String |
CATALOG
|
protected String |
collectionName
|
protected DateExtractor |
dateExtractor
|
static String |
PROTO
|
static String |
RESCAN
|
| Constructor Summary | |
|---|---|
protected |
DatasetCollectionManager()
|
|
DatasetCollectionManager(FeatureCollectionConfig config,
Formatter errlog)
|
|
DatasetCollectionManager(String recheckS)
For retrofitting to Aggregation Must also call addDirectoryScan one or more times |
| Method Summary | |
|---|---|
void |
addDirectoryScan(String dirName,
String suffix,
String regexpPatternString,
String subdirsS,
String olderS,
Object auxInfo)
Add a directory scan to the collection |
void |
addEventListener(DatasetCollectionManager.TriggerListener l)
|
void |
close()
release any resources |
static void |
enableMetadataManager()
|
Date |
extractRunDate(MFile mfile)
Use the date extractor to extract the date from the filename |
String |
getCollectionName()
|
CollectionSpecParser |
getCollectionSpecParser()
|
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,
String key)
|
double |
getOlderThanFilterInSecs()
|
int |
getProtoIndex()
|
TimeUnit |
getRecheck()
Get how often to rescan |
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(String collection,
String olderThan,
Formatter errlog)
|
void |
putMetadata(MFile file,
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(Map<String,MFile> map,
CancelTask cancelTask)
|
static void |
setController(MController _controller)
Set the MController used by scan. |
void |
setDateExtractor(DateExtractor dateExtractor)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String CATALOG
public static final String RESCAN
public static final String PROTO
protected String collectionName
protected DateExtractor dateExtractor
| Constructor Detail |
|---|
public DatasetCollectionManager(FeatureCollectionConfig config,
Formatter errlog)
protected DatasetCollectionManager()
public DatasetCollectionManager(String recheckS)
recheckS - a undunit time unit, specifying how often to rscan| Method Detail |
|---|
public static void enableMetadataManager()
public static void setController(MController _controller)
_controller - use this MController
public static DatasetCollectionManager open(String collection,
String olderThan,
Formatter errlog)
throws IOException
IOExceptionpublic void close()
CollectionManager
close in interface CollectionManagerpublic void setDateExtractor(DateExtractor dateExtractor)
public void addDirectoryScan(String dirName,
String suffix,
String regexpPatternString,
String subdirsS,
String olderS,
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 String getCollectionName()
getCollectionName in interface CollectionManagerpublic String getRoot()
CollectionManager
getRoot 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 CollectionManager
public void scan(CancelTask cancelTask)
throws IOException
scan in interface CollectionManagercancelTask - allow user to cancel
IOException - if io error
public boolean rescanIfNeeded()
throws IOException
IOExceptionprotected boolean hasScans()
public boolean isRescanNeeded()
isRescanNeeded in interface CollectionManager
public boolean rescan()
throws IOException
rescan in interface CollectionManagerIOException - on I/O errorpublic List<MFile> getFiles()
getFiles in interface CollectionManagerpublic Date extractRunDate(MFile mfile)
CollectionManager
extractRunDate in interface CollectionManagermfile - extract from here
public boolean hasDateExtractor()
protected void scan(Map<String,MFile> map,
CancelTask cancelTask)
throws IOException
IOExceptionpublic String toString()
toString in class 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,
String key,
byte[] value)
putMetadata in interface CollectionManager
public byte[] getMetadata(MFile file,
String key)
getMetadata in interface CollectionManager
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||