Package uk.ac.rdg.resc.edal.catalogue
Class DataCatalogue
- java.lang.Object
-
- uk.ac.rdg.resc.edal.catalogue.DataCatalogue
-
- All Implemented Interfaces:
CatalogueConfig.DatasetStorage
,DatasetCatalogue
,FeatureCatalogue
public class DataCatalogue extends Object implements DatasetCatalogue, CatalogueConfig.DatasetStorage, FeatureCatalogue
A catalogues which implementsDatasetCatalogue
,CatalogueConfig.DatasetStorage
, andFeatureCatalogue
. Given aCacheConfiguration
, this is able to returnDataset
s, andCollection
s ofDiscreteFeature
s given a singleString
layer identifier. It also provides a cache ofDiscreteFeature
s for speed.- Author:
- Guy Griffiths
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface uk.ac.rdg.resc.edal.graphics.utils.FeatureCatalogue
FeatureCatalogue.FeaturesAndMemberName
-
-
Field Summary
Fields Modifier and Type Field Description protected CatalogueConfig
config
protected Map<String,Dataset>
datasets
protected LayerNameMapper
layerNameMapper
-
Constructor Summary
Constructors Constructor Description DataCatalogue()
DataCatalogue(CatalogueConfig config, LayerNameMapper layerNameMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeDatasetId(String oldId, String newId)
Changes a dataset's ID.void
datasetLoaded(Dataset dataset, Collection<VariableConfig> variables)
Called once aDataset
is ready to be made availableCollection<Dataset>
getAllDatasets()
CatalogueConfig
getConfig()
Dataset
getDatasetFromId(String datasetId)
Returns aDataset
from its IDDatasetConfig
getDatasetInfo(String datasetId)
FeatureCatalogue.FeaturesAndMemberName
getFeaturesForLayer(String layerName, PlottingDomainParams params)
Given a singleString
identifier and a set ofPlottingDomainParams
, returns aCollection
ofDiscreteFeature
sorg.joda.time.DateTime
getLastUpdateTime()
EnhancedVariableMetadata
getLayerMetadata(VariableMetadata variableMetadata)
ReturnsEnhancedVariableMetadata
giving for a given layer.void
removeDataset(String id)
Removes a dataset from the catalogue.void
setCache(CacheInfo cacheConfig)
Configures the cache used to store featuresvoid
shutdown()
-
-
-
Field Detail
-
config
protected final CatalogueConfig config
-
layerNameMapper
protected final LayerNameMapper layerNameMapper
-
-
Constructor Detail
-
DataCatalogue
public DataCatalogue()
-
DataCatalogue
public DataCatalogue(CatalogueConfig config, LayerNameMapper layerNameMapper) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getConfig
public CatalogueConfig getConfig()
-
shutdown
public void shutdown()
-
setCache
public void setCache(CacheInfo cacheConfig)
Configures the cache used to store features- Parameters:
cacheConfig
- The (new) configuration to use for the cache. Must not benull
-
removeDataset
public void removeDataset(String id)
Removes a dataset from the catalogue. This will also delete any config information about the dataset from the config file.- Parameters:
id
- The ID of the dataset to remove
-
changeDatasetId
public void changeDatasetId(String oldId, String newId)
Changes a dataset's ID. This will also change the name in the saved config file.- Parameters:
oldId
- The old IDnewId
- The new ID
-
datasetLoaded
public void datasetLoaded(Dataset dataset, Collection<VariableConfig> variables)
Description copied from interface:CatalogueConfig.DatasetStorage
Called once aDataset
is ready to be made available- Specified by:
datasetLoaded
in interfaceCatalogueConfig.DatasetStorage
- Parameters:
dataset
- TheDataset
which is readyvariables
- ACollection
ofVariableConfig
objects representing the available variables in the givenDataset
-
getLastUpdateTime
public org.joda.time.DateTime getLastUpdateTime()
- Specified by:
getLastUpdateTime
in interfaceDatasetCatalogue
- Returns:
- The
DateTime
at which thisDatasetCatalogue
was last updated
-
getAllDatasets
public Collection<Dataset> getAllDatasets()
- Specified by:
getAllDatasets
in interfaceDatasetCatalogue
- Returns:
- All available
Dataset
s in thisDatasetCatalogue
. Will returnnull
in cases where this information is not available (e.g. allDataset
s are dynamically generated)
-
getDatasetFromId
public Dataset getDatasetFromId(String datasetId)
Description copied from interface:DatasetCatalogue
Returns aDataset
from its ID- Specified by:
getDatasetFromId
in interfaceDatasetCatalogue
- Parameters:
datasetId
- The ID of the dataset- Returns:
- The desired dataset, or
null
if it doesn't exist in the catalogue
-
getDatasetInfo
public DatasetConfig getDatasetInfo(String datasetId)
-
getLayerMetadata
public EnhancedVariableMetadata getLayerMetadata(VariableMetadata variableMetadata) throws EdalLayerNotFoundException
Description copied from interface:DatasetCatalogue
ReturnsEnhancedVariableMetadata
giving for a given layer. This gives default values for scale range, palette etc., as well as metadata such as title, description, etc.- Specified by:
getLayerMetadata
in interfaceDatasetCatalogue
- Parameters:
variableMetadata
- TheVariableMetadata
of the desired layer- Returns:
- Default metadata values for the desired layer
- Throws:
EdalLayerNotFoundException
-
getFeaturesForLayer
public FeatureCatalogue.FeaturesAndMemberName getFeaturesForLayer(String layerName, PlottingDomainParams params) throws EdalException
Description copied from interface:FeatureCatalogue
Given a singleString
identifier and a set ofPlottingDomainParams
, returns aCollection
ofDiscreteFeature
s- Specified by:
getFeaturesForLayer
in interfaceFeatureCatalogue
- Parameters:
layerName
- The name of the layer to extractparams
- ThePlottingDomainParams
describing the domain to be plotted- Returns:
- A
FeatureCatalogue.FeaturesAndMemberName
object encapsulating the returnedDiscreteFeature
s - Throws:
EdalException
- if there is a problem with feature extraction.
-
-