Package org.geoserver.wps

Examples of org.geoserver.wps.WPSException


    private static String parseCrs(CoordinateReferenceSystem crs) {
        Utilities.ensureNonNull("coordinateReferenceSystem", crs);
        try {
            return "EPSG:" + CRS.lookupEpsgCode(crs, true);
        } catch (FactoryException e) {
            throw new WPSException("Error occurred looking up target SRS");
        }
    }
View Full Code Here


            p.waitFor();
            log.flush();
            exitValue = p.exitValue();
        }
        catch(Exception e) {
            throw new WPSException("Error launching OS command: " + gdalCommand + " with arguments " + argument + " and env vars " + envVars, e);
        }
        finally {
            if(exitValue != 0) {
                if (logFile.exists() && logFile.canRead()) {
                    String error = getError(logFile);
                    throw new WPSException("Error launching OS command: '" + gdalCommand + "' with arguments '" + argument + "' and env vars '" + envVars + "': \n" + error);
                }
            }
           
            if (logFile != null) {
                logFile.delete();
View Full Code Here

        } else if(org.opengis.geometry.Envelope.class.isAssignableFrom(getType())) {
            GeneralEnvelope ge = new GeneralEnvelope(lower, upper);
            ge.setCoordinateReferenceSystem(crs);
            return ge;
        } else {
            throw new WPSException("Failed to convert from OWS 1.1 Bounding box type "
                    + "to the internal representation: " + getType());
        }
    }
View Full Code Here

            org.opengis.geometry.Envelope env = (org.opengis.geometry.Envelope) object;
            crs = env.getCoordinateReferenceSystem();
            bbox.setLowerCorner(Arrays.asList(env.getLowerCorner().getCoordinate()));
            bbox.setUpperCorner(Arrays.asList(env.getUpperCorner().getCoordinate()));
        } else {
            throw new WPSException("Failed to convert from " + object
                    + " to an OWS 1.1 Bounding box type");
        }
       
        // handle the EPSG code
        if(crs != null) {
            try {
                Integer code = CRS.lookupEpsgCode(crs, false);
                if(code != null) {
                    bbox.setCrs("EPSG:" + code);
                }
            } catch(Exception e) {
                throw new WPSException("Could not lookup epsg code for " + crs, e);
            }
        }
       
        return bbox;
    }
View Full Code Here

        }

        // and then we try to read it as a geotiff
        AbstractGridFormat format = GridFormatFinder.findFormat(f);
        if (format instanceof UnknownFormat) {
            throw new WPSException(
                    "Could not find the GeoTIFF GT2 format, please check it's in the classpath");
        }
        return format.getReader(f).read(null);
    }
View Full Code Here

            wparams.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);
            final GeneralParameterValue[] wps = (GeneralParameterValue[]) wparams.values().toArray(new GeneralParameterValue[1]);
            // write out the coverage
            AbstractGridCoverageWriter writer = (AbstractGridCoverageWriter) format.getWriter(os);
            if (writer == null)
                throw new WPSException(
                        "Could not find the GeoTIFF writer, please check it's in the classpath");
            try {
                writer.write(coverage, wps);
            } catch(IOException e) {
                throw new ProcessException(e);
View Full Code Here

        Object parsed;
        try {
            parsed = parser.parse(reader);
        } catch(Exception e) {
            throw new WPSException("Could not parse XML request.", e);
        }

        if (!parser.getValidationErrors().isEmpty()) {
            WPSException exception = new WPSException("Invalid request", "InvalidParameterValue");

            for(Exception error : (List<Exception>)parser.getValidationErrors()) {
                LOGGER.warning( error.getLocalizedMessage() );
                exception.getExceptionText().add(error.getLocalizedMessage());
            }
        }

        return parsed;
    }
View Full Code Here

                        if (encoding != null) {
                            if ("base64".equals(encoding)) {
                                String input = inputData.toString();
                                decoded = Base64.decode(input);
                            } else {
                                throw new WPSException("Unsupported encoding " + encoding);
                            }
                        }
                       
                        if(decoded != null) {
                            return new ByteArrayRawData(decoded, complex.getMimeType());
                        } else {
                            return new StringRawData(inputData.toString(), complex.getMimeType());
                        }
                       
                    } else {
                        Object inputData = complex.getData().get(0);
                        String encoding = complex.getEncoding();
                        byte[] decoded = null;
                        if (encoding != null) {
                            if ("base64".equals(encoding)) {
                                String input = inputData.toString();
                                decoded = Base64.decode(input);
                            } else {
                                throw new WPSException("Unsupported encoding " + encoding);
                            }
                        }

                        if (decoded != null) {
                            value = ((ComplexPPIO) ppio).decode(new ByteArrayInputStream(decoded));
View Full Code Here

        }

        Map<String, Object> results = executor.submitChained(new ExecuteRequest(request));
        Object obj = results.values().iterator().next();
        if (obj != null && !ppio.getType().isInstance(obj)) {
            throw new WPSException(
                    "The process output is incompatible with the input target type, was expecting "
                            + ppio.getType().getName() + " and got " + obj.getClass().getName());
        }
        return obj;
    }
View Full Code Here

        } else if (getCoverage instanceof net.opengis.wcs10.GetCoverageType) {
            WebCoverageService100 wcs = (WebCoverageService100) context
                    .getBean("wcs100ServiceTarget");
            return wcs.getCoverage((net.opengis.wcs10.GetCoverageType) getCoverage)[0];
        } else {
            throw new WPSException("Unrecognized request type " + getCoverage);
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wps.WPSException

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.