Exemplo n.º 1
0
    /** @param cv */
    private void handleCoverageOfferingBrief(CoverageInfo cv) {
      if (cv.isEnabled()) {
        start("wcs:CoverageOfferingBrief");

        String tmp;

        for (MetadataLinkInfo mdl : cv.getMetadataLinks()) handleMetadataLink(mdl);

        tmp = cv.getDescription();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:description", tmp);
        }

        tmp = cv.getPrefixedName();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:name", tmp);
        }

        tmp = cv.getTitle();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:label", tmp);
        }

        CoverageStoreInfo csinfo = cv.getStore();

        if (csinfo == null) {
          throw new WcsException(
              "Unable to acquire coverage store resource for coverage: " + cv.getName());
        }

        AbstractGridCoverage2DReader reader = null;
        try {
          reader =
              (AbstractGridCoverage2DReader)
                  catalog
                      .getResourcePool()
                      .getGridCoverageReader(csinfo, GeoTools.getDefaultHints());
        } catch (IOException e) {
          LOGGER.severe(
              "Unable to acquire a reader for this coverage with format: "
                  + csinfo.getFormat().getName());
        }

        if (reader == null)
          throw new WcsException(
              "Unable to acquire a reader for this coverage with format: "
                  + csinfo.getFormat().getName());

        DimensionInfo timeInfo = cv.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class);
        ReaderDimensionsAccessor dimensions = new ReaderDimensionsAccessor(reader);
        handleEnvelope(cv.getLatLonBoundingBox(), timeInfo, dimensions);
        handleKeywords(cv.getKeywords());

        end("wcs:CoverageOfferingBrief");
      }
    }
Exemplo n.º 2
0
  @Test
  public void testMetadataLink() throws Exception {
    Catalog catalog = getCatalog();
    CoverageInfo ci = catalog.getCoverageByName(getLayerId(TASMANIA_DEM));
    MetadataLinkInfo ml = catalog.getFactory().createMetadataLink();
    ml.setContent("http://www.geoserver.org/tasmania/dem.xml");
    ml.setAbout("http://www.geoserver.org");
    ci.getMetadataLinks().add(ml);
    catalog.save(ci);

    Document dom = getAsDOM("wcs?request=GetCapabilities");
    // print(dom);
    checkValidationErrors(dom, WCS11_SCHEMA);
    String xpathBase =
        "//wcs:CoverageSummary[wcs:Identifier = '"
            + TASMANIA_DEM.getLocalPart()
            + "']/ows:Metadata";
    assertXpathEvaluatesTo("http://www.geoserver.org", xpathBase + "/@about", dom);
    assertXpathEvaluatesTo("simple", xpathBase + "/@xlink:type", dom);
    assertXpathEvaluatesTo(
        "http://www.geoserver.org/tasmania/dem.xml", xpathBase + "/@xlink:href", dom);
  }