Examples of WfsException


Examples of org.geoserver.wfs.WFSException

                return;
            } else {
                //illegal
                String msg = "Specified " + m + " " + property + " for " + n + " queries.";
                throw new WFSException(msg);
            }
        }

        EMFUtils.set(query, property, values);
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSException

    
            String uri = null;
            if(prefix != null && !"".equals(prefix)) {
                final NamespaceInfo namespace = catalog.getNamespaceByPrefix(prefix);
                if(strict && namespace == null){
                    throw new WFSException("Unknown namespace [" + prefix + "]");
                }
                uri = namespace == null? null : namespace.getURI();
            }

            return new QName(uri, local, prefix);
View Full Code Here

Examples of org.geoserver.wfs.WFSException

        } else {
            // we don't have the namespace, use the catalog to lookup the feature type
            // mind, this is lenient behavior so we use it only if the server is not runnig in cite mode
            FeatureTypeInfo ftInfo = catalog.getFeatureTypeByName(token);
            if(ftInfo == null) {
                throw new WFSException("Could not find type name " + token, "InvalidParameterValue", "typeName");
            } else {
                final Name name = ftInfo.getFeatureType().getName();
                return new QName(name.getNamespaceURI(), name.getLocalPart());
            }
        }
View Full Code Here

Examples of org.geoserver.wfs.WFSException

        if (!response.getTransactionResults().getAction().isEmpty()) {
            //since we do atomic transactions, an action failure means all we rolled back
            // spec says to throw exception
            ActionType action = (ActionType) response.getTransactionResults().getAction().iterator()
                                                     .next();
            throw new WFSException(action.getMessage(), action.getCode(), action.getLocator());
        }

        Encoder encoder = new Encoder(configuration, configuration.schema());
        encoder.setEncoding(Charset.forName( getInfo().getGeoServer().getGlobal().getCharset()) );
View Full Code Here

Examples of org.geoserver.wfs.WFSException

            // zip file will be empty and the zip output stream will break
            boolean shapefileCreated = false;
            for (SimpleFeatureCollection curCollection : collections) {
               
                if(curCollection.getSchema().getGeometryDescriptor() == null) {
                    throw new WFSException("Cannot write geometryless shapefiles, yet "
                            + curCollection.getSchema() + " has no geometry field");
                }
                Class geomType = curCollection.getSchema().getGeometryDescriptor().getType().getBinding();
                if(GeometryCollection.class.equals(geomType) || Geometry.class.equals(geomType)) {
                    // in this case we fan out the output to multiple shapefiles
View Full Code Here

Examples of org.geoserver.wfs.WFSException

                    if(fos != null)
                        fos.close();
                }
            }
        } catch(IOException e) {
            throw new WFSException("Failed to dump the WFS request");
        }
       
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSException

        }
        else if ( value instanceof MultiPolygon ) {
            encoder.encode( value, GML.MultiPolygon, output );
        }
        else {
            throw new WFSException( "Cannot encode geometry of type: " + value.getClass() );
        }
     }
View Full Code Here

Examples of org.geotools.data.wfs.protocol.wfs.WFSException

            parsed = parser.parse(reader);
            if (!(parsed instanceof net.opengis.ows10.ExceptionReportType)) {
                return new IOException("Unrecognized server error");
            }
        } catch (Exception e) {
            return new WFSException("Exception parsing server exception report", e);
        }
        net.opengis.ows10.ExceptionReportType report = (ExceptionReportType) parsed;
        List<ExceptionType> exceptions = report.getException();

        EObject originatingRequest = response.getOriginatingRequest();
        StringBuilder msg = new StringBuilder("WFS returned an exception.");
        msg.append(" Target URL: " + response.getTargetUrl());
        if (originatingRequest != null) {
            try {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                WFS_1_1_0_Protocol.encode(originatingRequest, configuration, out, Charset
                        .forName("UTF-8"));
                String requestStr = out.toString("UTF-8");

                msg.append(". Originating request is: \n").append(requestStr).append("\n");
            } catch (Exception e) {
                LOGGER.log(Level.FINE, "Error encoding request for exception report", e);
            }
        }
        WFSException result = new WFSException(msg.toString());
        for (ExceptionType ex : exceptions) {
            result.addExceptionReport(String.valueOf(ex.getExceptionText()));
        }
        return result;
    }
View Full Code Here

Examples of org.vfny.geoserver.wfs.WfsException

            LOGGER.finest("calling parse on " + requestSource);
            adapter.parse(requestSource);
            LOGGER.fine("just parsed: " + requestSource);
        } catch (SAXException e) {
            e.printStackTrace(System.out);
            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());
        }

        Request r = contentHandler.getRequest(req);
View Full Code Here

Examples of org.vfny.geoserver.wfs.WfsException

        String outputFormat = request.getOutputFormat();

        try {
            delegate = GetNearestResponse.getDelegate(outputFormat);
        } catch (NoSuchElementException ex) {
            throw new WfsException("output format: " + outputFormat + " not "
                + "supported by geoserver", ex);
        }

        GetNearestResults results = new GetNearestResults(request);

        //
        // Optimization Idea
        //
        // We should be able to reduce this to a two pass opperations.
        //
        // Pass #1 execute
        // - Attempt to Locks Fids during the first pass
        // - Also collect Bounds information during the first pass
        //
        // Pass #2 writeTo
        // - Using the Bounds to describe our FeatureCollections
        // - Iterate through FeatureResults producing GML
        //
        // And allways remember to release locks if we are failing:
        // - if we fail to aquire all the locks we will need to fail and
        //   itterate through the the FeatureSources to release the locks
        //
        WFS wfs = request.getWFS();
        GeoServer config = wfs.getGeoServer();
        Data catalog = wfs.getData();
        FeatureTypeInfo meta = null;
        NameSpaceInfo namespace;
        Query query;

        FeatureSource source;
        Feature feature;
        String fid;
        FilterFactory filterFactory = FilterFactoryFinder.createFilterFactory();
        FidFilter fidFilter;

        try {
            for (Iterator it = request.getQueries().iterator(); it.hasNext();) {
                query = (Query) it.next();

                // the feature type name used in the content disposition response will match
                // the first feature type
                if (featureTypeName == null) {
                    featureTypeName = query.getTypeName();
                }

                meta = catalog.getFeatureTypeInfo(query.getTypeName());
                namespace = meta.getDataStoreInfo().getNameSpace();
                source = meta.getFeatureSource();

                List attrs = meta.getAttributes();

                List propNames = query.getPropertyNames(); // REAL LIST: be careful here :)
                List attributeNames = meta.getAttributeNames();

                for (Iterator iter = propNames.iterator(); iter.hasNext();) {
                    String propName = (String) iter.next();

                    if (!attributeNames.contains(propName)) {
                        String mesg = "Requested property: " + propName + " is "
                            + "not available for " + query.getTypeName() + ".  "
                            + "The possible propertyName values are: " + attributeNames;
                        throw new WfsException(mesg);
                    }
                   
                   
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.