/** * Creates a new configuration. * * @generated */ public WFSVConfiguration(Data catalog, FeatureTypeSchemaBuilder schemaBuilder) { super(catalog, schemaBuilder); addDependency(new WFSConfiguration(catalog, schemaBuilder)); }
public WFSConfiguration( GeoServer geoServer, FeatureTypeSchemaBuilder schemaBuilder, final WFS wfs) { super(wfs); this.catalog = geoServer.getCatalog(); this.schemaBuilder = schemaBuilder; addDependency(new OGCConfiguration()); addDependency(new OWSConfiguration()); addDependency(new GMLConfiguration()); // OGC and OWS add two extra GML configurations in the mix, make sure to configure them // all... CurvedGeometryFactory gf = new CurvedGeometryFactory(Double.MAX_VALUE); for (Object configuration : allDependencies()) { if (configuration instanceof GMLConfiguration) { GMLConfiguration gml = (GMLConfiguration) configuration; gml.setGeometryFactory(gf); } } }
public void configureContext(MutablePicoContainer context) { super.configureContext(context); context.registerComponentInstance(WfsvFactory.eINSTANCE); context.registerComponentInstance(new VersionedFeaturePropertyExtractor(catalog)); } }
WFSConfiguration configuration() { FeatureTypeSchemaBuilder sb = new FeatureTypeSchemaBuilder.GML3(getGeoServer()); return new WFSConfiguration(getGeoServer(), sb, new WFS(sb)); }
protected void configureContext(MutablePicoContainer context) { super.configureContext(context); context.registerComponentInstance(WfsFactory.eINSTANCE); context.registerComponentInstance(new WFSHandlerFactory(catalog, schemaBuilder)); context.registerComponentInstance(catalog); context.registerComponentImplementation(PropertyTypePropertyExtractor.class); context.registerComponentInstance(getSrsSyntax()); // seed the cache with entries from the catalog context.registerComponentInstance( FeatureTypeCache.class, new CatalogFeatureTypeCache(getCatalog())); context.registerComponentInstance(new CurvedGeometryFactory(Double.MAX_VALUE)); }
NameSpaceInfo[] namespaces = configuration.getCatalog().getNameSpaces(); for ( int i = 0; i < namespaces.length; i++) { if ( namespaces[i].isDefault() )
configuration.getProperties().remove(GMLConfiguration.NO_FEATURE_BOUNDS); } else { configuration.getProperties().add(GMLConfiguration.NO_FEATURE_BOUNDS); configuration.getProperties().add(GMLConfiguration.NO_SRS_DIMENSION); } else { configuration.getProperties().remove(GMLConfiguration.NO_SRS_DIMENSION); configuration.getProperties().add(GMLConfiguration.OPTIMIZED_ENCODING); } else { configuration.getProperties().remove(GMLConfiguration.OPTIMIZED_ENCODING); configuration.setSrsSyntax( wfs.getGML().get(WFSInfo.Version.V_11).getSrsNameStyle().toSrsSyntax()); configuration.getProperties().add(GMLConfiguration.ENCODE_FEATURE_MEMBER); } else { configuration.getProperties().remove(GMLConfiguration.ENCODE_FEATURE_MEMBER);
void write1_1(LockFeatureResponseType lockResponse, OutputStream output, Operation operation) throws IOException { Encoder encoder = new Encoder(configuration, configuration.schema()); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); LockFeatureType req = (LockFeatureType) operation.getParameters()[0]; encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, buildSchemaURL(req.getBaseUrl(), "schemas/wfs/1.1.0/wfs.xsd")); encoder.encode(lockResponse, org.geoserver.wfs.xml.v1_1_0.WFS.LOCKFEATURERESPONSE, output); output.flush(); } }
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); } }
GML3OutputFormat producer() { FeatureTypeSchemaBuilder sb = new FeatureTypeSchemaBuilder.GML3(getGeoServer()); WFSConfiguration configuration = new WFSConfiguration(getGeoServer(), sb, new WFS(sb)); return new GML3OutputFormat(getGeoServer(), configuration); }
public void v_1_1(TransactionResponseType response, OutputStream output, Operation operation) throws IOException, ServiceException { 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().getSettings().getCharset())); TransactionType req = (TransactionType) operation.getParameters()[0]; encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, buildSchemaURL(req.getBaseUrl(), "wfs/1.1.0/wfs.xsd")); encoder.encode(response, org.geoserver.wfs.xml.v1_1_0.WFS.TRANSACTIONRESPONSE, output); } }
@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()); }