Package org.geoserver.wps

Examples of org.geoserver.wps.WPSException


                xmls.setResult(new StreamResult(output));
                delegate.encode(xmls);
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw new WPSException("An error occurred while encoding "
                        + "the results of the process", e);
            }
        } else if(rawResult instanceof CDataEncoderDelegate) {
          try {
                ((CDataEncoderDelegate) rawResult).encode(output);
          } catch(Exception e) {
            throw new WPSException("An error occurred while encoding "
                        + "the results of the process", e);
          }
        } else if(rawResult instanceof BinaryEncoderDelegate) {
          try {
            ((BinaryEncoderDelegate) rawResult).encode(output);
          } catch(Exception e) {
            throw new WPSException("An error occurred while encoding "
                        + "the results of the process", e);
          }
        } else {
            throw new WPSException("Cannot encode an object of class "
                    + rawResult.getClass() + " in raw form");
        }
    }
View Full Code Here


        ImageDecoder decoder = getDecoder(inputStream);
        RenderedImage ri = null;
        try {
            ri = decoder.decodeAsRenderedImage();
        } catch (IOException ioe){
            WPSException wpse = new WPSException("Unable to decode the image. Expected an image having mimetype = " + mimeType);
            wpse.initCause(ioe);
            throw wpse;
        }
        return ri;
    }
View Full Code Here

    /**
     * Throws a WPS exception, specifying a message
     */
    public void throwException(String message) {
        throw new WPSException(message);
    }
View Full Code Here

    /**
     * Throws a WPS exception, specifying a message and the code (see OWS spec for exception
     * reporting details)
     */
    public void throwException(String message, String code) {
        throw new WPSException(code, message);
    }
View Full Code Here

    /**
     * Throws a WPS exception, specifying a message and the code and locator (see OWS spec for
     * exception reporting details)
     */
    public void throwException(String message, String code, String locator) {
        throw new WPSException(message, code, locator);
    }
View Full Code Here

            Map<String, Object> inputs) throws ProcessException {
        // straight execution, no thread pooling, we're already running in the parent process thread
        ProcessListener listener = new ProcessListener(new ExecutionStatus(processName, executionId, ProcessState.RUNNING, 0, null));
        ProcessFactory pf = GeoServerProcessors.createProcessFactory(processName);
        if (pf == null) {
            throw new WPSException("No such process: " + processName);
        }

        // execute the process in the same thread as the caller
        Process p = pf.create(processName);
        Map<String, Object> result = p.execute(inputs, listener);
View Full Code Here

                status.setPhase(ProcessState.RUNNING);
                ProcessListener listener = status.listener;
                Name processName = status.getProcessName();
                ProcessFactory pf = GeoServerProcessors.createProcessFactory(processName);
                if (pf == null) {
                    throw new WPSException("No such process: " + processName);
                }
   
                // execute the process
                Map<String, Object> result = null;
                try {
                    Process p = pf.create(processName);
                    result = p.execute(inputs, listener);
                    if (listener.exception != null) {
                        throw new WPSException("Process failed: " + listener.exception.getMessage(),
                                listener.exception);
                    }
                    return result;
                } finally {
                    // update status unless cancelled
View Full Code Here

        return file;
    }

    private void mkdir(File file) {
        if(!file.mkdir()) {
            throw new WPSException("Failed to create the specified directory " + file);
        }
    }
View Full Code Here

            if (pm.canHandle(processName)) {
                return pm;
            }
        }

        throw new WPSException("Could not find a ProcessManager able to run this process: "
                + processName);
    }
View Full Code Here

            // if we have the output path move the final file there
            if(Boolean.TRUE.equals(store) && outputPath != null) {
                File output = new File(outputPath);
                if(output.exists()) {
                    if(!output.delete()) {
                        throw new WPSException("Output file " + outputPath + " exists but cannot be overwritten");
                    }
                } else {
                    File parent = output.getParentFile();
                    if(!parent.exists()) {
                        if(!parent.mkdirs()) {
                            throw new WPSException("Output file parent directory "
                                    + parent.getAbsolutePath() + " does not exist and cannot be created");
                        }
                    }
                }
                if(!warpedFile.renameTo(output)) {
                    throw new WPSException("Could not move "
                            + warpedFile.getAbsolutePath() + " to " + outputPath
                            + ", it's likely a permission issue");
                }
                warpedFile = output;
            }
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.