Package thredds.inventory
Class CollectionManagerCatalog
- java.lang.Object
-
- thredds.inventory.CollectionAbstract
-
- thredds.inventory.CollectionManagerAbstract
-
- thredds.inventory.CollectionManagerCatalog
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,CatalogCrawler.Listener
,CollectionManager
,MCollection
@ThreadSafe public class CollectionManagerCatalog extends CollectionManagerAbstract implements CatalogCrawler.Listener
CollectionManager of datasets from a catalog.- Since:
- Jan 14, 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
-
-
Constructor Summary
Constructors Constructor Description CollectionManagerCatalog(String collectionName, String collectionSpec, String olderThan, Formatter errlog)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
getDataset(Dataset ds, Object context)
Gets called for each dataset found.Iterable<MFile>
getFilesSorted()
Get the current collection of MFile.long
getLastChanged()
Get the last time the collection changedlong
getLastScanned()
Get the last time scannedString
getRoot()
Get common root directory of all MFiles in the collection - may be nullboolean
isScanNeeded()
Compute whether rescan is needed, based on getRecheck(), and the LastScanned value.boolean
scan(boolean sendEvent)
Scan the collection.-
Methods inherited from class thredds.inventory.CollectionManagerAbstract
addEventListener, close, getFileIterator, getRecheck, isStatic, open, removeEventListener, scanIfNeeded, setStatic
-
Methods inherited from class thredds.inventory.CollectionAbstract
cleanName, extractDate, getAuxInfo, getCollectionName, getFilenames, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, 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.MCollection
extractDate, getAuxInfo, getCollectionName, getFilenames, getIndexFilename, getLastModified, getLatestFile, getPartitionDate, getProtoIndex, hasDateExtractor, putAuxInfo
-
-
-
-
Method Detail
-
getRoot
public String getRoot()
Description copied from interface:MCollection
Get common root directory of all MFiles in the collection - may be null- Specified by:
getRoot
in interfaceMCollection
- Overrides:
getRoot
in classCollectionAbstract
- Returns:
- root directory name, or null.
-
getLastScanned
public long getLastScanned()
Description copied from interface:CollectionManager
Get the last time scanned- Specified by:
getLastScanned
in interfaceCollectionManager
- Returns:
- msecs since 1970
-
getLastChanged
public long getLastChanged()
Description copied from interface:CollectionManager
Get the last time the collection changed- Specified by:
getLastChanged
in interfaceCollectionManager
- Returns:
- msecs since 1970
-
isScanNeeded
public boolean isScanNeeded()
Description copied from interface:CollectionManager
Compute whether rescan is needed, based on getRecheck(), and the LastScanned value.- Specified by:
isScanNeeded
in interfaceCollectionManager
- Returns:
- true if rescan is needed.
-
scan
public boolean scan(boolean sendEvent) throws IOException
Description copied from interface:CollectionManager
Scan the collection. Files may have been deleted or added since last time. If the MFile already exists in the current list, leave it in the list. If anything changes, send TriggerEvent(TriggerType.update) and return true Get the results from getFiles()- Specified by:
scan
in interfaceCollectionManager
- Returns:
- true if anything actually changed.
- Throws:
IOException
- on I/O error
-
getFilesSorted
public Iterable<MFile> getFilesSorted()
Description copied from interface:MCollection
Get the current collection of MFile. if hasDateExtractor() == true, these will be sorted by Date, otherwise by path.- Specified by:
getFilesSorted
in interfaceMCollection
- Returns:
- current collection of MFile as an Iterable.
-
getDataset
public void getDataset(Dataset ds, Object context)
Description copied from interface:CatalogCrawler.Listener
Gets called for each dataset found.- Specified by:
getDataset
in interfaceCatalogCrawler.Listener
- Parameters:
ds
- the datasetcontext
- object passed into crawl() by the caller
-
-