this.catalog = catalog;
}
@Override
public Object read(Object request, Map kvp, Map rawKvp) throws Exception {
GetCoverageType getCoverage = (GetCoverageType) super.read(request, kvp, rawKvp);
// grab coverage info to perform further checks
if (getCoverage.getSourceCoverage() == null) {
if (kvp.get("coverage") == null)
throw new WcsException("source coverage parameter is mandatory",
MissingParameterValue, "source coverage");
else
getCoverage.setSourceCoverage((String) ((List) kvp.get("coverage")).get(0));
}
// if not specified, throw a resounding exception (by spec)
if (!getCoverage.isSetVersion())
throw new WcsException("Version has not been specified",
WcsExceptionCode.MissingParameterValue, "version");
// do the version negotiation dance
List<String> provided = new ArrayList<String>();
provided.add(Wcs10GetCoverageRequestReader.VERSION);
List<String> accepted = null;
if (getCoverage.getVersion() != null) {
accepted = new ArrayList<String>();
accepted.add(getCoverage.getVersion());
}
String version = RequestUtils.getVersionPreOws(provided, accepted);
if (!Wcs10GetCoverageRequestReader.VERSION.equals(version)) {
throw new WcsException("An invalid version number has been specified",
WcsExceptionCode.InvalidParameterValue, "version");
}
getCoverage.setVersion(Wcs10GetCoverageRequestReader.VERSION);
// build the domain subset
getCoverage.setDomainSubset(parseDomainSubset(kvp));
// build the range subset
getCoverage.setRangeSubset(parseRangeSubset(kvp, getCoverage.getSourceCoverage()));
// build output element
getCoverage.setOutput(parseOutputElement(kvp));
return getCoverage;
}