DimensionInfo dimension, Class<T> clz) {
Object retval = null;
try {
GridCoverage2DReader reader = (GridCoverage2DReader) ((CoverageInfo) resource)
.getGridCoverageReader(null, null);
ReaderDimensionsAccessor dimAccessor = new ReaderDimensionsAccessor(reader);
if (dimensionName.equals(ResourceInfo.TIME)) {
retval = dimAccessor.getMaxTime();
} else if (dimensionName.equals(ResourceInfo.ELEVATION)) {
retval = dimAccessor.getMaxElevation();
} else if (dimensionName.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)){
String custDimName = dimensionName.substring(ResourceInfo.CUSTOM_DIMENSION_PREFIX.length());
// see if we have an optimize way to get the minimum
String maximum = reader.getMetadataValue(custDimName.toUpperCase()
+ "_DOMAIN_MAXIMUM");
if (maximum != null) {
retval = maximum;
}
else {
// ok, get the full domain then
List<String> domain = dimAccessor.getDomain(custDimName);
if (domain.isEmpty()) {
retval = null;
} else {
//Just a lexical (string) sort.