sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1708366 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/ sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/ sis-referenc...
Date Tue, 13 Oct 2015 12:16:36 GMT
Author: desruisseaux
Date: Tue Oct 13 12:16:36 2015
New Revision: 1708366

URL: http://svn.apache.org/viewvc?rev=1708366&view=rev
Log:
Identifier shall not be marshalled in "urn:ogc:" namespace if the authority is not one of
the authorities recognized by OGC.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/DerivedCRS.xml
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/TemporalDatum.xml
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata
with vertical CRS.xml
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -16,6 +16,9 @@
  */
 package org.apache.sis.internal.metadata;
 
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Locale;
 import org.opengis.parameter.*;
 import org.opengis.referencing.*;
 import org.opengis.referencing.cs.*;
@@ -32,7 +35,7 @@ import org.apache.sis.internal.util.Cons
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.7
  * @module
  *
  * @see org.apache.sis.internal.util.DefinitionURI
@@ -77,21 +80,56 @@ public final class NameMeaning extends S
     };
 
     /**
+     * Naming authorities allowed to appear in {@code "urn:ogc:def:"}.
+     *
+     * <p><b>Note on the case:</b> The <cite>"Name type specification
— definitions"</cite> document (OGC 09-048) writes
+     * authorities in upper cases, while <a href="http://www.opengis.net/def/auth/">http://www.opengis.net/def/auth/</a>
+     * use lower cases. Apache SIS uses upper cases for now.</p>
+     *
+     * @see <a href="http://www.opengis.net/def/auth/">http://www.opengis.net/def/auth/</a>
+     *
+     * @since 0.7
+     */
+    private static final Map<String,String> AUTHORITIES = new HashMap<>(12);
+    static {
+        add(Constants.EPSG);    // IOGP
+        add(Constants.OGC);     // Open Geospatial Consortium
+        add("OGC-WFS");         // OGC Web Feature Service
+        add("SI");              // Système International d'Unités
+        add("UCUM");            // Unified Code for Units of Measure
+        add("UNSD");            // United Nations Statistics Division
+        add("USNO");            // United States Naval Observatory
+    }
+
+    /**
+     * Adds the given authority to the {@link #AUTHORITIES} map.
+     * This method shall be invoked at class initialization time only.
+     */
+    private static void add(final String authority) {
+        AUTHORITIES.put(authority, authority);
+    }
+
+    /**
      * Do not allow instantiation of this class.
      */
     private NameMeaning() {
     }
 
     /**
-     * Returns {@code true} if codes in the given code space are often represented using
the URN syntax.
-     * Current implementation conservatively returns {@code true} only for {@code "EPSG"}.
-     * The list of accepted code spaces may be expanded in any future SIS version.
+     * Returns the authority to format for the given code space, or {@code null} if there
is no known authority
+     * in URN syntax for the given code space. The return value is used for fixing the Apache
SIS policy regarding
+     * lower or upper cases (both conventions are used in different OGC resources).
      *
      * @param  codeSpace The code space (can be {@code null}).
-     * @return {@code true} if the given code space is known to use the URN syntax.
+     * @return The authority to format in the URN, or {@code null} if none.
+     *
+     * @since 0.7
      */
