* found.
*/
private boolean enableDimensions(CoverageInfo ci) {
boolean timeDimension = false;
boolean customDimension = false;
GridCoverage2DReader reader = null;
try {
// acquire a reader
reader = (GridCoverage2DReader) ci.getGridCoverageReader(null, null);
if (reader == null) {
throw new RuntimeException("Unable to acquire reader for this coverageinfo: "
+ ci.getName());
}
// inspect dimensions
final ReaderDimensionsAccessor ra = new ReaderDimensionsAccessor(reader);
for (String domain : ra.getCustomDomains()) {
if (LOGGER.isLoggable(Level.FINE)) {
boolean hasRange = ra.hasRange(domain);
boolean hasResolution = ra.hasResolution(domain);
LOGGER.fine(ci.getName() + ": found " + domain + " dimension (hasRange: "
+ hasRange + ", hasResolution: " + hasResolution + ")");
}
DimensionInfo dimension = new DimensionInfoImpl();
dimension.setEnabled(true);
dimension.setPresentation(DimensionPresentation.LIST);
ci.getMetadata().put(ResourceInfo.CUSTOM_DIMENSION_PREFIX + domain, dimension);
customDimension = true;
}
String elev = reader.getMetadataValue(GridCoverage2DReader.HAS_ELEVATION_DOMAIN);
if (Boolean.parseBoolean(elev)) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(ci.getName() + ": found ELEVATION dimension");
}
DimensionInfo dimension = new DimensionInfoImpl();
dimension.setEnabled(true);
dimension.setPresentation(DimensionPresentation.LIST);
ci.getMetadata().put(ResourceInfo.ELEVATION, dimension);
customDimension = true;
}
String time = reader.getMetadataValue(GridCoverage2DReader.HAS_TIME_DOMAIN);
if (Boolean.parseBoolean(time)) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(ci.getName() + ": found TIME dimension");
}