public abstract class CollectionManagerAbstract extends CollectionAbstract implements CollectionManager
CollectionAbstract.DateSorter, CollectionAbstract.MyStreamFilter
CollectionManager.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, setStreamFilter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLastChanged, getLastScanned, isScanNeeded, scan
extractDate, getAuxInfo, getCollectionName, getFilenames, getFilesSorted, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, getRoot, hasDateExtractor, putAuxInfo
getCollectionName
protected 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.IOException
public boolean isStatic()
CollectionManager
isStatic
in interface CollectionManager
public void setStatic(boolean aStatic)
public TimeDuration getRecheck()
CollectionManager
getRecheck
in interface CollectionManager
public CloseableIterator<MFile> getFileIterator() throws java.io.IOException
MCollection
try (CloseableIteratoriter = getFileIterator()) { while (iter.hasNext()) { MFile file = iter.next(); } }
getFileIterator
in interface MCollection
java.io.IOException
public void close()
MCollection
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface MCollection
public boolean scanIfNeeded() throws java.io.IOException
CollectionManager
scanIfNeeded
in interface CollectionManager
java.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 CollectionUpdateListener
public void addEventListener(CollectionManager.TriggerListener l)
CollectionManager
addEventListener
in interface CollectionManager
l
- listenerpublic void removeEventListener(CollectionManager.TriggerListener l)
removeEventListener
in interface CollectionManager
protected void createListenerManager()