thredds.catalog
Class InvCatalog

java.lang.Object
  extended by thredds.catalog.InvCatalog
Direct Known Subclasses:
InvCatalogImpl

public abstract class InvCatalog
extends java.lang.Object

Public interface to a thredds catalog, a virtual directory of datasets. A catalog consists of nested collections of InvDatasets.

Version:
$Revision: 48 $ $Date: 2006-07-12 16:15:40Z $
Author:
john caron

Field Summary
protected  java.net.URI baseURI
           
protected  java.util.ArrayList datasets
           
protected  java.util.HashMap dsHash
           
protected  DateType expires
           
protected  java.lang.String name
           
protected  java.util.ArrayList properties
           
protected  java.util.HashMap serviceHash
           
protected  java.util.ArrayList services
           
protected  InvDatasetImpl topDataset
           
protected  java.lang.String version
           
 
Constructor Summary
protected InvCatalog()
          Protected constructor.
 
Method Summary
 boolean check(java.lang.StringBuffer out)
          Check internal data structures.
abstract  boolean check(java.lang.StringBuffer out, boolean show)
          Check internal data structures.
abstract  void filter(DatasetFilter filter)
          Munge this catalog to remove any dataset that doesnt pass through the filter.
 InvDataset findDatasetByID(java.lang.String id)
          Find a contained dataset by its ID.
 java.lang.String findProperty(java.lang.String name)
          Find named property.
 InvService findService(java.lang.String name)
          Find the named service declared in the top level of this catalog.
 InvDataset getDataset()
          Deprecated. use getDatasets()
 java.util.List getDatasets()
          Get top-level datasets.
 DateType getExpires()
          Get date catalog expires, or null if none given.
 java.lang.String getName()
          Get the name of the catalog
 java.util.List getProperties()
          Get catalog properties.
 java.util.List getServices()
          Get top-level services.
 java.lang.String getUriString()
          Get the base URI as a String
 java.lang.String getVersion()
          Get the version of the catalog
 java.net.URI resolveUri(java.lang.String uriString)
          Resolve reletive URIs, using the catalog's base URI.
 void setName(java.lang.String name)
          Used by TDR
abstract  void subset(InvDataset dataset)
          Munge this catalog so the given dataset is the top catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

version

protected java.lang.String version

baseURI

protected java.net.URI baseURI

topDataset

protected InvDatasetImpl topDataset

dsHash

protected java.util.HashMap dsHash

serviceHash

protected java.util.HashMap serviceHash

services

protected java.util.ArrayList services

properties

protected java.util.ArrayList properties

datasets

protected java.util.ArrayList datasets

expires

protected DateType expires
Constructor Detail

InvCatalog

protected InvCatalog()
Protected constructor.

Method Detail

getName

public java.lang.String getName()
Get the name of the catalog


setName

public void setName(java.lang.String name)
Used by TDR


getVersion

public java.lang.String getVersion()
Get the version of the catalog


getDataset

public InvDataset getDataset()
Deprecated. use getDatasets()

Get top-level dataset.

Returns:
top-level InvDataset. May not be null.

findDatasetByID

public InvDataset findDatasetByID(java.lang.String id)
Find a contained dataset by its ID.

Parameters:
id - : dataset ID
Returns:
InvDataset or null if not found.

getDatasets

public java.util.List getDatasets()
Get top-level datasets.

Returns:
List of InvDataset. May be empty, may not be null.

getServices

public java.util.List getServices()
Get top-level services.

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

getProperties

public java.util.List getProperties()
Get catalog properties.

Returns:
List of InvProperty. May be empty, may not be null.

findProperty

public java.lang.String findProperty(java.lang.String name)
Find named property.

Returns:
string value of property or null if not exist.

getExpires

public DateType getExpires()
Get date catalog expires, or null if none given.


findService

public InvService findService(java.lang.String name)
Find the named service declared in the top level of this catalog.

Returns:
service that matches the given name, or null if none found.

resolveUri

public java.net.URI resolveUri(java.lang.String uriString)
                        throws java.net.URISyntaxException
Resolve reletive URIs, using the catalog's base URI. If the uriString is not reletive, then no resolution is done. This also allows baseURI to be a file: scheme.

Parameters:
uriString - any uri, reletive or absolute
Returns:
resolved uri string, or null on error
Throws:
java.net.URISyntaxException - if uriString violates RFC 2396
See Also:
URI.resolve(java.net.URI)

getUriString

public java.lang.String getUriString()
Get the base URI as a String


check

public abstract boolean check(java.lang.StringBuffer out,
                              boolean show)
Check internal data structures.

Parameters:
out - : print errors here
show - : print messages for each object (debug)
Returns:
true if no fatal consistency errors.

check

public boolean check(java.lang.StringBuffer out)
Check internal data structures.

Parameters:
out - : print errors here
Returns:
true if no fatal consistency errors.

subset

public abstract void subset(InvDataset dataset)
Munge this catalog so the given dataset is the top catalog.

Parameters:
dataset - make this top; must be existing dataset in this catalog.

filter

public abstract void filter(DatasetFilter filter)
Munge this catalog to remove any dataset that doesnt pass through the filter.

Parameters:
filter - remove datasets that dont pass this filter.