Package org.vfny.geoserver.wfs

Examples of org.vfny.geoserver.wfs.WfsException


    public void writeTo(OutputStream out) throws WfsException {
        try {
            byte[] content = xmlResponse.getBytes();
            out.write(content);
        } catch (IOException ex) {
            throw new WfsException(ex, "", getClass().getName());
        }
    }
View Full Code Here


            //TypeInfo meta = repository.getFeatureType(curTypeName);
            FeatureTypeInfo meta = gs.getData().getFeatureTypeInfo(curTypeName);

            //curTypeName = meta.getName();
            if (meta == null) {
                throw new WfsException("Feature Type " + curTypeName + " does "
                    + "not exist on this server");
            }

            if (!validTypes.contains(meta)) {
View Full Code Here

            t.transform(schema, writer);

            return writer.getBuffer().toString();
        } catch (TransformerException te) {
            LOGGER.warning(te.toString());
            throw new WfsException("problem transforming type", te);
        }
    }
View Full Code Here

            }
        } catch (IOException e) {
            //REVISIT: should things fail if there are featureTypes that
            //don't have schemas in the right place?  Because as it is now
            //a describe all will choke if there is one ft with no schema.xml
            throw new WfsException("problem writing featureType information "
                + " from " + inputFile);
        }

        return finalOutput;
    }
View Full Code Here

    private String getPrefix(String featureTypeName, WFS gs)
        throws WfsException {
        FeatureTypeInfo ftConf = gs.getData().getFeatureTypeInfo(featureTypeName);

        if (ftConf == null) {
            throw new WfsException("Feature Type " + featureTypeName + " does "
                + "not exist or is not enabled on this server");
        }

        return ftConf.getPrefix();
    }
View Full Code Here

        transaction = null;
    }

    public void execute(Request request) throws ServiceException, WfsException {
        if (!(request instanceof TransactionRequest)) {
            throw new WfsException(
                "bad request, expected TransactionRequest, but got " + request);
        }

        if ((request.getWFS().getServiceLevel() & WFSDTO.TRANSACTIONAL) == 0) {
            throw new ServiceException("Transaction support is not enabled");
View Full Code Here

            LOGGER.finer("got lockId: " + authorizationID);

            if (!catalog.lockExists(authorizationID)) {
                String mesg = "Attempting to use a lockID that does not exist"
                    + ", it has either expired or was entered wrong.";
                throw new WfsException(mesg);
            }

            try {
                transaction.addAuthorization(authorizationID);
            } catch (IOException ioException) {
                // This is a real failure - not associated with a element
                //
                throw new WfsException("Authorization ID '" + authorizationID
                    + "' not useable", ioException);
            }
        }

        // execute elements in order,
View Full Code Here

        // read in XML file and parse to content handler
        try {
            parser.setContentHandler(currentRequest);
            parser.parse(requestSource);
        } catch (SAXException e) {
            throw new WfsException(e,
                "XML get capabilities request parsing error",
                DispatcherXmlReader.class.getName());
        } catch (IOException e) {
            throw new WfsException(e,
                "XML get capabilities request input error",
                DispatcherXmlReader.class.getName());
        }
    }
View Full Code Here

            unparsed = readFlat(bbox, INNER_DELIMETER);
            i = unparsed.listIterator();

            // check to make sure that the bounding box has 4 coordinates
            if (unparsed.size() != 4) {
                throw new WfsException("Requested bounding box contains wrong"
                    + "number of coordinates (should have " + "4): "
                    + unparsed.size());

                // if it does, store them in an array of doubles
            } else {
                int j = 0;

                while (i.hasNext()) {
                    try {
                        rawCoords[j] = Double.parseDouble((String) i.next());
                        j++;
                    } catch (NumberFormatException e) {
                        throw new WfsException("Bounding box coordinate " + j
                            + " is not parsable:" + unparsed.get(j));
                    }
                }
            }

            // turn the array of doubles into an appropriate geometry filter
            // TODO 2:
            //  hack alert: because we do not yet know the schema, we have
            //  used the '@' symbol for the attribute expression, to be
            //  replaced later by the appropriate attribute.  I would argue
            //  that this is a failure in the specification because there
            //  should always be explicit designation of geometry attibutes
            //  within the filter.  The BBOX element is ambiguous, since
            //  features may contain multiple geometries.  For now, we will
            //  parse it and keep a record of a 'primary geometry' in the
            //  server.
            try {
                GeometryFilter finalFilter = factory.createGeometryFilter(AbstractFilter.GEOMETRY_INTERSECTS);

                //leave as null and postgisDatSource will use default geom.
                //AttributeExpression leftExpression =
                //    factory.createAttributeExpression(null);
                //leftExpression.setAttributePath("@");
                // Creates coordinates for the linear ring
                Coordinate[] coords = new Coordinate[5];
                coords[0] = new Coordinate(rawCoords[0], rawCoords[1]);
                coords[1] = new Coordinate(rawCoords[0], rawCoords[3]);
                coords[2] = new Coordinate(rawCoords[2], rawCoords[3]);
                coords[3] = new Coordinate(rawCoords[2], rawCoords[1]);
                coords[4] = new Coordinate(rawCoords[0], rawCoords[1]);

                LinearRing outerShell = new LinearRing(coords,
                        new PrecisionModel(), 0);
                Geometry polygon = new Polygon(outerShell,
                        new PrecisionModel(), 0);
                LiteralExpression rightExpression = factory
                    .createLiteralExpression(polygon);

                //finalFilter.addLeftGeometry(leftExpression);
                finalFilter.addRightGeometry(rightExpression);
                filters.add(finalFilter);

                return filters;
            } catch (IllegalFilterException e) {
                throw new WfsException("Filter creation problem: "
                    + e.getMessage());
            }

            // handles unconstrained case
        } else if ((bbox == null) && (fid == null) && (filter == null)) {
            return new ArrayList();

            // handles error when more than one filter specified
        } else {
            throw new WfsException("GetFeature KVP request contained "
                + "conflicting filters.  Filter: " + filter + ", fid: " + fid
                + ", bbox:" + bbox);
        }
    }
View Full Code Here

            adapter.setContentHandler(documentFilter);
            adapter.parse(requestSource);
            LOGGER.fine("just parsed: " + requestSource);
        } catch (SAXException e) {
            throw new WfsException(e,
                "XML getFeature request SAX parsing error",
                XmlRequestReader.class.getName());
        } catch (IOException e) {
            throw new WfsException(e, "XML get feature request input error",
                XmlRequestReader.class.getName());
        } catch (ParserConfigurationException e) {
            throw new WfsException(e, "Some sort of issue creating parser",
                XmlRequestReader.class.getName());
        }

        LOGGER.fine("passing filter: " + contentHandler.getFilter());
View Full Code Here

TOP

Related Classes of org.vfny.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.