thredds.catalog
Class InvDatasetImpl

java.lang.Object
  extended by thredds.catalog.InvDataset
      extended by thredds.catalog.InvDatasetImpl
Direct Known Subclasses:
InvCatalogRef, InvDatasetImplProxy

public class InvDatasetImpl
extends InvDataset

Concrete implementation of a thredds Dataset, for reading and writing from XML.

Version:
$Revision: 1.49 $ $Date: 2006/04/20 22:13:15 $
Author:
john caron
See Also:
InvDataset

Field Summary
 
Fields inherited from class thredds.catalog.InvDataset
gc, tc
 
Constructor Summary
InvDatasetImpl(InvDatasetImpl from)
          copy constructor
InvDatasetImpl(InvDatasetImpl parent, java.lang.String name, DataType dataType, java.lang.String serviceName, java.lang.String urlPath)
          Constructor from Catalog XML info.
InvDatasetImpl(InvDataset parent, java.lang.String name)
           
InvDatasetImpl(java.lang.String urlPath, DataType dataType, ServiceType stype)
          Construct an InvDatasetImpl which refers to a urlPath.
 
Method Summary
 void addAccess(InvAccess a)
          Add InvAccess element to this dataset.
 void addAccess(java.util.List a)
          Add a list of InvAccess elements to this dataset.
 void addDataset(int index, InvDatasetImpl ds)
          Add a nested dataset at the location indicated by index.
 void addDataset(InvDatasetImpl ds)
          Add a nested dataset.
 void addDocumentation(InvDocumentation doc)
          Add documentation element to this dataset.
 void addProperty(InvProperty p)
          Add a property to this dataset
 void addService(InvService service)
          Deprecated. put services in catalog
 java.lang.String dump()
          debugging info
 boolean equals(java.lang.Object o)
          InvDatasetImpl elements with same values are equal.
 boolean finish()
          Finish constructing after all elements have been added.
 java.util.List getAccessLocal()
          Get the non-expanded access elements.
 java.lang.String getAlias()
          Get alias for this Dataset, if it exists
 ThreddsMetadata getCat6Metadata()
          local metadata that should be inherited by this dataset's children.
 double getDataSize()
           
 java.util.List getDocumentationLinks()
          get Documentation that are xlinks
 ThreddsMetadata getLocalMetadata()
          Get the metadata stored in this dataset element.
 ThreddsMetadata getLocalMetadataInheritable()
          local metadata that should be inherited by this dataset's children.
 org.jdom.Element getNcmlElement()
          Get ncml element if it exists, else return null.
 InvDataset getParentReal()
          Get real parent dataset, no proxies
 java.lang.String getServiceName()
           
 java.util.List getServicesLocal()
          Get services attached specifically to this dataset.
 java.lang.String getUrlPath()
          Get urlPath for this Dataset
 java.lang.Object getUserProperty(java.lang.Object key)
          User properties
 int hashCode()
          Override Object.hashCode() to implement equals.
static void main(java.lang.String[] args)
          test
 boolean removeDataset(InvDatasetImpl ds)
          Remove the given dataset element from this dataset if it is in the dataset.
 boolean removeLocalMetadata(InvMetadata metadata)
          Remove the given InvMetadata from the set of metadata local to this dataset.
 void removeService(InvService service)
          Deprecated. put services in catalog
 boolean replaceDataset(InvDatasetImpl remove, InvDatasetImpl add)
          Replace the given dataset if it is a nesetd dataset.
static java.lang.String resolve(InvDataset ds, java.lang.String href)
          resolve reletive URLS against the catalog URL.
 void setAlias(java.lang.String alias)
          Set alias for this Dataset
 void setAuthority(java.lang.String authorityName)
          Set authorityName for this Dataset
 void setCatalog(InvCatalog catalog)
          Set the containing catalog; use only for top level dataset.
 void setCollectionType(CollectionType collectionType)
          Set collectionType
 void setContributors(java.util.ArrayList a)
           
 void setDataSize(double dataSize)
           
 void setDataType(DataType dataType)
           
 void setGeospatialCoverage(ThreddsMetadata.GeospatialCoverage gc)
           
 void setHarvest(boolean harvest)
          Set harvest
 void setID(java.lang.String id)
          Set the ID for this Dataset
 void setKeywords(java.util.ArrayList a)
           
 void setLocalMetadata(ThreddsMetadata tm)
           
 void setName(java.lang.String name)
          Set name of this Dataset.
 void setNcmlElement(org.jdom.Element ncmlElement)
           
 void setParent(InvDatasetImpl parent)
          Set the parent dataset.
 void setProjects(java.util.ArrayList a)
           
 void setPublishers(java.util.ArrayList a)
           
 void setResourceControl(java.lang.String resourceControl)
           
 void setServiceName(java.lang.String serviceName)
           
 void setServicesLocal(java.util.ArrayList s)
          Set the list of services attached specifically to this dataset.
 void setTimeCoverage(thredds.datatype.DateRange tc)
           
 void setUrlPath(java.lang.String urlPath)
          Set the urlPath for this InvDatasetImpl
 void setUserProperty(java.lang.Object key, java.lang.Object value)
           
 java.lang.String toString()
           
 void transferMetadata(InvDatasetImpl fromDs)
          Transfer all inheritable metadata from fromDs to the local metadata of this dataset.
static void writeHtmlDescription(java.lang.StringBuffer buff, InvDatasetImpl ds, boolean complete, boolean isServer, boolean datasetEvents, boolean catrefEvents)
          Write an Html representation of the given dataset.
 
