Package thredds.inventory
Class CollectionManagerAbstract
- java.lang.Object
-
- thredds.inventory.CollectionAbstract
-
- thredds.inventory.CollectionManagerAbstract
-
- All Implemented Interfaces:
Closeable,AutoCloseable,CollectionManager,MCollection
- Direct Known Subclasses:
CollectionManagerCatalog,MFileCollectionManager
public abstract class CollectionManagerAbstract extends CollectionAbstract implements CollectionManager
Abstract superclass for implementations of CollectionManager.- Since:
- Jan 19, 2010
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class thredds.inventory.CollectionAbstract
CollectionAbstract.DateSorter, CollectionAbstract.MyStreamFilter
-
Nested classes/interfaces inherited from interface thredds.inventory.CollectionManager
CollectionManager.ChangeChecker, CollectionManager.TriggerEvent, CollectionManager.TriggerListener
-
-
Field Summary
-
Fields inherited from class thredds.inventory.CollectionAbstract
auxInfo, CATALOG, collectionName, dateExtractor, DIR, FILE, GLOB, lastModified, LIST, logger, protoChoice, root, sfilter, startCollection
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(CollectionManager.TriggerListener l)Register to get Trigger eventsvoidclose()Close and release any resources.CloseableIterator<MFile>getFileIterator()Get the current collection of MFile, no guaranteed order.TimeDurationgetRecheck()Get how often to rescanbooleanisStatic()static means doesnt need to be monitored for changes; can be externally triggered, or read in at startup.static CollectionManageropen(String collectionName, String collectionSpec, String olderThan, Formatter errlog)voidremoveEventListener(CollectionManager.TriggerListener l)booleanscanIfNeeded()If isScanNeeded(), do a scan.voidsetStatic(boolean aStatic)-
Methods inherited from class thredds.inventory.CollectionAbstract
cleanName, extractDate, getAuxInfo, getCollectionName, getFilenames, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, getRoot, hasDateExtractor, makeFileListSorted, parseOlderThanString, putAuxInfo, setDateExtractor, setRoot, setStreamFilter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface thredds.inventory.CollectionManager
getLastChanged, getLastScanned, isScanNeeded, scan
-
Methods inherited from interface thredds.inventory.MCollection
extractDate, getAuxInfo, getCollectionName, getFilenames, getFilesSorted, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, getRoot, hasDateExtractor, putAuxInfo
-
-
-
-
Method Detail
-
open
public static CollectionManager open(String collectionName, String collectionSpec, String olderThan, Formatter errlog)
-
isStatic
public boolean isStatic()
Description copied from interface:CollectionManagerstatic means doesnt need to be monitored for changes; can be externally triggered, or read in at startup. true if no recheckAfter and no update.rescan- Specified by:
isStaticin interfaceCollectionManager- Returns:
- if static
-
setStatic
public void setStatic(boolean aStatic)
-
getRecheck
public TimeDuration getRecheck()
Description copied from interface:CollectionManagerGet how often to rescan- Specified by:
getRecheckin interfaceCollectionManager- Returns:
- time duration of rescan period, or null if none.
-
getFileIterator
public CloseableIterator<MFile> getFileIterator() throws IOException
Description copied from interface:MCollectionGet the current collection of MFile, no guaranteed order. May be faster than getFilesSorted() for large collections, use when order is not important.try (CloseableIterator
iter = getFileIterator()) { while (iter.hasNext()) { MFile file = iter.next(); } } - Specified by:
getFileIteratorin interfaceMCollection- Returns:
- current collection of MFile as an CloseableIterator.
- Throws:
IOException
-
close
public void close()
Description copied from interface:MCollectionClose and release any resources. Do not make further calls on this object.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceMCollection
-
scanIfNeeded
public boolean scanIfNeeded() throws IOExceptionDescription copied from interface:CollectionManagerIf isScanNeeded(), do a scan. Do not send an event.- Specified by:
scanIfNeededin interfaceCollectionManager- Returns:
- true if scan was done, and anything changed.
- Throws:
IOException- on io error
-
addEventListener
public void addEventListener(CollectionManager.TriggerListener l)
Description copied from interface:CollectionManagerRegister to get Trigger events- Specified by:
addEventListenerin interfaceCollectionManager- Parameters:
l- listener
-
removeEventListener
public void removeEventListener(CollectionManager.TriggerListener l)
- Specified by:
removeEventListenerin interfaceCollectionManager
-
-