protected Encoder createEncoder( Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) { // reuse the WFS configuration feature builder, otherwise build a new one FeatureTypeSchemaBuilder schemaBuilder; if (configuration instanceof WFSConfiguration) { schemaBuilder = ((WFSConfiguration) configuration).getSchemaBuilder(); } else { schemaBuilder = new FeatureTypeSchemaBuilder.GML3(geoServer); } // create this request specific schema ApplicationSchemaXSD1 schema = new ApplicationSchemaXSD1(schemaBuilder); schema.setBaseURL(GetFeatureRequest.adapt(request).getBaseURL()); schema.setResources(resources); if (schema.getFeatureTypes().isEmpty()) { // no feature types so let's use the base WFS schema return new Encoder(configuration, configuration.schema()); } try { // let's just instantiate the encoder return new Encoder(configuration, schema.getSchema()); } catch (IOException exception) { throw new RuntimeException( "Error generating the XSD schema during the encoder instantiation.", exception); } }
public GML3(GeoServer gs) { super(gs); profiles.add(createTypeMappingProfile()); gmlNamespace = org.geotools.gml3.GML.NAMESPACE; gmlSchemaLocation = "gml/3.1.1/base/gml.xsd"; baseType = "AbstractFeatureType"; substitutionGroup = "_Feature"; describeFeatureTypeParams = params("request", "DescribeFeatureType", "version", "1.1.0", "service", "WFS"); gmlPrefix = "gml"; xmlConfiguration = new org.geotools.gml3.GMLConfiguration(); }
protected boolean filterAttributeType(AttributeDescriptor attribute) { return super.filterAttributeType(attribute) || "descriptionReference".equals(attribute.getLocalName()) || "identifier".equals(attribute.getLocalName()); }
public void write(Object value, OutputStream output, Operation describeFeatureType) throws IOException { VersionedDescribeResults results = (VersionedDescribeResults) value; // create the schema DescribeFeatureTypeType req = (DescribeFeatureTypeType) describeFeatureType .getParameters()[0]; String proxifiedBaseUrl = RequestUtils.proxifiedBaseURL(req .getBaseUrl(), wfs.getGeoServer().getProxyBaseUrl()); FeatureTypeSchemaBuilder builder = null; if (results.isVersioned()) { builder = new VersionedSchemaBuilder(wfs, catalog, resourceLoader, configuration); } else { builder = new FeatureTypeSchemaBuilder.GML3(wfs, catalog, resourceLoader); } XSDSchema schema = builder.build(results.getFeatureTypeInfo(), proxifiedBaseUrl); // serialize schema.updateElement(); XSDResourceImpl.serialize(output, schema.getElement()); }
@Test public void testListStoredQueries() throws Exception { MockHttpServletResponse response = getAsServletResponse("wfs?request=ListStoredQueries&service=wfs&version=2.0.0"); Document dom = dom(new ByteArrayInputStream(response.getContentAsByteArray())); XMLAssert.assertXpathExists( "//wfs:StoredQuery[@id = '" + StoredQuery.DEFAULT.getName() + "']", dom); // schema validate the response FeatureTypeSchemaBuilder sb = new FeatureTypeSchemaBuilder.GML3(getGeoServer()); WFSConfiguration configuration = new WFSConfiguration(getGeoServer(), sb, new org.geoserver.wfs.xml.v1_1_0.WFS(sb)); Parser parser = new Parser(configuration); parser.parse(new ByteArrayInputStream(response.getContentAsByteArray())); assertEquals(0, parser.getValidationErrors().size()); }
WFSConfiguration configuration() { FeatureTypeSchemaBuilder sb = new FeatureTypeSchemaBuilder.GML3(getGeoServer()); return new WFSConfiguration(getGeoServer(), sb, new WFS(sb)); }
public V11(GeoServer gs) { super("text/xml; subtype=gml/3.1.1", gs, new FeatureTypeSchemaBuilder.GML3(gs)); } }
protected GML3(FeatureTypeInfo featureType, WFSInfo wfs, Catalog catalog) { super(featureType, wfs, catalog); builder = new FeatureTypeSchemaBuilder.GML3(wfs.getGeoServer()); } }
protected XSDSchema gmlSchema() { if (gml3Schema == null) { gml3Schema = createGml3Schema(); } return gml3Schema; }
GML3OutputFormat producer() { FeatureTypeSchemaBuilder sb = new FeatureTypeSchemaBuilder.GML3(getGeoServer()); WFSConfiguration configuration = new WFSConfiguration(getGeoServer(), sb, new WFS(sb)); return new GML3OutputFormat(getGeoServer(), configuration); }