sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1547494 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/GM_Object.java sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
Date Tue, 03 Dec 2013 17:40:33 GMT
Author: desruisseaux
Date: Tue Dec  3 17:40:32 2013
New Revision: 1547494

URL: http://svn.apache.org/r1547494
Log:
Patch by Guilhem L├ęgal for supporting geometry objects in the GML 3.1 namespace.
This is hopefully a temporary patch until we find a better way to support evolution of GML
schemas.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/GM_Object.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/GM_Object.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/GM_Object.java?rev=1547494&r1=1547493&r2=1547494&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/GM_Object.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/GM_Object.java
[UTF-8] Tue Dec  3 17:40:32 2013
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.geometry.Geometry;
 import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 
 
 /**
@@ -45,6 +46,13 @@ public class GM_Object extends XmlAdapte
     protected JAXBElement<? extends Geometry> geometry;
 
     /**
+     * Same as {@link #geometry}, but using GML 3.1 namespace.
+     * This is hopefully a temporary patch.
+     */
+    @XmlElementRef(name = "AbstractGeometry", namespace = LegacyNamespaces.GML, type = JAXBElement.class)
+    protected JAXBElement<? extends Geometry> geometry31;
+
+    /**
      * Empty constructor for JAXB and subclasses only.
      */
     public GM_Object() {
@@ -59,7 +67,16 @@ public class GM_Object extends XmlAdapte
      */
     @Override
     public final Geometry unmarshal(final GM_Object value) {
-        return (value != null) ? value.geometry.getValue() : null;
+        if (value != null) {
+            JAXBElement<? extends Geometry> g = value.geometry;
+            if (g == null) {
+                g = value.geometry31;
+            }
+            if (g != null) {
+                return g.getValue();
+            }
+        }
+        return null;
     }
 
     /**

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=1547494&r1=1547493&r2=1547494&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  3 17:40:32 2013
@@ -20,6 +20,8 @@ package org.apache.sis.internal.jaxb;
 /**
  * Legacy XML namespaces.
  * This class is hopefully temporary, if we can find a way to share the same Java classes
between different versions.
+ * If such better way is found, then every classes, methods and fields having a JAXB annotation
using this namespace
+ * should be deleted.
  *
  * @author  Guilhem Legal (Geomatys)
  * @since   0.4



Mime
View raw message