attributes.addAttribute("", "version", "version", "", CUR_VERSION); start("Service", attributes); handleMetadataLink(wcs.getMetadataLink()); element("description", wcs.getAbstract()); element("name", wcs.getName()); element("label", wcs.getTitle()); handleKeywords(wcs.getKeywords()); handleContact(wcs); String fees = wcs.getFees(); String accessConstraints = wcs.getAccessConstraints();
private final String generateCoverages(DescribeRequest wcsRequest) throws WcsException { List requestedTypes = wcsRequest.getCoverages(); // Initialize return information and intermediate return objects StringBuffer tempResponse = new StringBuffer(); // ComplexType table = new ComplexType(); if (requestedTypes.size() == 0) { // if there are no specific requested types then get all. requestedTypes = new ArrayList(wcsRequest.getWCS().getData().getCoverageInfos().keySet()); } tempResponse.append("<?xml version=\"1.0\" encoding=\"") .append(wcs.getCharSet().name()).append("\"?>") .append("\n<CoverageDescription version=").append(CURR_VER).append(" ") .toString(); tempResponse.append(WCS_NAMESPACE); tempResponse.append(XLINK_NAMESPACE); tempResponse.append(OGC_NAMESPACE); tempResponse.append(GML_NAMESPACE); tempResponse.append(XSI_NAMESPACE); /*tempResponse.append(" xsi:schemaLocation=\"").append(WCS_URL).append( " ").append(request.getSchemaBaseUrl()).append( "wcs/1.0.0/describeCoverage.xsd\">\n\n");*/ tempResponse.append(" xsi:schemaLocation=\"").append(WCS_URL).append(" ") .append("http://schemas.opengis.net/wcs/1.0.0/") .append("describeCoverage.xsd\">\n\n"); tempResponse.append(generateSpecifiedCoverages(requestedTypes, wcsRequest.getWCS())); tempResponse.append(FOOTER); return tempResponse.toString(); }
/** * Convenience method for obtaining the global geoserver instance. */ public GeoServer getGeoServer() { GeoServer gs = getWCS().getGeoServer(); return gs; } }
/** * Handles the service identification of the capabilities document. * * @param config * The OGC service to transform. * * @throws SAXException * For any errors. */ private void handleServiceIdentification() { start("ows:ServiceIdentification"); element("ows:Title", wcs.getTitle()); element("ows:Abstract", wcs.getAbstract()); handleKeywords(wcs.getKeywords()); element("ows:ServiceType", "WCS"); element("ows:ServiceTypeVersion", "1.1.0"); element("ows:ServiceTypeVersion", "1.1.1"); String fees = wcs.getFees(); if ((fees == null) || "".equals(fees)) { fees = "NONE"; } element("ows:Fees", fees); String accessConstraints = wcs.getAccessConstraints(); if ((accessConstraints == null) || "".equals(accessConstraints)) { accessConstraints = "NONE"; } element("ows:AccessConstraints", accessConstraints); end("ows:ServiceIdentification"); }
public void writeTo(OutputStream out) throws WcsException { try { final Charset encoding = wcs.getCharSet(); Writer writer = new OutputStreamWriter(out, encoding); writer.write(xmlResponse); writer.flush(); } catch (IOException ex) { throw new WcsException(ex, "", getClass().getName()); } }
private String generateSpecifiedCoverages(List requestedTypes, WCS gs) throws WcsException { String tempResponse = new String(); String curCoverageName = new String(); final int length = requestedTypes.size(); CoverageInfo meta; for (int i = 0; i < length; i++) { curCoverageName = requestedTypes.get(i).toString(); meta = gs.getData().getCoverageInfo(curCoverageName); if (meta == null) { throw new WcsException(new StringBuffer("Coverage ").append(curCoverageName) .append(" does ") .append("not exist on this server") .toString()); } tempResponse = tempResponse + printElement(meta); } tempResponse = tempResponse + "\n\n"; return tempResponse; }
/** * Handles the printing of the exceptions information, prints the * formats that GeoServer can return exceptions in. * * @param config * The wms service global config. * * @throws SAXException * For any problems. */ private void handleExceptions(WCS config) { start("Exception"); final String[] formats = config.getExceptionFormats(); final int length = formats.length; for (int i = 0; i < length; i++) { element("Format", formats[i]); } end("Exception"); }
public DescribeCoverageTransformer describeCoverage(DescribeCoverageType request) { final String version = request.getVersion(); if ("1.1.0".equals(version) || "1.1.1".equals(version)) { DescribeCoverageTransformer describeTransformer = new DescribeCoverageTransformer(wcs, catalog); describeTransformer.setEncoding(wcs.getCharSet()); return describeTransformer; } throw new WcsException("Could not understand version:" + version); }
private void handleContentMetadata(WCS config) { AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "version", "version", "", CUR_VERSION); start("ContentMetadata", attributes); List coverages = new ArrayList(config.getData().getCoverageInfos().values()); Collections.sort(coverages, new CoverageInfoLabelComparator()); for (Iterator i = coverages.iterator(); i.hasNext();) { handleCoverageOfferingBrief(config, (CoverageInfo) i.next()); } end("ContentMetadata"); }
public void execute(Request req) throws WcsException { WCSRequest request = (WCSRequest) req; if (!(request instanceof DescribeRequest)) { throw new WcsException(new StringBuffer( "illegal request type, expected DescribeRequest, got ").append(request) .toString()); } DescribeRequest wcsRequest = (DescribeRequest) request; this.request = wcsRequest; LOGGER.finer("processing describe request" + wcsRequest); String outputFormat = wcsRequest.getOutputFormat(); if (!outputFormat.equalsIgnoreCase("XMLSCHEMA")) { throw new WcsException(new StringBuffer("output format: ").append(outputFormat) .append(" not ") .append("supported by geoserver") .toString()); } // generates response, using general function xmlResponse = generateCoverages(wcsRequest); if (!request.getWCS().getGeoServer().isVerbose()) { xmlResponse = xmlResponse.replaceAll(">\n[ \\t\\n]*", ">"); xmlResponse = xmlResponse.replaceAll("\n[ \\t\\n]*", " "); } }
public WCSCapsTransformer getCapabilities(GetCapabilitiesType request) { // do the version negotiation dance List<String> provided = new ArrayList<String>(); // provided.add("1.0.0"); provided.add("1.1.0"); provided.add("1.1.1"); List<String> accepted = null; if (request.getAcceptVersions() != null) accepted = request.getAcceptVersions().getVersion(); String version = RequestUtils.getVersionOws11(provided, accepted); // TODO: add support for 1.0.0 in here if ("1.1.0".equals(version) || "1.1.1".equals(version)) { WCSCapsTransformer capsTransformer = new WCSCapsTransformer(wcs, catalog); capsTransformer.setEncoding(wcs.getCharSet()); return capsTransformer; } throw new WcsException("Could not understand version:" + version); }
private void handleContents() { start("wcs:Contents"); List coverages = new ArrayList(wcs.getData().getCoverageInfos().values()); Collections.sort(coverages, new CoverageInfoLabelComparator()); for (Iterator i = coverages.iterator(); i.hasNext();) { CoverageInfo cv = (CoverageInfo) i.next(); if (cv.isEnabled()) handleCoverageSummary(cv); } end("wcs:Contents"); }
.getGeoServer().getProxyBaseUrl()) + "schemas/wcs/1.0.0/wcsCapabilities.xsd"; attributes.addAttribute("", "updateSequence", "updateSequence", "", wcs.getGeoServer().getUpdateSequence() + ""); start("WCS_Capabilities", attributes);
final Charset encoding = wcsConfig.getCharSet(); transformer.setEncoding(encoding);
"for this Coverage", WcsExceptionCode.InvalidParameterValue, "format"); final Data catalog = request.getWCS().getData(); CoverageInfo meta = null; GridCoverage coverage = null;
.getGeoServer().getProxyBaseUrl()); final String locationDef = WCS_URI + " " + proxifiedBaseUrl + "schemas/wcs/1.1.1/wcsCoverages.xsd";
/** * Handles the service provider of the capabilities document. * * @param config * The OGC service to transform. * * @throws SAXException * For any errors. */ private void handleServiceProvider() { start("ows:ServiceProvider"); element("ows:ProviderName", wcs.getGeoServer().getContactOrganization()); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "xlink:href", "xlink:href", "", wcs.getGeoServer() .getOnlineResource()); element("ows:ProviderSite", null, attributes); handleContact(); end("ows:ServiceProvider"); }
.getGeoServer().getProxyBaseUrl()); final String locationDef = WCS_URI + " " + proxifiedBaseUrl + "schemas/wcs/1.1.1/wcsDescribeCoverage.xsd";
final int updateSequence = wcs.getGeoServer().getUpdateSequence(); int requestedUpdateSequence = -1; if (request.getUpdateSequence() != null) { .getGeoServer().getProxyBaseUrl()); final String locationDef = WCS_URI + " " + proxifiedBaseUrl + "schemas/wcs/1.1.1/wcsGetCapabilities.xsd";
final String proxifiedBaseUrl = RequestUtils.proxifiedBaseURL(request.getBaseUrl(), wcs.getGeoServer().getProxyBaseUrl()); final String coverageLocation = proxifiedBaseUrl + "temp/wcs/" + coverageFile.getName();