sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1823853 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/ sis...
Date Sun, 11 Feb 2018 16:10:12 GMT
Author: desruisseaux
Date: Sun Feb 11 16:10:12 2018
New Revision: 1823853

URL: http://svn.apache.org/viewvc?rev=1823853&view=rev
Log:
Use a different strategy for parsing legacy <gmd:URL> element. Our previous attempt
using 'LegacyURL' class did not worked.
This failure were unoticed because of insuffisient test coverage in DefaultCitationTest.
This new approach handles <gmd:URL> in GO_CharacterString instead (like what we already
do for <gcx:FileName>).

Added:
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_URL.java
      - copied, changed from r1823852, sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyURL.java
Removed:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyURL.java
Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.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/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -203,7 +203,7 @@ public class TM_PeriodDuration extends P
      */
     public static final class Since2014 extends TM_PeriodDuration {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -17,7 +17,6 @@
 package org.apache.sis.metadata.iso.citation;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -25,8 +24,6 @@ import javax.xml.bind.annotation.adapter
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.OnLineFunction;
 import org.opengis.metadata.citation.OnlineResource;
-import org.apache.sis.internal.jaxb.FilterByVersion;
-import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.gco.StringAdapter;
 import org.apache.sis.internal.jaxb.gco.URIAdapter;
 import org.apache.sis.metadata.iso.ISOMetadata;
@@ -60,7 +57,6 @@ import org.apache.sis.metadata.iso.ISOMe
 @SuppressWarnings("CloneableClassWithoutClone")                 // ModifiableMetadata needs
shallow clones.
 @XmlType(name = "CI_OnlineResource_Type", propOrder = {
     "linkage",
-    "linkageURL",               // Legacy ISO 19139:2007 way to format the linkage.
     "protocol",
     "applicationProfile",
     "name",
@@ -268,7 +264,7 @@ public class DefaultOnlineResource exten
      */
     @Override
     @XmlElement(name = "linkage", required = true)
-    @XmlJavaTypeAdapter(URIAdapter.Since2014.class)
+    @XmlJavaTypeAdapter(URIAdapter.AsURL.class)
     public URI getLinkage() {
         return linkage;
     }
@@ -345,37 +341,4 @@ public class DefaultOnlineResource exten
         checkWritePermission();
         protocolRequest = 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 at marshalling time for writing URL as defined by ISO 19139:2007.
-     * That legacy standard wraps the URL in a {@code <gmd:URL>} element.
-     */
-    @XmlElement(name = "linkage", namespace = LegacyNamespaces.GMD)
-    private LegacyURL getLinkageURL() {
-        return FilterByVersion.LEGACY_METADATA.accept() ? LegacyURL.wrap(getLinkage()) :
null;
-    }
-
-    /**
-     * Invoked at ISO 19139:2007 unmarshalling time for storing the value of {@code <gmd:URL>}
element.
-     */
-    @SuppressWarnings("unused")
-    private void setLinkageURL(final LegacyURL newValue) throws URISyntaxException {
-        if (LegacyURL.isNonNull(newValue)) {
-            setLinkage(newValue.unwrap());
-        }
-    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -31,6 +31,7 @@ import org.opengis.metadata.citation.Par
 import org.opengis.metadata.citation.Role;
 import org.opengis.metadata.citation.Responsibility;
 import org.opengis.metadata.citation.OnLineFunction;
+import org.opengis.metadata.citation.OnlineResource;
 import org.opengis.metadata.citation.PresentationForm;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.xml.IdentifierMap;
@@ -282,7 +283,13 @@ public final strictfp class DefaultCitat
 
         final Iterator<Responsibility> it = c.getCitedResponsibleParties().iterator();
         final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, "Maid Marian",
it.next());
-        assertEquals("Contact instruction", "Send carrier pigeon.", contact.getContactInstructions().toString());
+        assertEquals("Contact instruction", "Send carrier pigeon.", String.valueOf(contact.getContactInstructions()));
+
+        final OnlineResource resource = TestUtilities.getSingleton(contact.getOnlineResources());
+        assertEquals("Resource name", "IP over Avian Carriers", String.valueOf(resource.getName()));
+        assertEquals("Resource description", "High delay, low throughput, and low altitude
service.", String.valueOf(resource.getDescription()));
+        assertEquals("Resource linkage", "https://tools.ietf.org/html/rfc1149", String.valueOf(resource.getLinkage()));
+        assertEquals("Resource function", OnLineFunction.OFFLINE_ACCESS, resource.getFunction());
 
         // Thanks to xlink:href, the Contact shall be the same instance as above.
         assertSame("contact", contact, assertResponsibilityEquals(Role.FUNDER, "Robin Hood",
it.next()));
@@ -295,7 +302,7 @@ public final strictfp class DefaultCitat
     private static Contact assertResponsibilityEquals(final Role role, final String name,
final Responsibility actual) {
         assertEquals("role", role, actual.getRole());
         final Party p = getSingleton(actual.getParties());
-        assertEquals("name", name, p.getName().toString());
+        assertEquals("name", name, String.valueOf(p.getName()));
         return getSingleton(p.getContactInfo());
     }
 }

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=1823853&r1=1823852&r2=1823853&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] Sun Feb 11 16:10:12 2018
@@ -190,7 +190,7 @@ public class CharSequenceAdapter extends
      */
     public static final class Since2014 extends CharSequenceAdapter {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -34,16 +34,18 @@ import org.apache.sis.internal.jaxb.gmx.
 import org.apache.sis.internal.jaxb.gmx.FileName;
 import org.apache.sis.internal.jaxb.gmx.MimeFileType;
 import org.apache.sis.internal.jaxb.gmd.CodeListUID;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.iso.Types;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.resources.IndexedResourceBundle;
 import org.apache.sis.util.resources.Messages;
+import org.apache.sis.util.resources.Errors;
 
 
 /**
- * JAXB wrapper for string value in a {@code <gco:CharacterString>}, {@code <gmx:Anchor>},
- * {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} element, for ISO 19139:2007
compliance.
+ * JAXB wrapper for string value in a {@code <gco:CharacterString>}, {@code <gcx:Anchor>},
+ * {@code <gcx:FileName>} or {@code <gcx:MimeFileType>} element, for ISO 19115-3
compliance.
  *
  * <p>{@code FileName} and {@code MimeFileType} are possible substitutions for {@code
CharacterString}.
  * They make sense only in {@link org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic}
or
@@ -78,27 +80,33 @@ public class GO_CharacterString {
      */
     /**
      * Value assigned to {@link #type} if the character string
-     * shall be marshalled as a {@code <gmx:MimeFileType>} element.
+     * shall be marshalled as a {@code <gcx:MimeFileType>} element.
      */
     public static final byte MIME_TYPE = 1;
 
     /**
      * Value assigned to {@link #type} if the character string
-     * shall be marshalled as a {@code <gmx:FileName>} element.
+     * shall be marshalled as a {@code <gcx:FileName>} element.
+     */
+    public static final byte FILENAME = 3;      // Precedence over legacy <gmd:UML>
+
+    /**
+     * Value assigned to {@link #type} if the character string
+     * shall be marshalled as a legacy {@code <gmd:URL>} element.
      */
-    public static final byte FILENAME = 2;
+    public static final byte URL = 2;
 
     /**
      * Value assigned to {@link #type} if the current {@link #text}
-     * has been found in a {@code <gmx:Anchor>} element.
+     * has been found in a {@code <gcx:Anchor>} element.
      */
-    private static final byte ANCHOR = 3;
+    private static final byte ANCHOR = 4;
 
     /**
      * Value assigned to {@link #type} if the current {@link #text}
      * has been found in an enumeration or code list element.
      */
-    private static final byte ENUM = 4;
+    private static final byte ENUM = 5;
 
     /**
      * The XML element names for each possible {@link #type} values.
@@ -111,6 +119,7 @@ public class GO_CharacterString {
             case FILENAME:  return "FileName";
             case ANCHOR:    return "Anchor";
             case ENUM:      return "ControlledVocabulary";
+            case URL:       return "URL";                       // In legacy XML only.
             default:        throw new AssertionError(type);
         }
     }
@@ -160,7 +169,7 @@ public class GO_CharacterString {
      * If the given value overwrites a previous one, a warning is emitted.
      *
      * @param  value     the value to set.
-     * @param  property  0 or one of the {@link #MIME_TYPE}, {@link #FILENAME} or {@link
#ANCHOR} constants.
+     * @param  property  0 or one of the {@link #MIME_TYPE}, {@link #FILENAME}, {@link #URL}
or {@link #ANCHOR} constants.
      */
     private void setText(CharSequence value, byte property) {
         value = CharSequences.trimWhitespaces(value);
@@ -189,7 +198,7 @@ public class GO_CharacterString {
     }
 
     /**
-     * Returns the text in a {@code <gco:CharacterString>}, {@code <gmx:FileName>}
or {@code <gmx:MimeFileType>}
+     * Returns the text in a {@code <gco:CharacterString>}, {@code <gcx:FileName>}
or {@code <gcx:MimeFileType>}
      * element, or {@code null} if none. This method does not return anything for {@code
Enum} or {@code CodeList}
      * instances, as the later are handled by {@link #getCodeList()}.
      *
@@ -199,11 +208,13 @@ public class GO_CharacterString {
         @XmlElement(type = String.class,       name = "CharacterString"),
         @XmlElement(type = Anchor.class,       name = "Anchor",       namespace = Namespaces.GCX),
         @XmlElement(type = FileName.class,     name = "FileName",     namespace = Namespaces.GCX),
-        @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GCX)
+        @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GCX),
+        @XmlElement(type = GO_URL.class,       name = "URL",          namespace = LegacyNamespaces.GMD)
     })
     private Object getValue() {
         switch (type) {
             case 0:         return StringAdapter.toString(text);
+            case URL:       return new GO_URL(text.toString());
             case FILENAME:  return new FileName(text.toString());
             case MIME_TYPE: return new MimeFileType(text.toString());
             case ANCHOR:    return text;                                // Shall be an instance
of Anchor.
@@ -212,7 +223,7 @@ public class GO_CharacterString {
     }
 
     /**
-     * Sets the {@code <gco:CharacterString>}, {@code <gmx:FileName>} or {@code
<gmx:MimeFileType>} value.
+     * Sets the {@code <gco:CharacterString>}, {@code <gcx:FileName>} or {@code
<gcx:MimeFileType>} value.
      *
      * <p>This method is invoked by JAXB at unmarshalling time and should not need
to be invoked directly.</p>
      */
@@ -224,6 +235,8 @@ public class GO_CharacterString {
             setText(value.toString(), FILENAME);
         } else if (value instanceof MimeFileType) {
             setText(value.toString(), MIME_TYPE);
+        } else if (value instanceof GO_URL) {           // Legacy ISO 19139:2007
+            setText(value.toString(), URL);
         } else {
             setText((CharSequence) value, (byte) 0);
         }
@@ -264,8 +277,8 @@ public class GO_CharacterString {
     }
 
     /**
-     * Invoked by JAXB for any XML element which is not a {@code <gco:CharacterString>},
{@code <gmx:FileName>}
-     * or {@code <gmx:MimeFileType>}. This method presumes that the element name is
the CodeList standard name.
+     * Invoked by JAXB for any XML element which is not a {@code <gco:CharacterString>},
{@code <gcx:FileName>}
+     * or {@code <gcx:MimeFileType>}. This method presumes that the element name is
the CodeList standard name.
      * If not, the element will be ignored.
      */
     @SuppressWarnings({"unchecked", "unused"})
@@ -273,16 +286,28 @@ public class GO_CharacterString {
         final Element e = (Element) value;
         if (e.getNodeType() == Element.ELEMENT_NODE) {
             final Class<?> ct = Types.forStandardName(e.getLocalName());
+            final Class<? extends IndexedResourceBundle> resources;
+            final short errorKey;
+            final Object[] args;
             if (ct != null && CodeList.class.isAssignableFrom(ct)) {
-                final String attribute = e.getAttribute("codeListValue");
+                final String attribute = e.getAttribute("codeListValue").trim();
                 if (!attribute.isEmpty()) {
                     text = Types.getCodeTitle(Types.forCodeName((Class) ct, attribute, true));
                     type = ENUM;
                     return;
+                } else {
+                    resources = Errors.class;
+                    errorKey  = Errors.Keys.MissingOrEmptyAttribute_2;
+                    args      = new Object[2];
+                    args[1]   = "codeListValue";
                 }
+            } else {
+                resources = Messages.class;
+                errorKey  = Messages.Keys.UnknownCodeList_1;
+                args      = new Object[1];
             }
-            Context.warningOccured(Context.current(), GO_CharacterString.class, "setCodeList",
-                    Errors.class, Errors.Keys.UnknownType_1, e.getNodeName());
+            args[0] = e.getNodeName();
+            Context.warningOccured(Context.current(), GO_CharacterString.class, "setCodeList",
resources, errorKey, args);
         }
     }
 

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -102,7 +102,7 @@ public class GO_Integer extends Property
      */
     public static final class Since2014 extends GO_Integer {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -104,7 +104,7 @@ public class GO_Real extends PropertyTyp
      */
     public static final class Since2014 extends GO_Real {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -95,7 +95,7 @@ public class GO_Record extends PropertyT
      */
     public static final class Since2014 extends GO_Record {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -95,7 +95,7 @@ public class GO_RecordType extends Prope
      */
     public static final class Since2014 extends GO_RecordType {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Copied: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_URL.java
(from r1823852, sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyURL.java)
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_URL.java?p2=sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_URL.java&p1=sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyURL.java&r1=1823852&r2=1823853&rev=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyURL.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_URL.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.metadata.iso.citation;
+package org.apache.sis.internal.jaxb.gco;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.apache.sis.internal.jaxb.Context;
-import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import javax.xml.bind.annotation.XmlValue;
 
 
 /**
- * JAXB wrapper for an URI in a {@code <gmd:URL>} element, for ISO 19139 compliance.
- * Note that while this object is called {@code "URL"}, we actually use the {@link URI}
- * Java object.
+ * JAXB wrapper for an URI in a {@code <gmd:URL>} element, for ISO 19139:2007 compliance.
+ * This type was used by legacy XML format inside {@code <gmd:CI_OnlineResource>},
but has
+ * been replaced by {@code <gcx:FileName>} in newer ISO 19115-3:2016 standard. Example:
+ *
+ * {@preformat xml
+ *   <gmd:linkage>
+ *      <gmd:URL>https://tools.ietf.org/html/rfc1149</gmd:URL>
+ *   </gmd:linkage>
+ * }
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -36,19 +36,18 @@ import org.apache.sis.internal.jaxb.Lega
  * @since   1.0
  * @module
  */
-final class LegacyURL {
+final class GO_URL {
     /**
-     * The URI as a string. We uses a string in order to allow the user
-     * to catch potential error at unmarshalling time.
+     * The URI as a string. We uses a string in order to allow
+     * the user to catch potential error at unmarshalling time.
      */
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    @XmlElement(name = "URL", namespace = LegacyNamespaces.GMD)
+    @XmlValue
     private String uri;
 
     /**
      * Empty constructor for JAXB only.
      */
-    LegacyURL() {
+    GO_URL() {
     }
 
     /**
@@ -56,35 +55,15 @@ final class LegacyURL {
      *
      * @param  value  the URI to marshal.
      */
-    private LegacyURL(final URI value) {
-        uri = value.toString();
-    }
-
-    /**
-     * Returns {@code true} if the given value contains a non-null URI.
-     */
-    static boolean isNonNull(final LegacyURL value) {
-        return (value != null) && (value.uri != null);
+    GO_URL(final String value) {
+        uri = value;
     }
 
     /**
-     * Converts a {@link URI} to the object to be marshalled in a XML file.
-     *
-     * @param  value  the URI value.
-     * @return the wrapper for the given URI.
-     */
-    static LegacyURL wrap(final URI value) {
-        return (value != null) ? new LegacyURL(value) : null;
-    }
-
-    /**
-     * Converts an URI read from a XML stream to the object which will contains the value.
-     *
-     * @return a {@link URI} which represents the metadata value.
-     * @throws URISyntaxException if the given value contains an invalid URI.
+     * Returns the URI.
      */
-    URI unwrap() throws URISyntaxException {
-        final Context context = Context.current();
-        return Context.converter(context).toURI(context, uri);
+    @Override
+    public String toString() {
+        return uri;
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -81,7 +81,7 @@ public class InternationalStringAdapter
      */
     public static final class Since2014 extends InternationalStringAdapter {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -117,7 +117,7 @@ public class StringAdapter extends XmlAd
      */
     public static final class Since2014 extends StringAdapter {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -48,7 +48,7 @@ public class URIAdapter extends XmlAdapt
      * @throws URISyntaxException if the string is not a valid URI.
      */
     @Override
-    public URI unmarshal(final GO_CharacterString value) throws URISyntaxException {
+    public final URI unmarshal(final GO_CharacterString value) throws URISyntaxException
{
         final String text = StringAdapter.toString(value);
         if (text != null) {
             final Context context = Context.current();
@@ -80,21 +80,24 @@ public class URIAdapter extends XmlAdapt
     }
 
     /**
-     * Wraps the value only if marshalling ISO 19115-3 element.
-     * Otherwise (i.e. if marshalling a legacy ISO 19139:2007 document), omit the element.
+     * Replace {@code <gcx:FileName>} by {@code <gmd:URL>} if marshalling legacy
ISO 19139:2007 document.
      */
-    public static final class Since2014 extends URIAdapter {
+    public static final class AsURL extends URIAdapter {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public AsURL() {
         }
 
         /**
-         * Wraps the given value in an ISO 19115-3 element, unless we are marshalling an
older document.
+         * Replaces {@code <gcx:FileName>} by {@code <gmd:URL>} if marshalling
legacy ISO 19139:2007 document.
          *
          * @return a non-null value only if marshalling ISO 19115-3 or newer.
          */
         @Override public GO_CharacterString marshal(final URI value) {
-            return FilterByVersion.CURRENT_METADATA.accept() ? super.marshal(value) : null;
+            final GO_CharacterString wrapper = super.marshal(value);
+            if (wrapper != null && wrapper.type == GO_CharacterString.FILENAME &&
!FilterByVersion.CURRENT_METADATA.accept()) {
+                wrapper.type = GO_CharacterString.URL;
+            }
+            return wrapper;
         }
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -86,7 +86,7 @@ public class UnitAdapter extends XmlAdap
      */
     public static final class Since2014 extends UnitAdapter {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -175,7 +175,7 @@ public class TM_Primitive extends Proper
      */
     public static final class Since2014 extends TM_Primitive {
         /** Empty constructor used only by JAXB. */
-        private Since2014() {
+        public Since2014() {
         }
 
         /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -256,7 +256,7 @@ public final class Errors extends Indexe
         public static final short EmptyProperty_1 = 32;
 
         /**
-         * An error occurred in file “{0}” at Line {1}.
+         * An error occurred in file “{0}” at line {1}.
          */
         public static final short ErrorInFileAtLine_2 = 33;
 
@@ -535,6 +535,11 @@ public final class Errors extends Indexe
         public static final short MissingJAXBContext = 86;
 
         /**
+         * Missing or empty ‘{1}’ attribute in “{0}”.
+         */
+        public static final short MissingOrEmptyAttribute_2 = 181;
+
+        /**
          * This operation requires the “{0}” module.
          */
         public static final short MissingRequiredModule_1 = 87;

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Sun Feb 11 16:10:12 2018
@@ -63,7 +63,7 @@ EmptyDictionary                   = The
 EmptyEnvelope2D                   = Envelope must be at least two-dimensional and non-empty.
 EmptyProperty_1                   = Property named \u201c{0}\u201d shall not be empty.
 ErrorIn_2                         = Error in \u201c{0}\u201d: {1}
-ErrorInFileAtLine_2               = An error occurred in file \u201c{0}\u201d at Line {1}.
+ErrorInFileAtLine_2               = An error occurred in file \u201c{0}\u201d at line {1}.
 ExcessiveArgumentSize_3           = Argument \u2018{0}\u2019 shall not contain more than
{1} elements. A number of {2} is excessive.
 ExcessiveListSize_2               = A size of {1} elements is excessive for the \u201c{0}\u201d
list.
 ExcessiveNumberOfDimensions_1     = For this algorithm, {0} is an excessive number of dimensions.
@@ -117,6 +117,7 @@ MismatchedMatrixSize_4            = Mism
 MissingCharacterInElement_2       = Missing a \u2018{1}\u2019 character in \u201c{0}\u201d
element.
 MissingComponentInElement_2       = Missing a \u201c{1}\u201d component in \u201c{0}\u201d.
 MissingJAXBContext                = JAXB context has not been specified.
+MissingOrEmptyAttribute_2         = Missing or empty \u2018{1}\u2019 attribute in \u201c{0}\u201d.
 MissingRequiredModule_1           = This operation requires the \u201c{0}\u201d module.
 MissingValueForOption_1           = Missing value for \u201c{0}\u201d option.
 MissingValueForProperty_1         = Missing value for \u201c{0}\u201d property.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Sun Feb 11 16:10:12 2018
@@ -114,6 +114,7 @@ MismatchedMatrixSize_4            = Une
 MissingCharacterInElement_2       = Un caract\u00e8re \u2018{1}\u2019 est manquant dans l\u2019\u00e9l\u00e9ment
\u00ab\u202f{0}\u202f\u00bb.
 MissingComponentInElement_2       = Il manque une composante \u00ab\u202f{1}\u202f\u00bb
dans l\u2019\u00e9l\u00e9ment \u00ab\u202f{0}\u202f\u00bb.
 MissingJAXBContext                = Le contexte JAXB n\u2019a pas \u00e9t\u00e9 sp\u00e9cifi\u00e9.
+MissingOrEmptyAttribute_2         = L\u2019attribut \u2018{1}\u2019 de \u00ab\u202f{0}\u202f\u00bb
est manquant ou vide.
 MissingRequiredModule_1           = Cette op\u00e9ration requiert le module \u00ab\u202f{0}\u202f\u00bb.
 MissingValueForOption_1           = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour
l\u2019option \u00ab\u202f{0}\u202f\u00bb.
 MissingValueForProperty_1         = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour
la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] Sun Feb 11 16:10:12 2018
@@ -204,6 +204,11 @@ public final class Messages extends Inde
         public static final short PropertyHiddenBy_2 = 28;
 
         /**
+         * “{0}” is not the name of a known list of codes.
+         */
+        public static final short UnknownCodeList_1 = 33;
+
+        /**
          * The text contains unknown elements:
          */
         public static final short UnknownElementsInText = 29;

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
[ISO-8859-1] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
[ISO-8859-1] Sun Feb 11 16:10:12 2018
@@ -44,6 +44,7 @@ LocalesDiscarded                 = Text
 OptionalModuleNotFound_1         = Optional module \u201c{0}\u201d requested but not found.
 PropertyHiddenBy_2               = Property \u201c{0}\u201d is hidden by \u201c{1}\u201d.
 NonConformFormatting_1           = This \u201c{0}\u201d formatting is a departure from standard
format.
+UnknownCodeList_1                = \u201c{0}\u201d is not the name of a known list of codes.
 UnknownElementsInText            = The text contains unknown elements:
 UnknownKeywordInRecord_2         = Loading of \u201c{0}\u201d done, but some records were
ignored because of unrecognized keywords: {1}
 UnparsableValueStoredAsText_2    = Can not parse \u201c{1}\u201d as an instance of \u2018{0}\u2019.
The value is stored as plain text instead, but will be ignored by some processing.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1823853&r1=1823852&r2=1823853&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] Sun Feb 11 16:10:12 2018
@@ -51,6 +51,7 @@ LocalesDiscarded                 = Des t
 OptionalModuleNotFound_1         = Le module optionnel \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9
demand\u00e9 mais n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
 PropertyHiddenBy_2               = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb est
masqu\u00e9e par \u00ab\u202f{1}\u202f\u00bb.
 NonConformFormatting_1           = Cette \u00e9criture de \u00ab\u202f{0}\u202f\u00bb d\u00e9vie
du format standard.
+UnknownCodeList_1                = \u00ab\u202f{0}\u202f\u00bb n\u2019est pas le nom d\u2019une
liste de codes connue.
 UnknownElementsInText            = Le texte contient des \u00e9l\u00e9ments inconnus\u00a0:
 UnknownKeywordInRecord_2         = La lecture de \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9
faite, mais en ignorant certains enregistrements \u00e0 cause de mots-cl\u00e9s non reconnus:
{1}
 UnparsableValueStoredAsText_2    = La valeur \u00ab\u202f{1}\u202f\u00bb ne peut pas \u00eatre
interpr\u00e9t\u00e9e comme une instance de \u2018{0}\u2019. Elle est donc m\u00e9moris\u00e9e
sous sa forme textuelle, mais sera ignor\u00e9e par certains traitements.



Mime
View raw message