From 51e8fc651e22c8ac9f8d2b44dc8dc79df38ccbac Mon Sep 17 00:00:00 2001 From: switzc Date: Wed, 9 Dec 2020 16:24:57 +0100 Subject: [PATCH] [GML_322_support] add GML 3.2.2 support --- .../types/AppSchemaGeometryHierarchy.java | 3 ++- .../filter/function/ParameterType.java | 7 +++++- .../java/org/deegree/gml/GMLStreamReader.java | 3 ++- .../java/org/deegree/gml/GMLStreamWriter.java | 21 ++++++++++++++++-- .../main/java/org/deegree/gml/GMLVersion.java | 8 +++++-- .../gml/commons/AbstractGMLObjectReader.java | 6 ++--- .../gml/geometry/GML3GeometryWriter.java | 19 +++++++++++----- .../deegree/gml/props/GMLStdPropsReader.java | 1 + .../deegree/gml/props/GMLStdPropsWriter.java | 1 + .../gml/schema/GMLAppSchemaWriter.java | 1 + .../deegree/gml/schema/GMLSchemaInfoSet.java | 5 ++++- .../org/deegree/gml/VersionFromMimeTest.java | 22 +++++++++++++++++-- .../gml/feature/GMLFeatureWriterTest.java | 1 - .../reader/GmlTimePositionTypeReaderTest.java | 1 - .../serializing/FeatureInfoGmlWriter.java | 3 +++ .../services/wfs/TransactionHandler.java | 8 ++----- .../services/wfs/WebFeatureService.java | 21 +++++++++++------- .../request/AbstractGmlRequestHandler.java | 5 +++-- .../GmlDescribeFeatureTypeHandler.java | 6 +++-- .../gml/request/GmlGetFeatureHandler.java | 6 +++-- .../gml/request/GmlGetGmlObjectHandler.java | 1 + 21 files changed, 108 insertions(+), 41 deletions(-) diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/feature/types/AppSchemaGeometryHierarchy.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/feature/types/AppSchemaGeometryHierarchy.java index 46a76e64d4..970c658e5f 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/feature/types/AppSchemaGeometryHierarchy.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/feature/types/AppSchemaGeometryHierarchy.java @@ -36,6 +36,7 @@ package org.deegree.feature.types; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import java.util.HashSet; import java.util.Set; @@ -119,7 +120,7 @@ public class AppSchemaGeometryHierarchy { } private QName getAbstractElementName( String localPart, GMLVersion version ) { - if ( version == GML_32 ) { + if ( version == GML_32 || version == GML_322 ) { return new QName( version.getNamespace(), "Abstract" + localPart ); } return new QName( version.getNamespace(), "_" + localPart ); diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/function/ParameterType.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/function/ParameterType.java index 698a0d9439..15eddd6a71 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/function/ParameterType.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/function/ParameterType.java @@ -42,6 +42,7 @@ import static org.deegree.gml.GMLVersion.GML_30; import static org.deegree.gml.GMLVersion.GML_31; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import java.util.HashMap; import java.util.Map; @@ -64,11 +65,13 @@ public class ParameterType { public static final ParameterType GEOMETRY = new ParameterType( new QName( GMLNS, "_Geometry", "gml" ), new QName( GMLNS, "_Geometry", "gml" ), new QName( GMLNS, "_Geometry", "gml" ), + new QName( GML3_2_NS, "AbstractGeometry", "gml32" ), new QName( GML3_2_NS, "AbstractGeometry", "gml32" ) ); public static final ParameterType POINT = new ParameterType( new QName( GMLNS, "Point", "gml" ), new QName( GMLNS, "Point", "gml" ), new QName( GMLNS, "Point", "gml" ), + new QName( GML3_2_NS, "Point", "gml32" ), new QName( GML3_2_NS, "Point", "gml32" ) ); public static final ParameterType STRING = new ParameterType( new QName( XSNS, "string", "xsd" ) ); @@ -88,13 +91,15 @@ public ParameterType( QName name ) { versionToName.put( GML_30, name ); versionToName.put( GML_31, name ); versionToName.put( GML_32, name ); + versionToName.put( GML_322, name ); } - public ParameterType( QName gml2Name, QName gml30Name, QName gml31Name, QName gml32Name ) { + public ParameterType( QName gml2Name, QName gml30Name, QName gml31Name, QName gml32Name, QName gml322Name ) { versionToName.put( GML_2, gml2Name ); versionToName.put( GML_30, gml30Name ); versionToName.put( GML_31, gml31Name ); versionToName.put( GML_32, gml32Name ); + versionToName.put( GML_322, gml322Name ); } /** diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamReader.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamReader.java index 2fd0dee1f8..cd95a7d831 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamReader.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamReader.java @@ -470,7 +470,8 @@ public GMLGeometryReader getGeometryReader() { } case GML_30: case GML_31: - case GML_32: { + case GML_32: + case GML_322: { geometryReader = new GML3GeometryReader( this ); break; } diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamWriter.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamWriter.java index b5eb32c486..1ae4f07130 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamWriter.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLStreamWriter.java @@ -44,6 +44,7 @@ import static org.deegree.feature.property.ExtraProps.EXTRA_PROP_NS_GEOMETRY; import static org.deegree.feature.property.ExtraProps.EXTRA_PROP_NS_STRING; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import java.util.HashMap; import java.util.List; @@ -134,7 +135,7 @@ public class GMLStreamWriter { this.xmlStream = xmlStream; referenceExportStrategy = new DefaultGmlXlinkStrategy( "#{}", new GmlXlinkOptions() ); prefixToNs.put( "ogc", OGCNS ); - prefixToNs.put( "gml", version != GML_32 ? GMLNS : GML3_2_NS ); + prefixToNs.put( "gml", !isVersionOfGML32( version ) ? GMLNS : GML3_2_NS ); prefixToNs.put( "xlink", XLNNS ); prefixToNs.put( "xsi", XSINS ); prefixToNs.put( "dxtra", EXTRA_PROP_NS ); @@ -142,6 +143,21 @@ public class GMLStreamWriter { prefixToNs.put( "dxtra-geometry", EXTRA_PROP_NS_GEOMETRY ); } + /** + * Returns if a version is of GML 3.2. + * + * @param version + * GML version of the output, must not be null + * + * @return true, if version is 3.2.1 or 3.2.2, false otherwise + */ + private boolean isVersionOfGML32( GMLVersion version ) { + if ( version == GML_32 || version == GML_322 ){ + return true; + } + return false; + } + /** * Returns the GML version of the generated output. * @@ -413,7 +429,8 @@ public GMLGeometryWriter getGeometryWriter() { } case GML_30: case GML_31: - case GML_32: { + case GML_32: + case GML_322: { geometryWriter = new GML3GeometryWriter( this ); break; } diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLVersion.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLVersion.java index 03c8f998aa..4efd15e78a 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLVersion.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/GMLVersion.java @@ -58,8 +58,10 @@ public enum GMLVersion { GML_30( GMLNS, "3.0", "3.0.1" ), /** GML 3.1 versions (either 3.1.0 or 3.1.1) */ GML_31( GMLNS, "3.1", "3.1.1" ), - /** GML 3.2 versions (3.2.1) */ - GML_32( GML3_2_NS, "3.2", "3.2.1" ); + /** GML 3.2.1 versions (3.2.1) */ + GML_32( GML3_2_NS, "3.2", "3.2.1" ), + /** GML 3.2.2 versions (3.2.2) */ + GML_322( GML3_2_NS, "3.2", "3.2.2" ); private final String ns; @@ -141,6 +143,8 @@ public static GMLVersion fromMimeType( String mimeType, GMLVersion defaultVersio result = GML_31; } else if ( v.compareTo( new Version( 3, 2, 1 ) ) <= 0 ) { result = GML_32; + } else if ( v.compareTo( new Version( 3, 2, 2 ) ) <= 0 ) { + result = GML_322; } } } diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/commons/AbstractGMLObjectReader.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/commons/AbstractGMLObjectReader.java index 153e42a27f..6d32cbf439 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/commons/AbstractGMLObjectReader.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/commons/AbstractGMLObjectReader.java @@ -51,9 +51,7 @@ import static org.deegree.commons.xml.stax.XMLStreamUtils.nextElement; import static org.deegree.commons.xml.stax.XMLStreamUtils.require; import static org.deegree.commons.xml.stax.XMLStreamUtils.skipElement; -import static org.deegree.gml.GMLVersion.GML_2; -import static org.deegree.gml.GMLVersion.GML_30; -import static org.deegree.gml.GMLVersion.GML_31; +import static org.deegree.gml.GMLVersion.GML_32; import java.util.ArrayList; import java.util.Collections; @@ -204,7 +202,7 @@ private boolean isGmlIdRequired() { if ( gmlStreamReader.getLaxMode() ) { return false; } - return version != GML_2 && version != GML_30 || version != GML_31; + return version == GML_32; } private void checkValidNcName( final String gmlId ) { diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/geometry/GML3GeometryWriter.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/geometry/GML3GeometryWriter.java index b3943467c2..3f72579dbf 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/geometry/GML3GeometryWriter.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/geometry/GML3GeometryWriter.java @@ -41,6 +41,7 @@ import static org.deegree.geometry.Geometry.GeometryType.ENVELOPE; import static org.deegree.gml.GMLVersion.GML_30; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import java.util.List; import java.util.UUID; @@ -119,6 +120,7 @@ import org.deegree.geometry.refs.GeometryReference; import org.deegree.geometry.standard.curvesegments.AffinePlacement; import org.deegree.gml.GMLStreamWriter; +import org.deegree.gml.GMLVersion; import org.deegree.gml.commons.AbstractGMLObjectWriter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -261,7 +263,7 @@ public void exportMultiGeometry( MultiGeometry geometry ) break; } case MULTI_LINE_STRING: { - if ( version == GML_32 ) { + if ( isGML32version( version ) ) { // GML 3.2 does not define MultiLineString anymore -> export as MultiCurve MultiCurve multiCurve = (MultiCurve) geometry; startGeometry( "MultiCurve", geometry ); @@ -308,7 +310,7 @@ public void exportMultiGeometry( MultiGeometry geometry ) writer.writeEndElement(); // MultiPoint break; case MULTI_POLYGON: - if ( version == GML_32 ) { + if ( isGML32version( version ) ) { // GML 3.2 does not define MultiPolygon anymore -> export as MultiSurface MultiSurface multiSurface = (MultiSurface) geometry; startGeometry( "MultiSurface", geometry ); @@ -743,7 +745,7 @@ public void exportRing( Ring ring ) switch ( ring.getRingType() ) { case Ring: - if ( GML_32 != version ) { + if ( !isGML32version( version ) ) { startGeometry( "Ring", ring ); } else { // in GML 3.2, a Ring is not a Geometry object @@ -760,7 +762,7 @@ public void exportRing( Ring ring ) case LinearRing: LinearRing linearRing = (LinearRing) ring; - if ( GML_32 != version ) { + if ( !isGML32version( version ) ) { startGeometry( "LinearRing", linearRing ); } else { // in GML 3.2, a LinearRing is not a Geometry object @@ -774,6 +776,13 @@ public void exportRing( Ring ring ) } } + private boolean isGML32version( GMLVersion version ) { + if ( version == GML_32 || version == GML_322 ) { + return true; + } + return false; + } + /** * Exporting a composite curve via the XMLStreamWriter given when the class was constructed * @@ -1561,7 +1570,7 @@ private void startGeometry( String localName, Geometry geometry ) referenceExportStrategy.addExportedId( geometry.getId() ); writeAttributeWithNS( gmlNs, "id", geometry.getId() ); } else if ( version == GML_32 && geometry.getId() == null ) { - // in GML 3.2, a gml:id is required for every geometry + // Only in GML 3.2.1, a gml:id is required for every geometry writeAttributeWithNS( gmlNs, "id", "GEOMETRY_" + generateNewId() ); } diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsReader.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsReader.java index e8dc1d9ff1..724713a281 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsReader.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsReader.java @@ -104,6 +104,7 @@ public GMLStdProps read( XMLStreamReader xmlStream ) props = readGML31( xmlStream ); break; case GML_32: + case GML_322: props = readGML32( xmlStream ); break; } diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsWriter.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsWriter.java index 1c1e0ff2f7..b33279356b 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsWriter.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/props/GMLStdPropsWriter.java @@ -95,6 +95,7 @@ public void write( GMLStdProps props ) writeGML3( props ); break; case GML_32: + case GML_322: writeGML32( props ); break; } diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/schema/GMLAppSchemaWriter.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/schema/GMLAppSchemaWriter.java index 636955a880..1c6766944a 100644 --- a/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/schema/GMLAppSchemaWriter.java +++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/gml/schema/GMLAppSchemaWriter.java @@ -231,6 +231,7 @@ public GMLAppSchemaWriter( GMLVersion version, String targetNamespace, Map featureDecls = getFeatureElementDeclarations( null, false ); fcDecls = new ArrayList(); for ( XSElementDeclaration featureDecl : featureDecls ) { @@ -304,6 +306,7 @@ private void init( GMLVersion version ) { } break; } + } for ( XSElementDeclaration elemDecl : ftDecls ) { QName name = new QName( elemDecl.getNamespace(), elemDecl.getName() ); diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/VersionFromMimeTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/VersionFromMimeTest.java index 12c6f43db9..ae47864ac3 100644 --- a/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/VersionFromMimeTest.java +++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/VersionFromMimeTest.java @@ -40,6 +40,9 @@ import static junit.framework.Assert.assertEquals; import static org.deegree.gml.GMLVersion.fromMimeType; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; import org.junit.Test; @@ -105,17 +108,32 @@ public void gml3_2_0() { } @Test - public void gml3_2_1() { + public void gml3_2() { assertEquals( GMLVersion.GML_32, fromMimeType( "text/xml; subtype=gml/3.2.1", null ) ); } + @Test + public void gml3_2_2() { + assertEquals( GMLVersion.GML_322, fromMimeType( "text/xml; subtype=gml/3.2.2", null ) ); + } + + @Test + public void subtypeGML3_2_1shouldNotMatchGMLVersion322() { + assertThat( GMLVersion.GML_322, is( not( fromMimeType( "text/xml; subtype=gml/3.2.1", null ) ) ) ); + } + + @Test + public void subtypeGML3_2_2shouldNotMatchGMLVersion32() { + assertThat( GMLVersion.GML_32, is( not( fromMimeType( "text/xml; subtype=gml/3.2.2", null ) ) ) ); + } + @Test public void noGML() { assertEquals( null, fromMimeType( "text/xml", null ) ); } @Test - public void multipleSubtypes() { + public void multipleSubtypesGML32() { assertEquals( GMLVersion.GML_32, fromMimeType( "text/xml; subtype=gml/3.2; subtype=gml/3.2.1", null ) ); } diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/feature/GMLFeatureWriterTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/feature/GMLFeatureWriterTest.java index 28da6a1515..fe8d281e30 100644 --- a/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/feature/GMLFeatureWriterTest.java +++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/gml/feature/GMLFeatureWriterTest.java @@ -52,7 +52,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URL; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/time/gml/reader/GmlTimePositionTypeReaderTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/time/gml/reader/GmlTimePositionTypeReaderTest.java index c81fe3e0be..a8eb7d31de 100644 --- a/deegree-core/deegree-core-base/src/test/java/org/deegree/time/gml/reader/GmlTimePositionTypeReaderTest.java +++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/time/gml/reader/GmlTimePositionTypeReaderTest.java @@ -49,7 +49,6 @@ import org.deegree.gml.GMLInputFactory; import org.deegree.gml.GMLStreamReader; -import org.deegree.time.gml.reader.GmlTimePositionTypeReader; import org.deegree.time.position.TimePosition; import org.junit.Test; diff --git a/deegree-core/deegree-core-featureinfo/src/main/java/org/deegree/featureinfo/serializing/FeatureInfoGmlWriter.java b/deegree-core/deegree-core-featureinfo/src/main/java/org/deegree/featureinfo/serializing/FeatureInfoGmlWriter.java index 9f100b0f91..c93381c8ac 100644 --- a/deegree-core/deegree-core-featureinfo/src/main/java/org/deegree/featureinfo/serializing/FeatureInfoGmlWriter.java +++ b/deegree-core/deegree-core-featureinfo/src/main/java/org/deegree/featureinfo/serializing/FeatureInfoGmlWriter.java @@ -211,6 +211,9 @@ public void serialize( FeatureInfoParams params, FeatureInfoContext context ) if ( format.endsWith( "3.2" ) || format.endsWith( "3.2.1" ) ) { gmlVersion = GMLVersion.GML_32; } + if ( format.endsWith( "3.2.2" ) ) { + gmlVersion = GMLVersion.GML_322; + } GMLStreamWriter gmlWriter = GMLOutputFactory.createGMLStreamWriter( gmlVersion, xmlWriter ); gmlWriter.setOutputCrs( params.getCrs() ); diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java index 9f1092e381..52c90a8520 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java @@ -48,7 +48,6 @@ import static org.deegree.commons.xml.CommonNamespaces.XLNNS; import static org.deegree.commons.xml.XMLAdapter.writeElement; import static org.deegree.commons.xml.stax.XMLStreamUtils.skipElement; -import static org.deegree.feature.Features.findFeaturesAndGeometries; import static org.deegree.gml.GMLInputFactory.createGMLStreamReader; import static org.deegree.gml.GMLVersion.GML_32; import static org.deegree.protocol.wfs.WFSConstants.VERSION_100; @@ -68,11 +67,9 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Set; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; @@ -114,8 +111,6 @@ import org.deegree.filter.IdFilter; import org.deegree.filter.OperatorFilter; import org.deegree.filter.expression.ValueReference; -import org.deegree.geometry.Envelope; -import org.deegree.geometry.Geometry; import org.deegree.geometry.GeometryFactory; import org.deegree.geometry.SimpleGeometryFactory; import org.deegree.geometry.validation.CoordinateValidityInspector; @@ -124,7 +119,6 @@ import org.deegree.gml.GMLVersion; import org.deegree.gml.feature.GMLFeatureReader; import org.deegree.gml.reference.FeatureReference; -import org.deegree.gml.reference.matcher.ReferencePatternMatcher; import org.deegree.protocol.wfs.transaction.ReleaseAction; import org.deegree.protocol.wfs.transaction.Transaction; import org.deegree.protocol.wfs.transaction.TransactionAction; @@ -911,6 +905,8 @@ private GMLVersion determineFormat( Version requestVersion, String format ) { gmlVersion = GMLVersion.GML_31; } else if ( "text/xml; subtype=gml/3.2.1".equals( format ) ) { gmlVersion = GMLVersion.GML_32; + } else if ( "text/xml; subtype=gml/3.2.2".equals( format ) ) { + gmlVersion = GMLVersion.GML_322; } } return gmlVersion; diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/WebFeatureService.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/WebFeatureService.java index b6e62d7a52..bec98255e5 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/WebFeatureService.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/WebFeatureService.java @@ -187,6 +187,7 @@ import static org.deegree.gml.GMLVersion.GML_30; import static org.deegree.gml.GMLVersion.GML_31; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import static org.deegree.protocol.wfs.WFSConstants.VERSION_100; import static org.deegree.protocol.wfs.WFSConstants.VERSION_110; import static org.deegree.protocol.wfs.WFSConstants.VERSION_200; @@ -216,13 +217,13 @@ *
  • 2.0.0
  • * *

    - * + * * @see AbstractOWS * @see OGCFrontController - * + * * @author Markus Schneider * @author last edited by: $Author: mschneider $ - * + * * @version $Revision: 15339 $, $Date: 2008-12-11 18:40:09 +0100 (Do, 11 Dez 2008) $ */ public class WebFeatureService extends AbstractOWS { @@ -549,8 +550,10 @@ private void initFormats( List> format GML_31 ); org.deegree.services.wfs.format.gml.GmlFormat gml32 = new org.deegree.services.wfs.format.gml.GmlFormat( this, - GML_32 ); + org.deegree.services.wfs.format.gml.GmlFormat gml322 = new org.deegree.services.wfs.format.gml.GmlFormat( + this, + GML_322 ); mimeTypeToFormat.put( "application/gml+xml; version=2.1", gml21 ); mimeTypeToFormat.put( "application/gml+xml; version=3.0", gml30 ); mimeTypeToFormat.put( "application/gml+xml; version=3.1", gml31 ); @@ -559,10 +562,12 @@ private void initFormats( List> format mimeTypeToFormat.put( "text/xml; subtype=gml/3.0.1", gml30 ); mimeTypeToFormat.put( "text/xml; subtype=gml/3.1.1", gml31 ); mimeTypeToFormat.put( "text/xml; subtype=gml/3.2.1", gml32 ); + mimeTypeToFormat.put( "text/xml; subtype=gml/3.2.2", gml322 ); mimeTypeToFormat.put( "text/xml; subtype=\"gml/2.1.2\"", gml21 ); mimeTypeToFormat.put( "text/xml; subtype=\"gml/3.0.1\"", gml30 ); mimeTypeToFormat.put( "text/xml; subtype=\"gml/3.1.1\"", gml31 ); mimeTypeToFormat.put( "text/xml; subtype=\"gml/3.2.1\"", gml32 ); + mimeTypeToFormat.put( "text/xml; subtype=\"gml/3.2.2\"", gml322 ); } else { LOG.debug( "Using customized format configuration." ); for ( JAXBElement formatEl : formatList ) { @@ -701,7 +706,7 @@ public void destroy() { /** * Returns the underlying {@link WfsFeatureStoreManager} instance. - * + * * @return the underlying {@link WfsFeatureStoreManager} */ public WfsFeatureStoreManager getStoreManager() { @@ -1298,7 +1303,7 @@ public int compare( FeatureType ftMd1, FeatureType ftMd2 ) { /** * Returns an XMLStreamWriter for writing an XML response document. - * + * * @param writer * writer to write the XML to, must not be null * @param mimeType @@ -1363,7 +1368,7 @@ private XMLExceptionSerializer getDefaultExceptionSerializer() { /** * Determines the requested output/input format. - * + * * @param requestVersion * version of the WFS request, must not be null * @param format @@ -1459,7 +1464,7 @@ public ReferencePatternMatcher getReferencePatternMatcher() { * {@link OWSException#VERSION_NEGOTIATION_FAILED} -- the latter should only be used for failed GetCapabilities * requests. *

    - * + * * @param requestedVersion * version to be checked, may be null (causes exception) * @return requestedVersion (if it is not null), or highest version supported diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/AbstractGmlRequestHandler.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/AbstractGmlRequestHandler.java index dc7857ed49..587ece1a7f 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/AbstractGmlRequestHandler.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/AbstractGmlRequestHandler.java @@ -42,6 +42,7 @@ import static org.deegree.gml.GMLVersion.GML_2; import static org.deegree.gml.GMLVersion.GML_31; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import static org.deegree.protocol.wfs.WFSConstants.GML32_NS; import static org.deegree.protocol.wfs.WFSConstants.GML32_SCHEMA_URL; import static org.deegree.protocol.wfs.WFSConstants.QUERY_ID_GET_FEATURE_BY_ID; @@ -356,7 +357,7 @@ protected QName determineFeatureMemberElement( Version version ) { memberElementName = new QName( options.getResponseFeatureMemberEl().getNamespaceURI(), options.getResponseFeatureMemberEl().getLocalPart(), options.getResponseFeatureMemberEl().getPrefix() ); - } else if ( gmlVersion == GML_32 ) { + } else if ( gmlVersion == GML_32 || gmlVersion == GML_322 ) { // WFS 1.0.0 / 1.1.0 without custom configured member element, GML 3.2 -> wfs:featureMember memberElementName = new QName( WFS_NS, "member", "wfs" ); } else { @@ -454,7 +455,7 @@ protected String getSchemaLocation( Version version, GMLVersion gmlVersion, QNam try { if ( VERSION_100.equals( version ) && gmlVersion == GML_2 ) { baseUrl.append( "XMLSCHEMA" ); - } else if ( VERSION_200.equals( version ) && gmlVersion == GML_32 ) { + } else if ( VERSION_200.equals( version ) && ( gmlVersion == GML_32 || gmlVersion == GML_322 ) ) { baseUrl.append( URLEncoder.encode( gmlVersion.getMimeType(), "UTF-8" ) ); } else { baseUrl.append( URLEncoder.encode( gmlVersion.getMimeTypeOldStyle(), "UTF-8" ) ); diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlDescribeFeatureTypeHandler.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlDescribeFeatureTypeHandler.java index f202402ea5..4efee228ed 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlDescribeFeatureTypeHandler.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlDescribeFeatureTypeHandler.java @@ -42,6 +42,7 @@ import static org.deegree.commons.xml.CommonNamespaces.XSNS; import static org.deegree.commons.xml.CommonNamespaces.XS_PREFIX; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import static org.deegree.gml.schema.GMLAppSchemaWriter.GML_2_DEFAULT_INCLUDE; import static org.deegree.gml.schema.GMLAppSchemaWriter.GML_30_DEFAULT_INCLUDE; import static org.deegree.gml.schema.GMLAppSchemaWriter.GML_31_DEFAULT_INCLUDE; @@ -396,6 +397,7 @@ private void writeWFSSchema( XMLStreamWriter writer, Version version, GMLVersion writer.writeAttribute( "schemaLocation", GML_31_DEFAULT_INCLUDE ); break; case GML_32: + case GML_322: // there is no abstract FeatureCollection element in GML 3.2 anymore parentElement = GML_PREFIX + ":AbstractFeature"; parentType = GML_PREFIX + ":AbstractFeatureType"; @@ -417,7 +419,7 @@ private void writeWFSSchema( XMLStreamWriter writer, Version version, GMLVersion writer.writeStartElement( XSNS, "extension" ); writer.writeAttribute( "base", parentType ); - if ( GML_32 == gmlVersion ) { + if ( GML_32 == gmlVersion || GML_322 == gmlVersion ) { // in GML 3.2, FeatureCollections are Features with properties that derive // gml:AbstractFeatureMemberType writer.writeStartElement( XSNS, "sequence" ); @@ -450,7 +452,7 @@ private void writeWFSSchema( XMLStreamWriter writer, Version version, GMLVersion writer.writeEndElement(); writer.writeEndElement(); - if ( GML_32 == gmlVersion ) { + if ( GML_32 == gmlVersion || GML_322 == gmlVersion ) { // write wfs:FeaturePropertyType declaration writer.writeStartElement( XSNS, "complexType" ); writer.writeAttribute( "name", "FeaturePropertyType" ); diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java index 122154abac..efd2310557 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java @@ -46,6 +46,7 @@ import static org.deegree.gml.GMLOutputFactory.createGMLStreamWriter; import static org.deegree.gml.GMLVersion.GML_2; import static org.deegree.gml.GMLVersion.GML_32; +import static org.deegree.gml.GMLVersion.GML_322; import static org.deegree.protocol.wfs.WFSConstants.VERSION_100; import static org.deegree.protocol.wfs.WFSConstants.VERSION_110; import static org.deegree.protocol.wfs.WFSConstants.VERSION_200; @@ -248,7 +249,7 @@ public void doGetFeatureResults( GetFeature request, HttpResponseBuffer response // ensure that namespace for gml (e.g. geometry elements) is bound writeNamespaceIfNotBound( xmlStream, "gml", gmlVersion.getNamespace() ); - if ( GML_32 == gmlVersion && !request.getVersion().equals( VERSION_200 ) ) { + if ( ( GML_32 == gmlVersion || GML_322 == gmlVersion ) && !request.getVersion().equals( VERSION_200 ) ) { xmlStream.writeAttribute( "gml", GML3_2_NS, "id", "WFS_RESPONSE" ); } } @@ -640,7 +641,8 @@ private void writeBoundedBy( Version wfsVersion, GMLStreamWriter gmlStream, GMLV xmlStream.writeEndElement(); break; } - case GML_32: { + case GML_32: + case GML_322: { if ( wfsVersion.equals( VERSION_200 ) ) { xmlStream.writeStartElement( "wfs", "boundedBy", GML3_2_NS ); if ( env == null ) { diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetGmlObjectHandler.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetGmlObjectHandler.java index 4fd7849cfb..795457010f 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetGmlObjectHandler.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/format/gml/request/GmlGetGmlObjectHandler.java @@ -142,6 +142,7 @@ public void doGetGmlObject( GetGmlObject request, HttpResponseBuffer response ) schemaLocation = GMLNS + " http://schemas.opengis.net/gml/3.1.1/base/geometryComplexes.xsd"; break; case GML_32: + case GML_322: schemaLocation = GML3_2_NS + " http://schemas.opengis.net/gml/3.2.1/geometryComplexes.xsd"; break; }