sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1682524 [1/2] - in /sis/branches/JDK8: application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-me...
Date Fri, 29 May 2015 17:52:15 GMT
Author: desruisseaux
Date: Fri May 29 17:52:14 2015
New Revision: 1682524

URL: http://svn.apache.org/r1682524
Log:
Referencing: Citations.getIdentifier(Citation) should take Identifier.codeSpace in account (SIS-201).
This work is a consequence of SIS-200 (Citations should not provide constant for organisations),
more visible with the case of "ISO 19115" citation.

Removed:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Standards.java
Modified:
    sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.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/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java

Modified: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -31,7 +31,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.6
  * @module
  */
 @DependsOn(SubCommandTest.class)
@@ -56,7 +56,7 @@ public final strictfp class MetadataSCTe
      */
     private static void verifyNetCDF(final String expectedHeader, final String result) {
         assertTrue(expectedHeader,                           result.startsWith(expectedHeader));
-        assertTrue("ISO 19115-2",                            result.contains("ISO 19115-2"));
+        assertTrue("ISO 19115",                              result.contains("ISO 19115"));
         assertTrue("Sea Surface Temperature Analysis Model", result.contains("Sea Surface Temperature Analysis Model"));
         assertTrue("GCMD Science Keywords",                  result.contains("GCMD Science Keywords"));
         assertTrue("NOAA/NWS/NCEP",                          result.contains("NOAA/NWS/NCEP"));

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] Fri May 29 17:52:14 2015
@@ -16,19 +16,18 @@
  */
 package org.apache.sis.internal.metadata;
 
-import java.util.Arrays;
 import org.opengis.metadata.citation.Role;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.PresentationForm;
 import org.apache.sis.internal.simple.SimpleCitation;
-import org.apache.sis.internal.simple.SimpleIdentifier;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.MetadataServices;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.DefaultOrganisation;
 import org.apache.sis.metadata.iso.citation.DefaultResponsibility;
-import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.iso.Types;
 
 
 /**
@@ -77,65 +76,75 @@ public final class ServicesForUtility ex
      */
     @Override
     public Citation createCitation(final String key) {
-        String   title;              // Title of the Citation to create.
-        int      storeKeyAs = 1;     // 0 to not store the key, 1 to store as alternate title, 2 to store as identifier.
-        Citation authority  = null;  // If the key is stored as an identifier (storeKeyAs = 2), the authority to use.
+        CharSequence     title;
+        CharSequence     alternateTitle        = null;
+        String           code                  = null;
+        String           codeSpace             = null;
+        CharSequence     citedResponsibleParty = null;
+        PresentationForm presentationForm      = null;
         switch (key) {
-            case "ISO"          : title = "International Organization for Standardization"; break;
-            case Constants.OGC  : title = "Open Geospatial Consortium"; break;
-            case Constants.IOGP : title = "International Association of Oil & Gas producers"; break;
-            case Constants.EPSG : title = "EPSG Geodetic Parameter Dataset"; storeKeyAs = 2; authority = Citations.OGP; break;
-            case Constants.SIS  : title = "Apache Spatial Information System"; storeKeyAs = 2; break;
-            case "ISBN"         : title = "International Standard Book Number"; break;
-            case "ISSN"         : title = "International Standard Serial Number"; break;
-            case "Proj4"        : title = "Proj.4"; storeKeyAs = 0; break;
-            case "S57"          : title = "S-57"; storeKeyAs = 0; break;
-            default: return super.createCitation(key);
-        }
-        final DefaultCitation c = new DefaultCitation(title);
-        switch (storeKeyAs) {
-            case 1: c.getAlternateTitles().add(new SimpleInternationalString(key)); break;
-            case 2: c.getIdentifiers().add(new SimpleIdentifier(authority, key, false)); break;
-        }
-        /*
-         * Additional information other than the given 'key' argument. All identifiers added here shall also be
-         * understood by Citations.fromName(String) method. Constants are declared below this method for making
-         * easier to track those special cases.
-         */
-        switch (key) {
-            /*
-             * More complete information is provided as an ISO 19115 structure
-             * in EPSG Surveying and Positioning Guidance Note Number 7, part 1.
-             */
+            case "ISO 19115": {
+                title     = "ISO 19115 Geographic Information — Metadata";
+                code      = "19115";
+                codeSpace = "ISO";
+                citedResponsibleParty = "International Organization for Standardization";
+                presentationForm = PresentationForm.DOCUMENT_DIGITAL;
+                break;
+            }
+            case Constants.OGC: {
+                title     = "Identifier in OGC namespace";
+                code      = "OGC";
+                citedResponsibleParty = "Open Geospatial Consortium";
+                presentationForm = PresentationForm.DOCUMENT_DIGITAL;
+                break;
+            }
             case Constants.EPSG: {
-                final DefaultOrganisation organisation = new DefaultOrganisation();
-                organisation.setName(Citations.OGP.getTitle());
-                c.getCitedResponsibleParties().add(new DefaultResponsibility(Role.PRINCIPAL_INVESTIGATOR, null, organisation));
-                c.getPresentationForms().add(PresentationForm.TABLE_DIGITAL);
+                title     = "EPSG Geodetic Parameter Dataset";
+                code      = Constants.EPSG;
+                codeSpace = Constants.IOGP;
+                citedResponsibleParty = "International Association of Oil & Gas producers";
+                presentationForm = PresentationForm.TABLE_DIGITAL;
+                /*
+                 * More complete information is provided as an ISO 19115 structure
+                 * in EPSG Surveying and Positioning Guidance Note Number 7, part 1.
+                 */
+                break;
+            }
+            case Constants.SIS: {
+                title = "Apache Spatial Information System";
+                code  = key;
                 break;
             }
-            /*
-             * "OGP" and "IOGP" are used as value in the GML 'codeSpace' attribute.
-             * From this point of view, we can see them as identifiers.
-             */
-            case Constants.IOGP: {
-                c.setIdentifiers(Arrays.asList(new SimpleIdentifier[] {
-                    new SimpleIdentifier(null, Constants.IOGP, false),
-                    new SimpleIdentifier(null, OGP, true)   // Existed before "IOGP".
-                }));
+            case "ISBN": {
+                title = "International Standard Book Number";
+                alternateTitle = key;
                 break;
             }
+            case "ISSN": {
+                title = "International Standard Serial Number";
+                alternateTitle = key;
+                break;
+            }
+            case "Proj4": {
+                title = "Proj.4";
+                break;
+            }
+            case "S57": {
+                title = "S-57";
+                break;
+            }
+            default: return super.createCitation(key);
+        }
+        final DefaultCitation c = new DefaultCitation(title);
+        if (alternateTitle        != null) c.getAlternateTitles().add(Types.toInternationalString(alternateTitle));
+        if (code                  != null) c.getIdentifiers().add(new ImmutableIdentifier(null, codeSpace, code));
+        if (presentationForm      != null) c.getPresentationForms().add(presentationForm);
+        if (citedResponsibleParty != null) {
+            final DefaultOrganisation organisation = new DefaultOrganisation();
+            organisation.setName(Types.toInternationalString(citedResponsibleParty));
+            c.getCitedResponsibleParties().add(new DefaultResponsibility(Role.PRINCIPAL_INVESTIGATOR, null, organisation));
         }
         c.freeze();
         return c;
     }
-
-    /**
-     * The legacy name of {@linkplain org.apache.sis.metadata.iso.citation.Citations#IOGP},
-     * to be declared as an additional identifier by {@link #createCitation(String)}.
-     *
-     * <p>Search for usages of this constant in order to locate where a special processing
-     * is done for managing the relationship between OGP, IOGP and EPSG identifiers.</p>
-     */
-    public static final String OGP = "OGP";
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] Fri May 29 17:52:14 2015
@@ -301,7 +301,7 @@ public class DefaultIdentifier extends I
 
     /**
      * Sets the organization or party responsible for definition and maintenance of the
-     * {@linkplain #getCode code}.
+     * {@linkplain #getCode() code}.
      *
      * @param newValue The new authority.
      */

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=1682524&r1=1682523&r2=1682524&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] Fri May 29 17:52:14 2015
@@ -420,12 +420,8 @@ public class ImmutableIdentifier extends
 
     /**
      * Organization or party responsible for definition and maintenance of the {@linkplain #getCode() code}.
-     * The organization's abbreviation is often the same than this identifier {@linkplain #getCodeSpace()
-     * code space}, but not necessarily.
-     *
-     * <div class="note"><b>Example:</b> Coordinate Reference System (CRS) identified by an EPSG code will return
-     * contact information for the <cite>International Association of Oil &amp; Gas producers</cite> (IOGP), since
-     * IOGP is the organization maintaining the EPSG geodetic database.</div>
+     * The organization's abbreviation is often the same than this identifier {@linkplain #getCodeSpace() code space},
+     * but not necessarily.
      *
      * @return The authority, or {@code null} if not available.
      */

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Fri May 29 17:52:14 2015
@@ -25,7 +25,6 @@ import org.apache.sis.internal.util.Cons
 import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.internal.simple.CitationConstant;
 import org.apache.sis.internal.jaxb.NonMarshalledAuthority;
