/** * reads a deegree WCS configuration file and performs a DescribeCoverage request Steps: * * <ul> * <li>read configuration file * <li>read a DescribeCoverage request object * <li>perform the request * </ul> */ public void _testDescribeCoverage() { try { WCSConfiguration configuration = WCSConfiguration.create(Configuration.getWCSConfigurationURL()); WCService service = new WCService(configuration); Map<String, String> map = new HashMap<String, String>(); map.put("SERVICE", "WCS"); map.put("REQUEST", "DescribeCoverage"); map.put("VERSION", "1.0.0"); map.put("COVERAGE", "europe"); // StringBuffer sb = new StringBuffer(); // sb.append(Configuration.PROTOCOL + "://" + Configuration.HOST).append(':').append( // Configuration.PORT).append('/').append(Configuration.WCS_WEB_CONTEXT).append( // '/').append(Configuration.WCS_SERVLET).append("?service=WCS&").append( // "request=DescribeCoverage&version=1.0.0&coverage=europe"); DescribeCoverage desc = DescribeCoverage.create(map); CoverageDescription o = (CoverageDescription) service.doService(desc); LOG.logInfo(Arrays.toString(o.getCoverageOfferings())); } catch (Exception e) { fail(StringTools.stackTraceToString(e)); } }
/** * validates the passed <tt>DescribeCoverage</tt> against the passed <tt>WCSCapabilities</tt> * * @param capabilities * @param request * @throws InvalidParameterValueException */ private static void validate(WCSCapabilities capabilities, DescribeCoverage request) throws InvalidParameterValueException { String[] coverages = request.getCoverages(); if (coverages != null) { ContentMetadata cm = capabilities.getContentMetadata(); for (int i = 0; i < coverages.length; i++) { if (cm.getCoverageOfferingBrief(coverages[i]) == null) { throw new InvalidParameterValueException( "Coverage: " + coverages[i] + "is not known by the WCS"); } } } }