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, NCX_SUFFIX, protoChoice, root, sfilter, startCollection| Modifier | Constructor and Description |
|---|---|
protected |
CollectionManagerAbstract(java.lang.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,
java.lang.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(java.lang.String collectionName,
java.lang.String collectionSpec,
java.lang.String olderThan,
java.util.Formatter errlog) |
void |
putMetadata(MFile file,
java.lang.String key,
byte[] value) |
void |
removeEventListener(CollectionManager.TriggerListener l) |
boolean |
scanIfNeeded()
If isScanNeeded(), do a scan.
|
void |
sendEvent(CollectionUpdateType type) |
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, putAuxInfogetCollectionNameprotected TimeDuration recheck
protected CollectionManagerAbstract(java.lang.String collectionName,
org.slf4j.Logger logger)
public static CollectionManager open(java.lang.String collectionName, java.lang.String collectionSpec, java.lang.String olderThan, java.util.Formatter errlog) throws java.io.IOException
java.io.IOExceptionpublic boolean isStatic()
CollectionManagerisStatic in interface CollectionManagerpublic void setStatic(boolean aStatic)
public TimeDuration getRecheck()
CollectionManagergetRecheck in interface CollectionManagerpublic CloseableIterator<MFile> getFileIterator() throws java.io.IOException
MCollection
try (CloseableIterator iter = getFileIterator()) {
while (iter.hasNext()) {
MFile file = iter.next();
}
}
getFileIterator in interface MCollectionjava.io.IOExceptionpublic void close()
MCollectionclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface MCollectionpublic boolean scanIfNeeded()
throws java.io.IOException
CollectionManagerscanIfNeeded in interface CollectionManagerjava.io.IOException - on io errorpublic static void setMetadataStore(StoreKeyValue.Factory _storeFactory)
public void putMetadata(MFile file, java.lang.String key, byte[] value)
public byte[] getMetadata(MFile file, java.lang.String key)
public void sendEvent(CollectionUpdateType type)
sendEvent in interface CollectionUpdateListenerpublic void addEventListener(CollectionManager.TriggerListener l)
CollectionManageraddEventListener in interface CollectionManagerl - listenerpublic void removeEventListener(CollectionManager.TriggerListener l)
removeEventListener in interface CollectionManagerprotected void createListenerManager()