Package thredds.inventory
Interface MCollection
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Subinterfaces:
CollectionManager
,PartitionManager
- All Known Implementing Classes:
CollectionAbstract
,CollectionFiltered
,CollectionGeneral
,CollectionGlob
,CollectionList
,CollectionListRange
,CollectionManagerAbstract
,CollectionManagerCatalog
,CollectionPathMatcher
,CollectionSingleFile
,CollectionSingleIndexFile
,DirectoryCollection
,DirectoryPartition
,FilePartition
,MFileCollectionManager
,PartitionManagerFromIndexDirectory
,PartitionManagerFromIndexList
,TimePartition
public interface MCollection extends Closeable
Collection of MFiles- Since:
- 11/11/13
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close and release any resources.CalendarDate
extractDate(MFile mfile)
Use the date extractor to extract the date from the filename.Object
getAuxInfo(String key)
String
getCollectionName()
The name of the collectionCloseableIterator<MFile>
getFileIterator()
Get the current collection of MFile, no guaranteed order.List<String>
getFilenames()
Get list of sorted filenames that are in this collection.Iterable<MFile>
getFilesSorted()
Get the current collection of MFile.String
getIndexFilename(String suffix)
long
getLastModified()
last time this collection was modifiedMFile
getLatestFile()
The latest file in the collection.CalendarDate
getPartitionDate()
The date to partition on, usually the starting date of the collection.int
getProtoIndex(int n)
Choose Proto dataset as index from [0..n-1], based on configuration.String
getRoot()
Get common root directory of all MFiles in the collection - may be nullboolean
hasDateExtractor()
Does this CollectionManager have the ability to extract a date from the MFile ?void
putAuxInfo(String key, Object value)
-
-
-
Method Detail
-
getCollectionName
String getCollectionName()
The name of the collection- Returns:
- name of the collection
-
getRoot
String getRoot()
Get common root directory of all MFiles in the collection - may be null- Returns:
- root directory name, or null.
-
extractDate
CalendarDate extractDate(MFile mfile)
Use the date extractor to extract the date from the filename. Only call if hasDateExtractor() == true.- Parameters:
mfile
- extract from here- Returns:
- Date, or null if none
-
hasDateExtractor
boolean hasDateExtractor()
Does this CollectionManager have the ability to extract a date from the MFile ?- Returns:
- true if CollectionManager has a DateExtractor
-
getPartitionDate
CalendarDate getPartitionDate()
The date to partition on, usually the starting date of the collection.- Returns:
- partition date of the collection, or null if unknown
-
close
void close()
Close and release any resources. Do not make further calls on this object.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getProtoIndex
int getProtoIndex(int n)
Choose Proto dataset as index from [0..n-1], based on configuration.- Parameters:
n
- size to choose from- Returns:
- index within range [0..n-1]
-
getLastModified
long getLastModified()
last time this collection was modified- Returns:
- msess since epoch
-
getFilesSorted
Iterable<MFile> getFilesSorted() throws IOException
Get the current collection of MFile. if hasDateExtractor() == true, these will be sorted by Date, otherwise by path.- Returns:
- current collection of MFile as an Iterable.
- Throws:
IOException
-
getFilenames
List<String> getFilenames() throws IOException
Get list of sorted filenames that are in this collection.- Throws:
IOException
-
getLatestFile
MFile getLatestFile() throws IOException
The latest file in the collection. Only call if hasDateExtractor() == true.- Returns:
- latest file in the collection
- Throws:
IOException
-
getFileIterator
CloseableIterator<MFile> getFileIterator() throws IOException
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(); } } - Returns:
- current collection of MFile as an CloseableIterator.
- Throws:
IOException
-
-