Package org.vfny.geoserver.wcs

Examples of org.vfny.geoserver.wcs.WcsException


                String coverageId = (String) it.next();

                // check the coverage is known
                LayerInfo layer = catalog.getLayerByName(coverageId);
        if (layer == null || layer.getType() != LayerInfo.Type.RASTER) {
                    throw new WcsException("Could not find the specified coverage: "
                            + coverageId, WcsExceptionCode.InvalidParameterValue, "identifiers");
                }

                CoverageInfo ci = catalog.getCoverageByName(coverageId);
                try {
View Full Code Here


            adapter.setContentHandler(contentHandler);
            adapter.parse(requestSource);
            LOGGER.finer("just parsed: " + requestSource);
        } catch (SAXException e) {
            throw new WcsException(e, "XML describe request parsing error", getClass().getName());
        } catch (IOException e) {
            throw new WcsException(e, "XML describe request input error", getClass().getName());
        } catch (ParserConfigurationException e) {
            throw new WcsException(e, "Some sort of issue creating parser", getClass().getName());
        }

        LOGGER.finer("about to return ");
        LOGGER.finer("returning " + contentHandler.getRequest(req));

        Request r = contentHandler.getRequest(req);

        if (r.getService() != null) {
            final String service = r.getService();

            if (!service.trim().toUpperCase().startsWith("WCS")) {
                throw new WcsException("SERVICE parameter is wrong.");
            }
        } else {
            throw new WcsException("SERVICE parameter is mandatory.");
        }

        if (r.getVersion() != null) {
            final String version = r.getVersion();

            if (!version.equals("1.0.0")) {
                throw new WcsException("VERSION parameter is wrong.");
            }
        } else {
            throw new WcsException("VERSION parameter is mandatory.");
        }

        if (r.getRequest() != null) {
            final String requestType = r.getRequest();

            if (!requestType.equalsIgnoreCase("DescribeCoverage")) {
                throw new WcsException("REQUEST parameter is wrong.");
            }
        } else {
            throw new WcsException("REQUEST parameter is mandatory.");
        }

        return r;
    }