-import org.apache.sis.internal.metadata.ServicesForUtility;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.metadata.iso.DefaultIdentifier;   // For javadoc
@@ -35,15 +34,22 @@ import static org.apache.sis.internal.ut
 
 /**
  * A set of pre-defined constants and static methods working on {@linkplain Citation citations}.
- * The citation constants declared in this class are for:
+ * The most common usage for those constants is to give information about who maintains the codes
+ * that we use in identifiers.
  *
- * <ul>
- *   <li><cite>Organizations</cite> (e.g. {@linkplain #OGC})</li>
- *   <li><cite>Specifications</cite> (e.g. {@linkplain #WMS})</li>
- *   <li><cite>Authorities</cite> that maintain definitions of codes (e.g. {@linkplain #EPSG})</li>
- * </ul>
+ * <div class="note"><b>Example:</b> {@code "EPSG:4326"} is a widely-used identifier
+ * for the <cite>World Geodetic System (WGS) 1984</cite> Coordinate Reference System (CRS).
+ * The {@code "4326"} part is the identifier {@linkplain DefaultIdentifier#getCode() code} and
+ * the {@code "EPSG"} part is the identifier {@linkplain DefaultIdentifier#getCodeSpace() code space}.
+ * The meaning of codes in that code space is controlled by an {@linkplain DefaultIdentifier#getAuthority() authority},
+ * the <cite>EPSG Geodetic Parameter Dataset</cite>. The {@linkplain DefaultCitation#getCitedResponsibleParties() cited
+ * reposible party} for the EPSG dataset is the <cite>International Association of Oil &amp; Gas producers</cite> (IOGP).
+ * </div>
  *
- * In the later case, the citations are actually of kind {@link IdentifierSpace}.
+ * The constants defined in this class are typically values returned by
+ * {@link org.apache.sis.metadata.iso.ImmutableIdentifier#getAuthority()}.
+ * Citations to resources that define identifiers ({@linkplain #EPSG}, {@linkplain #ISBN}, {@linkplain #ISSN},
+ * <i>etc.</i>) are instances of {@link IdentifierSpace}.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
@@ -51,26 +57,57 @@ import static org.apache.sis.internal.ut
  * @module
  */
 public final class Citations extends Static {
-    /*
-     * NOTE: other constants are defined in org.apache.sis.internal.metadata.Standards.
+    /**
+     * The <a href="http://www.iso.org/">International Organization for Standardization</a>.
+     *
+     * @deprecated No replacement since ISO is an {@linkplain DefaultOrganisation organisation} rather than a citation.
      */
+    @Deprecated
+    public static final Citation ISO = new SimpleCitation("ISO");
 
     /**
-     * The <a href="http://www.iso.org/">International Organization for Standardization</a>.
+     * The <cite>ISO 19115 Geographic Information — Metadata</cite> standards published by the
+     * <a href="http://www.iso.org/">International Organization for Standardization</a>.
+     * Apache SIS uses this constant for a merge of two standards:
+     *
+     * <ul>
+     *   <li>ISO 19115-1 Geographic Information — Metadata Part 1: Fundamentals</li>
+     *   <li>ISO 19115-2 Geographic Information — Metadata Part 2: Extensions for imagery and gridded data</li>
+     * </ul>
+     *
+     * <div class="note"><b>Note:</b>
+     * SIS uses a single citation that encompasses all standards of the ISO 19115 series because the SIS's API
+     * tries to provide a more unified view of some classes which are splitted between the two above standards
+     * (e.g. {@code MI_Band} versus {@code MD_Band}).</div>
+     *
+     * @see org.opengis.annotation.Specification#ISO_19115
+     * @see org.opengis.annotation.Specification#ISO_19115_2
      *
-     * @category Organization
+     * @since 0.6
      */
-    public static final Citation ISO = new CitationConstant("ISO");
+    public static final Citation ISO_19115 = new CitationConstant("ISO 19115");
 
     /**
-     * The <a href="http://www.opengeospatial.org">Open Geospatial Consortium</a> organization.
-     * <cite>"Open Geospatial Consortium"</cite> is the new name for <cite>"OpenGIS consortium"</cite>.
-     * An {@linkplain DefaultCitation#getAlternateTitles() alternate title} for this citation is "OGC"
-     * (according ISO 19115, alternate titles often contain abbreviations).
+     * The authority for identifiers found in specifications from the
+     * <a href="http://www.opengeospatial.org">Open Geospatial Consortium</a>.
+     * The specification actually referenced by this citation is implementation dependent
+     * and may change in future SIS version. Some of the specifications used are:
      *
-     * @category Organization
+     * <ul>
+     *   <li><a href="http://www.opengeospatial.org/standards/ct">Coordinate Transformation Service</a></li>
+     *   <li><a href="http://www.opengeospatial.org/standards/wms">Web Map Service</a></li>
+     *   <li>Definition identifier URNs in OGC namespace</li>
+     * </ul>
+     *
+     * Apache SIS uses this authority mostly for map projection methods and parameters as they were defined in older
+     * OGC specifications (in more recent specifications, {@linkplain #EPSG} identifiers tend to be more widely used).
+     * We do not commit to a particular OGC specification in order to keep the flexibility to change the
+     * {@linkplain DefaultCitation#getTitle() title} or URL according newer OGC publications.
+     *
+     * @see #EPSG
+     * @see #ESRI
      */
-    public static final Citation OGC = new CitationConstant(Constants.OGC);
+    public static final IdentifierSpace<String> OGC = new CitationConstant.Authority<>(Constants.OGC);
 
     /**
      * The <a href="http://www.ogp.org.uk">International Association of Oil &amp; Gas Producers</a> organization.
@@ -82,7 +119,7 @@ public final class Citations extends Sta
      *             because of this name change and for avoiding confusion with {@link #EPSG} citation.
      */
     @Deprecated
-    public static final Citation OGP = new CitationConstant(Constants.IOGP);
+    public static final Citation OGP = new SimpleCitation("OGP");
 
     /**
      * The <a href="http://www.epsg.org">EPSG Geodetic Parameter Dataset</a> identifier space.
@@ -98,18 +135,15 @@ public final class Citations extends Sta
      * known as <cite>EPSG Geodetic Parameter Dataset</cite>.</div>
      *
      * The citation {@linkplain DefaultCitation#getCitedResponsibleParties() responsible party} is
-     * the IOGP organization, but the {@link IdentifierSpace#getName() namespace} is {@code "EPSG"}.
+     * the IOGP organization, but the {@linkplain IdentifierSpace#getName() namespace} is {@code "EPSG"}.
      * The {@code "EPSG"} name shall be used in URN, but the {@code codeSpace} attribute value in
-     * GML files can be “EPSG” or the authority abbreviation, either “IOGP” or the older “OGP”.
-     * Example:
+     * GML files can be “EPSG” or the authority abbreviation, either “IOGP” or the older “OGP”,
+     * as in the following example:
      *
      * {@preformat xml
      *   <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
      * }
      *
-     * @see #AUTO
-     * @see #AUTO2
-     * @see #CRS
      * @category Code space
      *
      * @since 0.4
@@ -117,36 +151,41 @@ public final class Citations extends Sta
     public static final IdentifierSpace<Integer> EPSG = new CitationConstant.Authority<>(Constants.EPSG);
 
     /**
-     * The <a href="http://sis.apache.org">Apache SIS</a> project.
+     * The codespace of objects that are specific to the <a href="http://sis.apache.org">Apache SIS</a> project.
      *
      * @since 0.4
      */
     public static final Citation SIS = new CitationConstant(Constants.SIS);
 
     /**
-     * The <a href="http://www.esri.com">ESRI</a> organization.
-     * This company defines many Coordinate Reference Systems in addition to the {@linkplain #EPSG} ones.
+     * The authority for identifiers of objects provided by <a href="http://www.esri.com">ESRI</a>.
+     * This citation is used as the authority for many map projection method and parameter names
+     * other than the {@linkplain #EPSG} ones.
      *
-     * @category Organization
+     * <div class="note"><b>Note:</b>
+     * Many parameter names defined by {@linkplain #OGC} are very similar to the ESRI ones, except for the case.</div>
      *
      * @since 0.4
+     *
+     * @see #OGC
+     * @see #EPSG
      */
     public static final Citation ESRI = new CitationConstant("ESRI");
 
     /**
      * The <a href="http://www.oracle.com">Oracle</a> organization.
      *
-     * @category Organization
+     * @deprecated No replacement since Oracle is an {@linkplain DefaultOrganisation organisation} rather
+     *             than a citation, and we do not have Oracle-specific objects.
      *
      * @since 0.4
      */
+    @Deprecated
     public static final Citation ORACLE = new CitationConstant("Oracle");
 
     /**
      * The <a href="http://www.unidata.ucar.edu/software/netcdf-java">NetCDF</a> specification.
      *
-     * @category Specification
-     *
      * @since 0.4
      */
     public static final Citation NETCDF = new CitationConstant("NetCDF");
@@ -155,25 +194,19 @@ public final class Citations extends Sta
      * The <a href="http://trac.osgeo.org/geotiff/">GeoTIFF</a> specification.
      * This specification identifies some map projections by their own numerical codes.
      *
-     * @category Code space
-     *
      * @since 0.4
      */
     public static final IdentifierSpace<Integer> GEOTIFF = new CitationConstant.Authority<>("GeoTIFF");
 
     /**
-     * The <a href="http://trac.osgeo.org/proj/">Proj.4</a> project.
-     *
-     * @category Code space
+     * The authority for identifiers of objects defined by the <a href="http://trac.osgeo.org/proj/">Proj.4</a> project.
      *
      * @since 0.4
      */
     public static final IdentifierSpace<String> PROJ4 = new CitationConstant.Authority<>("Proj4");
 
     /**
-     * The MapInfo software. This software defines its own projection codes.
-     *
-     * @category Code space
+     * The authority for identifiers of objects defined by MapInfo.
      *
      * @since 0.6
      */
@@ -183,8 +216,6 @@ public final class Citations extends Sta
      * The <a href="http://www.iho.int/iho_pubs/standard/S-57Ed3.1/31Main.pdf">IHO transfer standard
      * for digital hydrographic data</a> specification.
      *
-     * @category Code space
-     *
      * @since 0.6
      */
     public static final IdentifierSpace<Integer> S57 = new CitationConstant.Authority<>("S57");
@@ -195,8 +226,6 @@ public final class Citations extends Sta
      * but the SIS library handles it like any other identifier.
      *
      * @see DefaultCitation#getISBN()
-     *
-     * @category Code space
      */
     public static final IdentifierSpace<String> ISBN = new NonMarshalledAuthority<>("ISBN", NonMarshalledAuthority.ISBN);
 
@@ -206,8 +235,6 @@ public final class Citations extends Sta
      * but the SIS library handles it like any other identifier.
      *
      * @see DefaultCitation#getISSN()
-     *
-     * @category Code space
      */
     public static final IdentifierSpace<String> ISSN = new NonMarshalledAuthority<>("ISSN", NonMarshalledAuthority.ISSN);
 
@@ -215,21 +242,22 @@ public final class Citations extends Sta
      * List of citations declared in this class.
      * Most frequently used citations (at least in SIS) should be first.
      */
-    private static final CitationConstant[] CITATIONS = {
-        (CitationConstant) EPSG,
-        (CitationConstant) OGC,
-        (CitationConstant) ISO,
-        (CitationConstant) OGP,
-        (CitationConstant) NETCDF,
-        (CitationConstant) GEOTIFF,
-        (CitationConstant) ESRI,
-        (CitationConstant) ORACLE,
-        (CitationConstant) PROJ4,
-        (CitationConstant) MAP_INFO,
-        (CitationConstant) S57,
-        (CitationConstant) ISBN,
-        (CitationConstant) ISSN,
-        (CitationConstant) SIS
+    private static final SimpleCitation[] CITATIONS = {
+        (SimpleCitation) EPSG,
+        (SimpleCitation) OGC,
+        (SimpleCitation) ISO,
+        (SimpleCitation) ISO_19115,
+        (SimpleCitation) OGP,
+        (SimpleCitation) NETCDF,
+        (SimpleCitation) GEOTIFF,
+        (SimpleCitation) ESRI,
+        (SimpleCitation) ORACLE,
+        (SimpleCitation) PROJ4,
+        (SimpleCitation) MAP_INFO,
+        (SimpleCitation) S57,
+        (SimpleCitation) ISBN,
+        (SimpleCitation) ISSN,
+        (SimpleCitation) SIS
     };
 
     static {  // Must be after CITATIONS array construction.
@@ -250,8 +278,10 @@ public final class Citations extends Sta
      * may have changed. This method notifies all citations that they will need to refresh their content.
      */
     static void refresh() {
-        for (final CitationConstant citation : CITATIONS) {
-            citation.refresh();
+        for (final SimpleCitation citation : CITATIONS) {
+            if (citation instanceof CitationConstant) {
+                ((CitationConstant) citation).refresh();
+            }
         }
     }
 
@@ -272,16 +302,15 @@ public final class Citations extends Sta
         if (identifier == null || ((identifier = CharSequences.trimWhitespaces(identifier)).isEmpty())) {
             return null;
         }
-        for (final CitationConstant citation : CITATIONS) {
+        for (final SimpleCitation citation : CITATIONS) {
             if (equalsFiltered(identifier, citation.title)) {
                 return citation;
             }
         }
         /*
-         * Additional identifiers other than the ones declared to CitationConstant constructors. Those identifiers
-         * shall be the same than the ones added by 'ServicesForUtility.createCitation(String)'.
+         * Temporary check to be removed after we deleted the deprecated citation.
          */
-        if (equalsFiltered(identifier, ServicesForUtility.OGP)) {
+        if (equalsFiltered(identifier, Constants.IOGP)) {
             return OGP;
         }
         /*
@@ -371,23 +400,26 @@ public final class Citations extends Sta
      *
      * <ul>
      *   <li>If the given citation is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the citation contains at least one
-     *       non-{@linkplain org.apache.sis.util.Deprecable#isDeprecated() deprecated}
-     *       {@linkplain DefaultCitation#getIdentifiers() identifier}, then:
+     *   <li>Otherwise if the collection of {@linkplain DefaultCitation#getIdentifiers() citation identifiers}
+     *       contains at least one non-{@linkplain org.apache.sis.util.Deprecable#isDeprecated() deprecated}
+     *       identifier, then:
      *     <ul>
-     *       <li>If at least one non-deprecated identifier is a
-     *           {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier unicode identifier},
-     *           then the shortest of those identifiers is returned.</li>
-     *       <li>Otherwise the shortest non-deprecated identifier is returned,
-     *           despite not being a Unicode identifier.</li>
+     *       <li>If the code and codespace of at least one non-deprecated identifier are
+     *           {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier unicode identifiers}, then
+     *           the <strong>first</strong> of those identifiers is returned in a {@code "[codespace:]code"} format.
+     *           Only the first character of the resulting string needs to be an
+     *           {@linkplain Character#isUnicodeIdentifierStart(int) identifier start character}.</li>
+     *       <li>Otherwise the first non-empty and non-deprecated identifier is returned in a
+     *           {@code "[codespace:]code"} format, despite not being a valid Unicode identifier.</li>
      *     </ul>
      *   </li>
-     *   <li>Otherwise if the citation contains at least one {@linkplain DefaultCitation#getTitle() title} or
-     *       {@linkplain DefaultCitation#getAlternateTitles() alternate title}, then:
+     *   <li>Otherwise if the citation contains at least one non-deprecated {@linkplain DefaultCitation#getTitle() title}
+     *       or {@linkplain DefaultCitation#getAlternateTitles() alternate title}, then:
      *     <ul>
-     *       <li>If at least one title is a {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier
-     *           unicode identifier}, then the shortest of those titles is returned.</li>
-     *       <li>Otherwise the shortest title is returned, despite not being a Unicode identifier.</li>
+     *       <li>If at least one non-deprecated title is a {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier
+     *           unicode identifier}, then the <strong>first</strong> of those titles is returned.</li>
+     *       <li>Otherwise the first non-empty and non-deprecated title is returned,
+     *           despite not being a valid Unicode identifier.</li>
      *     </ul>
      *   </li>
      *   <li>Otherwise this method returns {@code null}.</li>
@@ -396,7 +428,7 @@ public final class Citations extends Sta
      * <div class="note"><b>Note:</b>
      * This method searches in alternate titles as a fallback because ISO specification said
      * that those titles are often used for abbreviations. However titles are never searched
-     * if the given citation contains at least one identifier.</div>
+     * if the given citation contains at least one non-empty and non-deprecated identifier.</div>
      *
      * This method ignores leading and trailing {@linkplain Character#isWhitespace(int) whitespaces}
      * in every character sequences. Null or empty trimmed character sequences are ignored.
@@ -419,7 +451,9 @@ public final class Citations extends Sta
      * for processing purpose. This method performs the following actions:
      *
      * <ul>
-     *   <li>First, invoke {@link #getIdentifier(Citation)}.</li>
+     *   <li>First, performs the same work than {@link #getIdentifier(Citation)} except that {@code '_'}
+     *       is used instead of {@link org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR ':'}
+     *       as the separator between the codespace and the code.</li>
      *   <li>If the result of above method call is {@code null} or is not a
      *       {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier valid Unicode identifier},
      *       then return {@code null}.</li>
@@ -432,8 +466,17 @@ public final class Citations extends Sta
      * Those characters are illegal in XML identifiers, and should therfore be removed if the Unicode identifier
      * may also be used as XML identifier.</div>
      *
-     * If non-null, the result is suitable for use as a XML identifier except for a few uncommon characters
-     * ({@code µ}, {@code ª} (feminine ordinal indicator), {@code º} (masculine ordinal indicator) and {@code ⁔}).
+     * If non-null, the result is suitable for use as a XML identifier except for a few uncommon characters.
+     *
+     * <div class="note"><b>Note:</b>
+     * the following characters are invalid in XML identifiers. However since they are valid in Unicode identifiers,
+     * they could be included in the string returned by this method:
+     * <ul>
+     *   <li>{@code µ}</li>
+     *   <li>{@code ª} (feminine ordinal indicator)</li>
+     *   <li>{@code º} (masculine ordinal indicator)</li>
+     *   <li>{@code ⁔}</li>
+     * </ul></div>
      *
      * @param  citation The citation for which to get the Unicode identifier, or {@code null}.
      * @return A non-empty Unicode identifier for the given citation without leading or trailing whitespaces,

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -238,7 +238,7 @@ public final strictfp class PropertyAcce
     @DependsOnMethod("testConstructorWithInheritance")
     public void testConstructorWithCovariantReturnType() {
         final Class<?> type = GeographicCRS.class;
-        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO, type, type),
+        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO_19111, type, type),
         //……Declaring type……………………………Method……………………………………………JavaBeans……………………………UML identifier………………Sentence…………………………………Type…………………………………………………………
             GeographicCRS.class,    "getCoordinateSystem", "coordinateSystem", "coordinateSystem", "Coordinate system",  EllipsoidalCS.class,       // Covariant return type
             GeodeticCRS.class,      "getDatum",            "datum",            "datum",            "Datum",              GeodeticDatum.class,       // Covariant return type
@@ -269,32 +269,33 @@ public final strictfp class PropertyAcce
      * {@preformat text
      *   DefaultCitation
      *     ├─Title…………………………………… International Organization for Standardization
-     *     ├─Alternate title………… ISO
+     *     ├─Alternate title………… ISO 19111
      *     ├─Identifier
-     *     │   └─Code…………………………… ISO
+     *     │   ├─Code…………………………… 19111
+     *     │   └─Code space…………… ISO
      *     └─Presentation form…… Document digital
      * }
      */
     @Test
     @DependsOnMethod("testConstructor")
     public void testGet() {
-        final DefaultCitation  instance = HardCodedCitations.ISO;
+        final DefaultCitation  instance = HardCodedCitations.ISO_19111;
         final PropertyAccessor accessor = createPropertyAccessor();
 
         // Singleton value (not a collection)
         final Object title = accessor.get(accessor.indexOf("title", true), instance);
         assertInstanceOf("title", InternationalString.class, title);
-        assertEquals("title", "International Organization for Standardization", title.toString());
+        assertEquals("title", "Spatial referencing by coordinates", title.toString());
 
         // Collection of InternationalStrings
         final Object alternateTitles = accessor.get(accessor.indexOf("alternateTitles", true), instance);
         assertInstanceOf("alternateTitles", Collection.class, alternateTitles);
-        assertEquals("alternateTitles", "ISO", getSingleton((Collection<?>) alternateTitles).toString());
+        assertEquals("alternateTitles", "ISO 19111", getSingleton((Collection<?>) alternateTitles).toString());
 
         // Collection of Identifiers
         final Object identifiers = accessor.get(accessor.indexOf("identifiers", true), instance);
         assertInstanceOf("identifiers", Collection.class, identifiers);
-        assertContainsIdentifierCode("ISO", (Collection<?>) identifiers);
+        assertContainsIdentifierCode("19111", (Collection<?>) identifiers);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -20,13 +20,14 @@ import java.util.Locale;
 import java.lang.reflect.Field;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
+import org.apache.sis.internal.simple.CitationConstant;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.metadata.iso.citation.Citations.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
 import static org.apache.sis.test.Assert.*;
 
 
@@ -46,23 +47,24 @@ public final strictfp class CitationsTes
      */
     @Test
     public void testFromName() throws IllegalAccessException {
-        assertSame(ISO,      fromName("ISO"));
-        assertSame(OGC,      fromName(Constants.OGC));
-        assertSame(EPSG,     fromName(Constants.EPSG));  // This one is most important.
-        assertSame(OGP,      fromName(Constants.IOGP));  // For parsing GML "codeSpace" attribute.
-        assertSame(OGP,      fromName("OGP"));           // Sometime seen in GML instead of "IOGP".
-        assertSame(SIS,      fromName(Constants.SIS));
-        assertSame(ESRI,     fromName("ESRI"));
-        assertSame(ORACLE,   fromName("Oracle"));
-        assertSame(NETCDF,   fromName("NetCDF"));
-        assertSame(GEOTIFF,  fromName("GeoTIFF"));
-        assertSame(PROJ4,    fromName("Proj.4"));
-        assertSame(PROJ4,    fromName("Proj4"));
-        assertSame(MAP_INFO, fromName("MapInfo"));
-        assertSame(S57,      fromName("S-57"));
-        assertSame(S57,      fromName("S57"));
-        assertSame(ISBN,     fromName("ISBN"));
-        assertSame(ISSN,     fromName("ISSN"));
+        assertSame(ISO,       fromName("ISO"));
+        assertSame(ISO_19115, fromName("ISO 19115"));
+        assertSame(OGC,       fromName(Constants.OGC));
+        assertSame(EPSG,      fromName(Constants.EPSG));  // This one is most important.
+        assertSame(OGP,       fromName(Constants.IOGP));  // For parsing GML "codeSpace" attribute.
+        assertSame(OGP,       fromName("OGP"));           // Sometime seen in GML instead of "IOGP".
+        assertSame(SIS,       fromName(Constants.SIS));
+        assertSame(ESRI,      fromName("ESRI"));
+        assertSame(ORACLE,    fromName("Oracle"));
+        assertSame(NETCDF,    fromName("NetCDF"));
+        assertSame(GEOTIFF,   fromName("GeoTIFF"));
+        assertSame(PROJ4,     fromName("Proj.4"));
+        assertSame(PROJ4,     fromName("Proj4"));
+        assertSame(MAP_INFO,  fromName("MapInfo"));
+        assertSame(S57,       fromName("S-57"));
+        assertSame(S57,       fromName("S57"));
+        assertSame(ISBN,      fromName("ISBN"));
+        assertSame(ISSN,      fromName("ISSN"));
         /*
          * Verify again, but using reflection for making sure that the field names
          * are consistent and that we did not forgot any citation constant.
@@ -81,20 +83,21 @@ public final strictfp class CitationsTes
      */
     @Test
     public void testGetIdentifier() {
-        assertEquals("ISO",     getIdentifier(ISO));
-        assertEquals("OGC",     getIdentifier(OGC));
-        assertEquals("IOGP",    getIdentifier(OGP));
-        assertEquals("EPSG",    getIdentifier(EPSG));
-        assertEquals("SIS",     getIdentifier(SIS));
-        assertEquals("ESRI",    getIdentifier(ESRI));
-        assertEquals("Oracle",  getIdentifier(ORACLE));
-        assertEquals("NetCDF",  getIdentifier(NETCDF));
-        assertEquals("GeoTIFF", getIdentifier(GEOTIFF));
-        assertEquals("MapInfo", getIdentifier(MAP_INFO));
-        assertEquals("ISBN",    getIdentifier(ISBN));
-        assertEquals("ISSN",    getIdentifier(ISSN));
-        assertEquals("Proj.4",  getIdentifier(PROJ4));  // Not a valid Unicode identifier.
-        assertEquals("S-57",    getIdentifier(S57));    // Not a valid Unicode identifier.
+        assertEquals("ISO",        getIdentifier(ISO));
+        assertEquals("ISO:19115",  getIdentifier(ISO_19115));
+        assertEquals("OGC",        getIdentifier(OGC));
+        assertEquals("OGP",        getIdentifier(OGP));
+        assertEquals("EPSG",       getIdentifier(EPSG));
+        assertEquals("SIS",        getIdentifier(SIS));
+        assertEquals("ESRI",       getIdentifier(ESRI));
+        assertEquals("Oracle",     getIdentifier(ORACLE));
+        assertEquals("NetCDF",     getIdentifier(NETCDF));
+        assertEquals("GeoTIFF",    getIdentifier(GEOTIFF));
+        assertEquals("MapInfo",    getIdentifier(MAP_INFO));
+        assertEquals("ISBN",       getIdentifier(ISBN));
+        assertEquals("ISSN",       getIdentifier(ISSN));
+        assertEquals("Proj.4",     getIdentifier(PROJ4));  // Not a valid Unicode identifier.
+        assertEquals("S-57",       getIdentifier(S57));    // Not a valid Unicode identifier.
     }
 
     /**
@@ -104,20 +107,21 @@ public final strictfp class CitationsTes
     @Test
     @DependsOnMethod("testGetIdentifier")
     public void testGetUnicodeIdentifier() {
-        assertEquals("ISO",     getUnicodeIdentifier(ISO));
-        assertEquals("OGC",     getUnicodeIdentifier(OGC));
-        assertEquals("IOGP",    getUnicodeIdentifier(OGP));
-        assertEquals("EPSG",    getUnicodeIdentifier(EPSG));
-        assertEquals("SIS",     getUnicodeIdentifier(SIS));
-        assertEquals("ESRI",    getUnicodeIdentifier(ESRI));
-        assertEquals("Oracle",  getUnicodeIdentifier(ORACLE));
-        assertEquals("NetCDF",  getUnicodeIdentifier(NETCDF));
-        assertEquals("GeoTIFF", getUnicodeIdentifier(GEOTIFF));
-        assertEquals("MapInfo", getUnicodeIdentifier(MAP_INFO));
-        assertEquals("ISBN",    getUnicodeIdentifier(ISBN));
-        assertEquals("ISSN",    getUnicodeIdentifier(ISSN));
-        assertNull  ("Proj4",   getUnicodeIdentifier(PROJ4));   // Not yet publicly declared as an identifier.
-        assertNull  ("S57",     getUnicodeIdentifier(S57));     // Not yet publicly declared as an identifier.
+        assertEquals("ISO",        getUnicodeIdentifier(ISO));
+        assertEquals("ISO_19115",  getUnicodeIdentifier(ISO_19115));
+        assertEquals("OGC",        getUnicodeIdentifier(OGC));
+        assertEquals("OGP",        getUnicodeIdentifier(OGP));
+        assertEquals("EPSG",       getUnicodeIdentifier(EPSG));
+        assertEquals("SIS",        getUnicodeIdentifier(SIS));
+        assertEquals("ESRI",       getUnicodeIdentifier(ESRI));
+        assertEquals("Oracle",     getUnicodeIdentifier(ORACLE));
+        assertEquals("NetCDF",     getUnicodeIdentifier(NETCDF));
+        assertEquals("GeoTIFF",    getUnicodeIdentifier(GEOTIFF));
+        assertEquals("MapInfo",    getUnicodeIdentifier(MAP_INFO));
+        assertEquals("ISBN",       getUnicodeIdentifier(ISBN));
+        assertEquals("ISSN",       getUnicodeIdentifier(ISSN));
+        assertNull  ("Proj4",      getUnicodeIdentifier(PROJ4));      // Not yet publicly declared as an identifier.
+        assertNull  ("S57",        getUnicodeIdentifier(S57));        // Not yet publicly declared as an identifier.
     }
 
     /**
@@ -127,20 +131,21 @@ public final strictfp class CitationsTes
     @Test
     @DependsOnMethod("testGetUnicodeIdentifier")
     public void testGetCodeSpace() {
-        assertEquals("ISO",     org.apache.sis.internal.util.Citations.getCodeSpace(ISO));
-        assertEquals("OGC",     org.apache.sis.internal.util.Citations.getCodeSpace(OGC));
-        assertEquals("IOGP",    org.apache.sis.internal.util.Citations.getCodeSpace(OGP));
-        assertEquals("EPSG",    org.apache.sis.internal.util.Citations.getCodeSpace(EPSG));
-        assertEquals("SIS",     org.apache.sis.internal.util.Citations.getCodeSpace(SIS));
-        assertEquals("ESRI",    org.apache.sis.internal.util.Citations.getCodeSpace(ESRI));
-        assertEquals("Oracle",  org.apache.sis.internal.util.Citations.getCodeSpace(ORACLE));
-        assertEquals("NetCDF",  org.apache.sis.internal.util.Citations.getCodeSpace(NETCDF));
-        assertEquals("GeoTIFF", org.apache.sis.internal.util.Citations.getCodeSpace(GEOTIFF));
-        assertEquals("MapInfo", org.apache.sis.internal.util.Citations.getCodeSpace(MAP_INFO));
-        assertEquals("ISBN",    org.apache.sis.internal.util.Citations.getCodeSpace(ISBN));
-        assertEquals("ISSN",    org.apache.sis.internal.util.Citations.getCodeSpace(ISSN));
-        assertEquals("Proj4",   org.apache.sis.internal.util.Citations.getCodeSpace(PROJ4));
-        assertEquals("S57",     org.apache.sis.internal.util.Citations.getCodeSpace(S57));
+        assertEquals("ISO",        org.apache.sis.internal.util.Citations.getCodeSpace(ISO));
+        assertEquals("ISO_19115",  org.apache.sis.internal.util.Citations.getCodeSpace(ISO_19115));
+        assertEquals("OGC",        org.apache.sis.internal.util.Citations.getCodeSpace(OGC));
+        assertEquals("OGP",        org.apache.sis.internal.util.Citations.getCodeSpace(OGP));
+        assertEquals("EPSG",       org.apache.sis.internal.util.Citations.getCodeSpace(EPSG));
+        assertEquals("SIS",        org.apache.sis.internal.util.Citations.getCodeSpace(SIS));
+        assertEquals("ESRI",       org.apache.sis.internal.util.Citations.getCodeSpace(ESRI));
+        assertEquals("Oracle",     org.apache.sis.internal.util.Citations.getCodeSpace(ORACLE));
+        assertEquals("NetCDF",     org.apache.sis.internal.util.Citations.getCodeSpace(NETCDF));
+        assertEquals("GeoTIFF",    org.apache.sis.internal.util.Citations.getCodeSpace(GEOTIFF));
+        assertEquals("MapInfo",    org.apache.sis.internal.util.Citations.getCodeSpace(MAP_INFO));
+        assertEquals("ISBN",       org.apache.sis.internal.util.Citations.getCodeSpace(ISBN));
+        assertEquals("ISSN",       org.apache.sis.internal.util.Citations.getCodeSpace(ISSN));
+        assertEquals("Proj4",      org.apache.sis.internal.util.Citations.getCodeSpace(PROJ4));
+        assertEquals("S57",        org.apache.sis.internal.util.Citations.getCodeSpace(S57));
     }
 
     /**
@@ -148,17 +153,33 @@ public final strictfp class CitationsTes
      */
     @Test
     public void testGetTitles() {
-        assertEquals("International Organization for Standardization",    ISO    .getTitle().toString(Locale.US));
-        assertEquals("Open Geospatial Consortium",                        OGC    .getTitle().toString(Locale.US));
-        assertEquals("International Association of Oil & Gas producers",  OGP    .getTitle().toString(Locale.US));
-        assertEquals("EPSG Geodetic Parameter Dataset",                   EPSG   .getTitle().toString(Locale.US));
-        assertEquals("Apache Spatial Information System",                 SIS    .getTitle().toString(Locale.US));
-        assertEquals("International Standard Book Number",                ISBN   .getTitle().toString(Locale.US));
-        assertEquals("International Standard Serial Number",              ISSN   .getTitle().toString(Locale.US));
-        assertEquals("GeoTIFF",                                           GEOTIFF.getTitle().toString(Locale.US));
-        assertEquals("NetCDF",                                            NETCDF .getTitle().toString(Locale.US));
-        assertEquals("Proj.4",                                            PROJ4  .getTitle().toString(Locale.US));
-        assertEquals("S-57",                                              S57    .getTitle().toString(Locale.US));
+        assertEquals("ISO 19115 Geographic Information — Metadata",       ISO_19115.getTitle().toString(Locale.US));
+        assertEquals("Identifier in OGC namespace",                       OGC      .getTitle().toString(Locale.US));
+        assertEquals("EPSG Geodetic Parameter Dataset",                   EPSG     .getTitle().toString(Locale.US));
+        assertEquals("Apache Spatial Information System",                 SIS      .getTitle().toString(Locale.US));
+        assertEquals("International Standard Book Number",                ISBN     .getTitle().toString(Locale.US));
+        assertEquals("International Standard Serial Number",              ISSN     .getTitle().toString(Locale.US));
+        assertEquals("GeoTIFF",                                           GEOTIFF  .getTitle().toString(Locale.US));
+        assertEquals("NetCDF",                                            NETCDF   .getTitle().toString(Locale.US));
+        assertEquals("Proj.4",                                            PROJ4    .getTitle().toString(Locale.US));
+        assertEquals("S-57",                                              S57      .getTitle().toString(Locale.US));
+    }
+
+    /**
+     * Tests {@code getCitedResponsibleParties()} on some {@code Citation} constants.
+     */
+    @Test
+    public void testGetCitedResponsibleParty() {
+        assertEquals("Open Geospatial Consortium",                       getCitedResponsibleParty(OGC));
+        assertEquals("International Organization for Standardization",   getCitedResponsibleParty(ISO_19115));
+        assertEquals("International Association of Oil & Gas producers", getCitedResponsibleParty(EPSG));
+    }
+
+    /**
+     * Returns the responsible party for the given constant.
+     */
+    private static String getCitedResponsibleParty(final Citation citation) {
+        return getSingleton(getSingleton(citation.getCitedResponsibleParties()).getParties()).getName().toString(Locale.US);
     }
 
     /**
@@ -170,8 +191,7 @@ public final strictfp class CitationsTes
      */
     @Test
     public void testEPSG() {
-        final Identifier identifier = TestUtilities.getSingleton(EPSG.getIdentifiers());
-        assertEquals("IOGP", getUnicodeIdentifier(identifier.getAuthority()));
+        final Identifier identifier = getSingleton(EPSG.getIdentifiers());
         assertEquals("EPSG", getUnicodeIdentifier(EPSG));
         assertEquals("IOGP", identifier.getCodeSpace());
         assertEquals("EPSG", identifier.getCode());
@@ -186,7 +206,7 @@ public final strictfp class CitationsTes
     @DependsOnMethod("testFromName")
     public void testSerialization() throws IllegalAccessException {
         for (final Field field : Citations.class.getFields()) {
-            if (Citation.class.isAssignableFrom(field.getType())) {
+            if (CitationConstant.class.isAssignableFrom(field.getType())) {
                 final Object c = field.get(null);
                 assertSame(field.getName(), c, assertSerializedEquals(c));
             }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -59,13 +59,13 @@ public final strictfp class DefaultCitat
          */
         assertNull("ISSN shall be initially null.", citation.getISSN());
         citation.setIdentifiers(Arrays.asList(
-                new DefaultIdentifier(Citations.OGC,  "MyOGC"),
-                new DefaultIdentifier(Citations.EPSG, "MyEPSG"),
-                new DefaultIdentifier(Citations.ISBN, "MyIgnored"),
-                new DefaultIdentifier(Citations.ISSN, "MyISSN")));
+                new DefaultIdentifier(Citations.NETCDF, "MyNetCDF"),
+                new DefaultIdentifier(Citations.EPSG,   "MyEPSG"),
+                new DefaultIdentifier(Citations.ISBN,   "MyIgnored"),
+                new DefaultIdentifier(Citations.ISSN,   "MyISSN")));
 
         assertEquals("The ISBN value shall not have been overwritten.",    "MyISBN", citation.getISBN());
         assertEquals("The ISSN value shall have been added, because new.", "MyISSN", citation.getISSN());
-        assertEquals("{OGC=“MyOGC”, EPSG=“MyEPSG”, ISSN=“MyISSN”, ISBN=“MyISBN”}", identifierMap.toString());
+        assertEquals("{NetCDF=“MyNetCDF”, EPSG=“MyEPSG”, ISSN=“MyISSN”, ISBN=“MyISBN”}", identifierMap.toString());
     }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java [UTF-8] Fri May 29 17:52:14 2015
@@ -22,12 +22,11 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.metadata.citation.OnLineFunction;
 import org.opengis.metadata.citation.PresentationForm;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.Static;
 
-import static java.util.Collections.singleton;
-
 
 /**
  * Hard-coded citation constants used for testing purpose only.
@@ -43,18 +42,16 @@ import static java.util.Collections.sing
  */
 public final strictfp class HardCodedCitations extends Static {
     /**
-     * The <a href="http://www.iso.org/">International Organization for Standardization</a>
-     * organization. An {@linkplain Citation#getAlternateTitles() alternate title} for this
-     * citation is "ISO" (according ISO 19115, alternate titles often contain abbreviations).
+     * The ISO 19111 standard.
      */
-    public static final DefaultCitation ISO;
+    public static final DefaultCitation ISO_19111;
     static {
-        final DefaultCitation c = new DefaultCitation("International Organization for Standardization");
-        c.setAlternateTitles(singleton(new SimpleInternationalString("ISO")));
-        c.setPresentationForms(singleton(PresentationForm.DOCUMENT_DIGITAL));
-        c.setIdentifiers(singleton(new DefaultIdentifier("ISO")));
+        final DefaultCitation c = new DefaultCitation("Spatial referencing by coordinates");
+        c.getAlternateTitles().add(new SimpleInternationalString("ISO 19111"));
+        c.getIdentifiers().add(new ImmutableIdentifier(null, "ISO", "19111"));
+        c.getPresentationForms().add(PresentationForm.DOCUMENT_DIGITAL);
         c.freeze();
-        ISO = c;
+        ISO_19111 = c;
     }
 
     /**
@@ -63,7 +60,7 @@ public final strictfp class HardCodedCit
     public static final DefaultCitation ISO_19115;
     static {
         final DefaultCitation c = new DefaultCitation("ISO 19115");
-        c.setPresentationForms(singleton(PresentationForm.DOCUMENT_DIGITAL));
+        c.getPresentationForms().add(PresentationForm.DOCUMENT_DIGITAL);
         c.freeze();
         ISO_19115 = c;
     }
@@ -99,9 +96,9 @@ public final strictfp class HardCodedCit
                 new DefaultOrganisation("International Association of Oil & Gas Producers", null, null, new DefaultContact(r)));
 
         final DefaultCitation c = new DefaultCitation("EPSG Geodetic Parameter Dataset");
-        c.setPresentationForms(singleton(PresentationForm.TABLE_DIGITAL));
-        c.setIdentifiers(singleton(new DefaultIdentifier(Constants.EPSG)));
-        c.setCitedResponsibleParties(singleton(p));
+        c.getPresentationForms().add(PresentationForm.TABLE_DIGITAL);
+        c.getIdentifiers().add(new DefaultIdentifier(Constants.EPSG));
+        c.getCitedResponsibleParties().add(p);
         c.freeze();
         EPSG = c;
     }
@@ -112,7 +109,7 @@ public final strictfp class HardCodedCit
     public static final DefaultCitation GEOTIFF;
     static {
         final DefaultCitation c = new DefaultCitation("GeoTIFF");
-        c.setPresentationForms(singleton(PresentationForm.DOCUMENT_DIGITAL));
+        c.getPresentationForms().add(PresentationForm.DOCUMENT_DIGITAL);
         c.freeze();
         GEOTIFF = c;
     }

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=1682524&r1=1682523&r2=1682524&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] Fri May 29 17:52:14 2015
@@ -24,7 +24,6 @@ import org.opengis.metadata.citation.Cit
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.internal.metadata.NameMeaning;
-import org.apache.sis.internal.metadata.ServicesForUtility;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 
@@ -126,12 +125,10 @@ public final class Code {
              *
              * A symmetrical special handling for EPSG is done in the 'forIdentifiedObject(…)' method of this class.
              */
-            if (Constants.EPSG.equalsIgnoreCase(parsed.authority) &&
-               (Constants.IOGP.equalsIgnoreCase(cs) || ServicesForUtility.OGP.equalsIgnoreCase(cs)))
-            {
+            if (org.apache.sis.internal.util.Citations.isEPSG(cs, parsed.authority)) {
                 authority = Citations.EPSG;
             } else {
-                authority = Citations.fromName(cs); // May be null.
+                authority = Citations.fromName(cs);     // May be null.
             }
             cs      = parsed.authority;
             version = parsed.version;
@@ -204,31 +201,46 @@ public final class Code {
                          * -------------------------------------
                          * Apache SIS already formats the Identifier.getCodeSpace() value in the URN.
                          * This value is "EPSG" for IdentifiedObject instances from the EPSG database.
-                         * But GML additionally have a "codeSpace" attribute, and common usage seems
-                         * to give the "OGP" or "IOGP" to that attribute as in the following example:
+                         * But GML additionally have a "codeSpace" attribute, and common usage seems to
+                         * give the "OGP" or "IOGP" value to that attribute as in the following example:
                          *
                          *     <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
                          *
                          * A discussion can be found in the comments of https://issues.apache.org/jira/browse/SIS-196
                          *
                          * Where to take this "IOGP" value from? It is not the Identifier.getCodeSpace() String value
-                         * since ISO 19115-2 clearly uses the "EPSG" value in their example.  We could consider using
+                         * since ISO 19115-1 clearly uses the "EPSG" value in their example.  We could consider using
                          * the Identifier.getAuthority() value, which is a Citation. But the "EPSG" part in above URN
                          * is named "the authority" in URN specification, which suggest that Identifier.getAuthority()
                          * should return a citation for the "EPSG Geodetic Parameter Dataset" rather than for the IOGP
                          * organisation.
                          *
-                         * Apache SIS declares IOGP as the codespace of the EPSG codespace. We could write below a code
-                         * which would go down to this deeper level in identifier hierarchy, but there is no indication
-                         * at this time that objects from other sources than SIS would follow such convention. For now
-                         * the relationship between EPSG and IOGP is hard-coded, but we could revisit this approach in
-                         * any future SIS version.
+                         * Apache SIS declares IOGP as the codespace of the EPSG codespace, i.e. the identifier of the
+                         * EPSG authority is "IOGP:EPSG". So the code below searches for the "IOGP" part of the above.
+                         * However there is no indication at this time that objects from other sources than SIS would
+                         * follow such convention, so we also keep a hard-coded "IOGP" default value for now.
                          *
                          * A symmetrical special handling for EPSG is done in the 'getIdentifier()' method of this class.
                          *
                          * See https://issues.apache.org/jira/browse/SIS-199
                          */
-                        code.codeSpace = isEPSG ? Constants.IOGP : getCodeSpace(fallback.getAuthority());
+                        final Citation authority = fallback.getAuthority();
+                        if (isEPSG) {
+                            code.codeSpace = Constants.IOGP;    // Default value if we do not find a codespace below.
+                            if (authority != null) {
+                                for (final Identifier id : authority.getIdentifiers()) {
+                                    if (Constants.EPSG.equalsIgnoreCase(id.getCode())) {
+                                        final String cs = id.getCodeSpace();
+                                        if (cs != null) {
+                                            code.codeSpace = cs;
+                                            break;
+                                        }
+                                    }
+                                }
+                            }
+                        } else {
+                            code.codeSpace = getCodeSpace(authority);
+                        }
                         code.code = urn;
                         return code;
                     }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -23,6 +23,7 @@ import org.apache.sis.internal.util.Cons
 import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -100,6 +101,23 @@ public final strictfp class CodeTest ext
         assertEquals("code", "urn:ogc:def:crs:EPSG:8.2:4326", value.code);
     }
 
+    /**
+     * Tests {@link Code#forIdentifiedObject(Class, Iterable)} with the legacy "OGP" codespace
+     * (instead of "IOGP").
+     */
+    @Test
+    @DependsOnMethod("testForIdentifiedObject")
+    public void testLegacyCodeSpace() {
+        final DefaultCitation authority = new DefaultCitation("EPSG");
+        authority.getIdentifiers().add(new ImmutableIdentifier(null, "OGP", "EPSG"));
+
+        final Identifier id = new ImmutableIdentifier(authority, "EPSG", "4326", "8.2", null);
+        final Code value = Code.forIdentifiedObject(GeographicCRS.class, Collections.singleton(id));
+        assertNotNull(value);
+        assertEquals("codeSpace", "OGP", value.codeSpace);
+        assertEquals("code", "urn:ogc:def:crs:EPSG:8.2:4326", value.code);
+    }
+
     /**
      * Tests {@link Code#getIdentifier()} with {@code "urn:ogc:def:crs:EPSG:8.2:4326"}.
      * This test simulates the {@code Code} object state that we get after XML unmarshalling

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -34,7 +34,7 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.getSingleton;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
+import static org.apache.sis.metadata.iso.citation.Citations.EPSG;
 
 
 /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] Fri May 29 17:52:14 2015
@@ -81,7 +81,7 @@ public final strictfp class NamedIdentif
         // ImmutableIdentifier properties
         assertEquals("code",      "4326", identifier.getCode());
         assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
-        assertEquals("authority", "IOGP", Citations.getIdentifier(identifier.getAuthority()));
+        assertEquals("authority", "OGP",  Citations.getIdentifier(identifier.getAuthority()));  // May change after resolution of SIS-200.
         assertNull  ("version",           identifier.getVersion());
         assertNull  ("description",       identifier.getDescription());
 

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Fri May 29 17:52:14 2015
@@ -26,7 +26,7 @@ import org.opengis.referencing.datum.Ver
 import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.Citations;
 
 import static org.opengis.referencing.datum.Datum.*;
 
@@ -174,7 +174,7 @@ public final strictfp class HardCodedDat
         final Map<String,Object> properties = new HashMap<>(4);
         properties.put(NAME_KEY, name);
         if (code != null) {
-            properties.put(IDENTIFIERS_KEY, new NamedIdentifier(HardCodedCitations.EPSG, code));
+            properties.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, code));
         }
         if (scope != null) {
             properties.put(SCOPE_KEY, scope);

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] Fri May 29 17:52:14 2015
@@ -40,9 +40,9 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.util.iso.DefaultNameSpace;
+import org.apache.sis.internal.util.Constants;
 
 import static java.lang.StrictMath.*;
-import static org.apache.sis.internal.util.Constants.*;
 
 
 /**
@@ -73,8 +73,11 @@ public strictfp class ReferencingAssert
      */
     public static void assertOgcIdentifierEquals(final String expected, final Identifier actual) {
         assertNotNull(actual);
-        assertSame("Authority", Citations.OGC, actual.getAuthority());
-        assertIdentifierEquals(null, OGC, OGC, null, expected, actual);
+        assertEquals("code",       expected,      actual.getCode());
+        assertEquals("codeSpace",  Constants.OGC, actual.getCodeSpace());
+        assertSame  ("authority",  Citations.OGC, actual.getAuthority());
+        assertEquals("identifier", Constants.OGC + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
+                IdentifiedObjects.toString(actual));
     }
 
     /**
@@ -88,10 +91,10 @@ public strictfp class ReferencingAssert
      */
     public static void assertEpsgIdentifierEquals(final String expected, final Identifier actual) {
         assertNotNull(actual);
-        assertEquals("code",       expected, actual.getCode());
-        assertEquals("codeSpace",  EPSG,  actual.getCodeSpace());
-        assertEquals("authority",  EPSG,  Citations.getIdentifier(actual.getAuthority()));
-        assertEquals("identifier", EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
+        assertEquals("code",       expected,        actual.getCode());
+        assertEquals("codeSpace",  Constants.EPSG,  actual.getCodeSpace());
+        assertEquals("authority",  Constants.EPSG,  Citations.getIdentifier(actual.getAuthority()));
+        assertEquals("identifier", Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
                 IdentifiedObjects.toString(actual));
     }
 

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java [UTF-8] Fri May 29 17:52:14 2015
@@ -43,7 +43,7 @@ import java.util.Objects;
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see org.apache.sis.referencing.AbstractIdentifiedObject
@@ -251,7 +251,7 @@ public class SimpleIdentifiedObject impl
         buffer.append(code).append('"');
         final String identifier = Citations.getIdentifier(authority, true);
         if (identifier != null) {
-            buffer.append(", ID[\"").append(identifier).append("\"]");
+            buffer.append(", Id[\"").append(identifier).append("\"]");   // "Id" should be consistent with WKTKeywords.Id.
         }
         return buffer.append(']').toString();
     }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Fri May 29 17:52:14 2015
@@ -28,6 +28,8 @@ import org.apache.sis.util.Characters;
 import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.Static;
 
+import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR;
+
 // Branch-dependent imports
 import java.util.Objects;
 
@@ -50,6 +52,26 @@ public final class Citations extends Sta
     }
 
     /**
+     * Returns {@code true} if the given code is {@code "EPSG"} while the codespace is {@code "IOGP"} or {@code "OGP"}
+     * (ignoring case). This particular combination of code and codespace is handled in a special way.
+     *
+     * <p>This method can be used for identifying where in Apache SIS source code the relationship between
+     * EPSG authority and IOGP code space is hard-coded.</p>
+     *
+     * @param  codeSpace The identifier code space, or {@code null}.
+     * @param  code The identifier code, or {@code null}.
+     * @return {@code true} if the given identifier is {@code "IOGP:EPSG"}.
+     *
+     * @see org.apache.sis.metadata.iso.citation.Citations#EPSG
+     */
+    public static boolean isEPSG(final String codeSpace, final String code) {
+        return Constants.EPSG.equalsIgnoreCase(code) &&
+              (Constants.IOGP.equalsIgnoreCase(codeSpace) || "OGP".equalsIgnoreCase(codeSpace) ||
+               Constants.EPSG.equalsIgnoreCase(codeSpace));
+        // "OGP" is a legacy abbreviation that existed before "IOGP".
+    }
+
+    /**
      * Returns the collection iterator, or {@code null} if the given collection is null
      * or empty. We use this method as a paranoiac safety against broken implementations.
      *
@@ -69,12 +91,13 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns a "unlocalized" string representation of the given international string,
-     * or {@code null} if none. This method is used by {@link #getIdentifier(Citation, boolean)},
-     * which is why we don't want the localized string.
+     * Returns a "unlocalized" string representation of the given international string, or {@code null} if none
+     * or if the string is deprecated. This method is used by {@link #getIdentifier(Citation, boolean)}, which
+     * is why we don't want the localized string.
      */
     private static String toString(final InternationalString title) {
-        return (title != null) ? CharSequences.trimWhitespaces(title.toString(Locale.ROOT)) : null;
+        return (title != null && !isDeprecated(title))
+               ? CharSequences.trimWhitespaces(title.toString(Locale.ROOT)) : null;
     }
 
     /**
@@ -331,32 +354,57 @@ public final class Citations extends Sta
      * @param  strict {@code true} for returning a non-null value only if the identifier is a valid Unicode identifier.
      * @return A non-empty identifier for the given citation without leading or trailing whitespaces,
      *         or {@code null} if the given citation is null or does not declare any identifier or title.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-201">SIS-201</a>
      */
     public static String getIdentifier(final Citation citation, final boolean strict) {
-        boolean isUnicode = false;      // Whether 'identifier' is a Unicode identifier.
-        String identifier = null;
         if (citation != null) {
+            boolean isUnicode = false;      // Whether 'identifier' is a Unicode identifier.
+            String identifier = null;       // The best identifier found so far.
+            String codeSpace  = null;       // Code space of the identifier, or null if none.
             final Iterator<? extends Identifier> it = iterator(citation.getIdentifiers());
             if (it != null) while (it.hasNext()) {
                 final Identifier id = it.next();
                 if (id != null && !isDeprecated(id)) {
                     final String candidate = CharSequences.trimWhitespaces(id.getCode());
-                    if (candidate != null) {
-                        final int length = candidate.length();
-                        if (length != 0 && (identifier == null || length < identifier.length())) {
-                            final boolean s = CharSequences.isUnicodeIdentifier(candidate);
-                            if (s || !isUnicode) {
-                                identifier = candidate;
-                                isUnicode = s;
+                    if (candidate != null && !candidate.isEmpty()) {
+                        /*
+                         * For a non-empty identifier. Verify if both the code ans its codespace are valid
+                         * Unicode identifiers. If a codespace exist, the code does not need to begin with
+                         * a "Unicode identifier start" (it may be a "Unicode identifier part").
+                         */
+                        String cs = CharSequences.trimWhitespaces(id.getCodeSpace());
+                        if (cs == null || cs.isEmpty()) {
+                            cs = null;
+                            isUnicode = CharSequences.isUnicodeIdentifier(candidate);
+                        } else {
+                            isUnicode = CharSequences.isUnicodeIdentifier(cs);
+                            if (isUnicode) for (int i = 0; i < candidate.length();) {
+                                final int c = candidate.codePointAt(i);
+                                if (!Character.isUnicodeIdentifierPart(c)) {
+                                    isUnicode = false;
+                                    break;
+                                }
+                                i += Character.charCount(c);
                             }
                         }
+                        /*
+                         * If we found a Unicode identifier, we are done and we can exit the loop.
+                         * Otherwise retain the first identifier and continue the search for Unicode identifier.
+                         */
+                        if (identifier == null || isUnicode) {
+                            identifier = candidate;
+                            codeSpace  = cs;
+                            if (isUnicode) break;
+                        }
                     }
                 }
             }
             /*
-             * If no identifier has been found, fallback on the shortest title or alternate title.
-             * We search for alternate titles because ISO specification said that those titles are
-             * often used for abbreviations.
+             * If no identifier has been found, fallback on the first title or alternate title.
+             * We search for alternate titles because ISO specification said that those titles
+             * are often used for abbreviations. Again we give preference to Unicode identifiers,
+             * which are typically alternate titles.
              */
             if (identifier == null) {
                 identifier = toString(citation.getTitle());     // Whitepaces removed by toString(…).
@@ -367,23 +415,34 @@ public final class Citations extends Sta
                         isUnicode = CharSequences.isUnicodeIdentifier(identifier);
                     }
                 }
-                final Iterator<? extends InternationalString> iterator = iterator(citation.getAlternateTitles());
-                if (iterator != null) while (iterator.hasNext()) {
-                    final String candidate = toString(iterator.next());
-                    if (candidate != null) {
-                        final int length = candidate.length();
-                        if (length != 0 && (identifier == null || length < identifier.length())) {
-                            final boolean s = CharSequences.isUnicodeIdentifier(candidate);
-                            if (s || !isUnicode) {
+                if (!isUnicode) {
+                    final Iterator<? extends InternationalString> iterator = iterator(citation.getAlternateTitles());
+                    if (iterator != null) while (iterator.hasNext()) {
+                        final String candidate = toString(iterator.next());
+                        if (candidate != null && !candidate.isEmpty()) {
+                            isUnicode = CharSequences.isUnicodeIdentifier(candidate);
+                            if (identifier == null || isUnicode) {
                                 identifier = candidate;
-                                isUnicode = s;
+                                if (isUnicode) break;
                             }
                         }
                     }
                 }
             }
+            /*
+             * Finished searching in the identifiers, title and alternate titles. If the identifier that
+             * we found is not a valid Unicode identifier, we will return it only if the caller did not
+             * asked for strictly valid Unicode identifier.
+             */
+            if (isUnicode || !strict) {
+                if (codeSpace != null && !isEPSG(codeSpace, identifier)) {
+                    return codeSpace + (strict ? '_' : DEFAULT_SEPARATOR) + identifier;
+                } else {
+                    return identifier;
+                }
+            }
         }
-        return (isUnicode || !strict) ? identifier : null;
+        return null;
     }
 
     /**
@@ -450,9 +509,14 @@ public final class Citations extends Sta
      * Infers a code space from the given citation, or returns {@code null} if none.
      * This method is very close to {@link #getUnicodeIdentifier(Citation)}, except that it looks for
      * {@link IdentifierSpace#getName()} before to scan the identifiers and titles. The result should
-     * be the same in most cases, except some cases like the SIS citation constant for {@code "Proj.4"}
-     * in which case this method returns {@code "Proj4"} instead of {@code null}. As a side effect,
-     * using this method also avoid constructing the full {@code DefaultCitation} objects when not needed
+     * be the same in most cases, except some cases like the {@link org.apache.sis.metadata.iso.citation.Citations}
+     * constant for {@code "Proj.4"} in which case this method returns {@code "Proj4"} instead of {@code null}.
+     * As a side effect, using this method also avoid constructing {@code DefaultCitation} objects which were deferred.
+     *
+     * <p>We do not put this method in public API for now because the actions performed by this method could be
+     * revisited in any future SIS version depending on the experience gained. However we should try to keep the
+     * behavior of this method close to the behavior of {@link #getUnicodeIdentifier(Citation)}, which is the
+     * method having a public facade.</p>
      *
      * @param  citation The citation for which to infer the code space, or {@code null}.
      * @return A non-empty code space for the given citation without leading or trailing whitespaces,

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1682524&r1=1682523&r2=1682524&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] Fri May 29 17:52:14 2015
@@ -66,7 +66,6 @@ import org.apache.sis.internal.netcdf.De
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.internal.netcdf.GridGeometry;
 import org.apache.sis.internal.system.DefaultFactories;
-import org.apache.sis.internal.metadata.Standards;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.measure.Units;
 
@@ -933,7 +932,7 @@ final class MetadataReader {
      */
     public Metadata read() throws IOException {
         final DefaultMetadata metadata = new DefaultMetadata();
-        metadata.setMetadataStandards(singleton(Standards.ISO_19115_2));
+        metadata.setMetadataStandards(singleton(Citations.ISO_19115));
         final Identifier identifier = getFileIdentifier();
         metadata.setMetadataIdentifier(identifier);
         final Date creation = decoder.dateValue(METADATA_CREATION);



Mime
View raw message