public Object read(Object request, Map kvp, Map rawKvp) throws Exception { // let super do its thing request = super.read(request, kvp, rawKvp); DescribeCoverageType describeCoverage = (DescribeCoverageType) request; // we need at least one coverage final String identifiersValue = (String) rawKvp.get("identifiers"); final List identifiers = KvpUtils.readFlat(identifiersValue); if(identifiers == null || identifiers.size() == 0) { throw new WcsException("Required paramer, identifiers, missing", WcsExceptionCode.MissingParameterValue, "identifiers"); } // all right, set into the model (note there is a mismatch between the kvp name and the // xml name, that's why we have to parse the identifiers by hand) describeCoverage.getIdentifier().addAll(identifiers); // if not specified, throw a resounding exception (by spec) if(!describeCoverage.isSetVersion()) throw new WcsException("Version has not been specified", WcsExceptionCode.MissingParameterValue, "version"); return request; } }
for (Iterator it = request.getIdentifier().iterator(); it.hasNext(); ) { String coverageId = (String) it.next();
for (Iterator it = request.getIdentifier().iterator(); it.hasNext();) { String coverageId = (String) it.next();
public Object read(Object request, Map kvp, Map rawKvp) throws Exception { // let super do its thing request = super.read(request, kvp, rawKvp); DescribeCoverageType describeCoverage = (DescribeCoverageType) request; // we need at least one coverage final String identifiersValue = (String) rawKvp.get("identifiers"); final List identifiers = KvpUtils.readFlat(identifiersValue); if (identifiers == null || identifiers.size() == 0) { throw new WcsException( "Required paramer, identifiers, missing", WcsExceptionCode.MissingParameterValue, "identifiers"); } // all right, set into the model (note there is a mismatch between the kvp name and the // xml name, that's why we have to parse the identifiers by hand) describeCoverage.getIdentifier().addAll(identifiers); // if not specified, throw a resounding exception (by spec) if (!describeCoverage.isSetVersion()) throw new WcsException( "Version has not been specified", WcsExceptionCode.MissingParameterValue, "version"); return request; } }
@Test public void testWCS11DescribeCoverage() throws Exception { net.opengis.wcs11.DescribeCoverageType dc = Wcs11Factory.eINSTANCE.createDescribeCoverageType(); dc.getIdentifier().add("acme:foo"); dc.getIdentifier().add("acme:bar"); callback.operationDispatched(new Request(), op("DescribeCoverage", "WCS", "1.1.0", dc)); assertEquals("acme:foo", data.getResources().get(0)); assertEquals("acme:bar", data.getResources().get(1)); }
@Test public void testWCS11DescribeCoverage() throws Exception { net.opengis.wcs11.DescribeCoverageType dc = Wcs11Factory.eINSTANCE.createDescribeCoverageType(); dc.getIdentifier().add("acme:foo"); dc.getIdentifier().add("acme:bar"); callback.operationDispatched(new Request(), op("DescribeCoverage", "WCS", "1.1.0", dc)); assertEquals("acme:foo", data.getResources().get(0)); assertEquals("acme:bar", data.getResources().get(1)); }
assertEquals("WCS", cap.getService()); assertEquals("1.1.1", cap.getVersion()); assertEquals(1, cap.getIdentifier().size()); assertEquals("wcs:BlueMarble", cap.getIdentifier().get(0));
@Override protected void qualifyRequest( WorkspaceInfo ws, PublishedInfo l, Operation operation, Request request) { GetCapabilitiesType caps = parameter(operation, GetCapabilitiesType.class); if (caps != null) { return; } DescribeCoverageType dcov = parameter(operation, DescribeCoverageType.class); if (dcov != null) { qualifyLayerNames(dcov.getIdentifier(), ws); return; } GetCoverageType gcov = parameter(operation, GetCoverageType.class); if (gcov != null) { if (gcov.getIdentifier() != null && gcov.getIdentifier().getValue() != null) { gcov.getIdentifier().setValue(qualifyName(gcov.getIdentifier().getValue(), ws)); } } } }