sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1820024 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/ sis-utility/src/main/resources/org/apache/sis/xml/
Date Thu, 04 Jan 2018 00:07:15 GMT
Author: desruisseaux
Date: Thu Jan  4 00:07:15 2018
New Revision: 1820024

URL: http://svn.apache.org/viewvc?rev=1820024&view=rev
Log:
Adaptation of commit 0f574678f26d320e619831b29086e0167f7ffec5 from Image Matter
(update classes in lineage package)

The project at this revision can be built but is known to have test failures.
Tests will pass only after we completed the port of all ISO 19115-3 work.

Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java?rev=1820024&r1=1820023&r2=1820024&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
[UTF-8] Thu Jan  4 00:07:15 2018
@@ -27,11 +27,11 @@ import org.apache.sis.internal.jaxb.meta
  * package documentation for more information about JAXB and interface.
  *
  * @author  Guilhem Legal (Geomatys)
- * @version 0.4
+ * @version 1.0
  * @since   0.3
  * @module
  */
-public final class RS_ReferenceSystem extends PropertyType<RS_ReferenceSystem, ReferenceSystem>
{
+public class RS_ReferenceSystem extends PropertyType<RS_ReferenceSystem, ReferenceSystem>
{
     /**
      * Empty constructor for JAXB only.
      */
@@ -46,7 +46,7 @@ public final class RS_ReferenceSystem ex
      * @return {@code ReferenceSystem.class}
      */
     @Override
-    protected Class<ReferenceSystem> getBoundType() {
+    protected final Class<ReferenceSystem> getBoundType() {
         return ReferenceSystem.class;
     }
 
@@ -79,7 +79,7 @@ public final class RS_ReferenceSystem ex
      * @return the metadata to be marshalled.
      */
     @XmlElementRef
-    public ReferenceSystemMetadata getElement() {
+    public final ReferenceSystemMetadata getElement() {
         final ReferenceSystem metadata = this.metadata;
         if (metadata == null) {
             return null;
@@ -95,7 +95,26 @@ public final class RS_ReferenceSystem ex
      *
      * @param  metadata  the unmarshalled metadata.
      */
-    public void setElement(final ReferenceSystemMetadata metadata) {
+    public final void setElement(final ReferenceSystemMetadata metadata) {
         this.metadata = metadata;
     }
+
+    /**
+     * Wraps the value only if marshalling an element from the ISO 19115:2003 metadata model.
+     * Otherwise (i.e. if marshalling according legacy ISO 19115:2014 model), omits the element.
+     */
+    public static final class Since2014 extends RS_ReferenceSystem {
+        /** Empty constructor used only by JAXB. */
+        public Since2014() {
+        }
+
+        /**
+         * Wraps the given value in an ISO 19115-3 element, unless we are marshalling an
older document.
+         *
+         * @return a non-null value only if marshalling ISO 19115-3 or newer.
+         */
+        @Override protected RS_ReferenceSystem wrap(final ReferenceSystem value) {
+            return accept2014() ? super.wrap(value) : null;
+        }
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java?rev=1820024&r1=1820023&r2=1820024&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
[UTF-8] Thu Jan  4 00:07:15 2018
@@ -38,7 +38,9 @@ import org.apache.sis.metadata.TitleProp
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.metadata.iso.maintenance.DefaultScope;
 import org.apache.sis.metadata.iso.identification.DefaultResolution;
+import org.apache.sis.internal.jaxb.metadata.RS_ReferenceSystem;
 import org.apache.sis.internal.jaxb.metadata.MD_Resolution;
+import org.apache.sis.internal.jaxb.metadata.MD_Scope;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.util.iso.Types;
@@ -88,10 +90,13 @@ import org.apache.sis.xml.Namespaces;
 @XmlType(name = "LI_Source_Type", propOrder = {
     "description",
     "scaleDenominator",             // Legacy ISO 19115:2003
+    "sourceSpatialResolution",      // New in ISO 19115:2014
+    "sourceReferenceSystem",        // New in ISO 19115:2014
     "sourceCitation",
-    "sourceExtents",
+    "sources",                      // New in ISO 19115:2014 (actually "sourceMetadata")
+    "sourceExtents",                // Legacy ISO 19115:2003
+    "scope",                        // New in ISO 19115:2014
     "sourceSteps",
-    "sourceSpatialResolution",      // New in ISO 19115:2014
     "processedLevel",
     "resolution"
 })
@@ -316,11 +321,10 @@ public class DefaultSource extends ISOMe
      * Returns the spatial reference system used by the source data.
      *
      * @return spatial reference system used by the source data, or {@code null}.
-     *
-     * @todo We need to annotate the referencing module before we can annotate this method.
      */
     @Override
-/// @XmlElement(name = "sourceReferenceSystem")
+    @XmlElement(name = "sourceReferenceSystem")
+    @XmlJavaTypeAdapter(RS_ReferenceSystem.Since2014.class)
     public ReferenceSystem getSourceReferenceSystem()  {
         return sourceReferenceSystem;
     }
@@ -364,7 +368,7 @@ public class DefaultSource extends ISOMe
      * @since 0.5
      */
     @Override
-/// @XmlElement(name = "sourceMetadata")
+    // @XmlElement at the end of this class.
     public Collection<Citation> getSourceMetadata() {
         return sourceMetadata = nonNullCollection(sourceMetadata, Citation.class);
     }
@@ -389,7 +393,8 @@ public class DefaultSource extends ISOMe
      * @since 0.5
      */
     @Override
-/// @XmlElement(name = "scope")
+    @XmlElement(name = "scope")
+    @XmlJavaTypeAdapter(MD_Scope.Since2014.class)
     public Scope getScope() {
         return scope;
     }
@@ -419,16 +424,21 @@ public class DefaultSource extends ISOMe
     @XmlElement(name = "sourceExtent")
     @Dependencies("getScope")
     public Collection<Extent> getSourceExtents() {
-        Scope scope = getScope();
-        if (!(scope instanceof DefaultScope)) {
-            if (isModifiable()) {
-                scope = new DefaultScope(scope);
-                this.scope = scope;
-            } else {
-                return Collections.unmodifiableCollection(scope.getExtents());
+        if (FilterByVersion.LEGACY_METADATA.accept()) {
+            Scope scope = getScope();
+            if (scope != null) {
+                if (!(scope instanceof DefaultScope)) {
+                    if (isModifiable()) {
+                        scope = new DefaultScope(scope);
+                        this.scope = scope;
+                    } else {
+                        return Collections.unmodifiableCollection(scope.getExtents());
+                    }
+                }
+                return ((DefaultScope) scope).getExtents();
             }
         }
-        return ((DefaultScope) scope).getExtents();
+        return null;
     }
 
     /**
@@ -511,4 +521,28 @@ public class DefaultSource extends ISOMe
         checkWritePermission();
         resolution = newValue;
     }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                            
     ////////
+    ////////                               XML support with JAXB                        
     ////////
+    ////////                                                                            
     ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if 
     ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB. 
     ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language   
     ////////
+    ////////        (GML) support is not needed.                                        
     ////////
+    ////////                                                                            
     ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Invoked by JAXB at both marshalling and unmarshalling time.
+     * This attribute has been added by ISO 19115:2014 standard.
+     * If (and only if) marshalling an older standard version, we omit this attribute.
+     */
+    @XmlElement(name = "sourceMetadata")
+    private Collection<Citation> getSources() {
+        return FilterByVersion.CURRENT_METADATA.accept() ? getSourceMetadata() : null;
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt?rev=1820024&r1=1820023&r2=1820024&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
[UTF-8] Thu Jan  4 00:07:15 2018
@@ -829,19 +829,27 @@ http://standards.iso.org/iso/19115/-3/mr
     processingInformation
     processor
     rationale
+    reference
     report
+    scope
     source
   LE_Source
     description
     processedLevel
     resolution
     scaleDenominator
+    scope
     sourceCitation
     sourceExtent
+    sourceMetadata
+    sourceReferenceSystem
+    sourceSpatialResolution
     sourceStep
   LI_Lineage
     <type>
+    additionalDocumentation
     processStep
+    scope
     source
     statement
   LI_ProcessStep
@@ -850,13 +858,19 @@ http://standards.iso.org/iso/19115/-3/mr
     description
     processor
     rationale
+    reference
+    scope
     source
   LI_Source
     <type>
     description
     scaleDenominator
+    scope
     sourceCitation
     sourceExtent
+    sourceMetadata
+    sourceReferenceSystem
+    sourceSpatialResolution
     sourceStep
 http://standards.iso.org/iso/19115/-3/mrs/1.0
   MD_ReferenceSystem



Mime
View raw message