sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Move Schemas constant into CodeListUID for avoiding confusion: those URL are no longer the URL where to download the XML schemas since the protocol changed from "http" to "https". They are now only namespace for "codeList" ou "uom" attribute values in some XML elements. https://issues.apache.org/jira/browse/SIS-480
Date Thu, 09 Jan 2020 14:43:20 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 1c506b3  Move Schemas constant into CodeListUID for avoiding confusion: those URL
are no longer the URL where to download the XML schemas since the protocol changed from "http"
to "https". They are now only namespace for "codeList" ou "uom" attribute values in some XML
elements. https://issues.apache.org/jira/browse/SIS-480
1c506b3 is described below

commit 1c506b3e04233928d3655175ad5845100ec30f4c
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Jan 9 15:11:36 2020 +0100

    Move Schemas constant into CodeListUID for avoiding confusion: those URL are no longer
the URL where to download the XML schemas since the protocol changed from "http" to "https".
They are now only namespace for "codeList" ou "uom" attribute values in some XML elements.
    https://issues.apache.org/jira/browse/SIS-480
---
 .../apache/sis/internal/jaxb/cat/CodeListUID.java  |  88 ++++++++++++++++--
 .../apache/sis/internal/jaxb/cat/package-info.java |   2 +-
 .../sis/internal/jaxb/gml/CodeListAdapter.java     |  35 +++++++-
 .../apache/sis/internal/jaxb/gml/CodeListUID.java  |  59 ------------
 .../org/apache/sis/internal/jaxb/gml/Measure.java  |   8 +-
 .../apache/sis/internal/jaxb/gml/package-info.java |   2 +-
 .../java/org/apache/sis/internal/xml/Schemas.java  | 100 ---------------------
 .../org/apache/sis/internal/xml/package-info.java  |   2 +-
 .../internal/jaxb/cat/CodeListMarshallingTest.java |  19 ++--
 .../apache/sis/internal/jaxb/gml/MeasureTest.java  |  18 +++-
 .../sis/internal/jaxb/lan/LanguageCodeTest.java    |   6 +-
 .../iso/identification/DefaultResolutionTest.java  |   8 +-
 .../sis/test/xml/AnnotationConsistencyCheck.java   |   6 +-
 .../java/org/apache/sis/test/xml/TestCase.java     |   8 +-
 .../java/org/apache/sis/test/xml/package-info.java |   2 +-
 15 files changed, 158 insertions(+), 205 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/CodeListUID.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/CodeListUID.java
index f1a6054..a170bc1 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/CodeListUID.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/CodeListUID.java
@@ -26,7 +26,6 @@ import org.opengis.util.CodeList;
 import org.opengis.util.ControlledVocabulary;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.internal.jaxb.Context;
