Package thredds.crawlabledataset
Interface CrawlableDataset
-
- All Known Implementing Classes:
CrawlableCatalog
,CrawlableDatasetAlias
,CrawlableDatasetAmazonS3
,CrawlableDatasetDods
,CrawlableDatasetFile
public interface CrawlableDataset
CrawlableDataset represents an abstract dataset that is part of a hierarchical dataset collection. Parent and child datasets can be accessed allowing the collection to be crawled.The CrawlableDataset interface is a generalization (and simplification) of the java.io.File class. A CrawlableDataset path is made up of ONE or more path segments each separated by a slash ("/"). The path may start or end with a slash ("/").
Implementation Notes:
- The thredds.crawlabledataset.CrawlableDatasetFactory requires each CrawlableDataset implementation to define a public constructor with one String argument and one Object argument. The String argument is the path for the CrawlableDataset being constructed, the Object argument is a configuration object.
- The thredds.cataloggen.CollectionLevelScanner framework does not support building a catalog for the collection based at the CrawlableDataset path "/". So, do not implement your CrawlableDataset so that the path "/" is allowed, or at least so that it is not likely to be used as the root of a dataset collection (e.g., CrawlableDatasetFile is probably safe because the root directory ("/") should never be used as the base of a data collection. If the backend data source on top of which you are implementing CrawlabeDataset uses "/" as its root, you can simply prepend a string (e.g., "myDataCollection" or "root") to the backend path for the CrawlableDataset view of the path.
- Since:
- May 3, 2005 20:18:59 -0600
- See Also:
CollectionLevelScanner uses CrawlableDatasets to scan a dataset collection and create a THREDDS catalog.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
exists()
Return true if the dataset represented by this CrawlableDataset actually exists, null if it does not or an I/O error occurs.Object
getConfigObject()
Return the configuration Object (can be null).CrawlableDataset
getDescendant(String relativePath)
Return the requested descendant of this dataset.String
getName()
Returns the dataset name, i.e., the last part of the dataset path.CrawlableDataset
getParentDataset()
Returns the parent CrawlableDataset or null if this dataset has no parent.String
getPath()
Returns the dataset path.boolean
isCollection()
Return true if the dataset is a collection dataset.Date
lastModified()
Returns the date the dataset was last modified, null if unknown.long
length()
Returns the size in bytes of the dataset, -1 if unknown.List<CrawlableDataset>
listDatasets()
Returns the list of CrawlableDatasets contained in this collection dataset.List<CrawlableDataset>
listDatasets(CrawlableDatasetFilter filter)
Returns the list of CrawlableDatasets contained in this collection dataset that satisfy the given filter.
-
-
-
Method Detail
-
getConfigObject
Object getConfigObject()
Return the configuration Object (can be null).- Returns:
- the configuration Object (can be null).
-
getPath
String getPath()
Returns the dataset path.- Returns:
- the dataset path.
-
getName
String getName()
Returns the dataset name, i.e., the last part of the dataset path.- Returns:
- the dataset name, i.e., the last part of the dataset path.
-
getParentDataset
CrawlableDataset getParentDataset()
Returns the parent CrawlableDataset or null if this dataset has no parent.- Returns:
- the parent CrawlableDataset or null if this dataset has no parent.
-
exists
boolean exists()
Return true if the dataset represented by this CrawlableDataset actually exists, null if it does not or an I/O error occurs.- Returns:
- true if the dataset represented by this CrawlableDataset actually exists.
-
isCollection
boolean isCollection()
Return true if the dataset is a collection dataset.- Returns:
- true if the dataset is a collection dataset.
-
getDescendant
CrawlableDataset getDescendant(String relativePath)
Return the requested descendant of this dataset.- Parameters:
relativePath
- the path, relative to this dataset, of the requested dataset.- Returns:
- the requested descendant of this dataset.
- Throws:
IllegalArgumentException
- if the relative path is not relative (e.g., starts with a slash ("/")).IllegalStateException
- if this dataset is not a collection, the isCollection() method should be used to check.
-
listDatasets
List<CrawlableDataset> listDatasets() throws IOException
Returns the list of CrawlableDatasets contained in this collection dataset. The returned list will be empty if this collection dataset does not contain any children datasets. If this dataset is not a collection dataset, this method returns null.- Returns:
- Returns a list of the CrawlableDatasets contained in this collection dataset. The llist will be empty if no datasets are contained in this collection dataset.
- Throws:
IOException
- if an I/O error occurs while accessing the children datasets.IllegalStateException
- if this dataset is not a collection, the isCollection() method should be used to check.
-
listDatasets
List<CrawlableDataset> listDatasets(CrawlableDatasetFilter filter) throws IOException
Returns the list of CrawlableDatasets contained in this collection dataset that satisfy the given filter. The returned list will be empty if this collection dataset does not contain any children datasets that satisfy the given filter.- Parameters:
filter
- a CrawlableDataset filter (if null, accept all datasets).- Returns:
- Returns a list of the CrawlableDatasets contained in this collection dataset that satisfy the given filter. The list will be empty if no datasets are contained in this collection dataset.
- Throws:
IOException
- if an I/O error occurs while accessing the children datasets.IllegalStateException
- if this dataset is not a collection, the isCollection() method should be used to check.
-
length
long length()
Returns the size in bytes of the dataset, -1 if unknown.- Returns:
- the size in bytes of the dataset, -1 if unknown.
-
lastModified
Date lastModified()
Returns the date the dataset was last modified, null if unknown.- Returns:
- the date the dataset was last modified, null if unknown.
-
-