Package org.geoserver.wfs

Examples of org.geoserver.wfs.WFSException


     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        throw new WFSException("Circle is not supported", "InvalidParameterValue");
    }
View Full Code Here


                CoordinateReferenceSystem crs = GML2ParsingUtils.crs(node);
                if ( crs != null ) {
                    context.registerComponentInstance(CoordinateReferenceSystem.class, crs);
                }
            } catch(Exception e) {
                throw new WFSException(e, "InvalidParameterValue");
            }
        }
    }
View Full Code Here

        try {
            if (node.hasAttribute("srsName")) {
                CRS.decode(node.getAttributeValue("srsName").toString());
            }
        } catch (NoSuchAuthorityCodeException e) {
            throw new WFSException("Invalid Authority Code: " + e.getAuthorityCode(),
                "InvalidParameterValue");
        }

        Geometry geometry = (Geometry) super.parse(instance, node, value);

        if (geometry != null) {
            //1. ensure a crs is set
            if (geometry.getUserData() == null) {
                //no crs set for the geometry, did we inherit one from a parent?
                if ( crs != null ) {
                    geometry.setUserData(crs);
                } else {
                    // for the moment we don't do anything since we miss the information
                    // to infer the CRS from the feature type
                }
            }

            //2. ensure the coordinates of the geometry fall into valid space defined by crs
            CoordinateReferenceSystem crs = (CoordinateReferenceSystem) geometry.getUserData();
            if(crs != null)
                try {
                    JTS.checkCoordinatesRange(geometry, crs);
                } catch(PointOutsideEnvelopeException e) {
                    throw new WFSException(e, "InvalidParameterValue");
                }
        }

        return geometry;
    }
View Full Code Here

            parsed = WFSXmlUtils.parseRequest(parser, reader, wfs);   
        }
        catch(Exception e) {
            //check the exception, and set code to OperationParsingFailed if code not set
            if (!(e instanceof ServiceException) || ((ServiceException)e).getCode() == null) {
                e = new WFSException("Request parsing failed", e, "OperationParsingFailed");
            }
            throw e;
        }

        WFSXmlUtils.checkValidationErrors(parser, this);
View Full Code Here

        //parse
        Object parsed = parser.parse(reader);
       
        //if strict was set, check for validation errors and throw an exception
        if (strict.booleanValue() && !parser.getValidationErrors().isEmpty()) {
            WFSException exception = new WFSException("Invalid request", "InvalidParameterValue");

            for (Iterator e = parser.getValidationErrors().iterator(); e.hasNext();) {
                Exception error = (Exception) e.next();
                exception.getExceptionText().add(error.getLocalizedMessage());
            }

            throw exception;
        }
       
View Full Code Here

    public Object read(Object request, Map kvp, Map rawKvp) throws Exception {
        //special cite compliance check to ensure the client specified typeNames rather than just
        // typeName
        if (!kvp.containsKey("typenames") && kvp.containsKey("typename")
            && getWFS().isCiteCompliant()) {
            throw new WFSException("WFS 2.0 requires typeNames, not typeName");
        }
        return super.read(request, kvp, rawKvp);
    }
View Full Code Here

            encoder.encode(feature, GML._Feature, handler);

            return sw.toString();
        } catch(Exception e) {
            success = false;
            throw new WFSException(e);
        } finally {
            if(success) {
                double millis = ((double) System.nanoTime() - start) / 1000000;
                Name name = WFSNotify.getTypeName(feature);
                serializationMillis.add(millis);
View Full Code Here

    public String getMimeType(Object value, Operation operation) throws ServiceException {
        try {
            TransformInfo info = locateTransformation((FeatureCollectionResponse) value, operation);
            return info.mimeType();
        } catch(IOException e) {
            throw new WFSException("Failed to load the required transformation", e);
        }
    }
View Full Code Here

            }
            sb.append(extension);
   
            return sb.toString();
        } catch(IOException e) {
            throw new WFSException("Failed to locate the XSLT transformation", e);
        }
    }
View Full Code Here

        final Operation sourceOperation = buildSourceOperation(operation, info);

        // lookup the operation we are going to use
        final Response sourceResponse = findSourceResponse(sourceOperation, info);
        if (sourceResponse == null) {
            throw new WFSException(
                    "Could not locate a response that can generate the desired source format '"
                            + info.getSourceFormat() + "' for transformation '" + info.getName() + "'");

        }

        // prepare the stream connections, so that we can do the transformation on the fly
        PipedInputStream pis = new PipedInputStream();
        final PipedOutputStream pos = new PipedOutputStream(pis);

        // submit the source output format execution, tracking exceptions
        Future<Void> future = executor.submit(new Callable<Void>() {

            @Override
            public Void call() throws Exception {
                try {
                    sourceResponse.write(featureCollection, pos, sourceOperation);
                } finally {
                    // close the stream to make sure the transformation won't keep on waiting
                    pos.close();
                }

                return null;
            }
        });

        // run the transformation
        TransformerException transformerException = null;
        try {
            transformer.transform(new StreamSource(pis), new StreamResult(output));
        } catch (TransformerException e) {
            transformerException = e;
        } finally {
            pis.close();
        }

        // now handle exceptions, starting from the source
        try {
            future.get();
        } catch (Exception e) {
            throw new WFSException(
                    "Failed to run the output format generating the source for the XSTL transformation",
                    e);
        }
        if (transformerException != null) {
            throw new WFSException("Failed to run the the XSTL transformation",
                    transformerException);
        }

    }
View Full Code Here

TOP

Related Classes of org.geoserver.wfs.WFSException

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.