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 returnDatasets, andCollections ofDiscreteFeatures given a singleStringlayer identifier. It also provides a cache ofDiscreteFeatures 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 CatalogueConfigconfigprotected Map<String,Dataset>datasetsprotected LayerNameMapperlayerNameMapper
-
Constructor Summary
Constructors Constructor Description DataCatalogue()DataCatalogue(CatalogueConfig config, LayerNameMapper layerNameMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeDatasetId(String oldId, String newId)Changes a dataset's ID.voiddatasetLoaded(Dataset dataset, Collection<VariableConfig> variables)Called once aDatasetis ready to be made availableCollection<Dataset>getAllDatasets()CatalogueConfiggetConfig()DatasetgetDatasetFromId(String datasetId)Returns aDatasetfrom its IDDatasetConfiggetDatasetInfo(String datasetId)FeatureCatalogue.FeaturesAndMemberNamegetFeaturesForLayer(String layerName, PlottingDomainParams params)Given a singleStringidentifier and a set ofPlottingDomainParams, returns aCollectionofDiscreteFeaturesorg.joda.time.DateTimegetLastUpdateTime()EnhancedVariableMetadatagetLayerMetadata(VariableMetadata variableMetadata)ReturnsEnhancedVariableMetadatagiving for a given layer.voidremoveDataset(String id)Removes a dataset from the catalogue.voidsetCache(CacheInfo cacheConfig)Configures the cache used to store featuresvoidshutdown()
-
-
-
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.DatasetStorageCalled once aDatasetis ready to be made available- Specified by:
datasetLoadedin interfaceCatalogueConfig.DatasetStorage- Parameters:
dataset- TheDatasetwhich is readyvariables- ACollectionofVariableConfigobjects representing the available variables in the givenDataset
-
getLastUpdateTime
public org.joda.time.DateTime getLastUpdateTime()
- Specified by:
getLastUpdateTimein interfaceDatasetCatalogue- Returns:
- The
DateTimeat which thisDatasetCataloguewas last updated
-
getAllDatasets
public Collection<Dataset> getAllDatasets()
- Specified by:
getAllDatasetsin interfaceDatasetCatalogue- Returns:
- All available
Datasets in thisDatasetCatalogue. Will returnnullin cases where this information is not available (e.g. allDatasets are dynamically generated)
-
getDatasetFromId
public Dataset getDatasetFromId(String datasetId)
Description copied from interface:DatasetCatalogueReturns aDatasetfrom its ID- Specified by:
getDatasetFromIdin interfaceDatasetCatalogue- Parameters:
datasetId- The ID of the dataset- Returns:
- The desired dataset, or
nullif 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:DatasetCatalogueReturnsEnhancedVariableMetadatagiving for a given layer. This gives default values for scale range, palette etc., as well as metadata such as title, description, etc.- Specified by:
getLayerMetadatain interfaceDatasetCatalogue- Parameters:
variableMetadata- TheVariableMetadataof 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:FeatureCatalogueGiven a singleStringidentifier and a set ofPlottingDomainParams, returns aCollectionofDiscreteFeatures- Specified by:
getFeaturesForLayerin interfaceFeatureCatalogue- Parameters:
layerName- The name of the layer to extractparams- ThePlottingDomainParamsdescribing the domain to be plotted- Returns:
- A
FeatureCatalogue.FeaturesAndMemberNameobject encapsulating the returnedDiscreteFeatures - Throws:
EdalException- if there is a problem with feature extraction.
-
-