thredds.catalog
Class InvDatasetScan

java.lang.Object
  extended by thredds.catalog.InvDataset
      extended by thredds.catalog.InvDatasetImpl
          extended by thredds.catalog.InvCatalogRef
              extended by thredds.catalog.InvDatasetScan

public class InvDatasetScan
extends InvCatalogRef

Represents server-side information on how to scan a collection of datasets for catalog generation.

Used by the THREDDS Data Server (TDS) to automatically generate catalogs.

Typically built from the information given by a datasetScan element in a TDS config catalog.

Usage notes:

  1. The static methods setContext() and setCatalogServletName() should only be called once per web application instance. For instance, in your HttpServlet implementations init() method.
  2. The method setScanDir() should not be used; it is "public by accident".

Should be thread safe except that the above two usage notes are not enforced.


Field Summary
 
Fields inherited from class thredds.catalog.InvDataset
gc, tc
 
Constructor Summary
InvDatasetScan(InvCatalogImpl catalog, InvDatasetImpl parent, java.lang.String name, java.lang.String path, java.lang.String scanDir, java.lang.String filter, boolean addDatasetSize, java.lang.String addLatest, boolean sortOrderIncreasing, java.lang.String datasetNameMatchPattern, java.lang.String startTimeSubstitutionPattern, java.lang.String duration)
           
InvDatasetScan(InvCatalogImpl catalog, InvDatasetImpl parent, java.lang.String name, java.lang.String path, java.lang.String scanDir, java.lang.String filter, boolean addDatasetSize, java.lang.String addLatest, boolean sortOrderIncreasing, java.lang.String datasetNameMatchPattern, java.lang.String startTimeSubstitutionPattern, java.lang.String duration, long lastModifiedLimit)
          Constructor.
InvDatasetScan(InvDatasetImpl parent, java.lang.String name, java.lang.String path, java.lang.String scanDir, java.lang.String id, InvDatasetScan from)
           
InvDatasetScan(InvDatasetImpl parent, java.lang.String name, java.lang.String path, java.lang.String scanDir, java.lang.String configClassName, java.lang.Object configObj, thredds.crawlabledataset.CrawlableDatasetFilter filter, thredds.crawlabledataset.CrawlableDatasetLabeler identifier, thredds.crawlabledataset.CrawlableDatasetLabeler namer, boolean addDatasetSize, thredds.crawlabledataset.CrawlableDatasetSorter sorter, java.util.Map proxyDatasetHandlers, java.util.List childEnhancerList, thredds.cataloggen.CatalogRefExpander catalogRefExpander)
           
 
Method Summary
 boolean getAddDatasetSize()
           
 thredds.cataloggen.CatalogRefExpander getCatalogRefExpander()
           
 java.util.List getChildEnhancerList()
           
 java.lang.String getCrDsClassName()
           
 java.lang.Object getCrDsConfigObj()
           
 thredds.crawlabledataset.CrawlableDatasetFilter getFilter()
           
 thredds.crawlabledataset.CrawlableDatasetLabeler getIdentifier()
           
 thredds.crawlabledataset.CrawlableDatasetLabeler getNamer()
           
 java.lang.String getPath()
           
 java.util.Map getProxyDatasetHandlers()
           
 java.lang.String getScanDir()
           
 thredds.crawlabledataset.CrawlableDatasetSorter getSorter()
           
 boolean isRead()
          If the referenced catalog has been read
 InvCatalogImpl makeCatalogForDirectory(java.lang.String orgPath, java.net.URI baseURI)
          Try to build a catalog for the given path by scanning the location associated with this InvDatasetScan.
 InvCatalog makeLatestCatalogForDirectory(java.lang.String orgPath, java.net.URI baseURI)
          Deprecated. Instead use makeProxyDsResolver() which provides more general proxy dataset handling.
 InvCatalogImpl makeProxyDsResolverCatalog(java.lang.String path, java.net.URI baseURI)
          Try to build a catalog for the given resolver path by scanning the location associated with this InvDatasetScan.
 thredds.crawlabledataset.CrawlableDataset requestCrawlableDataset(java.lang.String path)
          Return the CrawlableDataset for the given path, null if this InvDatasetScan does not allow (filters out) the requested CrawlableDataset.
static void setCatalogServletName(java.lang.String catServletName)
           
