Class InvDatasetImpl

    • Constructor Detail

      • InvDatasetImpl

        public InvDatasetImpl​(InvDatasetImpl parent,
                              String name,
                              FeatureType dataType,
                              String serviceName,
                              String urlPath)
        Constructor from Catalog XML info. You must call finish() before this object is ready to be used. We had to do it this way so that nested service elements could be added through addService(), before we define on the default service.
        Parameters:
        parent - : parent dataset
        name - : display name of dataset
        dataType - : DataType name (may be null)
        serviceName - : default service (may be null)
        urlPath - : URL = server.getURLbase() + urlPath
      • InvDatasetImpl

        public InvDatasetImpl​(String urlPath,
                              FeatureType dataType,
                              ServiceType stype)
        Construct an InvDatasetImpl which refers to a urlPath. This is used to create a standalone InvDatasetImpl, outside of an InvCatalog. An "anonymous" InvServerImpl is created and attached to the InvDataset.
        Parameters:
        urlPath - : construct URL from this path
        dataType - : data type
        stype - : ServiceType
      • InvDatasetImpl

        public InvDatasetImpl​(InvDatasetImpl from)
        copy constructor
        Parameters:
        from - copy from here
    • Method Detail

      • finish

        public boolean finish()
        Finish constructing after all elements have been added. This does the inheritence thing This can be called again if new elements are added.
        Returns:
        true if successful.
      • transferMetadata

        public void transferMetadata​(InvDatasetImpl fromDs,
                                     boolean copyInheritedMetadataFromParents)
        Transfer all inheritable metadata from fromDs to the local metadata of this dataset. Called by InvDatasetScan to transfer inheritable metaddata to the nested catalogRef
        Parameters:
        fromDs - transfer from here
      • canonicalize

        protected void canonicalize()
        Put metadata into canonical form. All non-inherited thredds metadata put into single metadata element, pointed to by getLocalMetadata(). All inherited thredds metadata put into single metadata element, pointed to by getLocalMetadataInherited(). This is needed to do reliable editing.
      • getAlias

        public String getAlias()
        Returns:
        alias for this Dataset, if there is one
      • setAlias

        public void setAlias​(String alias)
        Set alias for this Dataset
        Parameters:
        alias - ID of another Dataset
      • setCatalog

        public void setCatalog​(InvCatalog catalog)
        Set the containing catalog; use only for top level dataset.
        Parameters:
        catalog - the containing catalog for the top level dataset.
      • getParentReal

        public InvDataset getParentReal()
        Get real parent dataset, no proxies
        Returns:
        parent dataset. If top dataset, return null.
      • getUrlPath

        public String getUrlPath()
        Get urlPath for this Dataset
        Returns:
        urlPath for this Dataset
      • setUrlPath

        public void setUrlPath​(String urlPath)
        Set the urlPath for this InvDatasetImpl
        Parameters:
        urlPath - the urlPath for this InvDatasetImpl
      • setAuthority

        public void setAuthority​(String authorityName)
        Set authorityName for this Dataset
        Parameters:
        authorityName - for this Dataset
      • setCollectionType

        public void setCollectionType​(CollectionType collectionType)
        Set collectionType
        Parameters:
        collectionType - the collection type
      • setHarvest

        public void setHarvest​(boolean harvest)
        Set harvest
        Parameters:
        harvest - true if this dataset should be harvested for Digital Libraries
      • setID

        public void setID​(String id)
        Set the ID for this Dataset
        Parameters:
        id - unique ID
      • setName

        public void setName​(String name)
        Set name of this Dataset.
        Parameters:
        name - of the dataset
      • setParent

        public void setParent​(InvDatasetImpl parent)
        Set the parent dataset.
        Parameters:
        parent - parent dataset
      • setTimeCoverage

        public void setTimeCoverage​(DateRange tc)
      • setDataFormatType

        public void setDataFormatType​(DataFormatType dataFormatType)
      • setDataType

        public void setDataType​(FeatureType dataType)
      • getDataSize

        public double getDataSize()
      • setDataSize

        public void setDataSize​(double dataSize)
      • getLastModifiedDate

        public DateType getLastModifiedDate()
      • setLastModifiedDate

        public void setLastModifiedDate​(DateType lastModDate)
      • setLastModifiedDate

        public void setLastModifiedDate​(Date lastModDate)
      • setServiceName

        public void setServiceName​(String serviceName)
      • setResourceControl

        public void setResourceControl​(String restrictAccess)
      • addAccess

        public void addAccess​(InvAccess a)
        Add InvAccess element to this dataset.
        Parameters:
        a - add dthis
      • addAccess

        public void addAccess​(List<InvAccess> a)
        Add a list of InvAccess elements to this dataset.
        Parameters:
        a - add all of these
      • getAccessLocal

        public List<InvAccess> getAccessLocal()
        Returns:
        the local access (non-expanded) elements.
      • getNcmlElement

        public org.jdom2.Element getNcmlElement()
        Returns:
        the ncml element if it exists, else return null.
      • setNcmlElement

        public void setNcmlElement​(org.jdom2.Element ncmlElement)
      • addDataset

        public void addDataset​(InvDatasetImpl ds)
        Add a nested dataset.
        Parameters:
        ds - add this
      • addDataset

        public void addDataset​(int index,
                               InvDatasetImpl ds)
        Add a nested dataset at the location indicated by index.
        Parameters:
        index - add at this position
        ds - add this
      • removeDataset

        public boolean removeDataset​(InvDatasetImpl ds)
        Remove the given dataset element from this dataset if it is in the dataset.
        Parameters:
        ds - - the dataset element to be removed
        Returns:
        true if this dataset contained the given dataset element.
      • replaceDataset

        public boolean replaceDataset​(InvDatasetImpl remove,
                                      InvDatasetImpl add)
        Replace the given dataset if it is a nesetd dataset.
        Parameters:
        remove - - the dataset element to be removed
        add - - the dataset element to be added
        Returns:
        true on success
      • addDocumentation

        public void addDocumentation​(InvDocumentation doc)
        Add documentation element to this dataset.
        Parameters:
        doc - add this
      • addProperty

        public void addProperty​(InvProperty p)
        Add a property to this dataset
        Parameters:
        p - add this
      • addService

        public void addService​(InvService service)
        Deprecated.
        add services only to catalog
        Add a service to this dataset.
        Parameters:
        service - add this service to the dataset
      • removeService

        public void removeService​(InvService service)
        Deprecated.
        put services in catalog
        Remove a service from this dataset.
        Parameters:
        service - remove this
      • getServicesLocal

        public List<InvService> getServicesLocal()
        Get services attached specifically to this dataset.
        Returns:
        List of type InvService. May be empty, but not null.
      • setServicesLocal

        public void setServicesLocal​(List<InvService> s)
        Set the list of services attached specifically to this dataset. Discard any previous servies.
        Parameters:
        s - list of services.
      • getLocalMetadata

        public ThreddsMetadata getLocalMetadata()
        Get the metadata stored in this dataset element. Inherited metadata only in an InvMetadata object.
        Returns:
        the metadata stored in this dataset element.
      • getLocalMetadataInheritable

        public ThreddsMetadata getLocalMetadataInheritable()
        local metadata that should be inherited by this dataset's children.
        Returns:
        local metadata that should be inherited by this dataset's children.
      • removeLocalMetadata

        public boolean removeLocalMetadata​(InvMetadata metadata)
        Remove the given InvMetadata from the set of metadata local to this dataset.
        Parameters:
        metadata - remove this
        Returns:
        true if an InvMetadata is removed, false otherwise.
      • getServiceName

        public String getServiceName()
      • getMark

        protected boolean getMark()
        Filtering
        Returns:
        true if this is "marked"
      • setMark

        protected void setMark​(boolean mark)
      • getUserProperty

        public Object getUserProperty​(Object key)
        Look up the User property having the given key
        Parameters:
        key - property key
        Returns:
        User property having the given key, or null
      • setUserProperty

        public void setUserProperty​(Object key,
                                    Object value)
      • writeHtmlDescription

        public static void writeHtmlDescription​(StringBuilder buff,
                                                InvDatasetImpl ds,
                                                boolean complete,
                                                boolean isServer,
                                                boolean datasetEvents,
                                                boolean catrefEvents,
                                                boolean resolveRelativeUrls)
        Write an Html representation of the given dataset.

        With datasetEvents, catrefEvents = true, this is used to construct an HTML page on the client (eg using HtmlPage); the client then detects URL clicks and processes.

        With datasetEvents, catrefEvents = false, this is used to construct an HTML page on the server. (eg using HtmlPage); the client then detects URL clicks and processes.

        Parameters:
        buff - put HTML here.
        ds - the dataset.
        complete - if true, add HTML header and ender so its a complete, valid HTML page.
        isServer - if true, then we are in the thredds data server, so do the following:
        • append "html" to DODS Access URLs
        datasetEvents - if true, prepend "dataset:" to any dataset access URLS
        catrefEvents - if true, prepend "catref:" to any catref URLS
      • resolve

        public static String resolve​(InvDataset ds,
                                     String href)
        resolve relative URLS against the catalog URL.
        Parameters:
        ds - use ds parent catalog, if it exists
        href - URL to resolve
        Returns:
        resolved URL
      • dump

        public String dump()
        Returns:
        debugging info
      • equals

        public boolean equals​(Object o)
        InvDatasetImpl elements with same values are equal.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Override Object.hashCode() to implement equals.
        Overrides:
        hashCode in class Object