|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthredds.cataloggen.CollectionLevelScanner
public class CollectionLevelScanner
CollectionLevelScanner maps between the CrawlableDataset realm and the InvCatalog/InvDataset realm. It scans a single level of a dataset collection and generates a catalog. The generated catalog contains InvCatalogRef objects for all contained collection datasets.
Three different levels of the dataset collection must be provided to to properly map from CrawlableDataset to InvCatalog/InvDataset:
Besides the three CrawlableDatasets that define the collection to be
cataloged, there are a variety of ways to modify or enhance the resulting
catalog. For more details, see the documentation for the various setters
(setCollectionId()
,
setIdentifier()
,
setNamer()
,
setDoAddDataSize()
,
setSorter()
,
setProxyDsHandlers()
,
addChildEnhancer()
.
Here we'll look at the parameters used to construct a CollectionLevelScanner and to generate a catalog for the following request:
http://my.server:8080/thredds/ncep/nam/80km/catalog.xml
In the constuctor, we have:
The two datasets we'll use in the example are:
Following are the details on how the resulting InvDataset and InvCatalogRef objects are created.
<dataset name="20060208_1200_nam80km.grib"/> <catalogRef xlink:title="2000archive"/>
<dataset name="20060208_1200_nam80km.grib" ID="NCEP/nam/80km/20060208_1200_nam80km.grib"/> <catalogRef xlink:title="2000archive" ID="NCEP/nam/80km/2000archive" />where the values were determined as follows:
<dataset name="20060208_1200_nam80km.grib" ID="NCEP/nam/80km/20060208_1200_nam80km.grib" urlPath="ncep/nam/80km/20060208_1200_nam80km.grib" />where the values were determined as follows:
<catalogRef xlink:title="2000archive" xlink:href="2000archive/catalog.xml"/>where the values were determined as follows:
See DatasetScanCatalogBuilder
for more details on how a
THREDDS server config file (catalog.xml) and the contained datasetScan
elements map into CollectionLevelScanner.
Resulting single level catalogs can be used to construct multi-level catalogs by replacing InvCatalogRef objects with the catalogs generated for the corresponding CrawlableDataset objects. Construction of multi-level catalogs is supported in several ways:
NOTE: The StandardCatalogBuilder
class is an example of using
ColletionLevelScanner to construct multi-level catalogs.
Constructor Summary | |
---|---|
CollectionLevelScanner(CollectionLevelScanner cs)
Copy constructor |
|
CollectionLevelScanner(String collectionPath,
CrawlableDataset collectionLevel,
CrawlableDataset catalogLevel,
CrawlableDataset currentLevel,
CrawlableDatasetFilter filter,
InvService service)
Construct a CollectionLevelScanner. |
Method Summary | |
---|---|
void |
addChildEnhancer(DatasetEnhancer childEnhancer)
Add the given DatasetEnhancer to the list that will be applied to each of the child datasets. |
InvCatalogImpl |
generateCatalog()
|
InvCatalogImpl |
generateProxyDsResolverCatalog(ProxyDatasetHandler pdh)
Generate the catalog for a resolver request of the given ProxyDatasetHandler. |
protected String |
getCollectionId()
|
protected String |
getCollectionName()
|
protected boolean |
getDoAddDataSize()
|
protected CrawlableDatasetLabeler |
getIdentifier()
|
protected CrawlableDatasetLabeler |
getNamer()
|
Map |
getProxyDsHandlers()
|
CrawlableDatasetSorter |
getSorter()
|
void |
scan()
Scan the collection and gather information on contained datasets. |
void |
setCollectionId(String collectionId)
Set the value of the base dataset ID. |
void |
setCollectionName(String collectionName)
Set the value of the collection Name. |
void |
setDoAddDataSize(boolean doAddDataSize)
Determines if datasetSize metadata will be added to each InvDataset built during catalog generation. |
void |
setIdentifier(CrawlableDatasetLabeler identifier)
Set the CrawlableDatasetLabeler used to determine the ID of the InvDataset built during catalog generation. |
void |
setNamer(CrawlableDatasetLabeler namer)
Set the CrawlableDatasetLabeler used to determine the name of each InvDataset built during catalog generation. |
void |
setProxyDsHandlers(Map proxyDsHandlers)
|
void |
setSorter(CrawlableDatasetSorter sorter)
Set the sorter with which to sort the list of child CrawlableDatasets. |
void |
setTopLevelMetadataContainer(InvDatasetImpl topLevelMetadataContainer)
Set the InvDatasetImpl that contains the metadata for the top level dataset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionLevelScanner(String collectionPath, CrawlableDataset collectionLevel, CrawlableDataset catalogLevel, CrawlableDataset currentLevel, CrawlableDatasetFilter filter, InvService service)
The collectionLevel and catalogLevel parameters are used to properly determine the dataset urlPath. The catalogLevel must either be the collectionLevel or be a decendent of the collectionLevel. The currentLevel, if not null, must either be the catalogLevel or be a decendent of the catalogLevel.
The currentLevel parameter indicates what level is to be scanned. It is the same as the catalogLevel except for the case when catalogRefs are not used for all collection levels. (The urlPath is still determined as described above. Only the location of the datasets is changed.)
collectionPath
- the path of the collection, used as the base of all resulting dataset@urlPath values (may be "", if null, "" is used).collectionLevel
- the root of the collection to be cataloged (must not be a CrawlableDatasetAlias).catalogLevel
- the location, within the collection, for which a catalog is being generated.currentLevel
- the location, at or below the catalog level, which is to be scanned for datasets. Only necessary when multiple catalogs are to be aggregated. May be null. If null, assumed to be same as catalog level.filter
- determines which CrawlableDatasets are accepted as part of the collection.service
- the default service of all InvDatasets in the generated catalog.
IllegalArgumentException
public CollectionLevelScanner(CollectionLevelScanner cs)
Method Detail |
---|
public CrawlableDatasetSorter getSorter()
public void setSorter(CrawlableDatasetSorter sorter)
sorter
- the CrawlableDatasetSorter that will be used to sort the list of child CrawlableDatasets.public Map getProxyDsHandlers()
public void setProxyDsHandlers(Map proxyDsHandlers)
public void setCollectionId(String collectionId)
collectionId
- protected String getCollectionId()
public void setCollectionName(String collectionName)
collectionName
- protected String getCollectionName()
public void setIdentifier(CrawlableDatasetLabeler identifier)
identifier
- protected CrawlableDatasetLabeler getIdentifier()
public void setNamer(CrawlableDatasetLabeler namer)
namer
- protected CrawlableDatasetLabeler getNamer()
public void setDoAddDataSize(boolean doAddDataSize)
doAddDataSize
- protected boolean getDoAddDataSize()
public void addChildEnhancer(DatasetEnhancer childEnhancer)
childEnhancer
- public void setTopLevelMetadataContainer(InvDatasetImpl topLevelMetadataContainer)
topLevelMetadataContainer
- public void scan() throws IOException
IOException
- if an I/O error occurs while locating the contained datasets.public InvCatalogImpl generateCatalog() throws IOException
IOException
public InvCatalogImpl generateProxyDsResolverCatalog(ProxyDatasetHandler pdh)
pdh
- the ProxyDatasetHandler corresponding to the resolver request.
IllegalStateException
- if this collection has not yet been scanned.
IllegalArgumentException
- if the given ProxyDatasetHandler is not known by this CollectionLevelScanner.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |