sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1817620 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/ sis-referencing/src/test/java/org/apache/sis/referencing/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/ sis-utility/src...
Date Sat, 09 Dec 2017 15:02:46 GMT
Author: desruisseaux
Date: Sat Dec  9 15:02:45 2017
New Revision: 1817620

URL: http://svn.apache.org/viewvc?rev=1817620&view=rev
Log:
Declare constants and internal methods for support of ISO 19115-3 metadata version.
This is part of commit e780d66b4d7d59368e742ba01777a151d8827ea8 from Image Matter.

This revision can built but is known to have test failure.
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/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
    sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
    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/LegacyNamespaces.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilterVersion.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -81,7 +81,7 @@ public final strictfp class DefaultConta
      * Initializes the test for catching warning messages.
      */
     private void init() {
-        context = new Context(0, null, null, null, null, null, null, this);
+        context = new Context(0, null, null, null, null, null, null, null, this);
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -213,7 +213,7 @@ public final strictfp class AbstractIden
         final AbstractIdentifiedObject o2 = new AbstractIdentifiedObject(properties);
         final AbstractIdentifiedObject o3 = new AbstractIdentifiedObject(properties);
         final AbstractIdentifiedObject o4 = new AbstractIdentifiedObject(properties);
-        final Context context = new Context(0, null, null, null, null, null, null, null);
+        final Context context = new Context(0, null, null, null, null, null, null, null,
null);
         try {
             final String c1, c2, c3, c4;
             assertEquals("o1", "epsg-7019", c1 = o1.getID());

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=1817620&r1=1817619&r2=1817620&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] Sat Dec  9 15:02:45 2017
@@ -50,7 +50,8 @@ import org.apache.sis.xml.ReferenceResol
  * if no (un)marshalling is in progress.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -135,6 +136,12 @@ public final class Context extends Marsh
     private final Version versionGML;
 
     /**
+     * The metadata version to be marshalled or unmarshalled, or {@code null} if unspecified.
+     * If null, than the latest version is assumed.
+     */
+    private final Version versionMetadata;
+
+    /**
      * The reference resolver currently in use, or {@code null} for {@link ReferenceResolver#DEFAULT}.
      */
     private final ReferenceResolver resolver;
@@ -203,15 +210,20 @@ public final class Context extends Marsh
      * @param  timezone         the timezone, or {@code null} if unspecified.
      * @param  schemas          the schemas root URL, or {@code null} if none.
      * @param  versionGML       the GML version, or {@code null}.
+     * @param  versionMetadata  the metadata version, or {@code null}.
      * @param  resolver         the resolver in use.
      * @param  converter        the converter in use.
      * @param  warningListener  the object to inform about warnings.
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
     public Context(final int                bitMasks,
-                   final Locale             locale,   final TimeZone       timezone,
-                   final Map<String,String> schemas,  final Version        versionGML,
-                   final ReferenceResolver  resolver, final ValueConverter converter,
+                   final Locale             locale,
+                   final TimeZone           timezone,
+                   final Map<String,String> schemas,
+                   final Version            versionGML,
+                   final Version            versionMetadata,
+                   final ReferenceResolver  resolver,
+                   final ValueConverter     converter,
                    final WarningListener<?> warningListener)
     {
         this.bitMasks          = bitMasks;
@@ -219,6 +231,7 @@ public final class Context extends Marsh
         this.timezone          = timezone;
         this.schemas           = schemas;               // No clone, because this class is
internal.
         this.versionGML        = versionGML;
+        this.versionMetadata   = versionMetadata;
         this.resolver          = resolver;
         this.converter         = converter;
         this.warningListener   = warningListener;
@@ -347,7 +360,7 @@ public final class Context extends Marsh
 
     /**
      * Returns {@code true} if the GML version is equals or newer than the specified version.
-     * If no GML version were specified, then this method returns {@code true}, i.e. newest
+     * If no GML version was specified, then this method returns {@code true}, i.e. newest
      * version is assumed.
      *
      * <div class="note"><b>API note:</b>
@@ -367,6 +380,30 @@ public final class Context extends Marsh
             }
         }
         return true;
+    }
+
+    /**
+     * Returns {@code true} if the metadata version is equals or newer than the specified
version.
+     * If no metadata version was specified, then this method returns {@code true}, i.e.
newest
+     * version is assumed.
+     *
+     * <div class="note"><b>API note:</b>
+     * This method is static for the convenience of performing the check for null context.</div>
+     *
+     * @param  context  the current context, or {@code null} if none.
+     * @param  version  the version to compare to.
+     * @return {@code true} if the metadata version is equals or newer than the specified
version.
+     *
+     * @see #getVersion(String)
+     */
+    public static boolean isMetadataVersion(final Context context, final Version version)
{
+        if (context != null) {
+            final Version versionMetadata = context.versionMetadata;
+            if (versionMetadata != null) {
+                return versionMetadata.compareTo(version) >= 0;
+            }
+        }
+        return true;
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -22,7 +22,8 @@ import org.apache.sis.util.Version;
 /**
  * Legacy XML namespaces, and {@link Version} constants for identifying when those namespaces
were used.
  *
- * @author  Guilhem Legal (Geomatys)
+ * @author  Guilhem Legal  (Geomatys)
+ * @author  Cullen Rombach (Image Matters)
  * @version 1.0
  *
  * @see org.apache.sis.xml.Namespaces
@@ -32,6 +33,12 @@ import org.apache.sis.util.Version;
  */
 public final class LegacyNamespaces {
     /**
+     * @deprecated to be replaced by {@code VERSION_1_0}, which is the version declared in
XML schemas.
+     */
+    @Deprecated
+    public static final Version ISO_19115_3 = new Version("2014");
+
+    /**
      * Miscellaneous version constants.
      */
     public static final Version VERSION_3_0 = new Version("3.0"),
@@ -91,6 +98,12 @@ public final class LegacyNamespaces {
     public static final String GFC = "http://www.isotc211.org/2005/gfc";
 
     /**
+     * The <code>{@value}</code> URL, used in ISO 19139.
+     * The usual prefix for this namespace is {@code "gts"}.
+     */
+    public static final String GTS = "http://www.isotc211.org/2005/gts";
+
+    /**
      * A non-public (un)marshaller property for controlling usage of {@code org.apache.sis.xml.FilteredNamespaces}.
      * Values can be:
      *

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -41,7 +41,8 @@ package org.apache.sis.internal.jaxb;
  * </ul>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
@@ -52,24 +53,49 @@ public final class Schemas {
     public static final String GML_XSD = "http://schemas.opengis.net/gml/3.2.1/gml.xsd";
 
     /**
-     * The XSD definition for metadata objects.
+     * The XSD definition for 193139 metadata objects.
      */
+    @Deprecated
     public static final String METADATA_XSD = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd";
 
     /**
+     * The XSD definition for the root of ISO 19115-3 metadata objects.
+     */
+    public static final String METADATA_XSD_BASE           = "http://standards.iso.org/iso/19115/-3/mdb/1.0/mdb.xsd",
+                               METADATA_XSD_SPATIAL        = "http://standards.iso.org/iso/19115/-3/msr/1.0/msr.xsd",
+                               METADATA_XSD_QUALITY        = "http://standards.iso.org/iso/19157/-2/dqc/1.0/dqc.xsd",
+                               METADATA_XSD_MAINTENANCE    = "http://standards.iso.org/iso/19115/-3/mmi/1.0/mmi.xsd",
+                               METADATA_XSD_LINEAGE        = "http://standards.iso.org/iso/19115/-3/mrl/1.0/mrl.xsd",
+                               METADATA_XSD_IDENTIFICATION = "http://standards.iso.org/iso/19115/-3/mri/1.0/mri.xsd",
+                               METADATA_XSD_EXTENT         = "http://standards.iso.org/iso/19115/-3/gex/1.0/gex.xsd",
+                               METADATA_XSD_DISTRIBUTION   = "http://standards.iso.org/iso/19115/-3/mrd/1.0/mrd.xsd",
+                               METADATA_XSD_CONTENT        = "http://standards.iso.org/iso/19115/-3/mrc/1.0/mrc.xsd",
+                               METADATA_XSD_CONSTRAINT     = "http://standards.iso.org/iso/19115/-3/mrc/1.0/mrc.xsd",
+                               METADATA_XSD_CITATION       = "http://standards.iso.org/iso/19115/-3/cit/1.0/cit.xsd",
+                               METADATA_XSD_ACQUISITION    = "http://standards.iso.org/iso/19115/-3/mac/1.0/mac.xsd";
+
+    /**
+     * The root directory of OGC metadata schemas.
+     * This is the schema used by default in Apache SIS.
+     */
+    @Deprecated
+    public static final String METADATA_ROOT_OLD = "http://schemas.opengis.net/iso/19139/20070417/";
+
+    /**
      * The root directory of OGC metadata schemas.
      * This is the schema used by default in Apache SIS.
      */
-    public static final String METADATA_ROOT = "http://schemas.opengis.net/iso/19139/20070417/";
+    public static final String METADATA_ROOT = "http://standards.iso.org/iso/19115/";
 
     /**
-     * The root directory of ISO metadata schemas.
-     * This is sometime used as an alternative to {@link #METADATA_ROOT}.
+     * The root directory of ISO 19139 metadata schemas.
+     * This is sometime used as an alternative to {@link #METADATA_ROOT_OLD}.
      */
+    @Deprecated
     public static final String ISO_19139_ROOT = "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/";
 
     /**
-     * The string to append to {@link #METADATA_ROOT} or {@link #ISO_19139_ROOT} for obtaining
the path
+     * The string to append to {@link #METADATA_ROOT_OLD} or {@link #ISO_19139_ROOT} for
obtaining the path
      * to the definitions of code lists.
      *
      * <p>A localized version of this file exists also with the {@code "ML_gmxCodelists.xml"}
filename
@@ -77,7 +103,15 @@ public final class Schemas {
      *
      * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
      */
-    public static final String CODELISTS_PATH = "resources/Codelist/gmxCodelists.xml";
+    @Deprecated
+    public static final String CODELISTS_PATH_OLD = "resources/Codelist/gmxCodelists.xml";
+
+    /**
+     * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions
of code lists.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
+     */
+    public static final String CODELISTS_PATH = "resources/Codelist/cat/codelists.xml";
 
     /**
      * The string to append to {@link #METADATA_ROOT} or {@link #ISO_19139_ROOT} for obtaining
the path

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/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/package-info.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -33,7 +33,8 @@
  * This is used for storing the value in a list of identifiers while preserving the original
object.</p>
  *
  * @author  Cédric Briançon (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilterVersion.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilterVersion.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilterVersion.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilterVersion.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -17,6 +17,8 @@
 package org.apache.sis.xml;
 
 import java.util.Map;
+import java.util.HashMap;
+import org.apache.sis.util.collection.Containers;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 
 import static java.util.Collections.singletonMap;
@@ -28,21 +30,60 @@ import static java.util.Collections.sing
  * See {@link FilteredNamespaces} for more information.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
 enum FilterVersion {
     /**
+     * Metadata using the legacy ISO 19139 schema (replaced by ISO 19115-3).
+     */
+    ISO19139(new String[] {
+            Namespaces.CAT,
+            Namespaces.CIT,
+            Namespaces.LAN,
+            Namespaces.MAC,
+            Namespaces.MAS,
+            Namespaces.MCC,
+            Namespaces.MCO,
+            Namespaces.MEX,
+            Namespaces.MMI,
+            Namespaces.MPC,
+            Namespaces.MRC,
+            Namespaces.MRD,
+            Namespaces.MDQ,
+            Namespaces.MRI,
+            Namespaces.MRL,
+            Namespaces.MRS,
+            Namespaces.MSR,
+            Namespaces.MDS,
+            Namespaces.MD1,
+            Namespaces.MDA,
+            Namespaces.MDT,
+            Namespaces.MD2,
+            Namespaces.RCE,
+            Namespaces.FCC,
+            Namespaces.GMW,
+            Namespaces.DQC,
+            Namespaces.MDB,
+            Namespaces.GEX,
+        }, LegacyNamespaces.GMD,
+        new String[] {
+            Namespaces.GCX, LegacyNamespaces.GMX,
+            Namespaces.GCO, LegacyNamespaces.GCO,
+            Namespaces.SRV, LegacyNamespaces.SRV}),
+
+    /**
      * GML using the legacy {@code "http://www.opengis.net/gml"} namespace.
      */
-    GML31(Namespaces.GML, LegacyNamespaces.GML);
+    GML31(Namespaces.GML, LegacyNamespaces.GML),
 
     /**
      * Apply all known namespace replacements. This can be used only at unmarshalling time,
      * for replacing all namespaces by the namespaces declared in Apache SIS JAXB annotations.
      */
-    static FilterVersion ALL = GML31;
+    ALL(ISO19139, GML31);
 
     /**
      * The URI replacements to apply when going from the "real" data producer (JAXB marshaller)
@@ -63,9 +104,46 @@ enum FilterVersion {
 
     /**
      * Creates a new enum for replacing only one namespace.
+     *
+     * @param  impl  the namespace used in JAXB annotations (should be latest schema).
+     * @param  view  the namespace used in the XML file to (un)marshall (older schema).
      */
     private FilterVersion(final String impl, final String view) {
         this.toView = singletonMap(impl, view);
         this.toImpl = singletonMap(view, impl);
     }
+
+    /**
+     * Creates a new enum for replacing many namespaces by a single one.
+     * This constructor is used when the legacy schema (the "view") was one large monolithic
schema,
+     * and the new schema (the "impl") has been separated in many smaller modules.
+     *
+     * @param  impl        the namespaces used in JAXB annotations (should be latest schema).
+     * @param  view        the single namespace used in the XML file to (un)marshall (older
schema).
+     * @param  additional  additional (<var>impl</var>, <var>view</var>)
mapping for a few namespaces
+     *                     having different {@code view} values.
+     */
+    private FilterVersion(final String[] impl, final String view, final String[] additional)
{
+        toView = new HashMap<>(Containers.hashMapCapacity(impl.length));
+        toImpl = new HashMap<>();
+        for (final String e : impl) {
+            toImpl.put(e, view);
+        }
+        for (int i=0; i<additional.length;) {
+            final String p = additional[i++];
+            final String v = additional[i++];
+            toView.put(p, v);
+            toImpl.put(v, p);
+        }
+    }
+
+    /**
+     * Creates the {@link #ALL} enumeration.
+     */
+    private FilterVersion(final FilterVersion first, final FilterVersion more) {
+        toView = new HashMap<>(first.toView);
+        toImpl = new HashMap<>(first.toImpl);
+        toView.putAll(more.toView);
+        toImpl.putAll(more.toImpl);
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -26,7 +26,7 @@ import org.opengis.util.InternationalStr
  * Context of a marshalling or unmarshalling process.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -83,14 +83,8 @@ public abstract class MarshalContext {
      *
      * <table class="sis">
      *   <caption>Supported schemas</caption>
-     *   <tr>
-     *     <th>Prefix</th>
-     *     <th>Standard</th>
-     *     <th>Typical values</th>
-     *   </tr>
-     *   <tr>
-     *     <td>gml</td> <td>Geographic Markup Language</td> <td>{@code
3.0}, {@code 3.2}</td>
-     *   </tr>
+     *   <tr><th>Prefix</th>  <th>Standard</th>           
       <th>Typical values</th></tr>
+     *   <tr><td>gml</td>     <td>Geographic Markup Language</td>
<td>{@code 3.0}, {@code 3.2}</td></tr>
      * </table>
      *
      * @param  prefix  one of the above-cited prefix.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -118,6 +118,7 @@ public final class Namespaces extends St
      *   <caption>Change log</caption>
      *   <tr><th>SIS version</th> <th>URL</th></tr>
      *   <tr><td>0.3 to 0.8</td>  <td>http://www.isotc211.org/2005/gco</td></tr>
+     *   <tr><td>Since 1.0</td>   <td>http://standards.iso.org/iso/19115/-3/gco/1.0</td></tr>
      * </table>
      *
      * @category ISO
@@ -154,6 +155,7 @@ public final class Namespaces extends St
      *   <caption>Change log</caption>
      *   <tr><th>SIS version</th> <th>URL</th></tr>
      *   <tr><td>0.3 to 0.8</td>  <td>http://www.isotc211.org/2005/gfc</td></tr>
+     *   <tr><td>Since 1.0</td>   <td>http://standards.iso.org/iso/19110/gfc/1.1</td></tr>
      * </table>
      *
      * @category ISO
@@ -350,6 +352,7 @@ public final class Namespaces extends St
      *   <caption>Change log</caption>
      *   <tr><th>SIS version</th> <th>URL</th></tr>
      *   <tr><td>0.3 to 0.8</td>  <td>http://www.isotc211.org/2005/srv</td></tr>
+     *   <tr><td>Since 1.0</td>   <td>http://standards.iso.org/iso/19115/-3/srv/2.0</td></tr>
      * </table>
      *
      * @category ISO
@@ -475,8 +478,11 @@ public final class Namespaces extends St
      * The usual prefix for this namespace is {@code "gts"}.
      *
      * @category ISO
+     *
+     * @deprecated as of ISO 19115-3, splitted in many different namespaces.
      */
-    public static final String GTS = "http://www.isotc211.org/2005/gts";
+    @Deprecated
+    public static final String GTS = LegacyNamespaces.GTS;
 
     /**
      * The <code>{@value}</code> URL.
@@ -488,6 +494,7 @@ public final class Namespaces extends St
      *   <caption>Change log</caption>
      *   <tr><th>SIS version</th> <th>URL</th></tr>
      *   <tr><td>0.3</td>         <td>http://www.opengis.net/gml</td></tr>
+     *   <tr><td>Since 0.4</td>   <td>http://www.opengis.net/gml/3.2</td></tr>
      * </table>
      *
      * @category OGC

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -49,7 +49,8 @@ import org.apache.sis.internal.jaxb.Type
  * "endorsed JAR" names if needed.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -115,12 +116,14 @@ abstract class Pooled {
      * Whether {@link FilteredNamespaces} shall be used of not. Values can be:
      *
      * <ul>
-     *   <li>0 for the default behavior, which applies namespace replacements only
if the {@link XML#GML_VERSION}
-     *       property is set to an older value than the one supported natively by SIS.</li>
-     *   <li>1 for forcing namespace replacements at unmarshalling time. This is useful
for reading a XML document
-     *       of unknown GML version.</li>
-     *   <li>2 for disabling namespace replacements. XML (un)marshalling will use the
namespaces URI supported
-     *       natively by SIS as declared in JAXB annotations. This is sometime useful for
debugging purpose.</li>
+     *   <li>{@value #DEFAULT_REPLACEMENT} for the default behavior, which applies
namespace replacements
+     *       only if the {@link XML#GML_VERSION} property is set to an older value than the
one supported
+     *       natively by SIS.</li>
+     *   <li>{@value #FORCE_REPLACEMENT} for forcing namespace replacements at unmarshalling
time.
+     *       This is useful for reading a XML document of unknown GML version.</li>
+     *   <li>{@value #DISABLE_REPLACEMENT} for disabling namespace replacements. XML
(un)marshalling
+     *       will use the namespaces URI supported natively by SIS as declared in JAXB annotations.
+     *       This is sometime useful for debugging purpose.</li>
      * </ul>
      *
      * @see LegacyNamespaces#APPLY_NAMESPACE_REPLACEMENTS
@@ -128,6 +131,11 @@ abstract class Pooled {
     private byte xmlnsReplaceCode;
 
     /**
+     * Enumeration values for {@link #xmlnsReplaceCode}.
+     */
+    private static final byte DEFAULT_REPLACEMENT = 0, FORCE_REPLACEMENT = 1, DISABLE_REPLACEMENT
= 2;
+
+    /**
      * The GML version to be marshalled or unmarshalled, or {@code null} if unspecified.
      * If null, then the latest version is assumed.
      *
@@ -136,6 +144,14 @@ abstract class Pooled {
     private Version versionGML;
 
     /**
+     * The metadata version to be marshalled or unmarshalled, or {@code null} if unspecified.
+     * If null, then the latest version is assumed.
+     *
+     * @see Context#getVersion(String)
+     */
+    private Version versionMetadata;
+
+    /**
      * The reference resolver to use during unmarshalling.
      * Can be set by the {@link XML#RESOLVER} property.
      */
@@ -224,6 +240,7 @@ abstract class Pooled {
         schemas          = template.schemas;
         xmlnsReplaceCode = template.xmlnsReplaceCode;
         versionGML       = template.versionGML;
+        versionMetadata  = template.versionMetadata;
         resolver         = template.resolver;
         converter        = template.converter;
         rootAdapters     = template.rootAdapters;
@@ -258,23 +275,28 @@ abstract class Pooled {
      */
     final FilterVersion getFilterVersion() {
         switch (xmlnsReplaceCode) {
-            case 0: {
+            case DEFAULT_REPLACEMENT: {
                 // Apply namespace replacements only for older versions than the one supported
natively by SIS.
                 if (versionGML != null) {
                     if (versionGML.compareTo(LegacyNamespaces.VERSION_3_2_1) < 0) {
                         return FilterVersion.GML31;
                     }
                 }
+                if (versionMetadata != null) {
+                    if (versionMetadata.compareTo(LegacyNamespaces.ISO_19115_3) < 0) {
+                        return FilterVersion.ISO19139;
+                    }
+                }
                 break;
             }
-            case 1: {
+            case FORCE_REPLACEMENT: {
                 // Force namespace replacements at unmarshalling time (illegal for marshalling).
                 if ((bitMasks & Context.MARSHALLING) == 0) {
                     return FilterVersion.ALL;
                 }
                 break;
             }
-            // case 2: disable namespace replacements.
+            // case DISABLE_REPLACEMENT: disable namespace replacements.
         }
         return null;
     }
@@ -343,6 +365,10 @@ abstract class Pooled {
                     versionGML = (value instanceof CharSequence) ? new Version(value.toString())
: (Version) value;
                     return;
                 }
+                case XML.METADATA_VERSION: {
+                    versionMetadata = (value instanceof CharSequence) ? new Version(value.toString())
: (Version) value;
+                    return;
+                }
                 case XML.RESOLVER: {
                     resolver = (ReferenceResolver) value;
                     return;
@@ -376,9 +402,9 @@ abstract class Pooled {
                     return;
                 }
                 case LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS: {
-                    xmlnsReplaceCode = 0;
+                    xmlnsReplaceCode = DEFAULT_REPLACEMENT;
                     if (value != null) {
-                        xmlnsReplaceCode = ((Boolean) value) ? (byte) 1 : (byte) 2;
+                        xmlnsReplaceCode = ((Boolean) value) ? FORCE_REPLACEMENT : DISABLE_REPLACEMENT;
                     }
                     return;
                 }
@@ -416,6 +442,7 @@ abstract class Pooled {
             case XML.TIMEZONE:         return timezone;
             case XML.SCHEMAS:          return schemas;
             case XML.GML_VERSION:      return versionGML;
+            case XML.METADATA_VERSION: return versionMetadata;
             case XML.RESOLVER:         return resolver;
             case XML.CONVERTER:        return converter;
             case XML.WARNING_LISTENER: return warningListener;
@@ -430,9 +457,9 @@ abstract class Pooled {
             }
             case LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS: {
                 switch (xmlnsReplaceCode) {
-                    case 1:  return Boolean.TRUE;
-                    case 2:  return Boolean.FALSE;
-                    default: return null;
+                    case FORCE_REPLACEMENT:   return Boolean.TRUE;
+                    case DISABLE_REPLACEMENT: return Boolean.FALSE;
+                    default:                  return null;
                 }
             }
             case TypeRegistration.ROOT_ADAPTERS: return (rootAdapters != null) ? rootAdapters.clone()
: null;
@@ -546,6 +573,6 @@ abstract class Pooled {
      * @see Context#finish()
      */
     final Context begin() {
-        return new Context(bitMasks, locale, timezone, schemas, versionGML, resolver, converter,
warningListener);
+        return new Context(bitMasks, locale, timezone, schemas, versionGML, versionMetadata,
resolver, converter, warningListener);
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8]
(original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8]
Sat Dec  9 15:02:45 2017
@@ -64,7 +64,8 @@ import static org.apache.sis.util.Argume
  *   <tr><td>{@link #TIMEZONE}</td>           <td>{@link TimeZone}</td>
         <td>for specifying the timezone to use for dates and times.</td></tr>
  *   <tr><td>{@link #SCHEMAS}</td>            <td>{@link Map}</td>
              <td>for specifying the root URL of metadata schemas to use.</td></tr>
  *   <tr><td>{@link #DEFAULT_NAMESPACE}</td>  <td>{@link String}</td>
           <td>for specifying the default namespace of the XML document to write.</td></tr>
- *   <tr><td>{@link #GML_VERSION}</td>        <td>{@link Version}</td>
          <td>for specifying the GML version to the document be (un)marshalled.</td></tr>
+ *   <tr><td>{@link #GML_VERSION}</td>        <td>{@link Version}</td>
          <td>for specifying the GML version of the document to be (un)marshalled.</td></tr>
+ *   <tr><td>{@link #METADATA_VERSION}</td>   <td>{@link Version}</td>
          <td>for specifying the metadata version of the document to be (un)marshalled.</td></tr>
  *   <tr><td>{@link #RESOLVER}</td>           <td>{@link ReferenceResolver}</td>
<td>for replacing {@code xlink} or {@code uuidref} attributes by the actual object to
use.</td></tr>
  *   <tr><td>{@link #CONVERTER}</td>          <td>{@link ValueConverter}</td>
   <td>for controlling the conversion of URL, UUID, Units or similar objects.</td></tr>
  *   <tr><td>{@link #STRING_SUBSTITUTES}</td> <td>{@code String[]}</td>
         <td>for specifying which code lists to replace by simpler {@code <gco:CharacterString>}
elements.</td></tr>
@@ -73,7 +74,8 @@ import static org.apache.sis.util.Argume
  *
  * @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
  */
@@ -171,7 +173,7 @@ public final class XML extends Static {
      * Newer versions typically have more elements, but not always. For example in {@code
<gml:VerticalDatum>},
      * the {@code <gml:verticalDatumType>} property presents in GML 3.0 and 3.1 has
been removed in GML 3.2.</div>
      *
-     * The value can be {@link String} or {@link Version} objects.
+     * The value can be {@link String} or {@link Version} object.
      * If no version is specified, then the most recent GML version is assumed.
      *
      * <div class="section">Supported GML versions</div>
@@ -184,6 +186,20 @@ public final class XML extends Static {
     public static final String GML_VERSION = "org.apache.sis.gml.version";
 
     /**
+     * Specifies the metadata version of the document to be marshalled or unmarshalled.
+     * The metadata version may affect the set of XML elements to be marshalled and their
namespaces.
+     * The value can be {@link String} or {@link Version} object.
+     * If no version is specified, then the most recent metadata version is assumed (ISO
19115-3).
+     *
+     * <div class="section">Supported metadata versions</div>
+     * Apache SIS currently supports ISO 19115-3 by default (with the value "2014").
+     * SIS can read and write ISO 19139 if this property is set to "2003".
+     *
+     * @since 1.0
+     */
+    public static final String METADATA_VERSION = "org.apache.sis.metadata.version";
+
+    /**
      * Allows client code to replace {@code xlink} or {@code uuidref} attributes by the actual
objects to use.
      * The value for this property shall be an instance of {@link ReferenceResolver}.
      *

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -58,7 +58,8 @@
  * @author  Cédric Briançon (Geomatys)
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -57,7 +57,7 @@ public final strictfp class StringAdapte
         i18n.add(Locale.ENGLISH,  "A word");
         i18n.add(Locale.FRENCH,   "Un mot");
         i18n.add(Locale.JAPANESE, "言葉");
-        final Context context = new Context(0, Locale.ENGLISH, null, null, null, null, null,
null);
+        final Context context = new Context(0, Locale.ENGLISH, null, null, null, null, null,
null, null);
         try {
             Context.push(Locale.JAPANESE);  assertEquals("言葉",    StringAdapter.toString(i18n));
             Context.push(Locale.FRENCH);    assertEquals("Un mot", StringAdapter.toString(i18n));

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -143,7 +143,7 @@ public abstract strictfp class XMLTestCa
      */
     protected final void createContext(final boolean marshal, final Locale locale, final
String timezone) {
         context = new Context(marshal ? Context.MARSHALLING : 0, locale,
-                (timezone != null) ? TimeZone.getTimeZone(timezone) : null, null, null, null,
null, null);
+                (timezone != null) ? TimeZone.getTimeZone(timezone) : null, null, null, null,
null, null, null);
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java?rev=1817620&r1=1817619&r2=1817620&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java
[UTF-8] Sat Dec  9 15:02:45 2017
@@ -58,7 +58,7 @@ public final strictfp class ReferenceRes
      */
     public static Context begin(final boolean marshalling) {
         return new Context(marshalling ? Context.MARSHALLING : 0, null, null, null, null,
-                new ReferenceResolverMock(), null, null);
+                null, new ReferenceResolverMock(), null, null);
     }
 
     /**



Mime
View raw message