View Full Code Here

      ParserAdapter adapter = new ParserAdapter(parser.getParser());
      adapter.setContentHandler(currentRequest);
      adapter.parse(requestSource);
      LOGGER.fine("just parsed: " + requestSource);
    } catch (SAXException e) {
      throw new WcsException(e, "XML capabilities request parsing error",
          getClass().getName());
    } catch (IOException e) {
      throw new WcsException(e, "XML capabilities request input error",
          getClass().getName());
    } catch (ParserConfigurationException e) {
      throw new WcsException(e, "Some sort of issue creating parser",
          getClass().getName());
    }

    Request r = currentRequest.getRequest(req);

    if (r.getService() != null) {
      final String service = r.getService();

      if (!service.trim().toUpperCase().startsWith("WCS")) {
        throw new WcsException("SERVICE parameter is wrong.");
      }
    } else {
      throw new WcsException("SERVICE parameter is mandatory.");
    }

    if (r.getVersion() != null) {
      final String version = r.getVersion();

      if (!version.equals("1.0.0")) {
        throw new WcsException("VERSION parameter is wrong.");
      }
    } else {
      throw new WcsException("VERSION parameter is mandatory.");
    }

    /*
     * if (r.getRequest() != null) { final String requestType =
     * r.getRequest(); if (!requestType.equalsIgnoreCase("GetCapabilities")
View Full Code Here

            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.fine("just parsed: " + requestSource);
            }
        } catch (SAXException e) {
            throw new WcsException(e, "XML getCoverage request SAX parsing error",
                XmlRequestReader.class.getName());
        } catch (IOException e) {
            throw new WcsException(e, "XML get coverage request input error",
                XmlRequestReader.class.getName());
        } catch (ParserConfigurationException e) {
            throw new WcsException(e, "Some sort of issue creating parser",
                XmlRequestReader.class.getName());
        }

        Request r = contentHandler.getRequest(req);

        if (r.getService() != null) {
            final String service = r.getService();

            if (!service.trim().toUpperCase().startsWith("WCS")) {
                throw new WcsException("SERVICE parameter is wrong.");
            }
        } else {
            throw new WcsException("SERVICE parameter is mandatory.");
        }

        if (r.getVersion() != null) {
            final String version = r.getVersion();

            if (!version.equals("1.0.0")) {
                throw new WcsException("VERSION parameter is wrong.");
            }
        } else {
            throw new WcsException("VERSION parameter is mandatory.");
        }

        if (r.getRequest() != null) {
            final String requestType = r.getRequest();

            if (!requestType.equalsIgnoreCase("GetCoverage")) {
                throw new WcsException("REQUEST parameter is wrong.");
            }
        } else {
            throw new WcsException("REQUEST parameter is mandatory.");
        }

        return r;
    }
View Full Code Here

            final String service = getValue("SERVICE");

            if (service.trim().toUpperCase().startsWith("WCS")) {
                currentRequest.setService(service);
            } else {
                throw new WcsException("SERVICE parameter is wrong.");
            }
        } else {
            throw new WcsException("SERVICE parameter is mandatory.");
        }

        if (keyExists("VERSION")) {
            final String version = getValue("VERSION");

            if (version.equals("1.0.0")) {
                currentRequest.setVersion(version);
            } else {
                throw new WcsException("VERSION parameter is wrong.");
            }
        } else {
            throw new WcsException("VERSION parameter is mandatory.");
        }

        if (keyExists("REQUEST")) {
            final String requestType = getValue("REQUEST");

            if (requestType.equalsIgnoreCase("DescribeCoverage")) {
                currentRequest.setRequest(requestType);
            } else {
                throw new WcsException("REQUEST parameter is wrong.");
            }
        } else {
            throw new WcsException("REQUEST parameter is mandatory.");
        }

        currentRequest.setHttpServletRequest(request);
        currentRequest.setVersion(getValue("VERSION"));
        currentRequest.setRequest(getValue("REQUEST"));
View Full Code Here

            final String service = getValue("SERVICE");

            if (service.trim().toUpperCase().startsWith("WCS")) {
                currentRequest.setService(service);
            } else {
                throw new WcsException("SERVICE parameter is wrong.");
            }

            parameters.remove("SERVICE");
        } else {
            throw new WcsException("SERVICE parameter is mandatory.");
        }

        if (keyExists("VERSION")) {
            final String version = getValue("VERSION");

            if (version.equals("1.0.0")) {
                currentRequest.setVersion(version);
            } else {
                throw new WcsException("VERSION parameter is wrong.");
            }

            parameters.remove("VERSION");
        } else {
            throw new WcsException("VERSION parameter is mandatory.");
        }

        if (keyExists("REQUEST")) {
            final String request = getValue("REQUEST");

            if (request.equalsIgnoreCase("GetCoverage")) {
                currentRequest.setRequest(request);
            } else {
                throw new WcsException("REQUEST parameter is wrong.");
            }

            parameters.remove("REQUEST");
        } else {
            throw new WcsException("REQUEST parameter is mandatory.");
        }

        if (keyExists("COVERAGE")) {
            currentRequest.setCoverage(getValue("COVERAGE"));
            parameters.remove("COVERAGE");
        } else {
            throw new WcsException("COVERAGE parameter is mandatory.");
        }

        if (keyExists("COVERAGEVERSION")) {
            currentRequest.setCoverageVersion(getValue("COVERAGEVERSION"));
            parameters.remove("COVERAGEVERSION");
        }

        if (keyExists("FORMAT")) {
            currentRequest.setOutputFormat(getValue("FORMAT"));
            parameters.remove("FORMAT");
        } else {
            throw new WcsException("FORMAT parameter is mandatory.");
        }

        if (keyExists("CRS")) {
            currentRequest.setCRS(getValue("CRS"));
            parameters.remove("CRS");
        } else {
            throw new WcsException("CRS parameter is mandatory.");
        }

        if (keyExists("RESPONSE_CRS")) {
            currentRequest.setResponseCRS(getValue("RESPONSE_CRS"));
            parameters.remove("RESPONSE_CRS");
        } else {
            currentRequest.setResponseCRS(getValue("CRS"));
        }

        if (keyExists("BBOX")) {
            currentRequest.setEnvelope(getValue("BBOX"));
            parameters.remove("BBOX");
        } else {
            throw new WcsException("BBOX parameter is mandatory.");
        }

        if (keyExists("WIDTH") && keyExists("HEIGHT")) {
            currentRequest.setGridOrigin(new Double[] { new Double(0.0), new Double(0.0) });
            currentRequest.setGridLow(new Double[] { new Double(0.0), new Double(0.0) });
View Full Code Here

    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());
        }
View Full Code Here

            final Charset encoding = Charset.forName(wcs.getGeoServer().getGlobal().getCharset());
            Writer writer = new OutputStreamWriter(out, encoding);
            writer.write(xmlResponse);
            writer.flush();
        } catch (IOException ex) {
            throw new WcsException(ex, "", getClass().getName());
        }
    }
View Full Code Here

            curCoverageName = requestedTypes.get(i).toString();

      meta = catalog.getCoverageByName(curCoverageName);

            if (meta == null) {
                throw new WcsException(new StringBuffer("Coverage ").append(curCoverageName)
                                                                    .append(" does ")
                                                                    .append("not exist on this server")
                                                                    .toString());
            }

            try {
              tempResponse = tempResponse + printElement(meta);
            } catch(Exception e) {
              throw new WcsException(e);
            }
        }

        tempResponse = tempResponse + "\n\n";
View Full Code Here

        final String outputFormat = request.getOutputFormat();

        delegate = CoverageResponseDelegateFactory.encoderFor(outputFormat);
        if(delegate == null)
            throw new WcsException("Output format: " + outputFormat + " not supported by geoserver " +
                "for this Coverage", WcsExceptionCode.InvalidParameterValue, "format");

        final Catalog catalog = request.getWCS().getGeoServer().getCatalog();
        CoverageInfo meta = null;
        GridCoverage coverage = null;

        try {
            meta = catalog.getCoverageByName(request.getCoverage());

            if (!meta.getSupportedFormats().contains(outputFormat.toUpperCase())) {
                WcsException newEx = new WcsException(new StringBuffer("output format: ").append(
                            outputFormat).append(" not ")
                                                                                         .append("supported by geoserver for this Coverage")
                                                                                         .toString());
                throw newEx;
            }

            final Format format = meta.getStore().getFormat();
            final AbstractGridCoverage2DReader reader =
              (AbstractGridCoverage2DReader) catalog.getResourcePool().getGridCoverageReader(meta.getStore(),hints);

            // /////////////////////////////////////////////////////////
            //
            // Setting coverage reading params.
            //
            // /////////////////////////////////////////////////////////
            final ParameterValueGroup params = reader.getFormat().getReadParameters();

            final GridCoverage2D finalCoverage = getFinalCoverage(request, meta, reader,
                    CoverageUtils.getParametersKVP(params));
            delegate.prepare(outputFormat, finalCoverage);
        } catch (IOException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());

            throw newEx;
        } catch (NoSuchElementException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        } catch (IllegalArgumentException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        } catch (SecurityException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        } catch (WcsException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        } catch (FactoryException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        } catch (IndexOutOfBoundsException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        } catch (TransformException e) {
            final WcsException newEx = new WcsException(e, "problem with CoverageResults",
                    request.getHandle());
            throw newEx;
        }
    }
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.wcs.WcsException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.