sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1817905 - in /sis/branches/ISO-19115-3/core/sis-utility/src: main/java/org/apache/sis/internal/jaxb/ main/java/org/apache/sis/internal/jaxb/gco/ main/java/org/apache/sis/internal/jaxb/gmd/ main/java/org/apache/sis/internal/jaxb/gml/ main/j...
Date Tue, 12 Dec 2017 11:31:18 GMT
Author: desruisseaux
Date: Tue Dec 12 11:31:18 2017
New Revision: 1817905

URL: http://svn.apache.org/viewvc?rev=1817905&view=rev
Log:
Upgrade JAXB internal objects (Measure, Language, Country, etc.) to ISO 19115-3.
This is part of commit e780d66b4d7d59368e742ba01777a151d8827ea8 from Image Matter.

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

Added:
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LinearMeasure.java
      - copied, changed from r1817904, sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
  (with props)
Modified:
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.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_Measure.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/PropertyType.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamReader.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -407,6 +407,17 @@ public final class Context extends Marsh
     }
 
     /**
+     * Returns {@code true} if we are (un)marshalling ISO 19115-3 metadata,
+     * or {@code false} if (un)marshalling ISO 19139 metadata.
+     * This is a convenience method for {@link #isMetadataVersion(Context, Version)}.
+     *
+     * @return whether the (un)marshalling process is for ISO 19115-3.
+     */
+    public static boolean isLatestMetadata() {
+        return isMetadataVersion(current(), LegacyNamespaces.ISO_19115_3);
+    }
+
+    /**
      * Returns the base URL of ISO 19139 (or other standards) schemas.
      * The valid values are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property.
      * If the returned value is not empty, then this method guarantees it ends with {@code
'/'}.

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=1817905&r1=1817904&r2=1817905&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] Tue Dec 12 11:31:18 2017
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import org.w3c.dom.Element;
 import org.opengis.util.CodeList;
@@ -55,7 +56,8 @@ import org.apache.sis.util.resources.Mes
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see org.apache.sis.internal.jaxb.gmd.PT_FreeText
  *
@@ -68,6 +70,7 @@ import org.apache.sis.util.resources.Mes
     org.apache.sis.internal.jaxb.gmd.LanguageCode.class,
     org.apache.sis.internal.jaxb.gmd.Country.class
 })
+@XmlRootElement(name = "CharacterString")
 public class GO_CharacterString {
     /*
      * Numerical values below are ordered: if two or more values are defined (thoerically
not legal,
@@ -194,9 +197,9 @@ public class GO_CharacterString {
      */
     @XmlElements({
         @XmlElement(type = String.class,       name = "CharacterString"),
-        @XmlElement(type = Anchor.class,       name = "Anchor",       namespace = Namespaces.GMX),
-        @XmlElement(type = FileName.class,     name = "FileName",     namespace = Namespaces.GMX),
-        @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GMX)
+        @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)
     })
     private Object getValue() {
         switch (type) {
@@ -272,7 +275,7 @@ public class GO_CharacterString {
      * or {@code <gmx:MimeFileType>}. This method presumes that the element name is
the CodeList standard name.
      * If not, the element will be ignored.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "unused" })
     private void setCodeList(final Object value) {
         final Element e = (Element) value;
         if (e.getNodeType() == Element.ELEMENT_NODE) {

Copied: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LinearMeasure.java
(from r1817904, sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.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_LinearMeasure.java?p2=sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LinearMeasure.java&p1=sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java&r1=1817904&r2=1817905&rev=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LinearMeasure.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
-import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.apache.sis.internal.jaxb.gml.Measure;
@@ -30,14 +29,16 @@ import org.apache.sis.measure.Units;
  * <p>This class is identical to {@link GO_Distance} except for the name of the element,
  * which is {@code "Measure"}.</p>
  *
+ * Used only for ISO 19139 metadata.
+ *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
- * @since   0.3
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
+ * @since   1.0
  * @module
  */
-@XmlType(name = "Measure_PropertyType")
-public final class GO_Measure extends XmlAdapter<GO_Measure, Double> {
+public final class GO_LinearMeasure extends XmlAdapter<GO_LinearMeasure, Double> {
     /**
      * A proxy representation of the {@code <gco:Measure>} element.
      */
@@ -47,7 +48,7 @@ public final class GO_Measure extends Xm
     /**
      * Empty constructor used only by JAXB.
      */
-    public GO_Measure() {
+    public GO_LinearMeasure() {
     }
 
     /**
@@ -59,7 +60,7 @@ public final class GO_Measure extends Xm
      *       in current metadata interface. This will need to be revisited in a future SIS
version if we
      *       replace the Double type by some quantity type.
      */
-    private GO_Measure(final Double value) {
+    private GO_LinearMeasure(final Double value) {
         measure = new Measure(value, Units.METRE);
         measure.asXPointer = true;
     }
@@ -71,7 +72,7 @@ public final class GO_Measure extends Xm
      * @return the double value extracted from the adapter.
      */
     @Override
-    public Double unmarshal(final GO_Measure value) {
+    public Double unmarshal(final GO_LinearMeasure value) {
         if (value != null) {
             final Measure measure = value.measure;
             if (measure != null) {
@@ -90,7 +91,7 @@ public final class GO_Measure extends Xm
      *         by {@code <gco:Measure>} element, with an {@code uom} attribute.
      */
     @Override
-    public GO_Measure marshal(final Double value) {
-        return (value != null) ? new GO_Measure(value) : null;
+    public GO_LinearMeasure marshal(final Double value) {
+        return (value != null) ? new GO_LinearMeasure(value) : null;
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.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_Measure.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -20,7 +20,6 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.apache.sis.internal.jaxb.gml.Measure;
-import org.apache.sis.measure.Units;
 
 
 /**
@@ -32,12 +31,13 @@ import org.apache.sis.measure.Units;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @XmlType(name = "Measure_PropertyType")
-public final class GO_Measure extends XmlAdapter<GO_Measure, Double> {
+public final class GO_Measure extends XmlAdapter<GO_Measure, Measure> {
     /**
      * A proxy representation of the {@code <gco:Measure>} element.
      */
@@ -54,43 +54,32 @@ public final class GO_Measure extends Xm
      * Constructs an adapter for the given value before marshalling.
      *
      * @param  value  the value.
-     *
-     * @todo The unit of measurement is fixed to metres for now because we do not have this
information
-     *       in current metadata interface. This will need to be revisited in a future SIS
version if we
-     *       replace the Double type by some quantity type.
      */
-    private GO_Measure(final Double value) {
-        measure = new Measure(value, Units.METRE);
+    private GO_Measure(final Measure value) {
+        measure = value;
         measure.asXPointer = true;
     }
 
     /**
-     * Allows JAXB to generate a Double object using the value found in the adapter.
+     * Allows JAXB to generate a Measure object using the value found in the adapter.
      *
      * @param  value  the value wrapped in an adapter.
-     * @return the double value extracted from the adapter.
+     * @return the Measure object extracted from the adapter.
      */
     @Override
-    public Double unmarshal(final GO_Measure value) {
-        if (value != null) {
-            final Measure measure = value.measure;
-            if (measure != null) {
-                return measure.value;
-            }
-        }
-        return null;
+    public Measure unmarshal(final GO_Measure value) {
+        return (value != null) ? value.measure : null;
     }
 
     /**
      * Allows JAXB to change the result of the marshalling process, according to the
      * ISO-19139 standard and its requirements about {@code measures}.
      *
-     * @param  value  the double value we want to integrate into a {@code <gco:Measure>}
element.
-     * @return an adaptation of the double value, that is to say a double value surrounded
-     *         by {@code <gco:Measure>} element, with an {@code uom} attribute.
+     * @param  value  the Measure value we want to integrate into a {@code <gco:Measure>}
element.
+     * @return a {@code <gco:Measure>} element, with an {@code uom} attribute.
      */
     @Override
-    public GO_Measure marshal(final Double value) {
+    public GO_Measure marshal(final Measure value) {
         return (value != null) ? new GO_Measure(value) : null;
     }
 }

Added: 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=1817905&view=auto
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
(added)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.jaxb.gco;
+
+import javax.xml.bind.annotation.XmlElement;
+import org.opengis.util.Record;
+import org.apache.sis.util.iso.DefaultRecord;
+
+
+/**
+ * JAXB wrapper in order to map implementing class with the GeoAPI interface.
+ * See package documentation for more information about JAXB and interface.
+ *
+ * @author  Cullen Rombach (Image Matters)
+ * @since   1.0
+ * @version 1.0
+ * @module
+ */
+public final class GO_Record extends PropertyType<GO_Record, Record> {
+    /**
+     * Empty constructor for JAXB only.
+     */
+    public GO_Record() {
+    }
+
+    /**
+     * Wraps a {@code Record} value with a {@code gco:Record} element at marshalling-time.
+     *
+     * @param  metadata  the metadata value to marshal.
+     */
+    private GO_Record(final Record metadata) {
+        super(metadata);
+    }
+
+    /**
+     * Returns a wrapper for the given {@code Record} element.
+     *
+     * @param  value  the value to marshal.
+     * @return the wrapper around the given metadata value.
+     */
+    @Override
+    protected GO_Record wrap(final Record value) {
+        return new GO_Record(value);
+    }
+
+    /**
+     * Returns the GeoAPI interface which is bound by this adapter.
+     *
+     * @return {@code Record.class}
+     */
+    @Override
+    protected Class<Record> getBoundType() {
+        return Record.class;
+    }
+
+    /**
+     * Returns the {@link DefaultRecord} generated from the metadata value.
+     * This method is systematically called at marshalling-time by JAXB.
+     *
+     * @return the metadata to be marshalled.
+     */
+    @XmlElement(name = "Record")
+    public DefaultRecord getElement() {
+        return DefaultRecord.castOrCopy(metadata);
+    }
+
+    /**
+     * Sets the value for the {@link DefaultRecord}.
+     * This method is systematically called at unmarshalling-time by JAXB.
+     *
+     * @param  metadata  the unmarshalled metadata.
+     */
+    public void setElement(final DefaultRecord metadata) {
+        this.metadata = metadata;
+    }
+}

Propchange: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Record.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

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=1817905&r1=1817904&r2=1817905&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] Tue Dec 12 11:31:18 2017
@@ -38,7 +38,7 @@ public final class GO_RecordType extends
     }
 
     /**
-     * Wraps a {@code RecordType} value with a {@code gco:RecordType} tags at marshalling-time.
+     * Wraps a {@code RecordType} value with a {@code gco:RecordType} element at marshalling-time.
      *
      * @param  metadata  the metadata value to marshal.
      */

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -104,7 +104,8 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @param <ValueType>  the adapter subclass.
  * @param <BoundType>  the interface being adapted.
@@ -122,6 +123,7 @@ public abstract class PropertyType<Value
      * (ISO 19115:2014 model) is not yet supported, so we currently use this variable only
as a way
      * to identify the code to revisit when we will want to support the new model.
      */
+    @Deprecated
     public static final boolean LEGACY_XML = true;
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -77,7 +77,8 @@
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
  *
@@ -86,7 +87,7 @@
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GCO, xmlns =
{
     @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO),
-    @XmlNs(prefix = "gmx", namespaceURI = Namespaces.GMX)
+    @XmlNs(prefix = "gcx", namespaceURI = Namespaces.GCX)
 })
 @XmlAccessorType(XmlAccessType.NONE)
 /*

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -24,6 +24,7 @@ import org.apache.sis.internal.jaxb.Cont
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -43,16 +44,17 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
-@XmlType(name = "Country_PropertyType")
+@XmlType(name = "Country_PropertyType", namespace = Namespaces.LAN)
 public final class Country extends GO_CharacterString {
     /**
      * The country using a {@link org.opengis.util.CodeList}-like format.
+     * This was called "Country" in ISO 19139 and has been renamed "CountryCode" in ISO 19115-3
      */
-    @XmlElement(name = "Country")
     private CodeListUID identifier;
 
     /**
@@ -83,6 +85,38 @@ public final class Country extends GO_Ch
     }
 
     /**
+     * Gets the value of the Country code using ISO 19139 element name.
+     */
+    @XmlElement(name = "Country")
+    private CodeListUID getCountry() {
+        return Context.isLatestMetadata() ? null : identifier;
+    }
+
+    /**
+     * Sets the value of the Country code in ISO 19139 element name.
+     */
+    @SuppressWarnings("unused")
+    private void setCountry(CodeListUID newValue) {
+        identifier = newValue;
+    }
+
+    /**
+     * Gets the value of the Country code using ISO 19115-3 element name.
+     */
+    @XmlElement(name = "CountryCode")
+    private CodeListUID getCountryCode() {
+        return Context.isLatestMetadata() ? identifier : null;
+    }
+
+    /**
+     * Sets the value of the Country code in ISO 19115-3 element name.
+     */
+    @SuppressWarnings("unused")
+    private void setCountryCode(CodeListUID newValue) {
+        identifier = newValue;
+    }
+
+    /**
      * Creates a new wrapper for the given locale.
      *
      * @param  context  the current (un)marshalling context, or {@code null} if none.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlElem
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
+import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -41,11 +42,12 @@ import org.apache.sis.internal.jaxb.gco.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
-@XmlType(name = "LanguageCode_PropertyType")
+@XmlType(name = "LanguageCode_PropertyType", namespace = Namespaces.LAN)
 public final class LanguageCode extends GO_CharacterString {
     /**
      * The language using a {@link org.opengis.util.CodeList}-like format.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -27,6 +27,7 @@ import org.apache.sis.internal.jaxb.Cont
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.util.iso.DefaultInternationalString;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.xml.Namespaces;
 import org.apache.sis.util.ArraysExt;
 
 
@@ -56,14 +57,15 @@ import org.apache.sis.util.ArraysExt;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-152">GEOTK-152</a>
  *
  * @since 0.3
  * @module
  */
-@XmlType(name = "PT_FreeText_PropertyType")
+@XmlType(name = "PT_FreeText_PropertyType", namespace = Namespaces.LAN)
 public final class PT_FreeText extends GO_CharacterString {
     /**
      * A set of {@link LocalisedCharacterString}, representing the {@code <gmd:textGroup>}
element.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gmd
 import java.util.Locale;
 import javax.xml.bind.annotation.XmlElement;
 import org.apache.sis.util.Debug;
+import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -68,7 +69,8 @@ import org.apache.sis.util.Debug;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see LocalisedCharacterString
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-152">GEOTK-152</a>
@@ -86,7 +88,7 @@ final class TextGroup {
      * as in the second example of class javadoc. However SIS allows arbitrary length
      * (as in the first example of class javadoc) for compatibility and convenience reasons.</p>
      */
-    @XmlElement(name = "LocalisedCharacterString")
+    @XmlElement(name = "LocalisedCharacterString", namespace = Namespaces.LAN)
     protected LocalisedCharacterString[] localized;
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -21,15 +21,17 @@
  * lists (except base classes), which are defined in their own package.
  *
  * @author  Cédric Briançon (Geomatys)
- * @version 0.7
+ * @author  Martin Desruisseaux (Geomatys)
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
  *
  * @since 0.3
  * @module
  */
-@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GMD, xmlns =
{
-    @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
+@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.MDB, xmlns =
{
+    @XmlNs(prefix = "mdb", namespaceURI = Namespaces.MDB),
     @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO)
 })
 @XmlAccessorType(XmlAccessType.NONE)

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -39,7 +39,7 @@ import org.apache.sis.measure.Units;
  *
  * <p>This class duplicates {@code org.apache.sis.measure.Measure}, but we have to
do that way
  * because that {@code Measure} extends {@link Number} and we are not allowed to use the
- * {@code @XmlValue} annotation on a class that extends an other class.</p>
+ * {@code @XmlValue} annotation on a class that extends another class.</p>
  *
  * <div class="section">XML marshalling</div>
  * Measures are used in different ways by the ISO 19115 (Metadata) and GML standards.
@@ -165,7 +165,8 @@ public final class Measure {
         if (unit == null || unit.equals(Units.UNITY)) {
             return "";
         }
-        final StringBuilder buffer = Context.schema(Context.current(), "gmd", Schemas.METADATA_ROOT)
+        // Changed to METADATA_ROOT_OLD while updating to ISO 19115-3
+        final StringBuilder buffer = Context.schema(Context.current(), "gmd", Schemas.METADATA_ROOT_OLD)
                                             .append(Schemas.UOM_PATH).append("#xpointer(//*[@gml:id='");
         try {
             UCUM.format(unit, buffer);

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -17,17 +17,20 @@
 
 /**
  * Miscellaneous objects and adapters defined in the {@code "gmx"} namespace.
+ * In ISO 19115-3, this namespace was changed to {@code "gcx"}.
  *
  * @author  Guilhem Legal (Geomatys)
- * @version 0.4
+ * @author  Martin Desruisseaux (Geomatys)
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
  *
  * @since 0.3
  * @module
  */
-@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GMX, xmlns =
{
-    @XmlNs(prefix = "gmx", namespaceURI = Namespaces.GMX)
+@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GCX, xmlns =
{
+    @XmlNs(prefix = "gcx", namespaceURI = Namespaces.GCX)
 })
 @XmlAccessorType(XmlAccessType.NONE)
 @XmlJavaTypeAdapter(InternationalStringConverter.class)

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamReader.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamReader.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamReader.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamReader.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -44,6 +44,7 @@ class FilteredStreamReader extends Strea
 
     /**
      * Creates a new filter for the given version of the standards.
+     * Use {@link #create(XMLStreamReader, FilterVersion)} instead.
      */
     FilteredStreamReader(final XMLStreamReader in, final FilterVersion version) {
         super(in);
@@ -51,6 +52,17 @@ class FilteredStreamReader extends Strea
     }
 
     /**
+     * Creates a new filter for the given version of the standards.
+     */
+    static FilteredStreamReader create(final XMLStreamReader in, final FilterVersion version)
{
+        if (version.manyToOne) {
+            return new FilteredStreamResolver(in, version);
+        } else {
+            return new FilteredStreamReader(in, version);
+        }
+    }
+
+    /**
      * Converts a JAXB URI to the URI seen by the consumer of this wrapper.
      */
     private String toView(final String uri) {

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -120,7 +120,7 @@ final class PooledUnmarshaller extends P
     private Object unmarshal(XMLStreamReader input, final FilterVersion version)
             throws XMLStreamException, JAXBException
     {
-        input = new FilteredStreamReader(input, version);
+        input = FilteredStreamReader.create(input, version);
         final Context context = begin();
         final Object object;
         try {
@@ -139,7 +139,7 @@ final class PooledUnmarshaller extends P
     private <T> JAXBElement<T> unmarshal(XMLStreamReader input, final FilterVersion
version, final Class<T> declaredType)
             throws XMLStreamException, JAXBException
     {
-        input = new FilteredStreamReader(input, version);
+        input = FilteredStreamReader.create(input, version);
         final Context context = begin();
         final JAXBElement<T> object;
         try {
@@ -342,7 +342,7 @@ final class PooledUnmarshaller extends P
     public Object unmarshal(XMLStreamReader input) throws JAXBException {
         final FilterVersion version = getFilterVersion();
         if (version != null) {
-            input = new FilteredStreamReader(input, version);
+            input = FilteredStreamReader.create(input, version);
         }
         final Context context = begin();
         try {
@@ -359,7 +359,7 @@ final class PooledUnmarshaller extends P
     public <T> JAXBElement<T> unmarshal(XMLStreamReader input, final Class<T>
declaredType) throws JAXBException {
         final FilterVersion version = getFilterVersion();
         if (version != null) {
-            input = new FilteredStreamReader(input, version);
+            input = FilteredStreamReader.create(input, version);
         }
         final Context context = begin();
         try {

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java?rev=1817905&r1=1817904&r2=1817905&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
[UTF-8] Tue Dec 12 11:31:18 2017
@@ -61,7 +61,7 @@ public final strictfp class MeasureTest
         assertEquals(Units.METRE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9001", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])",
measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = false;
@@ -69,12 +69,12 @@ public final strictfp class MeasureTest
         assertEquals(Units.DEGREE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9102", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = true;
         measure.setUOM("gmxUom.xml#kg");                        // Not really an existing
unit in 'gmxUom'.
         assertEquals(Units.KILOGRAM, measure.unit);
-        assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
     }
 }



Mime
View raw message