Package org.geoserver.catalog

Examples of org.geoserver.catalog.FeatureTypeInfo


        //allSameType will throw WFSException if there are types that are not found.
        if (allSameType(infos)) {
            //all the requested have the same namespace prefix, so return their
            //schemas.
            FeatureTypeInfo ftInfo = infos[0];
            String targetNs = ftInfo.getNamespace().getURI();

            //String targetNs = nsInfoType.getXmlns();
            tempResponse.append(TARGETNS_PREFIX + targetNs + TARGETNS_SUFFIX);

            //namespace
            tempResponse.append("\n  " + "xmlns:" + ftInfo.getNamespace().getPrefix() + "=\""
                + targetNs + "\"");

            //xmlns:" + nsPrefix + "=\"" + targetNs
            //+ "\"");
            tempResponse.append(GML_NAMESPACE);
            tempResponse.append(XS_NAMESPACE);
            tempResponse.append(ELEMENT_FORM_DEFAULT + ATTR_FORM_DEFAULT);

            //request.getBaseUrl should actually be GeoServer.getSchemaBaseUrl()
            //but that method is broken right now.  See the note there.

            //JD: need a good way to publish resources under a web url, at the
            // same time abstracting away the httpness of the service, for
            // now replacing the schemas.opengis.net

            //            tempResponse.append("\n\n<xs:import namespace=" + GML_URL
            //                + " schemaLocation=\"" + request.getSchemaBaseUrl()
            //                + "gml/2.1.2/feature.xsd\"/>\n\n");
            tempResponse.append("\n\n<xs:import namespace=" + GML_URL + " schemaLocation=\"" +
                    buildSchemaURL(request.getBaseUrl(), "gml/2.1.2.1/feature.xsd")
                + "\"/>\n\n");
            tempResponse.append(generateSpecifiedTypes(infos));
        } else {
            //the featureTypes do not have all the same prefixes.
            tempResponse.append(XS_NAMESPACE);
            tempResponse.append(ELEMENT_FORM_DEFAULT + ATTR_FORM_DEFAULT);

            Set prefixes = new HashSet();

            //iterate through the types, and make a set of their prefixes.
            for (int i = 0; i < infos.length; i++) {
                FeatureTypeInfo ftInfo = infos[i];
                prefixes.add(ftInfo.getNamespace().getPrefix());
            }

            Iterator prefixIter = prefixes.iterator();

            while (prefixIter.hasNext()) {
View Full Code Here


        params.put("service", "wfs");
        params.put("version", "1.0.0");
       
        StringBuilder typeNames = new StringBuilder();
        for (int i = 0; i < infos.length; i++) {
            FeatureTypeInfo info = infos[i];
            String typeName = info.getPrefixedName();

            if (typeName.startsWith(prefix + ":")) {
                typeNames.append(typeName).append(",");
            }
View Full Code Here

        String generatedType = new String();
        Set validTypes = new HashSet();

        // Loop through requested tables to add element types
        for (int i = 0; i < infos.length; i++) {
            FeatureTypeInfo ftInfo = (FeatureTypeInfo) infos[i];

            if (!validTypes.contains(ftInfo)) {
                //TODO: ressurect this
                File schemaFile = null; /*ftInfo.getSchemaFile();*/

                try {
                    //Hack here, schemaFile should not be null, but it is
                    //when a fType is first created, since we only add the
                    //schemaFile param to dto on a load.  This should be
                    //fixed, maybe even have the schema file persist, or at
                    //the very least be present right after creation.
                    if ((schemaFile != null) && schemaFile.exists() && schemaFile.canRead()) {
                        generatedType = writeFile(schemaFile);
                    } else {
                        FeatureType ft = ftInfo.getFeatureType();
                        String gType = generateFromSchema(ft);
                        if ((gType != null) && (gType != "")) {
                            generatedType = gType;
                        }
                    }
View Full Code Here

        if (infos.length == 0) {
            return false;
        }

        FeatureTypeInfo first = infos[0];

        for (int i = 0; i < infos.length; i++) {
            FeatureTypeInfo ftInfo = infos[i];

            if (!first.getNamespace().equals(ftInfo.getNamespace())) {
                return false;
            }
        }

        return sameType;
View Full Code Here

        List result = new ArrayList(queries.size());

        try {
            for (int i = 0; (i < queries.size()); i++) {
                DifferenceQueryType query = (DifferenceQueryType) queries.get(i);
                FeatureTypeInfo meta = featureTypeInfo((QName) query.getTypeName());
                FeatureSource<? extends FeatureType, ? extends Feature> source = meta.getFeatureSource(null,null);

                if (!(source instanceof VersioningFeatureSource)) {
                    throw new WFSException("Feature type" + query.getTypeName()
                        + " is not versioned");
                }
View Full Code Here

        return (FeatureDiffReader[]) result.toArray(new FeatureDiffReader[result.size()]);
    }

    FeatureTypeInfo featureTypeInfo(QName name) throws WFSException, IOException {
        FeatureTypeInfo meta = catalog.getFeatureTypeByName(name.getNamespaceURI(), name.getLocalPart());

        if (meta == null) {
            String msg = "Could not locate " + name + " in catalog.";
            throw new WFSException(msg);
        }
View Full Code Here

        // check it's built as expected
        // LINES is a feature type with a native SRS, so we want the bounds to be there
        Catalog cat = getCatalog();
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(cat.getDataStoreByName(MockData.BRIDGES.getPrefix()));
        FeatureTypeInfo fti = cb.buildFeatureType(toName(MockData.BRIDGES));
       
        // perform basic checks, this has no srs so no lat/lon bbox computation possible
        assertNull(fti.getSRS());
        assertNull(fti.getNativeCRS());
        assertNull(fti.getNativeBoundingBox());
        assertNull(fti.getLatLonBoundingBox());
       
        // force bounds computation
        cb.setupBounds(fti);
        assertNotNull(fti.getNativeBoundingBox());
        assertNull(fti.getNativeBoundingBox().getCoordinateReferenceSystem());
        assertNull(fti.getLatLonBoundingBox());
    }
View Full Code Here

        assertEquals(5, featureMembers.getLength());
    }
   
    public void testLocalMax() throws Exception {
        // setup different max on local
        FeatureTypeInfo info = getFeatureTypeInfo(MockData.FIFTEEN );
        info.setMaxFeatures(3);
        catalog.save( info );
       
        // fifteen has 15 elements, but global max is 5 and local is 3
        Document doc = getAsDOM("wfs?request=GetFeature&typename=cdf:Fifteen" +
            "&version=1.0.0&service=wfs");
View Full Code Here

        assertEquals(3, featureMembers.getLength());
    }
   
    public void testLocalMaxBigger() throws Exception {
        // setup different max on local
        FeatureTypeInfo info = getFeatureTypeInfo(MockData.FIFTEEN);
        info.setMaxFeatures(10);
        catalog.save( info );
       
        // fifteen has 15 elements, but global max is 5 and local is 10
        Document doc = getAsDOM("wfs?request=GetFeature&typename=cdf:Fifteen" +
            "&version=1.0.0&service=wfs");
View Full Code Here

        assertEquals(5, featureMembers.getLength());
    }
   
    public void testCombinedLocalMaxes() throws Exception {
        // fifteen has 15 features, basic polygons 3
        FeatureTypeInfo info = getFeatureTypeInfo(MockData.FIFTEEN);
        info.setMaxFeatures(2);
        catalog.save( info );
       
        info = getFeatureTypeInfo(MockData.BASIC_POLYGONS);
        info.setMaxFeatures(2);
        catalog.save( info );
       
        Document doc = getAsDOM("wfs?request=GetFeature&typename=cdf:Fifteen,cite:BasicPolygons" +
            "&version=1.0.0&service=wfs");
        assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.FeatureTypeInfo

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.