static void setContext(java.lang.String c)
           
 void setScanDir(java.lang.String scanDir)
          Resets the location being scanned (DO NOT USE THIS METHOD, "public by accident").
 java.lang.String translatePathToLocation(java.lang.String path)
           
 
Methods inherited from class thredds.catalog.InvCatalogRef
equals, findDatasetByName, findProperty, findService, finish, getAccess, getAccess, getAlias, getAuthority, getCollectionType, getContributors, getCreators, getDataFormatType, getDatasets, getDataType, getDates, getDocumentation, getDocumentation, getFullName, getGeospatialCoverage, getID, getKeywords, getMetadata, getMetadata, getName, getParent, getProjects, getProperties, getProxyDataset, getPublishers, getServiceDefault, getTimeCoverage, getUniqueID, getURI, getUrlPath, getUserProperty, getVariables, getXlinkHref, hasAccess, hashCode, hasNestedDatasets, isHarvest, readAsynch, release
 
Methods inherited from class thredds.catalog.InvDatasetImpl
addAccess, addAccess, addDataset, addDataset, addDocumentation, addProperty, addService, dump, getAccessLocal, getCat6Metadata, getDataSize, getDocumentationLinks, getLastModifiedDate, getLocalMetadata, getLocalMetadataInheritable, getNcmlElement, getParentReal, getServiceName, getServicesLocal, main, removeDataset, removeLocalMetadata, removeService, replaceDataset, resolve, setAlias, setAuthority, setCatalog, setCollectionType, setContributors, setDataFormatType, setDataSize, setDataType, setGeospatialCoverage, setHarvest, setID, setKeywords, setLastModifiedDate, setLastModifiedDate, setLocalMetadata, setName, setNcmlElement, setParent, setProjects, setPublishers, setResourceControl, setServiceName, setServicesLocal, setTimeCoverage, setUrlPath, setUserProperty, toString, transferMetadata, writeHtmlDescription
 
Methods inherited from class thredds.catalog.InvDataset
findAccess, getCatalogUrl, getHistory, getParentCatalog, getProcessing, getResourceControl, getRights, getSubsetUrl, getSummary, getVariables
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvDatasetScan

public InvDatasetScan(InvDatasetImpl parent,
                      java.lang.String name,
                      java.lang.String path,
                      java.lang.String scanDir,
                      java.lang.String id,
                      InvDatasetScan from)

InvDatasetScan

public InvDatasetScan(InvCatalogImpl catalog,
                      InvDatasetImpl parent,
                      java.lang.String name,
                      java.lang.String path,
                      java.lang.String scanDir,
                      java.lang.String filter,
                      boolean addDatasetSize,
                      java.lang.String addLatest,
                      boolean sortOrderIncreasing,
                      java.lang.String datasetNameMatchPattern,
                      java.lang.String startTimeSubstitutionPattern,
                      java.lang.String duration)

InvDatasetScan

public InvDatasetScan(InvCatalogImpl catalog,
                      InvDatasetImpl parent,
                      java.lang.String name,
                      java.lang.String path,
                      java.lang.String scanDir,
                      java.lang.String filter,
                      boolean addDatasetSize,
                      java.lang.String addLatest,
                      boolean sortOrderIncreasing,
                      java.lang.String datasetNameMatchPattern,
                      java.lang.String startTimeSubstitutionPattern,
                      java.lang.String duration,
                      long lastModifiedLimit)
Constructor.

Parameters:
catalog - containing catalog
parent - parent dataset
name - dataset name
path - url path
scanDir - scan this directory
filter - RegExp match on name
addDatasetSize - add a size element
addLatest - add a latest element
sortOrderIncreasing - sort
datasetNameMatchPattern - dataset naming
startTimeSubstitutionPattern - time range using the file name
duration - time range using the file name
lastModifiedLimit - only use datasets whose lastModified() time is at least this many msecs in the past. Ignore if <= 0

InvDatasetScan

public InvDatasetScan(InvDatasetImpl parent,
                      java.lang.String name,
                      java.lang.String path,
                      java.lang.String scanDir,
                      java.lang.String configClassName,
                      java.lang.Object configObj,
                      thredds.crawlabledataset.CrawlableDatasetFilter filter,
                      thredds.crawlabledataset.CrawlableDatasetLabeler identifier,
                      thredds.crawlabledataset.CrawlableDatasetLabeler namer,
                      boolean addDatasetSize,
                      thredds.crawlabledataset.CrawlableDatasetSorter sorter,
                      java.util.Map proxyDatasetHandlers,
                      java.util.List childEnhancerList,
                      thredds.cataloggen.CatalogRefExpander catalogRefExpander)
