Class DatasetSource

  • Direct Known Subclasses:
    DodsDirDatasetSource, DodsFileServerDatasetSource, GrADSDataServerDatasetSource, LocalDatasetSource

    public abstract class DatasetSource
    extends Object
    Represents a source from which a collection of datasets can be found and expanded into an InvCatalog. Besides expanding the DatasetSource, the datasets in the resulting catalog can be named, sorted, and have metadata added to them.

    Currently an abstract class, three abstract methods must be implemented to make a concrete subclass. These methods are getTopLevelDataset():InvDataset, isCollection():boolean, and expandThisLevel(InvDataset):List. (In previous versions, expandThisType():void was the only abstract method.)

    • Field Detail

      • resultingCatalog

        protected InvCatalog resultingCatalog
        The catalog that results from expanding this DatasetSource.
      • accessPointDataset

        protected InvDataset accessPointDataset
        Top-level dataset of the catalog generated by this DatasetSource.
      • catalogRefInfoList

        protected List catalogRefInfoList
        Information on the catalogRefs in the resulting catalog.
      • createCatalogRefs

        protected boolean createCatalogRefs
      • datasetNamerList

        protected List datasetNamerList
      • datasetFilterList

        protected List datasetFilterList
      • datasetEnhancerList

        protected List datasetEnhancerList
      • addDatasetSize

        protected boolean addDatasetSize
      • isValid

        protected boolean isValid
    • Constructor Detail

      • DatasetSource

        protected DatasetSource()
        Default Constructor
    • Method Detail

      • getResultingCatalog

        public InvCatalog getResultingCatalog()
      • getCatalogRefInfoList

        public List getCatalogRefInfoList()
      • getName

        public String getName()
      • setName

        public void setName​(String name)
      • isFlatten

        public boolean isFlatten()
      • getAccessPoint

        public String getAccessPoint()
      • setAccessPoint

        public void setAccessPoint​(String accessPoint)
      • getPrefixUrlPath

        public String getPrefixUrlPath()
      • setPrefixUrlPath

        public void setPrefixUrlPath​(String prefixUrlPath)
      • setResultService

        public void setResultService​(ResultService resultService)
      • isCreateCatalogRefs

        public boolean isCreateCatalogRefs()
      • setCreateCatalogRefs

        public void setCreateCatalogRefs​(boolean createCatalogRefs)
      • getDatasetNamerList

        public List getDatasetNamerList()
      • addDatasetNamer

        public void addDatasetNamer​(DatasetNamer datasetNamer)
      • getDatasetFilterList

        public List getDatasetFilterList()
      • addDatasetFilter

        public void addDatasetFilter​(DatasetFilter datasetFilter)
      • setDatasetSorter

        public void setDatasetSorter​(DatasetSorter datasetSorter)
      • getDatasetEnhancerList

        public List getDatasetEnhancerList()
      • addDatasetEnhancer

        public void addDatasetEnhancer​(DatasetEnhancer1 dsEnhancer)
      • isAddDatasetSize

        public boolean isAddDatasetSize()
      • setAddDatasetSize

        public void setAddDatasetSize​(boolean addDatasetSize)
      • expand

        public InvDataset expand()
                          throws IOException
        Crawl this DatasetSource and generate a new InvCatalog, return the top-level InvDataset. Each object found on the DatasetSource becomes an InvDataset if it is accepted by at least one DatasetFilter. The catalog reflects the heirarchical structure of the DatasetSource. All datasets are named with the location of the object they represent on the dataset source.
        Returns:
        the top-level InvDataset in the generated InvCatalog.
        Throws:
        IOException - if the accessPoint for this DatasetSource is not a container dataset.
      • expand

        public InvDataset expand​(List accessPoints)
                          throws IOException
        Parameters:
        accessPoints -
        Returns:
        the top-level dataset
        Throws:
        IOException - if the main access point for this DatasetSource is not a container dataset or any of the given access points do not exist or are not under the main access point.
      • fullExpand

        public InvCatalog fullExpand()
                              throws IOException
        Crawl this DatasetSource and generate a new InvCatalog with all datasets named, sorted, and organized as defined by this DatasetSource, return the newly generated InvCatalog.
        Returns:
        the generated InvCatalog.
        Throws:
        IOException - if DatasetSource does not reference a container dataset.
      • createDataset

        protected abstract InvDataset createDataset​(String datasetLocation,
                                                    String prefixUrlPath)
                                             throws IOException
        Creates an InvDataset to represent the dataset at the given location on this DatasetSource.
        Parameters:
        datasetLocation - a String indicating the location of a dataset.
        prefixUrlPath - a path name to be prefixed on the urlPath
        Returns:
        an InvDataset for the given dataset location.
        Throws:
        IOException - if the dataset location does not correspond to an actual dataset or is not below the accessPointHeader directory.
        NullPointerException - if the given dataset location is null.
      • isCollection

        protected abstract boolean isCollection​(InvDataset dataset)
        Return true if the given dataset is a collection dataset, false otherwise.
        Parameters:
        dataset - - the InvDataset to test for being a collection dataset.
        Returns:
        true if the given dataset is a collection dataset, false otherwise.
        Throws:
        NullPointerException - if the given InvDataset is null.
        ClassCastException - if the given InvDataset is not a LocalInvDataset.
      • createSkeletonCatalog

        protected abstract InvCatalog createSkeletonCatalog​(String prefixUrlPath)
                                                     throws IOException
        Return a skeleton InvCatalog for this DatasetSource. The skeleton catalog is unnamed with a single top-level dataset representing the DatasetSource accessPoint and a service built from the DatasetSource ResultService.
        Parameters:
        prefixUrlPath -
        Returns:
        a skeleton InvCatalog for this DatasetSource.
        Throws:
        IOException - if top-level dataset does not exist or is not a collection dataset.
      • expandThisLevel

        protected abstract List expandThisLevel​(InvDataset collectionDataset,
                                                String prefixUrlPath)
        Return a list of the InvDatasets contained in the given collection dataset on this DatasetSource.
        Parameters:
        collectionDataset - - the collection dataset to be expanded.
        prefixUrlPath -
        Returns:
        A list of the InvDatasets contained in the given collection dataset.
        Throws:
        IllegalArgumentException - when given dataset is not a collection dataset.
        NullPointerException - if given dataset is null.
        ClassCastException - if the given InvDataset is not a LocalInvDataset.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object