Author: desruisseaux
Date: Tue Dec 10 04:55:11 2013
New Revision: 1549758
URL: http://svn.apache.org/r1549758
Log:
Adjust the GML version number when the namespace changed (was GML 3.2.1).
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java?rev=1549758&r1=1549757&r2=1549758&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
[UTF-8] Tue Dec 10 04:55:11 2013
@@ -23,7 +23,6 @@ import org.opengis.temporal.Instant;
import org.opengis.temporal.TemporalPrimitive;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.XmlUtilities;
-import org.apache.sis.internal.jaxb.LegacyNamespaces;
import org.apache.sis.internal.jaxb.gco.PropertyType;
import org.apache.sis.internal.util.TemporalUtilities;
import org.apache.sis.util.resources.Errors;
@@ -77,17 +76,6 @@ public final class TM_Primitive extends
}
/**
- * Returns {@code true} if the user asked to format a GML 3.2 document, or {@code false}
for GML 3.1 or older.
- * The only difference managed by this class is the namespace.
- *
- * <p>This method will be removed in a future SIS version if we find a better way
to support evolution
- * of GML schemas.</p>
- */
- private static boolean isGML32() {
- return Context.isGMLVersion(Context.current(), LegacyNamespaces.VERSION_3_2);
- }
-
- /**
* Returns the {@code TimePeriod} generated from the metadata value.
* This method is systematically called at marshalling-time by JAXB.
*
@@ -95,7 +83,7 @@ public final class TM_Primitive extends
*/
@XmlElement(name = "TimePeriod")
public TimePeriod getTimePeriod() {
- if (!skip() && isGML32()) {
+ if (!skip()) {
final TemporalPrimitive metadata = this.metadata;
if (metadata instanceof Period) {
return new TimePeriod((Period) metadata);
@@ -112,7 +100,7 @@ public final class TM_Primitive extends
*/
@XmlElement(name = "TimeInstant")
public TimeInstant getTimeInstant() {
- if (!skip() && isGML32()) {
+ if (!skip()) {
final TemporalPrimitive metadata = this.metadata;
if (metadata instanceof Instant) {
return new TimeInstant((Instant) metadata);
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java?rev=1549758&r1=1549757&r2=1549758&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
[UTF-8] Tue Dec 10 04:55:11 2013
@@ -37,6 +37,13 @@ public final class LegacyNamespaces {
VERSION_3_2 = new Version("3.2");
/**
+ * First GML version of the new {@code xmlns}.
+ * GML 3.2.0 schemas are defined in the namespace {@code http://www.opengis.net/gml}
whereas
+ * GML 3.2.1 schemas are defined in the namespace {@code http://www.opengis.net/gml/3.2}.
+ */
+ public static final Version VERSION_3_2_1 = new Version("3.2.1");
+
+ /**
* The {@value} URL, which was used for all GML versions before 3.2.
* This URL should not be used in JAXB annotations, even if the annotated element is
really for that
* legacy GML version. Instead, namespace replacements are applied on-the-fly at marshalling
time.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1549758&r1=1549757&r2=1549758&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8]
(original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8]
Tue Dec 10 04:55:11 2013
@@ -259,7 +259,7 @@ abstract class Pooled {
case 0: {
// Apply namespace replacements only for older versions than the one supported
natively by SIS.
if (gmlVersion != null) {
- if (gmlVersion.compareTo(LegacyNamespaces.VERSION_3_2, 2) < 0) {
+ if (gmlVersion.compareTo(LegacyNamespaces.VERSION_3_2_1, 2) < 0) {
return FilterVersion.GML31;
}
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1549758&r1=1549757&r2=1549758&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Tue
Dec 10 04:55:11 2013
@@ -147,10 +147,11 @@ public final class XML extends Static {
/**
* Specifies the GML version of the document to be marshalled or unmarshalled.
- * The GML version may affect the set of XML elements to be marshalled.
- * Newer versions typically have more elements, but not always.
- * For example in {@code gml:VerticalDatum}, the {@code gml:verticalDatumType} property
- * presents in GML 3.0 and 3.1 has been removed in GML 3.2.
+ * The GML version may affect the set of XML elements to be marshalled and their namespaces.
+ *
+ * {@note Newer versions typically have more elements, but not always.
+ * For example in <code>gml:VerticalDatum</code>, the <code>gml:verticalDatumType</code>
property
+ * presents in GML 3.0 and 3.1 has been removed in GML 3.2.}
*
* <p>The value can be {@link String} or {@link Version} objects.
* If no version is specified, then the most recent GML version is assumed.</p>
|