Methods inherited from class thredds.catalog.InvDataset
findAccess, findDatasetByName, findProperty, findService, getAccess, getAccess, getAuthority, getCatalogUrl, getCollectionType, getContributors, getCreators, getDataFormatType, getDatasets, getDataType, getDates, getDocumentation, getDocumentation, getFullName, getGeospatialCoverage, getHistory, getID, getKeywords, getMetadata, getMetadata, getName, getParent, getParentCatalog, getProcessing, getProjects, getProperties, getPublishers, getResourceControl, getRights, getServiceDefault, getSubsetUrl, getSummary, getTimeCoverage, getUniqueID, getVariables, getVariables, hasAccess, hasNestedDatasets, isHarvest
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvDatasetImpl

public InvDatasetImpl(InvDatasetImpl parent,
                      java.lang.String name,
                      DataType dataType,
                      java.lang.String serviceName,
                      java.lang.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(java.lang.String urlPath,
                      DataType 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(InvDataset parent,
                      java.lang.String name)

InvDatasetImpl

public InvDatasetImpl(InvDatasetImpl from)
copy constructor

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)
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

getAlias

public java.lang.String getAlias()
Get alias for this Dataset, if it exists


setAlias

public void setAlias(java.lang.String alias)
Set alias for this Dataset


setCatalog

public void setCatalog(InvCatalog catalog)
Set the containing catalog; use only for top level dataset.


getParentReal

public InvDataset getParentReal()
Get real parent dataset, no proxies

Returns:
parent dataset. If top dataset, return null.

getUrlPath

public java.lang.String getUrlPath()
Get urlPath for this Dataset


setUrlPath

public void setUrlPath(java.lang.String urlPath)
Set the urlPath for this InvDatasetImpl


setAuthority

public void setAuthority(java.lang.String authorityName)
Set authorityName for this Dataset


setCollectionType

public void setCollectionType(CollectionType collectionType)
Set collectionType


setHarvest

public void setHarvest(boolean harvest)
Set harvest


setID

public void setID(java.lang.String id)
Set the ID for this Dataset


setName

public void setName(java.lang.String name)
Set name of this Dataset.


setParent

public void setParent(InvDatasetImpl parent)
Set the parent dataset.


setGeospatialCoverage

public void setGeospatialCoverage(ThreddsMetadata.GeospatialCoverage gc)

setTimeCoverage

public void setTimeCoverage(thredds.datatype.DateRange tc)

setDataType

public void setDataType(DataType dataType)

getDataSize

public double getDataSize()

setDataSize

public void setDataSize(double dataSize)

setServiceName

public void setServiceName(java.lang.String serviceName)

setContributors

public void setContributors(java.util.ArrayList a)

setKeywords

public void setKeywords(java.util.ArrayList a)

setProjects

public void setProjects(java.util.ArrayList a)

setPublishers

public void setPublishers(java.util.ArrayList a)

setResourceControl

public void setResourceControl(java.lang.String resourceControl)

addAccess

public void addAccess(InvAccess a)
Add InvAccess element to this dataset.


addAccess

public void addAccess(java.util.List a)
Add a list of InvAccess elements to this dataset.


getAccessLocal

public java.util.List getAccessLocal()
Get the non-expanded access elements.


getNcmlElement

public org.jdom.Element getNcmlElement()
Get ncml element if it exists, else return null.


setNcmlElement

public void setNcmlElement(org.jdom.Element ncmlElement)

addDataset

public void addDataset(InvDatasetImpl ds)
Add a nested dataset.


addDataset

public void addDataset(int index,
                       InvDatasetImpl ds)
Add a nested dataset at the location indicated by index.


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.


addProperty

public void addProperty(InvProperty p)
Add a property to this dataset


addService

public void addService(InvService service)
Deprecated. put services in catalog

Add a service to this dataset.


removeService

public void removeService(InvService service)
Deprecated. put services in catalog

Remove a service from this dataset.


getServicesLocal

public java.util.List getServicesLocal()
Get services attached specifically to this dataset.

Returns:
List of type InvService. May be empty, but not null.

setServicesLocal

public void setServicesLocal(java.util.ArrayList 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.


setLocalMetadata

public void setLocalMetadata(ThreddsMetadata tm)

getLocalMetadataInheritable

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


getCat6Metadata

public ThreddsMetadata getCat6Metadata()
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 -
Returns:
true if an InvMetadata is removed, false otherwise.

getServiceName

public java.lang.String getServiceName()

getDocumentationLinks

public java.util.List getDocumentationLinks()
get Documentation that are xlinks


getUserProperty

public java.lang.Object getUserProperty(java.lang.Object key)
User properties


setUserProperty

public void setUserProperty(java.lang.Object key,
                            java.lang.Object value)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

writeHtmlDescription

public static void writeHtmlDescription(java.lang.StringBuffer buff,
                                        InvDatasetImpl ds,
                                        boolean complete,
                                        boolean isServer,
                                        boolean datasetEvents,
                                        boolean catrefEvents)
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 java.lang.String resolve(InvDataset ds,
                                       java.lang.String href)
resolve reletive URLS against the catalog URL.

Parameters:
ds - use ds parent catalog, if it exists
href - URL to resolve
Returns:
resolved URL

dump

public java.lang.String dump()
debugging info


equals

public boolean equals(java.lang.Object o)
InvDatasetImpl elements with same values are equal.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Override Object.hashCode() to implement equals.

Overrides:
hashCode in class java.lang.Object

main

public static void main(java.lang.String[] args)
test