public abstract class CollectionManagerAbstract extends CollectionAbstract implements CollectionManager
CollectionAbstract.DateSorter, CollectionAbstract.MyStreamFilterCollectionManager.ChangeChecker, CollectionManager.TriggerEvent, CollectionManager.TriggerListener| Modifier and Type | Field and Description |
|---|---|
protected TimeDuration |
recheck |
auxInfo, CATALOG, collectionName, dateExtractor, DIR, FILE, GLOB, lastModified, LIST, logger, protoChoice, root, sfilter, startCollection| Modifier | Constructor and Description |
|---|---|
protected |
CollectionManagerAbstract(String collectionName,
org.slf4j.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(CollectionManager.TriggerListener l)
Register to get Trigger events
|
void |
close()
Close and release any resources.
|
protected void |
createListenerManager() |
CloseableIterator<MFile> |
getFileIterator()
Get the current collection of MFile, no guaranteed order.
|
byte[] |
getMetadata(MFile file,
String key) |
TimeDuration |
getRecheck()
Get how often to rescan
|
boolean |
isStatic()
static means doesnt need to be monitored for changes; can be externally triggered, or read in at startup.
|
static CollectionManager |
open(String collectionName,
String collectionSpec,
String olderThan,
Formatter errlog) |
void |
putMetadata(MFile file,
String key,
byte[] value) |
void |
removeEventListener(CollectionManager.TriggerListener l) |
boolean |
scanIfNeeded()
If isScanNeeded(), do a scan.
|
static void |
setMetadataStore(StoreKeyValue.Factory _storeFactory) |
void |
setStatic(boolean aStatic) |
cleanName, extractDate, getAuxInfo, getCollectionName, getFilenames, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, getRoot, hasDateExtractor, makeFileListSorted, parseOlderThanString, putAuxInfo, setDateExtractor, setRoot, setStreamFilterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLastChanged, getLastScanned, isScanNeeded, scanextractDate, getAuxInfo, getCollectionName, getFilenames, getFilesSorted, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, getRoot, hasDateExtractor, putAuxInfoprotected TimeDuration recheck
protected CollectionManagerAbstract(String collectionName, org.slf4j.Logger logger)
public static CollectionManager open(String collectionName, String collectionSpec, String olderThan, Formatter errlog) throws IOException
IOExceptionpublic boolean isStatic()
CollectionManagerisStatic in interface CollectionManagerpublic void setStatic(boolean aStatic)
public TimeDuration getRecheck()
CollectionManagergetRecheck in interface CollectionManagerpublic CloseableIterator<MFile> getFileIterator() throws IOException
MCollection
try (CloseableIterator iter = getFileIterator()) {
while (iter.hasNext()) {
MFile file = iter.next();
}
}
getFileIterator in interface MCollectionIOExceptionpublic void close()
MCollectionclose in interface Closeableclose in interface AutoCloseableclose in interface MCollectionpublic boolean scanIfNeeded()
throws IOException
CollectionManagerscanIfNeeded in interface CollectionManagerIOException - on io errorpublic static void setMetadataStore(StoreKeyValue.Factory _storeFactory)
public void addEventListener(CollectionManager.TriggerListener l)
CollectionManageraddEventListener in interface CollectionManagerl - listenerpublic void removeEventListener(CollectionManager.TriggerListener l)
removeEventListener in interface CollectionManagerprotected void createListenerManager()