-import org.apache.sis.internal.xml.Schemas;
 
 
 /**
@@ -39,10 +38,42 @@ import org.apache.sis.internal.xml.Schemas;
  * This object is wrapped by {@link CodeListAdapter} or, in the special case of {@link Locale}
type, by
  * {@link org.apache.sis.internal.jaxb.lan.LanguageCode} or {@link org.apache.sis.internal.jaxb.lan.Country}.
  *
+ * <h2>Base URLs</h2>
+ * This class defines constants for URL to schema directories or definition files used in
code list elements.
+ * SIS does not use those URL directly for downloading files (downloading an XML schema from
ISO servers
+ * require {@code "https"} protocol, but the URLs in this class use {@code "http"} for historical
reasons).
+ * Example:
+ *
+ * {@preformat xml
+ *   <gmi:MI_SensorTypeCode
+ *       codeList="http://standards.iso.org/…snip…/codelists.xml#CI_SensorTypeCode"
+ *       codeListValue="RADIOMETER">Radiometer</gmi:MI_SensorTypeCode>
+ * }
+ *
+ * <p>Constants in this class are organized in three groups:</p>
+ * <ul>
+ *   <li>Constants with the {@code _ROOT} suffix are {@code "http://"} URL to a root
directory.</li>
+ *   <li>Constants with the {@code _PATH} suffix are relative paths to concatenate
to a {@code _ROOT}
+ *       constant in order to get the full path to a file.</li>
+ *   <li>Constants with the {@code _XSD} suffix are {@code "http://"} URL to a the
XSD definition file.</li>
+ * </ul>
+ *
+ * <h3>Note on multi-lingual files</h3>
+ * Some files are available in two variants: with and without {@code "ML_"} prefix, which
stands for "Multi Lingual".
+ * Some examples are {@code "[ML_]gmxCodelists.xml"} and {@code "[ML_]gmxUom.xml"}. The following
assumptions hold:
+ *
+ * <ul>
+ *   <li>All code lists defined in a {@code ML_foo.xml} file exist also in {@code foo.xml}.</li>
+ *   <li>The converse of above point is not necessarily true:
+ *       the {@code ML_foo.xml} file may contain only a subset of {@code foo.xml}.</li>
+ *   <li>All English descriptions in {@code ML_foo.xml} file are strictly identical
to the ones in {@code foo.xml}.</li>
+ *   <li>Descriptions in other languages than English exist only in {@code ML_foo.xml}.</li>
+ * </ul>
+ *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.1
  *
  * @see CodeListAdapter
  *
@@ -52,6 +83,51 @@ import org.apache.sis.internal.xml.Schemas;
 @XmlType(name = "CodeList", propOrder = {"codeList", "codeListValue", "codeSpace"})
 public final class CodeListUID {
     /**
+     * The root directory of ISO 19115 metadata schemas.
+     * This is the schema used by default in Apache SIS.
+     */
+    public static final String METADATA_ROOT = "http://standards.iso.org/iso/19115/";
+
+    /**
+     * The root directory of OGC metadata schemas.
+     * This is the schema used by default in Apache SIS.
+     * Some alternatives to this URL are:
+     *
+     * <ul>
+     *   <li>http://schemas.opengis.net/iso/19139/20070417/</li>
+     *   <li>http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/</li>
+     * </ul>
+     */
+    public static final String METADATA_ROOT_LEGACY = "http://www.isotc211.org/2005/";
+
+    /**
+     * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions
of code lists.
+     */
+    public static final String CODELISTS_PATH = "resources/Codelist/cat/codelists.xml";
+
+    /**
+     * The string to append to {@link #METADATA_ROOT_LEGACY} or one of its alternative 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
+     * instead of {@code "gmxCodelists.xml"}</p>
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
+     */
+    public static final String CODELISTS_PATH_LEGACY = "resources/Codelist/gmxCodelists.xml";
+
+    /**
+     * The string to append to {@link #METADATA_ROOT} or one of its alternative for obtaining
the path
+     * to the definitions of units of measurement.
+     *
+     * <p>A localized version of this file exists also with the {@code "ML_gmxUom.xml"}
filename
+     * instead of {@code "gmxUom.xml"}</p>
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
+     */
+    public static final String UOM_PATH = "resources/uom/gmxUom.xml";
+
+    /**
      * Returns the URL to a given code list in the given XML file.
      * This method concatenates the base schema URL with the given identifier.
      * Some examples of strings returned by this method are:
@@ -73,12 +149,12 @@ public final class CodeListUID {
         final String prefix, root, path;
         if (Context.isFlagSet(context, Context.LEGACY_METADATA)) {
             prefix = "gmd";
-            root = Schemas.METADATA_ROOT_LEGACY;
-            path = Schemas.CODELISTS_PATH_LEGACY;   // Future SIS version may switch between
localized/unlocalized file.
+            root = METADATA_ROOT_LEGACY;
+            path = CODELISTS_PATH_LEGACY;       // Future SIS version may switch between
localized/unlocalized file.
         } else {
             prefix = "cat";
-            root = Schemas.METADATA_ROOT;
-            path = Schemas.CODELISTS_PATH;
+            root = METADATA_ROOT;
+            path = CODELISTS_PATH;
         }
         return Context.schema(context, prefix, root).append(path).append('#').append(identifier).toString();
     }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/package-info.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/package-info.java
index f2a1931..c1ded97 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/cat/package-info.java
@@ -20,7 +20,7 @@
  * ISO 19115-3:2016 defines them in the {@value org.apache.sis.xml.Namespaces#CAT} namespace.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   1.0
  * @module
  */
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java
index db7e184..f2e1e3b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.internal.jaxb.gml;
 
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.CodeList;
 import org.apache.sis.util.iso.Types;
