thredds.crawlabledataset
Interface CrawlableDataset

All Known Implementing Classes:
CrawlableDatasetAlias, 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 seperated by a slash ("/"). The path may start or end with a slash ("/").

Implementation Notes:

  1. 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.
  2. 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
Author:
edavis
See Also:
CollectionLevelScanner uses CrawlableDatasets to scan a dataset collection and create a THREDDS catalog.

Method Summary
 boolean exists()
          Return true if the dataset represented by this CrawlableDataset actually exists, null if it does not or an I/O error occurs.
 java.lang.Object getConfigObject()
          Return the configuration Object (can be null).
 CrawlableDataset getDescendant(java.lang.String relativePath)
          A factory method for getting a descendant of this datasets.
 java.lang.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.
 java.lang.String getPath()
          Returns the dataset path.
 boolean isCollection()
          Return true if the dataset is a collection dataset.
 java.util.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.
 java.util.List listDatasets()
          Returns the list of CrawlableDatasets contained in this collection dataset.
 java.util.List listDatasets(CrawlableDatasetFilter filter)
          Returns the list of CrawlableDatasets contained in this collection dataset that satisfy the given filter.
 

Method Detail

getConfigObject

java.lang.Object getConfigObject()
Return the configuration Object (can be null).


getPath

java.lang.String getPath()
Returns the dataset path.


getName

java.lang.String getName()
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.


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.


getDescendant

CrawlableDataset getDescendant(java.lang.String relativePath)
A factory method for getting a descendant of this datasets.

Parameters:
relativePath - the path relative to this dataset of the requested dataset.
Returns:
the requested descendant of this dataset.

listDatasets

java.util.List listDatasets()
                            throws java.io.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:
java.io.IOException - if an I/O error occurs while accessing the children datasets.
java.lang.IllegalStateException - if this dataset is not a collection, the isCollection() method should be used to check.

listDatasets

java.util.List listDatasets(CrawlableDatasetFilter filter)
                            throws java.io.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:
java.io.IOException - if an I/O error occurs while accessing the children datasets.
java.lang.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.


lastModified

java.util.Date lastModified()
Returns the date the dataset was last modified, null if unknown.