Package thredds.catalog
Class InvDatasetImpl
- java.lang.Object
-
- thredds.catalog.InvDataset
-
- 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.- See Also:
InvDataset
-
-
Field Summary
Fields Modifier and Type Field Description protected StringBuilderlogprotected booleanmarkprotected org.jdom2.ElementncmlElementprotected ThreddsMetadatatmprotected ThreddsMetadatatmi-
Fields inherited from class thredds.catalog.InvDataset
access, authorityName, catalog, collectionType, contributors, creators, dataFormatType, datasets, dataType, dates, defaultService, docs, gc, harvest, id, keywords, metadata, name, parent, projects, properties, publishers, restrictAccess, services, tc, variableMapLink, variables
-
-
Constructor Summary
Constructors Constructor Description InvDatasetImpl(String urlPath, ucar.nc2.constants.FeatureType dataType, ServiceType stype)Construct an InvDatasetImpl which refers to a urlPath.InvDatasetImpl(InvDatasetImpl from)copy constructorInvDatasetImpl(InvDatasetImpl parent, String name, ucar.nc2.constants.FeatureType dataType, String serviceName, String urlPath)Constructor from Catalog XML info.InvDatasetImpl(InvDataset parent, String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAccess(List<InvAccess> a)Add a list of InvAccess elements to this dataset.voidaddAccess(InvAccess a)Add InvAccess element to this dataset.voidaddDataset(int index, InvDatasetImpl ds)Add a nested dataset at the location indicated by index.voidaddDataset(InvDatasetImpl ds)Add a nested dataset.voidaddDocumentation(InvDocumentation doc)Add documentation element to this dataset.voidaddProperty(InvProperty p)Add a property to this datasetvoidaddService(InvService service)Deprecated.add services only to catalogprotected voidcanonicalize()Put metadata into canonical form.Stringdump()booleanequals(Object o)InvDatasetImpl elements with same values are equal.booleanfinish()Finish constructing after all elements have been added.List<InvAccess>getAccessLocal()StringgetAlias()doublegetDataSize()ucar.nc2.units.DateTypegetLastModifiedDate()ThreddsMetadatagetLocalMetadata()Get the metadata stored in this dataset element.ThreddsMetadatagetLocalMetadataInheritable()local metadata that should be inherited by this dataset's children.protected booleangetMark()Filteringorg.jdom2.ElementgetNcmlElement()InvDatasetgetParentReal()Get real parent dataset, no proxiesStringgetServiceName()List<InvService>getServicesLocal()Get services attached specifically to this dataset.StringgetUrlPath()Get urlPath for this DatasetObjectgetUserProperty(Object key)Look up the User property having the given keyinthashCode()Override Object.hashCode() to implement equals.booleanremoveDataset(InvDatasetImpl ds)Remove the given dataset element from this dataset if it is in the dataset.booleanremoveLocalMetadata(InvMetadata metadata)Remove the given InvMetadata from the set of metadata local to this dataset.voidremoveService(InvService service)Deprecated.put services in catalogbooleanreplaceDataset(InvDatasetImpl remove, InvDatasetImpl add)Replace the given dataset if it is a nesetd dataset.static Stringresolve(InvDataset ds, String href)resolve reletive URLS against the catalog URL.voidsetAlias(String alias)Set alias for this DatasetvoidsetAuthority(String authorityName)Set authorityName for this DatasetvoidsetCatalog(InvCatalog catalog)Set the containing catalog; use only for top level dataset.voidsetCollectionType(CollectionType collectionType)Set collectionTypevoidsetContributors(List<ThreddsMetadata.Contributor> a)voidsetDataFormatType(DataFormatType dataFormatType)voidsetDataSize(double dataSize)voidsetDataType(ucar.nc2.constants.FeatureType dataType)voidsetGeospatialCoverage(ThreddsMetadata.GeospatialCoverage gc)voidsetHarvest(boolean harvest)Set harvestvoidsetID(String id)Set the ID for this DatasetvoidsetKeywords(List<ThreddsMetadata.Vocab> a)voidsetLastModifiedDate(Date lastModDate)voidsetLastModifiedDate(ucar.nc2.units.DateType lastModDate)voidsetLocalMetadata(ThreddsMetadata tm)protected voidsetMark(boolean mark)voidsetName(String name)Set name of this Dataset.voidsetNcmlElement(org.jdom2.Element ncmlElement)voidsetParent(InvDatasetImpl parent)Set the parent dataset.voidsetProjects(List<ThreddsMetadata.Vocab> a)voidsetPublishers(List<ThreddsMetadata.Source> a)voidsetResourceControl(String restrictAccess)voidsetServiceName(String serviceName)voidsetServicesLocal(List<InvService> s)Set the list of services attached specifically to this dataset.voidsetTimeCoverage(ucar.nc2.time.CalendarDateRange tc)voidsetTimeCoverage(ucar.nc2.units.DateRange tc)voidsetUrlPath(String urlPath)Set the urlPath for this InvDatasetImplvoidsetUserProperty(Object key, Object value)StringtoString()voidtransferMetadata(InvDatasetImpl fromDs, boolean copyInheritedMetadataFromParents)Transfer all inheritable metadata from fromDs to the local metadata of this dataset.static voidwriteHtmlDescription(StringBuilder buff, InvDatasetImpl ds, boolean complete, boolean isServer, boolean datasetEvents, boolean catrefEvents)static voidwriteHtmlDescription(StringBuilder buff, InvDatasetImpl ds, boolean complete, boolean isServer, boolean datasetEvents, boolean catrefEvents, boolean resolveRelativeUrls)Write an Html representation of the given dataset.-
Methods inherited from class thredds.catalog.InvDataset
findAccess, findDatasetByName, findProperty, findService, getAccess, getAccess, getAuthority, getCalendarDateCoverage, getCatalogUrl, getCollectionType, getContributors, getCreators, getDataFormatType, getDatasets, getDataType, getDates, getDocumentation, getDocumentation, getFullName, getGeospatialCoverage, getHistory, getID, getKeywords, getMetadata, getMetadata, getName, getParent, getParentCatalog, getProcessing, getProjects, getProperties, getPublishers, getRestrictAccess, getRights, getServiceDefault, getSubsetUrl, getSummary, getTimeCoverage, getUniqueID, getVariableMapLink, getVariables, getVariables, hasAccess, hasNestedDatasets, isHarvest
-
-
-
-
Field Detail
-
tm
protected ThreddsMetadata tm
-
tmi
protected ThreddsMetadata tmi
-
ncmlElement
protected org.jdom2.Element ncmlElement
-
log
protected StringBuilder log
-
mark
protected boolean mark
-
-
Constructor Detail
-
InvDatasetImpl
public InvDatasetImpl(InvDatasetImpl parent, String name, ucar.nc2.constants.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 datasetname- : display name of datasetdataType- : DataType name (may be null)serviceName- : default service (may be null)urlPath- : URL = server.getURLbase() + urlPath
-
InvDatasetImpl
public InvDatasetImpl(String urlPath, ucar.nc2.constants.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 pathdataType- : data typestype- : ServiceType
-
InvDatasetImpl
public InvDatasetImpl(InvDataset parent, String name)
-
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
-
setGeospatialCoverage
public void setGeospatialCoverage(ThreddsMetadata.GeospatialCoverage gc)
-
setTimeCoverage
public void setTimeCoverage(ucar.nc2.time.CalendarDateRange tc)
-
setTimeCoverage
public void setTimeCoverage(ucar.nc2.units.DateRange tc)
-
setDataFormatType
public void setDataFormatType(DataFormatType dataFormatType)
-
setDataType
public void setDataType(ucar.nc2.constants.FeatureType dataType)
-
getDataSize
public double getDataSize()
-
setDataSize
public void setDataSize(double dataSize)
-
getLastModifiedDate
public ucar.nc2.units.DateType getLastModifiedDate()
-
setLastModifiedDate
public void setLastModifiedDate(ucar.nc2.units.DateType lastModDate)
-
setLastModifiedDate
public void setLastModifiedDate(Date lastModDate)
-
setServiceName
public void setServiceName(String serviceName)
-
setContributors
public void setContributors(List<ThreddsMetadata.Contributor> a)
-
setKeywords
public void setKeywords(List<ThreddsMetadata.Vocab> a)
-
setProjects
public void setProjects(List<ThreddsMetadata.Vocab> a)
-
setPublishers
public void setPublishers(List<ThreddsMetadata.Source> a)
-
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 positionds- 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 removedadd- - 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 catalogAdd a service to this dataset.- Parameters:
service- add this service to the dataset
-
removeService
public void removeService(InvService service)
Deprecated.put services in catalogRemove 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.
-
setLocalMetadata
public void setLocalMetadata(ThreddsMetadata tm)
-
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
-
writeHtmlDescription
public static void writeHtmlDescription(StringBuilder buff, InvDatasetImpl ds, boolean complete, boolean isServer, boolean datasetEvents, boolean catrefEvents)
Deprecated.- Parameters:
buff- ads- acomplete- aisServer- adatasetEvents- acatrefEvents- a
-
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 URLScatrefEvents- if true, prepend "catref:" to any catref URLS
-
resolve
public static String resolve(InvDataset ds, String href)
resolve reletive URLS against the catalog URL.- Parameters:
ds- use ds parent catalog, if it existshref- 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.
-
-