Package org.geoserver.wfs

Examples of org.geoserver.wfs.WFSException


        //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


                QName qName = (QName) itr.next();
               
                // check the type name is known, otherwise complain
                if(catalog.getFeatureTypeByName(qName.getNamespaceURI(), qName.getLocalPart()) == null) {
                    String name = qName.getPrefix() + ":" + qName.getLocalPart();
                    throw new WFSException("Feature type " + name + " unknown", "InvalidParameterValue", "typeName");
                }
               
                List l = new ArrayList();
                l.add(qName);
                list.add(l);
            }

            kvp.put("typeName", list);
            querySet(eObject, "typeName", list);
        } else {
            //check for featureId and infer typeName
            if (kvp.containsKey("featureId")) {
                //use featureId to infer type Names
                List featureId = (List) kvp.get("featureId");

                ArrayList typeNames = new ArrayList();

                QNameKvpParser parser = new QNameKvpParser("typeName", catalog);

                for (int i = 0; i < featureId.size(); i++) {
                    String fid = (String) featureId.get(i);
                    int pos = fid.indexOf(".");

                    if (pos != -1) {
                        String typeName = fid.substring(0, fid.lastIndexOf("."));

                        //add to a list to set on the query
                        List parsed = (List) parser.parse(typeName);
                        typeNames.add(parsed);
                    }
                }

                querySet(eObject, "typeName", typeNames);
            } else {
                throw new WFSException("The query should specify either typeName or a featureId filter", "MissingParameterValue");
            }
        }

        //filter
        if (kvp.containsKey("filter")) {
View Full Code Here

            if (kvp.containsKey(keys[i])) {
                for (int j = i + 1; j < keys.length; j++) {
                    if (kvp.containsKey(keys[j])) {
                        String msg = keys[i] + " and " + keys[j]
                            + " both specified but are mutually exclusive";
                        throw new WFSException(msg);
                    }
                }
            }
        }
    }
View Full Code Here

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

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

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

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

            // load the metadata for the feature type
            String namespaceURI = featureType.getName().getNamespaceURI();
            FeatureTypeInfo meta = catalog.getFeatureTypeByName(namespaceURI, featureType.getTypeName() );

            if (meta == null)
                throw new WFSException("Could not find feature type "
                        + namespaceURI + ":" + featureType.getTypeName()
                        + " in the GeoServer catalog");

            // add it to the map
            Set metas = (Set) ns2metas.get(namespaceURI);
View Full Code Here

        // figure out which output format we're going to generate
        GetFeatureType gft = (GetFeatureType) getFeature.getParameters()[0];
        OgrFormat format = formats.get(gft.getOutputFormat());
        if (format == null)
            throw new WFSException("Unknown output format " + gft.getOutputFormat());

        // create the first temp directory, used for dumping gs generated
        // content
        File tempGS = org.geoserver.data.util.IOUtils.createTempDirectory("ogrtmpin");
        File tempOGR = org.geoserver.data.util.IOUtils.createTempDirectory("ogrtmpout");
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

            //load the metadata for the feature type
            String namespaceURI = featureType.getName().getNamespaceURI();
            FeatureTypeInfo meta = catalog.getFeatureTypeByName( namespaceURI, featureType.getTypeName() );
            if(meta == null)
                throw new WFSException("Could not find feature type " + namespaceURI + ":" + featureType.getTypeName() + " in the GeoServer catalog");

            NamespaceInfo ns = catalog.getNamespaceByURI( namespaceURI );
            ns2metas.put( ns, meta );
        }
View Full Code Here

            boolean shapefileCreated = false;
            while (outputFeatureCollections.hasNext()) {
                curCollection = outputFeatureCollections.next();
               
                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

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.