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 voidgetDataset(Dataset ds, Object context)Gets called for each dataset found.Iterable<MFile>getFilesSorted()Get the current collection of MFile.longgetLastChanged()Get the last time the collection changedlonggetLastScanned()Get the last time scannedStringgetRoot()Get common root directory of all MFiles in the collection - may be nullbooleanisScanNeeded()Compute whether rescan is needed, based on getRecheck(), and the LastScanned value.booleanscan(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:MCollectionGet common root directory of all MFiles in the collection - may be null- Specified by:
getRootin interfaceMCollection- Overrides:
getRootin classCollectionAbstract- Returns:
- root directory name, or null.
-
getLastScanned
public long getLastScanned()
Description copied from interface:CollectionManagerGet the last time scanned- Specified by:
getLastScannedin interfaceCollectionManager- Returns:
- msecs since 1970
-
getLastChanged
public long getLastChanged()
Description copied from interface:CollectionManagerGet the last time the collection changed- Specified by:
getLastChangedin interfaceCollectionManager- Returns:
- msecs since 1970
-
isScanNeeded
public boolean isScanNeeded()
Description copied from interface:CollectionManagerCompute whether rescan is needed, based on getRecheck(), and the LastScanned value.- Specified by:
isScanNeededin interfaceCollectionManager- Returns:
- true if rescan is needed.
-
scan
public boolean scan(boolean sendEvent) throws IOExceptionDescription copied from interface:CollectionManagerScan 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:
scanin interfaceCollectionManager- Returns:
- true if anything actually changed.
- Throws:
IOException- on I/O error
-
getFilesSorted
public Iterable<MFile> getFilesSorted()
Description copied from interface:MCollectionGet the current collection of MFile. if hasDateExtractor() == true, these will be sorted by Date, otherwise by path.- Specified by:
getFilesSortedin interfaceMCollection- Returns:
- current collection of MFile as an Iterable.
-
getDataset
public void getDataset(Dataset ds, Object context)
Description copied from interface:CatalogCrawler.ListenerGets called for each dataset found.- Specified by:
getDatasetin interfaceCatalogCrawler.Listener- Parameters:
ds- the datasetcontext- object passed into crawl() by the caller
-
-