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 void
addEventListener(CollectionManager.TriggerListener l)
Register to get Trigger eventsvoid
close()
Close and release any resources.CloseableIterator<MFile>
getFileIterator()
Get the current collection of MFile, no guaranteed order.TimeDuration
getRecheck()
Get how often to rescanboolean
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
removeEventListener(CollectionManager.TriggerListener l)
boolean
scanIfNeeded()
If isScanNeeded(), do a scan.void
setStatic(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:CollectionManager
static 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:
isStatic
in interfaceCollectionManager
- Returns:
- if static
-
setStatic
public void setStatic(boolean aStatic)
-
getRecheck
public TimeDuration getRecheck()
Description copied from interface:CollectionManager
Get how often to rescan- Specified by:
getRecheck
in interfaceCollectionManager
- Returns:
- time duration of rescan period, or null if none.
-
getFileIterator
public CloseableIterator<MFile> getFileIterator() throws IOException
Description copied from interface:MCollection
Get 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:
getFileIterator
in interfaceMCollection
- Returns:
- current collection of MFile as an CloseableIterator.
- Throws:
IOException
-
close
public void close()
Description copied from interface:MCollection
Close and release any resources. Do not make further calls on this object.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceMCollection
-
scanIfNeeded
public boolean scanIfNeeded() throws IOException
Description copied from interface:CollectionManager
If isScanNeeded(), do a scan. Do not send an event.- Specified by:
scanIfNeeded
in 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:CollectionManager
Register to get Trigger events- Specified by:
addEventListener
in interfaceCollectionManager
- Parameters:
l
- listener
-
removeEventListener
public void removeEventListener(CollectionManager.TriggerListener l)
- Specified by:
removeEventListener
in interfaceCollectionManager
-
-