sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1820232 - 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/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ sis-utility/...
Date Thu, 04 Jan 2018 22:15:34 GMT
Author: desruisseaux
Date: Thu Jan  4 22:15:34 2018
New Revision: 1820232

URL: http://svn.apache.org/viewvc?rev=1820232&view=rev
Log:
Adaptation of commit f0ca202ef911462fbe514e1310050f95e81fdd83 from Image Matter
(update DefaultApplicationSchemaInformation and DefaultExtendedElementInformation)

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/CI_OnlineResource.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.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/CI_OnlineResource.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/CI_OnlineResource.java?rev=1820232&r1=1820231&r2=1820232&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/CI_OnlineResource.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/CI_OnlineResource.java
[UTF-8] Thu Jan  4 22:15:34 2018
@@ -28,11 +28,11 @@ import org.apache.sis.internal.jaxb.gco.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
-public final class CI_OnlineResource extends PropertyType<CI_OnlineResource, OnlineResource>
{
+public class CI_OnlineResource extends PropertyType<CI_OnlineResource, OnlineResource>
{
     /**
      * Empty constructor for JAXB only.
      */
@@ -47,7 +47,7 @@ public final class CI_OnlineResource ext
      * @return {@code OnlineResource.class}
      */
     @Override
-    protected Class<OnlineResource> getBoundType() {
+    protected final Class<OnlineResource> getBoundType() {
         return OnlineResource.class;
     }
 
@@ -78,7 +78,7 @@ public final class CI_OnlineResource ext
      * @return the metadata to be marshalled.
      */
     @XmlElementRef
-    public DefaultOnlineResource getElement() {
+    public final DefaultOnlineResource getElement() {
         return DefaultOnlineResource.castOrCopy(metadata);
     }
 
@@ -87,7 +87,26 @@ public final class CI_OnlineResource ext
      *
      * @param  metadata  the unmarshalled metadata.
      */
-    public void setElement(final DefaultOnlineResource metadata) {
+    public final void setElement(final DefaultOnlineResource 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 CI_OnlineResource {
+        /** 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 CI_OnlineResource wrap(final OnlineResource value) {
+            return accept2014() ? super.wrap(value) : null;
+        }
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java?rev=1820232&r1=1820231&r2=1820232&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
[UTF-8] Thu Jan  4 22:15:34 2018
@@ -19,9 +19,12 @@ package org.apache.sis.metadata.iso;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.metadata.ApplicationSchemaInformation;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.OnlineResource;
+import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
+import org.apache.sis.internal.jaxb.metadata.CI_OnlineResource;
 
 
 /**
@@ -47,7 +50,8 @@ import org.opengis.metadata.citation.Onl
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -56,9 +60,9 @@ import org.opengis.metadata.citation.Onl
     "name",
     "schemaLanguage",
     "constraintLanguage",
-/// "schemaAscii",
-/// "graphicsFile",
-/// "softwareDevelopmentFile",
+    "schemaAscii",
+    "graphicsFile",
+    "softwareDevelopmentFile",
     "softwareDevelopmentFileFormat"
 })
 @XmlRootElement(name = "MD_ApplicationSchemaInformation")
@@ -241,7 +245,8 @@ public class DefaultApplicationSchemaInf
      * @return application schema as an ASCII file, or {@code null}.
      */
     @Override
-/// @XmlElement(name = "schemaAscii")
+    @XmlElement(name = "schemaAscii")
+    @XmlJavaTypeAdapter(CharSequenceAdapter.Since2014.class)
     public CharSequence getSchemaAscii()  {
         return schemaAscii;
     }
@@ -262,7 +267,8 @@ public class DefaultApplicationSchemaInf
      * @return application schema as a graphics file, or {@code null}.
      */
     @Override
-/// @XmlElement(name = "graphicsFile")
+    @XmlElement(name = "graphicsFile")
+    @XmlJavaTypeAdapter(CI_OnlineResource.Since2014.class)
     public OnlineResource getGraphicsFile()  {
         return graphicsFile;
     }
@@ -283,7 +289,8 @@ public class DefaultApplicationSchemaInf
      * @return application schema as a software development file, or {@code null}.
      */
     @Override
-/// @XmlElement(name = "softwareDevelopmentFile")
+    @XmlElement(name = "softwareDevelopmentFile")
+    @XmlJavaTypeAdapter(CI_OnlineResource.Since2014.class)
     public OnlineResource getSoftwareDevelopmentFile()  {
         return softwareDevelopmentFile;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java?rev=1820232&r1=1820231&r2=1820232&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
[UTF-8] Thu Jan  4 22:15:34 2018
@@ -32,6 +32,7 @@ import org.apache.sis.measure.ValueRange
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 
@@ -90,7 +91,7 @@ import static org.apache.sis.internal.me
     "domainValue",
     "parentEntity",
     "rule",
-    "rationales",
+    "rationale",
     "sources"
 })
 @XmlRootElement(name = "MD_ExtendedElementInformation", namespace = Namespaces.MEX)
@@ -307,7 +308,7 @@ public class DefaultExtendedElementInfor
     @Deprecated
     @XmlElement(name = "shortName", namespace = LegacyNamespaces.GMD)
     public String getShortName()  {
-        return shortName;
+        return FilterByVersion.LEGACY_METADATA.accept() ? shortName : null;
     }
 
     /**
@@ -336,7 +337,7 @@ public class DefaultExtendedElementInfor
     @Deprecated
     @XmlElement(name = "domainCode", namespace = LegacyNamespaces.GMD)
     public Integer getDomainCode() {
-        return domainCode;
+        return FilterByVersion.LEGACY_METADATA.accept() ? domainCode : null;
     }
 
     /**
@@ -542,6 +543,7 @@ public class DefaultExtendedElementInfor
      * @since 0.5
      */
     @Override
+    @XmlElement(name = "rationale")
     public InternationalString getRationale() {
         return rationale;
     }
@@ -565,7 +567,6 @@ public class DefaultExtendedElementInfor
      */
     @Override
     @Deprecated
-    @XmlElement(name = "rationale")
     @Dependencies("getRationale")
     public Collection<InternationalString> getRationales() {
         return new AbstractSet<InternationalString>() {

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java?rev=1820232&r1=1820231&r2=1820232&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
[UTF-8] Thu Jan  4 22:15:34 2018
@@ -22,6 +22,7 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.xml.XLink;
 import org.apache.sis.xml.ReferenceResolver;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
 import org.apache.sis.internal.jaxb.gmd.PT_FreeText;
 
@@ -40,7 +41,7 @@ import org.apache.sis.internal.jaxb.gmd.
  * @author  Cédric Briançon (Geomatys)
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @version 1.0
  *
  * @see StringAdapter
  * @see InternationalStringAdapter
@@ -48,11 +49,11 @@ import org.apache.sis.internal.jaxb.gmd.
  * @since 0.3
  * @module
  */
-public final class CharSequenceAdapter extends XmlAdapter<GO_CharacterString, CharSequence>
{
+public class CharSequenceAdapter extends XmlAdapter<GO_CharacterString, CharSequence>
{
     /**
      * Constructor for JAXB only.
      */
-    private CharSequenceAdapter() {
+    public CharSequenceAdapter() {
     }
 
     /**
@@ -63,7 +64,7 @@ public final class CharSequenceAdapter e
      * @return a {@link CharSequence} which represents the metadata value.
      */
     @Override
-    public CharSequence unmarshal(final GO_CharacterString value) {
+    public final CharSequence unmarshal(final GO_CharacterString value) {
         return (value != null) ? value.toCharSequence() : null;
     }
 
@@ -182,4 +183,23 @@ public final class CharSequenceAdapter e
         }
         return string;
     }
+
+    /**
+     * Wraps the value only if marshalling ISO 19115-3 element.
+     * Otherwise (i.e. if marshalling a legacy ISO 19139:2007 document), omit the element.
+     */
+    public static final class Since2014 extends CharSequenceAdapter {
+        /** Empty constructor used only by JAXB. */
+        private 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 public GO_CharacterString marshal(final CharSequence value) {
+            return FilterByVersion.CURRENT_METADATA.accept() ? super.marshal(value) : 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=1820232&r1=1820231&r2=1820232&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 22:15:34 2018
@@ -341,8 +341,11 @@ http://standards.iso.org/iso/19115/-3/md
   MD_ApplicationSchemaInformation
     <type>
     constraintLanguage
+    graphicsFile
     name
+    schemaAscii
     schemaLanguage
+    softwareDevelopmentFile
     softwareDevelopmentFileFormat
   MD_CellGeometryCode
     <type>



Mime
View raw message