-    public static boolean usesURN(final String codeSpace) {
-        return (codeSpace != null) && codeSpace.equalsIgnoreCase(Constants.EPSG);
+    public static String authority(String codeSpace) {
+        if (codeSpace != null) {
+            codeSpace = AUTHORITIES.get(codeSpace.toUpperCase(Locale.US));
+        }
+        return codeSpace;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -550,10 +550,11 @@ public class ImmutableIdentifier extends
                      * Other conventions format only for the ID[…] of root element.
                      */
                     if (isRoot && enclosing != null && convention != Convention.INTERNAL)
{
-                        if (NameMeaning.usesURN(cs)) {
+                        final String auth = NameMeaning.authority(cs);
+                        if (auth != null) {
                             final String type = NameMeaning.toObjectType(enclosing.getClass());
                             if (type != null) {
-                                formatter.append(new URI(type, cs, version, code));
+                                formatter.append(new URI(type, auth, version, code));
                             }
                         }
                     }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -37,7 +37,7 @@ import static org.apache.sis.internal.ut
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @XmlType(name = "CodeType")
@@ -193,7 +193,9 @@ public final class Code {
              */
             if (fallback != null) {
                 if (!isHTTP) {
-                    final String urn = DefinitionURI.format(NameMeaning.toObjectType(type),
fallback);
+                    final String urn = DefinitionURI.format(NameMeaning.toObjectType(type),
+                                                            NameMeaning.authority(fallback.getCodeSpace()),
+                                                            fallback.getVersion(), fallback.getCode());
                     if (urn != null) {
                         final Code code = new Code();
                         /*

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -321,7 +321,7 @@ final class DefaultConcatenatedOperation
      */
     @Override
     protected long computeHashCode() {
-        return super.computeHashCode() + 37 * operations.hashCode();
+        return super.computeHashCode() + 37 * Objects.hashCode(operations);
     }
 
 

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/DerivedCRS.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/DerivedCRS.xml?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/DerivedCRS.xml
(original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/DerivedCRS.xml
Tue Oct 13 12:16:36 2015
@@ -24,12 +24,12 @@
                 xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
                 gml:id             = "test-crs-derived">
 
-  <gml:identifier codeSpace="test">urn:ogc:def:crs:test::derived</gml:identifier>
+  <gml:identifier codeSpace="test">derived</gml:identifier>
   <gml:name codeSpace="test">Topocentric example</gml:name>
   <gml:scope>Nowhere.</gml:scope>
   <gml:conversion>
     <gml:Conversion gml:id="test-coordinateOperation-frombase">
-      <gml:identifier codeSpace="test">urn:ogc:def:coordinateOperation:test::fromBase</gml:identifier>
+      <gml:identifier codeSpace="test">fromBase</gml:identifier>
       <gml:name codeSpace="test">Topocentric example</gml:name>
       <gml:scope>Nowhere.</gml:scope>
       <gml:method>
@@ -151,11 +151,11 @@
 
   <gml:coordinateSystem>
     <gml:CartesianCS gml:id="test-cs-derivedcs">
-      <gml:identifier codeSpace="test">urn:ogc:def:cs:test::derivedCS</gml:identifier>
+      <gml:identifier codeSpace="test">derivedCS</gml:identifier>
       <gml:name>Topocentric easting and northing</gml:name>
       <gml:axis>
         <gml:CoordinateSystemAxis uom="urn:ogc:def:uom:EPSG::9001" gml:id="test-axis-east">
-          <gml:identifier codeSpace="test">urn:ogc:def:axis:test::east</gml:identifier>
+          <gml:identifier codeSpace="test">east</gml:identifier>
           <gml:name>Topocentric East</gml:name>
           <gml:axisAbbrev>U</gml:axisAbbrev>
           <gml:axisDirection codeSpace="EPSG">east</gml:axisDirection>
@@ -163,7 +163,7 @@
       </gml:axis>
       <gml:axis>
         <gml:CoordinateSystemAxis uom="urn:ogc:def:uom:EPSG::9001" gml:id="test-axis-north">
-          <gml:identifier codeSpace="test">urn:ogc:def:axis:test::north</gml:identifier>
+          <gml:identifier codeSpace="test">north</gml:identifier>
           <gml:name>Topocentric North</gml:name>
           <gml:axisAbbrev>V</gml:axisAbbrev>
           <gml:axisDirection codeSpace="EPSG">north</gml:axisDirection>
@@ -171,7 +171,7 @@
       </gml:axis>
       <gml:axis>
         <gml:CoordinateSystemAxis uom="urn:ogc:def:uom:EPSG::9001" gml:id="test-axis-up">
-          <gml:identifier codeSpace="test">urn:ogc:def:axis:test::up</gml:identifier>
+          <gml:identifier codeSpace="test">up</gml:identifier>
           <gml:name>Topocentric Up</gml:name>
           <gml:axisAbbrev>z</gml:axisAbbrev>
           <gml:axisDirection codeSpace="EPSG">up</gml:axisDirection>

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/TemporalDatum.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/TemporalDatum.xml?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/TemporalDatum.xml
(original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/TemporalDatum.xml
Tue Oct 13 12:16:36 2015
@@ -23,7 +23,7 @@
                    xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
                    gml:id             = "sis-datum-mj">
 
-  <gml:identifier codeSpace="SIS">urn:ogc:def:datum:SIS::MJ</gml:identifier>
+  <gml:identifier codeSpace="SIS">MJ</gml:identifier>
   <gml:name>Modified Julian</gml:name>
   <gml:remarks>Time measured as days since November 17, 1858 at 00:00 UTC.</gml:remarks>
   <gml:scope>History.</gml:scope>

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
(original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
Tue Oct 13 12:16:36 2015
@@ -24,7 +24,7 @@
                            xmlns:gco          = "http://www.isotc211.org/2005/gco"
                            xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
                            xmlns:xlink        = "http://www.w3.org/1999/xlink"
-                           gml:id             = "test-operation-concatenated">
+                           gml:id             = "test-coordinateOperation-concatenated">
 
   <!--
     For this test we use the "NTF (Paris) to NTF (1)" transformation (EPSG:1763), but separated
@@ -124,7 +124,7 @@
     between the real source and real target CRS.
   -->
   <gml:coordOperation>
-    <gml:Transformation gml:id="test-crs-step1">
+    <gml:Transformation gml:id="test-coordinateOperation-step1">
       <gml:identifier codeSpace="test">step-1</gml:identifier>
       <gml:name>Paris to tmp</gml:name>
       <gml:scope>None.</gml:scope>
@@ -180,7 +180,7 @@
     Second transformation step, reusing above elements.
   -->
   <gml:coordOperation>
-    <gml:Transformation gml:id="test-crs-step2">
+    <gml:Transformation gml:id="test-coordinateOperation-step2">
       <gml:identifier codeSpace="test">step-2</gml:identifier>
       <gml:name>Tmp to Greenwich</gml:name>
       <gml:scope>None.</gml:scope>

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata
with vertical CRS.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata%20with%20vertical%20CRS.xml?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata
with vertical CRS.xml (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata
with vertical CRS.xml Tue Oct 13 12:16:36 2015
@@ -112,16 +112,16 @@
               <gmd:maximumValue> <gco:Real>10000</gco:Real> </gmd:maximumValue>
               <gmd:verticalCRS>
                 <gml:VerticalCRS gml:id="sis-crs-test1">
-                  <gml:identifier codeSpace="SIS">urn:ogc:def:crs:SIS::test1</gml:identifier>
+                  <gml:identifier codeSpace="SIS">test1</gml:identifier>
                   <gml:name>Depth</gml:name>
                   <gml:scope>World</gml:scope>
                   <gml:verticalCS>
                     <gml:VerticalCS gml:id="sis-cs-test3">
-                      <gml:identifier codeSpace="SIS">urn:ogc:def:cs:SIS::test3</gml:identifier>
+                      <gml:identifier codeSpace="SIS">test3</gml:identifier>
                       <gml:name>Depth</gml:name>
                       <gml:axis>
                         <gml:CoordinateSystemAxis uom="urn:ogc:def:uom:EPSG::9001" gml:id="sis-axis-test4">
-                          <gml:identifier codeSpace="SIS">urn:ogc:def:axis:SIS::test4</gml:identifier>
+                          <gml:identifier codeSpace="SIS">test4</gml:identifier>
                           <gml:name>Depth</gml:name>
                           <gml:axisAbbrev>d</gml:axisAbbrev>
                           <gml:axisDirection codeSpace="EPSG">down</gml:axisDirection>
@@ -131,7 +131,7 @@
                   </gml:verticalCS>
                   <gml:verticalDatum>
                     <gml:VerticalDatum gml:id="sis-datum-test2">
-                      <gml:identifier codeSpace="SIS">urn:ogc:def:datum:SIS::test2</gml:identifier>
+                      <gml:identifier codeSpace="SIS">test2</gml:identifier>
                       <gml:name>Depth</gml:name>
                       <gml:scope>World</gml:scope>
                     </gml:VerticalDatum>

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlValu
 import javax.xml.bind.annotation.XmlAttribute;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.Schemas;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.measure.Units;
@@ -146,7 +147,7 @@ public final class Measure {
         if (!asXPointer) {
             final Integer code = Units.getEpsgCode(unit, inAxis);
             if (code != null) {
-                return DefinitionURI.PREFIX + ":uom:EPSG::" + code;
+                return DefinitionURI.PREFIX + ":uom:" + Constants.EPSG + "::" + code;
             }
         }
         if (unit == null || unit.equals(Unit.ONE)) {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -18,7 +18,6 @@ package org.apache.sis.internal.util;
 
 import java.util.Map;
 import java.util.Collections;
-import org.opengis.metadata.Identifier;
 
 import static org.apache.sis.util.CharSequences.*;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -97,9 +96,10 @@ import static org.apache.sis.internal.ut
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  *
+ * @see org.apache.sis.internal.metadata.NameMeaning
  * @see <a href="http://portal.opengeospatial.org/files/?artifact_id=24045">Definition
identifier URNs in OGC namespace</a>
  * @see <a href="http://www.opengeospatial.org/ogcna">OGC Naming Authority</a>
  */
@@ -132,17 +132,25 @@ public final class DefinitionURI {
 
     /**
      * The type part of a URI, or {@code null} if none (empty).
+     * Note that the set of valid types in OGC namespace is restricted.
+     * See class javadoc for more information.
      *
      * <div class="note"><b>Example:</b>
      * In the {@code "urn:ogc:def:crs:EPSG:8.2:4326"} URN, this is {@code "crs"}.</div>
+     *
+     * @see org.apache.sis.internal.metadata.NameMeaning#toObjectType(Class)
      */
     public String type;
 
     /**
      * The authority part of a URI, or {@code null} if none (empty).
+     * Note that the set of valid authorities in OGC namespace is restricted.
+     * See class javadoc for more information.
      *
      * <div class="note"><b>Example:</b>
      * In the {@code "urn:ogc:def:crs:EPSG:8.2:4326"} URN, this is {@code "EPSG"}.</div>
+     *
+     * @see org.apache.sis.internal.metadata.NameMeaning#authority(String)
      */
     public String authority;
 
@@ -451,19 +459,21 @@ public final class DefinitionURI {
      * version and code are appended omitting any characters that are not valid for a Unicode
identifier.
      * If some information are missing in the given identifier, then this method returns
{@code null}.
      *
-     * @param  type The object type, as one of the type documented in class javadoc, or {@code
null}.
-     * @param  identifier The identifier to format.
-     * @return An identifier using the URN syntax, or {@code null} if an information is missing.
+     * @param  type      The object type as one of the types documented in class javadoc,
or {@code null}.
+     * @param  authority The authority as one of the values documented in class javadoc,
or {@code null}.
+     * @param  version   The code version, or {@code null}. This is the only optional information.
+     * @param  code      The code, or {@code null}.
+     * @return An identifier using the URN syntax, or {@code null} if a mandatory information
is missing.
      */
-    public static String format(final String type, final Identifier identifier) {
+    public static String format(final String type, final String authority, final String version,
final String code) {
         final StringBuilder buffer = new StringBuilder(PREFIX);
         for (int p=0; p<4; p++) {
             final String component;
             switch (p) {
-                case 0:  component = type;                      break;
-                case 1:  component = identifier.getCodeSpace(); break;
-                case 2:  component = identifier.getVersion();   break;
-                case 3:  component = identifier.getCode();      break;
+                case 0:  component = type;      break;
+                case 1:  component = authority; break;
+                case 2:  component = version;   break;
+                case 3:  component = code;      break;
                 default: throw new AssertionError(p);
             }
             if (!appendUnicodeIdentifier(buffer.append(SEPARATOR), '\u0000', component, ".-",
false)) {

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java?rev=1708366&r1=1708365&r2=1708366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java
[UTF-8] Tue Oct 13 12:16:36 2015
@@ -17,8 +17,6 @@
 package org.apache.sis.internal.util;
 
 import org.opengis.metadata.Identifier;
-import org.apache.sis.internal.simple.SimpleIdentifier;
-import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -151,7 +149,7 @@ public final strictfp class DefinitionUR
      */
     @Test
     public void testToURN() {
-        final Identifier identifier = new SimpleIdentifier(new SimpleCitation("EPSG"), "4326",
false);
-        assertEquals("urn:ogc:def:crs:EPSG::4326", DefinitionURI.format("crs", identifier));
+        assertEquals("urn:ogc:def:crs:EPSG::4326", DefinitionURI.format("crs", "EPSG", null,
"4326"));
+        assertNull  ("Authority is not optional.", DefinitionURI.format("crs", null,   null,
"4326"));
     }
 }



Mime
View raw message