@@ -34,7 +36,32 @@ import org.apache.sis.util.iso.Types;
  * @since 0.3
  * @module
  */
-public abstract class CodeListAdapter<BoundType extends CodeList<BoundType>>
extends XmlAdapter<CodeListUID,BoundType> {
+public abstract class CodeListAdapter<BoundType extends CodeList<BoundType>>
extends XmlAdapter<CodeListAdapter.Value, BoundType> {
+    /**
+     * Wraps the {@link CodeList} value in a GML document. This class does not need to be
public
+     * even if exported from public {@link CodeListAdapter} API, because it is used only
by JAXB
+     * and JAXB can access private members.
+     */
+    static final class Value {
+        /** The code space of the {@link #value} as a URI, or {@code null}. */
+        @XmlAttribute
+        String codeSpace;
+
+        /** The code list identifier. */
+        @XmlValue
+        String value;
+
+        /** Empty constructor for JAXB only. */
+        Value() {
+        }
+
+        /** Creates a new wrapper for the given value. */
+        Value(final String codeSpace, final CodeList<?> code) {
+           this.codeSpace = codeSpace;
+           value = Types.getCodeName(code);
+        }
+    }
+
     /**
      * Empty constructor for subclasses only.
      */
@@ -66,7 +93,7 @@ public abstract class CodeListAdapter<BoundType extends CodeList<BoundType>>
ext
      * @return a code list which represents the GML value.
      */
     @Override
-    public final BoundType unmarshal(final CodeListUID identifier) {
+    public final BoundType unmarshal(final Value identifier) {
         return (identifier != null) ? Types.forCodeName(getCodeListClass(), identifier.value,
true) : null;
     }
 
@@ -78,7 +105,7 @@ public abstract class CodeListAdapter<BoundType extends CodeList<BoundType>>
ext
      * @return the proxy for the given code list.
      */
     @Override
-    public final CodeListUID marshal(final BoundType code) {
-        return (code != null) ? new CodeListUID(getCodeSpace(), code) : null;
+    public final Value marshal(final BoundType code) {
+        return (code != null) ? new Value(getCodeSpace(), code) : null;
     }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
deleted file mode 100644
index 93db762..0000000
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.gml;
-
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.XmlAttribute;
-import org.opengis.util.CodeList;
-import org.apache.sis.util.iso.Types;
-
-
-/**
- * An element of the XML documented created for GML {@link CodeList}.
- *
- * @author  Guilhem Legal (Geomatys)
- * @version 0.7
- * @since   0.3
- * @module
- */
-public final class CodeListUID {
-    /**
-     * The code space of the {@link #value} as a URI, or {@code null}.
-     */
-    @XmlAttribute
-    String codeSpace;
-
-    /**
-     * The code list identifier.
-     */
-    @XmlValue
-    String value;
-
-    /**
-     * Empty constructor for JAXB only.
-     */
-    private CodeListUID() {
-    }
-
-    /**
-     * Creates a new adapter for the given value.
-     */
-    CodeListUID(final String codeSpace, final CodeList<?> code) {
-       this.codeSpace = codeSpace;
-       value = Types.getCodeName(code);
-    }
-}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
index e9d94b1..18dae97 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
@@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
 import javax.xml.bind.annotation.XmlAttribute;
 import org.apache.sis.internal.jaxb.Context;
-import org.apache.sis.internal.xml.Schemas;
+import org.apache.sis.internal.jaxb.cat.CodeListUID;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.measure.UnitFormat;
@@ -64,7 +64,7 @@ import org.apache.sis.measure.Units;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  *
  * @see org.apache.sis.internal.jaxb.gml.MeasureList
  * @see org.apache.sis.internal.jaxb.gco.UnitAdapter
@@ -179,8 +179,8 @@ public final class Measure {
          *     link = current code
          * }
          */
-        link = Context.schema(context, "gmd", Schemas.METADATA_ROOT_LEGACY);
-        link.append(Schemas.UOM_PATH).append("#xpointer(//*[@gml:id='");
+        link = Context.schema(context, "gmd", CodeListUID.METADATA_ROOT_LEGACY);
+        link.append(CodeListUID.UOM_PATH).append("#xpointer(//*[@gml:id='");
         try {
             UCUM.format(unit, link);
         } catch (IOException e) {
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/package-info.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/package-info.java
index ac2b314..25afebd 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/package-info.java
@@ -27,7 +27,7 @@
  * @author  Guilhem Legal (Geomatys)
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.1
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
  *
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/Schemas.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/Schemas.java
deleted file mode 100644
index 14e3b09..0000000
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/Schemas.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.xml;
-
-
-/**
- * Constants for URL to schema directories or definition files.
- * Constants in this class are organized in three groups:
- *
- * <ul>
- *   <li>Constants with the {@code _ROOT} suffix are {@code "http://"} URL to a root
directory.</li>
- *   <li>Constants with the {@code _PATH} suffix are relative paths to concatenate
to a {@code _ROOT}
- *       constant in order to get the full path to a file.</li>
- *   <li>Constants with the {@code _XSD} suffix are {@code "http://"} URL to a the
XSD definition file.</li>
- * </ul>
- *
- * <h2>Note on multi-lingual files</h2>
- * Some files are available in two variants: with and without {@code "ML_"} prefix, which
stands for "Multi Lingual".
- * Some examples are {@code "[ML_]gmxCodelists.xml"} and {@code "[ML_]gmxUom.xml"}. The following
assumptions hold:
- *
- * <ul>
- *   <li>All code lists defined in a {@code ML_foo.xml} file exist also in {@code foo.xml}.</li>
- *   <li>The converse of above point is not necessarily true:
- *       the {@code ML_foo.xml} file may contain only a subset of {@code foo.xml}.</li>
- *   <li>All English descriptions in {@code ML_foo.xml} file are strictly identical
to the ones in {@code foo.xml}.</li>
- *   <li>Descriptions in other languages than English exist only in {@code ML_foo.xml}.</li>
- * </ul>
- *
- * @author  Martin Desruisseaux (Geomatys)
- * @author  Cullen Rombach (Image Matters)
- * @version 1.1
- * @since   0.4
- * @module
- */
-public final class Schemas {
-    /**
-     * The root directory of ISO 19115 metadata schemas.
-     * This is the schema used by default in Apache SIS.
-     */
-    public static final String METADATA_ROOT = "http://standards.iso.org/iso/19115/";
-
-    /**
-     * The root directory of OGC metadata schemas.
-     * This is the schema used by default in Apache SIS.
-     * Some alternatives to this URL are:
-     *
-     * <ul>
-     *   <li>http://schemas.opengis.net/iso/19139/20070417/</li>
-     *   <li>http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/</li>
-     * </ul>
-     */
-    public static final String METADATA_ROOT_LEGACY = "http://www.isotc211.org/2005/";
-
-    /**
-     * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions
of code lists.
-     */
-    public static final String CODELISTS_PATH = "resources/Codelist/cat/codelists.xml";
-
-    /**
-     * The string to append to {@link #METADATA_ROOT_LEGACY} or one of its alternative 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
-     * instead of {@code "gmxCodelists.xml"}</p>
-     *
-     * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
-     */
-    public static final String CODELISTS_PATH_LEGACY = "resources/Codelist/gmxCodelists.xml";
-
-    /**
-     * The string to append to {@link #METADATA_ROOT} or one of its alternative for obtaining
the path
-     * to the definitions of units of measurement.
-     *
-     * <p>A localized version of this file exists also with the {@code "ML_gmxUom.xml"}
filename
-     * instead of {@code "gmxUom.xml"}</p>
-     *
-     * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
-     */
-    public static final String UOM_PATH = "resources/uom/gmxUom.xml";
-
-    /**
-     * Do not allow instantiation of this class.
-     */
-    private Schemas() {
-    }
-}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/package-info.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/package-info.java
index 01200a3..4017656 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/xml/package-info.java
@@ -30,7 +30,7 @@
  * @author  Cédric Briançon (Geomatys)
  * @author  Cullen Rombach (Image Matters)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   1.0
  * @module
  */
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/CodeListMarshallingTest.java
b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/CodeListMarshallingTest.java
index 28b529f..2ea86e8 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/CodeListMarshallingTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/CodeListMarshallingTest.java
@@ -28,7 +28,6 @@ import org.opengis.metadata.citation.Responsibility;
 import org.opengis.metadata.citation.PresentationForm;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.internal.xml.LegacyNamespaces;
-import org.apache.sis.internal.xml.Schemas;
 import org.apache.sis.xml.XML;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.MarshallerPool;
@@ -44,7 +43,7 @@ import static org.apache.sis.test.MetadataAssert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Guilhem Legal (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -58,7 +57,7 @@ public final strictfp class CodeListMarshallingTest extends TestCase {
     private static String getResponsiblePartyXML(final String baseURL) {
         return "<gmd:CI_ResponsibleParty xmlns:gmd=\"" + LegacyNamespaces.GMD + "\">\n"
+
                "  <gmd:role>\n" +
-               "    <gmd:CI_RoleCode codeList=\"" + baseURL + Schemas.CODELISTS_PATH_LEGACY
+ "#CI_RoleCode\"" +
+               "    <gmd:CI_RoleCode codeList=\"" + baseURL + CodeListUID.CODELISTS_PATH_LEGACY
+ "#CI_RoleCode\"" +
                     " codeListValue=\"principalInvestigator\">" + "Principal investigator</gmd:CI_RoleCode>\n"
+
                "  </gmd:role>\n" +
                "</gmd:CI_ResponsibleParty>";
@@ -75,15 +74,15 @@ public final strictfp class CodeListMarshallingTest extends TestCase {
         final Object[] args = new Object[] {
             "cit",                          // Prefix
             Namespaces.CIT,                 // Namespace
-            Schemas.METADATA_ROOT,          // Base URL of code list path
-            Schemas.CODELISTS_PATH,         // Relative code list path in base URL
+            CodeListUID.METADATA_ROOT,      // Base URL of code list path
+            CodeListUID.CODELISTS_PATH,     // Relative code list path in base URL
             language, dateType
         };
         if (legacy) {
-            args[0] = "gmd";                              // Prefix
-            args[1] = LegacyNamespaces.GMD;               // Namespace
-            args[2] = Schemas.METADATA_ROOT_LEGACY;       // Base URL of code list path
-            args[3] = Schemas.CODELISTS_PATH_LEGACY;      // Relative code list path in base
URL
+            args[0] = "gmd";                                // Prefix
+            args[1] = LegacyNamespaces.GMD;                 // Namespace
+            args[2] = CodeListUID.METADATA_ROOT_LEGACY;     // Base URL of code list path
+            args[3] = CodeListUID.CODELISTS_PATH_LEGACY;    // Relative code list path in
base URL
         }
         return String.format(
                 "<%1$s:CI_Date xmlns:%1$s=\"%2$s\">\n" +
@@ -101,7 +100,7 @@ public final strictfp class CodeListMarshallingTest extends TestCase {
      */
     @Test
     public void testDefaultURL() throws JAXBException {
-        final String expected = getResponsiblePartyXML(Schemas.METADATA_ROOT_LEGACY);
+        final String expected = getResponsiblePartyXML(CodeListUID.METADATA_ROOT_LEGACY);
         final Responsibility rp = unmarshal(Responsibility.class, expected);
         assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole());
         /*
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
index c0b437c..d3d675c 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
@@ -18,7 +18,7 @@ package org.apache.sis.internal.jaxb.gml;
 
 import java.net.URISyntaxException;
 import org.apache.sis.measure.Units;
-import org.apache.sis.internal.xml.Schemas;
+import org.apache.sis.internal.jaxb.cat.CodeListUID;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -36,6 +36,16 @@ import static org.junit.Assert.*;
  */
 public final strictfp class MeasureTest extends TestCase {
     /**
+     * The URL used in {@code uom} attribute of XML elements which contains a measurements.
+     * Example:
+     *
+     * {@preformat xml
+     *     <gco:Distance uom="http://www.isotc211.org/2005/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])">1000.0</gco:Distance>
+     * }
+     */
+    public static final String UOM_URL = CodeListUID.METADATA_ROOT_LEGACY + CodeListUID.UOM_PATH;
+
+    /**
      * Tests the {@link Measure#getUOM()}.
      */
     @Test
@@ -61,7 +71,7 @@ public final strictfp class MeasureTest extends TestCase {
         assertEquals(Units.METRE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9001", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals(Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])",
measure.getUOM());
+        assertEquals(UOM_URL + "#xpointer(//*[@gml:id='m'])", measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = false;
@@ -69,12 +79,12 @@ public final strictfp class MeasureTest extends TestCase {
         assertEquals(Units.DEGREE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9102", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals(Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
+        assertEquals(UOM_URL + "#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_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
+        assertEquals(UOM_URL + "#xpointer(//*[@gml:id='kg'])", measure.getUOM());
     }
 }
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
index 24aca9d..cb14efb 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
@@ -26,7 +26,7 @@ import javax.xml.bind.JAXBException;
 import org.opengis.metadata.Metadata;
 import org.apache.sis.xml.XML;
 import org.apache.sis.xml.MarshallerPool;
-import org.apache.sis.internal.xml.Schemas;
+import org.apache.sis.internal.jaxb.cat.CodeListUID;
 import org.apache.sis.internal.xml.LegacyNamespaces;
 import org.apache.sis.test.mock.MetadataMock;
 import org.apache.sis.test.DependsOnMethod;
@@ -49,7 +49,7 @@ import static org.apache.sis.internal.util.StandardDateFormat.UTC;
  * {@code "http://www.isotc211.org/2005/gmd"} namespace to {@code "http://standards.iso.org/…"}.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -68,7 +68,7 @@ public final strictfp class LanguageCodeTest extends TestCase {
      * XML fragment using the {@code <gmd:LanguageCode>} construct with attributes.
      */
     private static final String LANGUAGE_CODE = "<gmd:LanguageCode" +
-            " codeList=\"" + Schemas.METADATA_ROOT_LEGACY + Schemas.CODELISTS_PATH_LEGACY
+ "#LanguageCode\"" +
+            " codeList=\"" + CodeListUID.METADATA_ROOT_LEGACY + CodeListUID.CODELISTS_PATH_LEGACY
+ "#LanguageCode\"" +
             " codeListValue=\"jpn\">Japanese</gmd:LanguageCode>";
 
     /**
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
index c3b9f07..70f16a3 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
@@ -21,7 +21,6 @@ import org.opengis.metadata.identification.RepresentativeFraction;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.xml.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.Context;
-import org.apache.sis.internal.xml.Schemas;
 import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.xml.TestCase;
 import org.apache.sis.test.DependsOn;
@@ -30,6 +29,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.internal.jaxb.gml.MeasureTest.UOM_URL;
 
 
 /**
@@ -37,7 +37,7 @@ import static org.apache.sis.test.MetadataAssert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -126,7 +126,7 @@ public final strictfp class DefaultResolutionTest extends TestCase {
                 "<mri:MD_Resolution xmlns:mri=\"" + Namespaces.MRI + '"' +
                                   " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
                 "  <mri:distance>\n" +
-                "    <gco:Distance uom=\"" + Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH
+ "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n" +
+                "    <gco:Distance uom=\"" + UOM_URL + "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n"
+
                 "  </mri:distance>\n" +
                 "</mri:MD_Resolution>", xml, "xmlns:*");
 
@@ -157,7 +157,7 @@ public final strictfp class DefaultResolutionTest extends TestCase {
                 "<gmd:MD_Resolution xmlns:gmd=\"" + LegacyNamespaces.GMD + '"' +
                                   " xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" +
                 "  <gmd:distance>\n" +
-                "    <gco:Distance uom=\"" + Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH
+ "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n" +
+                "    <gco:Distance uom=\"" + UOM_URL + "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n"
+
                 "  </gmd:distance>\n" +
                 "</gmd:MD_Resolution>", xml, "xmlns:*");
 
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
index 8e0b5db..6c3ae89 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
@@ -39,8 +39,8 @@ import org.opengis.util.CodeList;
 import org.opengis.util.ControlledVocabulary;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.internal.xml.Schemas;
 import org.apache.sis.internal.xml.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.cat.CodeListUID;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.TestCase;
@@ -72,7 +72,7 @@ import junit.framework.AssertionFailedError;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -341,7 +341,7 @@ public abstract strictfp class AnnotationConsistencyCheck extends TestCase
{
         switch (uml.specification()) {
             case ISO_19115:
             case ISO_19115_2:
-            case ISO_19115_3: return Schemas.METADATA_ROOT;
+            case ISO_19115_3: return CodeListUID.METADATA_ROOT;
             case ISO_19139:   return LegacyNamespaces.GMX;
             case ISO_19108:   return LegacyNamespaces.GMD;
             default: throw new IllegalArgumentException(uml.toString());
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/TestCase.java b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/TestCase.java
index dab8dd6..925ba3b 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/TestCase.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/TestCase.java
@@ -32,7 +32,7 @@ import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.xml.LegacyNamespaces;
-import org.apache.sis.internal.xml.Schemas;
+import org.apache.sis.internal.jaxb.cat.CodeListUID;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Version;
 import org.apache.sis.xml.Namespaces;
@@ -57,7 +57,7 @@ import static org.apache.sis.test.MetadataAssert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.1
  *
  * @see DocumentComparator
  *
@@ -398,8 +398,8 @@ public abstract strictfp class TestCase extends org.apache.sis.test.TestCase
{
         Namespaces.MRI, LegacyNamespaces.GMD, "mri",  "gmd",
         Namespaces.GCO, LegacyNamespaces.GCO,      // "gco"
         Namespaces.GCX, LegacyNamespaces.GMX, "gcx",  "gmx",
-        Schemas.METADATA_ROOT,  Schemas.METADATA_ROOT_LEGACY,           // For code lists
-        Schemas.CODELISTS_PATH, Schemas.CODELISTS_PATH_LEGACY
+        CodeListUID.METADATA_ROOT,  CodeListUID.METADATA_ROOT_LEGACY,           // For code
lists.
+        CodeListUID.CODELISTS_PATH, CodeListUID.CODELISTS_PATH_LEGACY
     };
 
     /**
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/package-info.java b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/package-info.java
index 7f58f3e..da318ef 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/package-info.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/package-info.java
@@ -25,7 +25,7 @@
  * in any future version without notice.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   1.0
  * @module
  */


Mime
View raw message