/** * Creates a shallow copy of the given Dimension object * * @param info */ public DimensionInfoImpl(DimensionInfo info) { super(); this.enabled = info.isEnabled(); this.attribute = info.getAttribute(); this.endAttribute = info.getEndAttribute(); this.presentation = info.getPresentation(); this.resolution = info.getResolution(); this.units = info.getUnits(); this.unitSymbol = info.getUnitSymbol(); this.defaultValue = info.getDefaultValue(); this.enabled = info.isEnabled(); }
Set<String> getEnabledDimensionNames(LayerInfo layer) { Set<String> dimensionNames = new HashSet<String>(); for (Map.Entry<String, Serializable> entry : layer.getResource().getMetadata().entrySet()) { String key = entry.getKey(); Serializable md = entry.getValue(); if (md instanceof DimensionInfo) { // skip disabled dimensions DimensionInfo di = (DimensionInfo) md; if (!di.isEnabled()) { continue; } // get the dimension name String dimensionName; if (key.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)) { dimensionName = key.substring(ResourceInfo.CUSTOM_DIMENSION_PREFIX.length()); } else { dimensionName = key; } dimensionNames.add(dimensionName); } } return dimensionNames; }
if (entry.getValue() instanceof DimensionInfo) { DimensionInfo di = (DimensionInfo) entry.getValue(); if (di.isEnabled()) { String dimensionName = entry.getKey(); if (dimensionName.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)) {
if (entry.getValue() instanceof DimensionInfo) { DimensionInfo di = (DimensionInfo) entry.getValue(); if (di.isEnabled()) { String dimensionName = entry.getKey(); if (dimensionName.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)) {
/** * Scan the metadataMap looking for resources related to {@link DimensionInfo} objects and * return a dimensions Map. Return an empty map if no dimensions are found. * * @param metadata */ public static Map<String, DimensionInfo> getDimensionsFromMetadata(MetadataMap metadata) { Map<String, DimensionInfo> dimensionsMap = new HashMap<String, DimensionInfo>(); if (metadata != null && !metadata.isEmpty()) { final Set<String> metadataKeys = metadata.keySet(); final Iterator<String> metadataIterator = metadataKeys.iterator(); // loop over metadata keys while (metadataIterator.hasNext()) { String key = metadataIterator.next(); if (isADimension(key)) { // Check whether the specified metadata is related to an enabled Dimension DimensionInfo dimension = metadata.get(key, DimensionInfo.class); if (dimension != null && dimension.isEnabled()) { if (key.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)) { key = key.substring(ResourceInfo.CUSTOM_DIMENSION_PREFIX.length()); } dimensionsMap.put(key, dimension); } } } } return dimensionsMap; }
private List<DefaultValueConfiguration> filterConfigurations( DefaultValueConfigurations configsBean, ResourceInfo resource) { List<DefaultValueConfiguration> configs = configsBean.getConfigurations(); List<DefaultValueConfiguration> result = new ArrayList<DefaultValueConfiguration>(configs.size()); MetadataMap metadata = resource.getMetadata(); for (DefaultValueConfiguration config : configs) { String key = getDimensionMetadataKey(config.getDimension()); DimensionInfo di = metadata.get(key, DimensionInfo.class); if (di == null) { LOGGER.warning( "Skipping dynamic default configuration for dimension " + config.getDimension() + " as the base dimension configuration is missing"); } else if (!di.isEnabled()) { LOGGER.warning( "Skipping dynamic default configuration for dimension " + config.getDimension() + " as the dimension is not enabled"); } else { result.add(config); } } return result; }
if (timeInfo != null && timeInfo.isEnabled()) { SimpleDateFormat timeFormat = dimensions.getTimeFormat(); element("gml:timePosition", timeFormat.format(dimensions.getMinTime()));
/** * Looks up the elevation configuration, throws an exception if not found * * @param resourceInfo * @param dimensionName */ public DimensionInfo getDimensionInfo(ResourceInfo resourceInfo, String dimensionName) { DimensionInfo info = resourceInfo.getMetadata().get(dimensionName, DimensionInfo.class); if (info == null || !info.isEnabled()) { throw new ServiceException( "Layer " + resourceInfo.prefixedName() + " does not have " + dimensionName + " support enabled"); } return info; }
/** * Returns the default value for time dimension. * * @param resourceInfo */ public Object getDefaultTime(ResourceInfo resourceInfo) { // check the time metadata DimensionInfo time = resourceInfo.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class); if (time == null || !time.isEnabled()) { throw new ServiceException( "Layer " + resourceInfo.prefixedName() + " does not have time support enabled"); } DimensionDefaultValueSelectionStrategy strategy = this.getDefaultValueStrategy(resourceInfo, ResourceInfo.TIME, time); return strategy.getDefaultValue(resourceInfo, ResourceInfo.TIME, time, Date.class); }
if (requestedTimeSubset != null && timeDimension != null && timeDimension.isEnabled()) { checkTimeDomainIntersection(helper, accessor, requestedTimeSubset, timeDimension); if (requestedElevationRange != null && elevationDimension != null && elevationDimension.isEnabled()) { checkElevationDomainIntersection( helper, accessor, requestedElevationRange, elevationDimension);
if (time == null || !time.isEnabled()) { throw new ServiceException( "Layer " + typeInfo.prefixedName() + " does not have time support enabled");
ResourceInfo.CUSTOM_DIMENSION_PREFIX + dimensionName, DimensionInfo.class); if (customDim == null || !customDim.isEnabled()) { throw new ServiceException( "Layer "
/** * Checks if the specified coverage is a valid dataset, e.g., it has the dataset flag enabled * and time dimension, and has a structured grid coverage reader backing it * * @param ci */ public boolean isValidDataset(CoverageInfo ci) { Boolean dataset = ci.getMetadata().get(WCSEOMetadata.DATASET.key, Boolean.class); DimensionInfo time = ci.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class); try { GridCoverageReader reader = ci.getGridCoverageReader(null, GeoTools.getDefaultHints()); boolean structured = reader instanceof StructuredGridCoverage2DReader; return dataset != null && dataset && time != null && time.isEnabled() && structured; } catch (IOException e) { throw new ServiceException( "Failed to locate the grid coverage reader for coverage " + ci.prefixedName()); } }
if (timeInfo != null && timeInfo.isEnabled()) { SimpleDateFormat timeFormat = dimensions.getTimeFormat(); minTime = timeFormat.format(dimensions.getMinTime());
/** * Query and returns the times for the given layer, in the given time range * * @throws IOException */ public TreeSet<Object> queryCoverageTimes( CoverageInfo coverage, DateRange queryRange, int maxAnimationSteps) throws IOException { // grab the time metadata DimensionInfo time = coverage.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class); if (time == null || !time.isEnabled()) { throw new ServiceException( "Layer " + coverage.getPrefixedName() + " does not have time support enabled"); } GridCoverage2DReader reader = null; try { reader = (GridCoverage2DReader) coverage.getGridCoverageReader(null, null); } catch (Throwable t) { throw new ServiceException( "Unable to acquire a reader for this coverage " + coverage.prefixedName(), t); } if (reader == null) { throw new ServiceException( "Unable to acquire a reader for this coverage " + coverage.prefixedName()); } ReaderDimensionsAccessor dimensions = new ReaderDimensionsAccessor(reader); return dimensions.getTimeDomain(queryRange, maxAnimationSteps); }
if (elevation == null || !elevation.isEnabled()) { throw new ServiceException( "Layer "
if (di == null || !di.isEnabled()) { throw new ServiceException( "Layer "
handleGrid(ci); end("wcs:spatialDomain"); if (timeInfo != null && timeInfo.isEnabled()) { handleTemporalDomain(ci, timeInfo, dimensions);
Boolean dataset = ci.getMetadata().get(WCSEOMetadata.DATASET.key, Boolean.class); DimensionInfo time = ci.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class); if (dataset != null && dataset && time != null && time.isEnabled()) { tx.start("wcseo:DatasetSeriesSummary"); ReferencedEnvelope bbox = ci.getLatLonBoundingBox();