Method Detail

setContext

public static void setContext(java.lang.String c)

setCatalogServletName

public static void setCatalogServletName(java.lang.String catServletName)

getPath

public java.lang.String getPath()

getScanDir

public java.lang.String getScanDir()

setScanDir

public void setScanDir(java.lang.String scanDir)
Resets the location being scanned (DO NOT USE THIS METHOD, "public by accident").

Used by DataRootHandler to allow scanning an aliased directory ("content").

Parameters:
scanDir - the scan location.

getCrDsClassName

public java.lang.String getCrDsClassName()

getCrDsConfigObj

public java.lang.Object getCrDsConfigObj()

getFilter

public thredds.crawlabledataset.CrawlableDatasetFilter getFilter()

getIdentifier

public thredds.crawlabledataset.CrawlableDatasetLabeler getIdentifier()

getNamer

public thredds.crawlabledataset.CrawlableDatasetLabeler getNamer()

getSorter

public thredds.crawlabledataset.CrawlableDatasetSorter getSorter()

getProxyDatasetHandlers

public java.util.Map getProxyDatasetHandlers()

getAddDatasetSize

public boolean getAddDatasetSize()

getChildEnhancerList

public java.util.List getChildEnhancerList()

getCatalogRefExpander

public thredds.cataloggen.CatalogRefExpander getCatalogRefExpander()

translatePathToLocation

public java.lang.String translatePathToLocation(java.lang.String path)

requestCrawlableDataset

public thredds.crawlabledataset.CrawlableDataset requestCrawlableDataset(java.lang.String path)
                                                                  throws java.io.IOException
Return the CrawlableDataset for the given path, null if this InvDatasetScan does not allow (filters out) the requested CrawlableDataset.

This method can handle requests for regular datasets and proxy datasets.

Parameters:
path - the path of the requested CrawlableDataset
Returns:
the CrawlableDataset for the given path or null if the path is not allowed by this InvDatasetScan.
Throws:
java.io.IOException - if an I/O error occurs while locating the children datasets.
java.lang.IllegalArgumentException - if the given path is not a descendant of (or the same as) this InvDatasetScan collection level.

makeCatalogForDirectory

public InvCatalogImpl makeCatalogForDirectory(java.lang.String orgPath,
                                              java.net.URI baseURI)
Try to build a catalog for the given path by scanning the location associated with this InvDatasetScan. The given path must start with the path of this InvDatasetScan.

Parameters:
orgPath - the part of the baseURI that is the path
baseURI - the base URL for the catalog, used to resolve relative URLs.
Returns:
the catalog for this path (uses version 1.1) or null if build unsuccessful.

makeProxyDsResolverCatalog

public InvCatalogImpl makeProxyDsResolverCatalog(java.lang.String path,
                                                 java.net.URI baseURI)
Try to build a catalog for the given resolver path by scanning the location associated with this InvDatasetScan. The given path must start with the path of this InvDatasetScan and refer to a resolver ProxyDatasetHandler that is part of this InvDatasetScan.

Parameters:
path - the part of the baseURI that is the path
baseURI - the base URL for the catalog, used to resolve relative URLs.
Returns:
the resolver catalog for this path (uses version 1.1) or null if build unsuccessful.

makeLatestCatalogForDirectory

public InvCatalog makeLatestCatalogForDirectory(java.lang.String orgPath,
                                                java.net.URI baseURI)
Deprecated. Instead use makeProxyDsResolver() which provides more general proxy dataset handling.

Try to build a catalog for the given path by scanning the location associated with this InvDatasetScan. The given path must start with the path of this InvDatasetScan.

Parameters:
orgPath - the part of the baseURI that is the path
baseURI - the base URL for the catalog, used to resolve relative URLs.
Returns:
the catalog for this path (uses version 1.1) or null if build unsuccessful.

isRead

public boolean isRead()
Description copied from class: InvCatalogRef
If the referenced catalog has been read

Overrides:
isRead in class InvCatalogRef