You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/03/02 23:31:04 UTC

svn commit: r1733385 [1/4] - in /sis/trunk: ./ application/sis-console/src/main/artifact/bin/ application/sis-console/src/main/artifact/conf/ application/sis-console/src/main/artifact/data/ application/sis-console/src/main/artifact/lib/ application/sis...

Author: desruisseaux
Date: Wed Mar  2 22:31:02 2016
New Revision: 1733385

URL: http://svn.apache.org/viewvc?rev=1733385&view=rev
Log:
Merge the command-line tools improvement from the JDK6 branch.

Added:
    sis/trunk/application/sis-console/src/main/artifact/data/
      - copied from r1733382, sis/branches/JDK6/application/sis-console/src/main/artifact/data/
    sis/trunk/application/sis-console/src/main/artifact/lib/README
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/artifact/lib/README
    sis/trunk/application/sis-console/src/main/artifact/log/README
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/artifact/log/README
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/IdentifierRow.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/IdentifierRow.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java
      - copied, changed from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java
    sis/trunk/application/sis-console/src/main/resources/META-INF/
      - copied from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/META-INF/
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState.properties
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState.properties
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_en.properties
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_en.properties
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_fr.properties
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_fr.properties
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Messages_en.properties
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Messages_en.properties
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
      - copied, changed from r1733382, sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
      - copied unchanged from r1733382, sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java
      - copied unchanged from r1733382, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AccessDeniedException.java
      - copied unchanged from r1733382, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AccessDeniedException.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Fallback.java
      - copied unchanged from r1733382, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/Fallback.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/InstallationResources.java
      - copied unchanged from r1733382, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/InstallationResources.java
Removed:
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeSCTest.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/SubCommandTest.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/application/sis-console/src/main/artifact/bin/sis
    sis/trunk/application/sis-console/src/main/artifact/conf/logging.properties
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Command.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Option.java
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties
    sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/VerticalDatumTypes.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/VerticalDatumTypesTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/package-info.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/package-info.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/IO.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/package-info.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar  2 22:31:02 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1732239
-/sis/branches/JDK7:1394913-1732235
-/sis/branches/JDK8:1584960-1732232
+/sis/branches/JDK6:1394364-1733382
+/sis/branches/JDK7:1394913-1733371
+/sis/branches/JDK8:1584960-1733370

Modified: sis/trunk/application/sis-console/src/main/artifact/bin/sis
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/artifact/bin/sis?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/artifact/bin/sis [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/artifact/bin/sis [UTF-8] Wed Mar  2 22:31:02 2016
@@ -17,6 +17,8 @@
 # ------------------------------------------------------------------------
 
 BASE_DIR="`dirname $0`/.."
+SIS_DATA="${SIS_DATA:-$BASE_DIR/data}"
+export SIS_DATA
 
 # Unpack the JAR file when first needed.
 if [ ! -f $BASE_DIR/lib/sis.jar ]

Modified: sis/trunk/application/sis-console/src/main/artifact/conf/logging.properties
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/artifact/conf/logging.properties?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/artifact/conf/logging.properties [ISO-8859-1] (original)
+++ sis/trunk/application/sis-console/src/main/artifact/conf/logging.properties [ISO-8859-1] Wed Mar  2 22:31:02 2016
@@ -59,5 +59,5 @@ java.util.logging.ConsoleHandler.level =
 #         class:short and class:long.
 
 java.util.logging.ConsoleHandler.formatter = org.apache.sis.util.logging.MonolineFormatter
-org.apache.sis.util.logging.MonolineFormatter.source = class:short
+org.apache.sis.util.logging.MonolineFormatter.source = logger:long
 org.apache.sis.util.logging.MonolineFormatter.colors = true

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Command.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Command.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Command.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Command.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -35,11 +35,12 @@ import org.apache.sis.util.logging.Monol
  * Command line interface for Apache SIS. The {@link #main(String[])} method accepts the following actions:
  *
  * <blockquote><table class="compact" summary="Supported command-line actions.">
- * <tr><td>{@code help}     </td><td>Show a help overview.</td></tr>
- * <tr><td>{@code about}    </td><td>Show information about Apache SIS and system configuration.</td></tr>
- * <tr><td>{@code mime-type}</td><td>Show MIME type for the given file.</td></tr>
- * <tr><td>{@code metadata} </td><td>Show metadata information for the given file.</td></tr>
- * <tr><td>{@code crs}      </td><td>Show Coordinate Reference System information for the given file or code.</td></tr>
+ * <tr><td>{@code help}       </td><td>Show a help overview.</td></tr>
+ * <tr><td>{@code about}      </td><td>Show information about Apache SIS and system configuration.</td></tr>
+ * <tr><td>{@code mime-type}  </td><td>Show MIME type for the given file.</td></tr>
+ * <tr><td>{@code metadata}   </td><td>Show metadata information for the given file.</td></tr>
+ * <tr><td>{@code crs}        </td><td>Show Coordinate Reference System information for the given file or code.</td></tr>
+ * <tr><td>{@code identifier} </td><td>Show identifiers for metadata and referencing systems in the given file.</td></tr>
  * </table></blockquote>
  *
  * Each command can accepts an arbitrary amount of the following options:
@@ -118,7 +119,7 @@ public final class Command {
     /**
      * The sub-command to execute.
      */
-    private final SubCommand command;
+    private final CommandRunner command;
 
     /**
      * Creates a new command for the given arguments. The first value in the given array which is
@@ -152,18 +153,20 @@ public final class Command {
             }
         }
         if (commandName == null) {
-            command = new HelpSC(-1, args);
+            command = new HelpCommand(-1, args);
         } else {
             commandName = commandName.toLowerCase(Locale.US);
-                 if (commandName.equals("about"))     command = new AboutSC   (       commandIndex, args);
-            else if (commandName.equals("help"))      command = new HelpSC    (       commandIndex, args);
-            else if (commandName.equals("mime-type")) command = new MimeTypeSC(       commandIndex, args);
-            else if (commandName.equals("metadata"))  command = new MetadataSC(false, commandIndex, args);
-            else if (commandName.equals("crs"))       command = new MetadataSC(true,  commandIndex, args);
+                 if (commandName.equals("help"))       command = new HelpCommand    (commandIndex, args);
+            else if (commandName.equals("about"))      command = new AboutCommand   (commandIndex, args);
+            else if (commandName.equals("mime-type"))  command = new MimeTypeCommand(commandIndex, args);
+            else if (commandName.equals("identifier")) command = new MetadataCommand(MetadataCommand.Info.IDENTIFIER, commandIndex, args);
+            else if (commandName.equals("metadata"))   command = new MetadataCommand(MetadataCommand.Info.METADATA,   commandIndex, args);
+            else if (commandName.equals("crs"))        command = new MetadataCommand(MetadataCommand.Info.CRS,        commandIndex, args);
             else throw new InvalidCommandException(Errors.format(
                         Errors.Keys.UnknownCommand_1, commandName), commandName);
         }
         this.commandName = commandName;
+        CommandRunner.instance = command;       // For ResourcesDownloader only.
     }
 
     /**
@@ -211,7 +214,7 @@ public final class Command {
 
     /**
      * Prints the message of the given exception. This method is invoked only when the error occurred before
-     * the {@link SubCommand} has been built, otherwise the {@link SubCommand#err} printer shall be used.
+     * the {@link CommandRunner} has been built, otherwise the {@link CommandRunner#err} printer shall be used.
      *
      * @param args The command line arguments, used only for detecting if the {@code --debug} option was present.
      */

Copied: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java (from r1733382, sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java)
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java?p2=sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java&p1=sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java&r1=1733382&r2=1733385&rev=1733385&view=diff
==============================================================================
--- sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -37,6 +37,7 @@ import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.io.wkt.Colors;
 import org.apache.sis.metadata.MetadataStandard;
 import org.apache.sis.metadata.ValueExistencePolicy;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.CRS;
@@ -246,11 +247,13 @@ final class MetadataCommand extends Comm
 choice: switch (command) {
             case IDENTIFIER: {
                 final List<IdentifierRow> rows = new ArrayList<IdentifierRow>();
-                final Identifier id = metadata.getMetadataIdentifier();
-                if (id != null) {
-                    CharSequence desc = id.getDescription();
-                    if (desc != null && !files.isEmpty()) desc = files.get(0);
-                    rows.add(new IdentifierRow(IdentifierRow.State.VALID, IdentifiedObjects.toString(id), desc));
+                if (metadata instanceof DefaultMetadata) {
+                    final Identifier id = ((DefaultMetadata) metadata).getMetadataIdentifier();
+                    if (id instanceof DefaultIdentifier) {
+                        CharSequence desc = ((DefaultIdentifier) id).getDescription();
+                        if (desc != null && !files.isEmpty()) desc = files.get(0);
+                        rows.add(new IdentifierRow(IdentifierRow.State.VALID, IdentifiedObjects.toString(id), desc));
+                    }
                 }
                 for (final ReferenceSystem rs : metadata.getReferenceSystemInfo()) {
                     rows.add(IdentifierRow.create(rs));

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Option.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Option.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Option.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/Option.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -91,7 +91,7 @@ enum Option {
     private static final String[] BOOLEAN_VALUES = {
         "false", "true",
         "off",   "on",
-        "yes",   "no"
+        "no",    "yes"
     };
 
     /**

Modified: sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties [ISO-8859-1] (original)
+++ sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties [ISO-8859-1] Wed Mar  2 22:31:02 2016
@@ -4,6 +4,7 @@ Usage=Usage: sis <command> [options] [fi
 
 help=Show a help overview.
 about=Show information about Apache SIS and system configuration.
-crs=Show Coordinate Reference System information for the given file.
 mime-type=Show MIME type for the given file.
 metadata=Show metadata information for the given file.
+crs=Show Coordinate Reference System (CRS) information for the given file.
+identifier=Show identifiers for metadata and referencing systems in the given file.

Modified: sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties [ISO-8859-1] Wed Mar  2 22:31:02 2016
@@ -4,6 +4,7 @@ Usage=Usage: sis <commande> [options] [f
 
 help=Affiche un écran d\u2019aide.
 about=Affiche des informations à propos de Apache SIS et de la configuration du système.
-crs=Affiche le système de référence des coordonnées du fichier spécifié.
 mime-type=Affiche le type MIME du fichier spécifié.
 metadata=Affiche les méta-données du fichier spécifié.
+crs=Affiche le système de référence des coordonnées du fichier spécifié.
+identifier=Affiche les identifiants des méta-données et des systèmes de références du fichier spécifié.

Copied: sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java (from r1733382, sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java?p2=sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java&p1=sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java&r1=1733382&r2=1733385&rev=1733385&view=diff
==============================================================================
--- sis/branches/JDK6/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -17,10 +17,10 @@
 package org.apache.sis.console;
 
 import java.net.URL;
-import org.opengis.wrapper.netcdf.IOTestCase;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -55,9 +55,10 @@ public final strictfp class MetadataComm
      * @throws Exception Should never happen.
      */
     @Test
+    @Ignore("Requires GeoAPI 3.1")
     public void testNetCDF() throws Exception {
-        final URL url = IOTestCase.class.getResource(IOTestCase.NCEP);
-        assertNotNull(IOTestCase.NCEP, url);
+        final URL url = MetadataCommandTest.class.getResource("NCEP-SST.nc");
+        assertNotNull("NCEP-SST.nc", url);
         final MetadataCommand test = new MetadataCommand(MetadataCommand.Info.METADATA, 0, CommandRunner.TEST, url.toString());
         test.run();
         verifyNetCDF("Metadata", test.outputBuffer.toString());
@@ -81,9 +82,10 @@ public final strictfp class MetadataComm
      * @throws Exception Should never happen.
      */
     @Test
+    @Ignore("Requires GeoAPI 3.1")
     @DependsOnMethod("testNetCDF")
     public void testFormatXML() throws Exception {
-        final URL url = IOTestCase.class.getResource(IOTestCase.NCEP);
+        final URL url = MetadataCommandTest.class.getResource("NCEP-SST.nc");
         final MetadataCommand test = new MetadataCommand(MetadataCommand.Info.METADATA,
                 0, CommandRunner.TEST, url.toString(), "--format", "XML");
         test.run();

Modified: sis/trunk/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -30,11 +30,11 @@ import org.junit.BeforeClass;
  * @module
  */
 @Suite.SuiteClasses({
-    org.apache.sis.console.SubCommandTest.class,
-    org.apache.sis.console.HelpSCTest.class,
-    org.apache.sis.console.AboutSCTest.class,
-    org.apache.sis.console.MimeTypeSCTest.class,
-    org.apache.sis.console.MetadataSCTest.class
+    org.apache.sis.console.CommandRunnerTest.class,
+    org.apache.sis.console.HelpCommandTest.class,
+    org.apache.sis.console.AboutCommandTest.class,
+    org.apache.sis.console.MimeTypeCommandTest.class,
+    org.apache.sis.console.MetadataCommandTest.class
 })
 public final strictfp class ConsoleTestSuite extends TestSuite {
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -176,6 +176,37 @@ public final class MetadataUtilities ext
     }
 
     /**
+     * Invoked by private setter methods (themselves invoked by JAXB at unmarshalling time)
+     * when an element is already set. Invoking this method from those setter methods serves
+     * three purposes:
+     *
+     * <ul>
+     *   <li>Make sure that a singleton property is not defined twice in the XML document.</li>
+     *   <li>Protect ourselves against changes in immutable objects outside unmarshalling. It should
+     *       not be necessary since the setter methods shall not be public, but we are paranoiac.</li>
+     *   <li>Be a central point where we can trace all setter methods, in case we want to improve
+     *       warning or error messages in future SIS versions.</li>
+     * </ul>
+     *
+     * @param  classe The caller class, used only in case of warning message to log.
+     * @param  method The caller method, used only in case of warning message to log.
+     * @param  name   The property name, used only in case of error message to format.
+     * @throws IllegalStateException if {@code isDefined} is {@code true} and we are not unmarshalling an object.
+     *
+     * @since 0.7
+     */
+    public static void propertyAlreadySet(final Class<?> classe, final String method, final String name)
+            throws IllegalStateException
+    {
+        final Context context = Context.current();
+        if (context != null) {
+            Context.warningOccured(context, classe, method, Errors.class, Errors.Keys.ElementAlreadyPresent_1, name);
+        } else {
+            throw new IllegalStateException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, name));
+        }
+    }
+
+    /**
      * Returns the {@code gco:id} or {@code gml:id} value to use for the given object.
      * The returned identifier will be unique in the current XML document.
      *

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -45,7 +45,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class NameToIdentifier implements ReferenceIdentifier {
@@ -204,19 +204,20 @@ public final class NameToIdentifier impl
      * primary name} or one of the given aliases matches the given name. The comparison ignores case, some Latin
      * diacritical signs and any characters that are not letters or digits.
      *
-     * @param  name     The name of the {@code IdentifiedObject} to check.
-     * @param  aliases  The list of alias in the {@code IdentifiedObject} (may be {@code null}). This method will never
-     *                  modify that list. Consequently, the given list can be a direct reference to an internal list.
-     * @param  toSearch The name for which to check for equality.
+     * @param  name       The name of the {@code IdentifiedObject} to check.
+     * @param  aliases    The list of aliases in the {@code IdentifiedObject} (may be {@code null}). This method will never
+     *                    modify that list. Consequently, the given list can be a direct reference to an internal list.
+     * @param  toSearch   The name for which to check for equality.
+     * @param  simplifier A function for simplifying the names before comparison.
      * @return {@code true} if the primary name or at least one alias matches the given {@code name}.
      */
     public static boolean isHeuristicMatchForName(final Identifier name, final Collection<GenericName> aliases,
-            CharSequence toSearch)
+            CharSequence toSearch, final Simplifier simplifier)
     {
-        toSearch = CharSequences.toASCII(toSearch);
-        if (name != null) { // Paranoiac check.
-            final CharSequence code = CharSequences.toASCII(name.getCode());
-            if (code != null) { // Paranoiac check.
+        toSearch = simplifier.apply(toSearch);
+        if (name != null) {                                                                 // Paranoiac check.
+            final CharSequence code = simplifier.apply(name.getCode());
+            if (code != null) {                                                             // Paranoiac check.
                 if (CharSequences.equalsFiltered(toSearch, code, LETTERS_AND_DIGITS, true)) {
                     return true;
                 }
@@ -224,8 +225,8 @@ public final class NameToIdentifier impl
         }
         if (aliases != null) {
             for (final GenericName alias : aliases) {
-                if (alias != null) { // Paranoiac check.
-                    final CharSequence tip = CharSequences.toASCII(alias.tip().toString());
+                if (alias != null) {                                                        // Paranoiac check.
+                    final CharSequence tip = simplifier.apply(alias.tip().toString());
                     if (CharSequences.equalsFiltered(toSearch, tip, LETTERS_AND_DIGITS, true)) {
                         return true;
                     }
@@ -240,4 +241,33 @@ public final class NameToIdentifier impl
         }
         return false;
     }
+
+    /**
+     * A function for simplifying an {@link IdentifiedObject} name before comparison with
+     * {@link NameToIdentifier#isHeuristicMatchForName(Identifier, Collection, CharSequence, Simplifier)}.
+     *
+     * @since 0.7
+     */
+    public static class Simplifier {
+        /**
+         * The default instance, which replaces some non-ASCII characters by ASCII ones.
+         */
+        public static final Simplifier DEFAULT = new Simplifier();
+
+        /**
+         * For subclasses and default instance only.
+         */
+        protected Simplifier() {
+        }
+
+        /**
+         * Simplifies the given name.
+         *
+         * @param name The object name (may be {@code null}).
+         * @return The name to use for comparison purpose, or {@code null}.
+         */
+        protected CharSequence apply(final CharSequence name) {
+            return CharSequences.toASCII(name);
+        }
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -24,15 +24,20 @@ import javax.measure.quantity.Length;
 import org.opengis.geometry.Envelope;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.IdentifiedObject;
+import org.opengis.referencing.crs.CRSFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.DerivedCRS;
+import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CSFactory;
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.CoordinateOperationFactory;
@@ -49,6 +54,7 @@ import org.apache.sis.internal.system.De
 import org.apache.sis.internal.system.OptionalDependency;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.resources.Errors;
@@ -412,6 +418,85 @@ public class ReferencingServices extends
     }
 
     /**
+     * Creates a compound CRS, but we special processing for (two-dimensional Geographic + ellipsoidal heights) tupples.
+     * If any such tupple is found, a three-dimensional geographic CRS is created instead than the compound CRS.
+     *
+     * @param  crsFactory The factory to use for creating compound or three-dimensional geographic CRS.
+     * @param  csFactory  The factory to use for creating three-dimensional ellipsoidal CS, if needed.
+     * @param  properties Name and other properties to give to the new object.
+     * @param  components ordered array of {@code CoordinateReferenceSystem} objects.
+     * @return The coordinate reference system for the given properties.
+     * @throws FactoryException if the object creation failed.
+     *
+     * @since 0.7
+     */
+    public final CoordinateReferenceSystem createCompoundCRS(final CRSFactory crsFactory, final CSFactory csFactory,
+            final Map<String,?> properties, CoordinateReferenceSystem... components) throws FactoryException
+    {
+        for (int i=0; i<components.length; i++) {
+            final CoordinateReferenceSystem vertical = components[i];
+            if (vertical instanceof VerticalCRS) {
+                final VerticalDatum datum = ((VerticalCRS) vertical).getDatum();
+                if (datum != null && datum.getVerticalDatumType() == VerticalDatumTypes.ELLIPSOIDAL) {
+                    int axisPosition = 0;
+                    EllipsoidalCS cs = null;
+                    CoordinateReferenceSystem crs = null;
+                    if (i == 0 || (cs = getCsIfGeographic2D(crs = components[i - 1])) == null) {
+                        /*
+                         * GeographicCRS are normally before VerticalCRS. But Apache SIS is tolerant to the
+                         * opposite order (note however that such ordering is illegal according ISO 19162).
+                         */
+                        if (i+1 >= components.length || (cs = getCsIfGeographic2D(crs = components[i + 1])) == null) {
+                            continue;
+                        }
+                        axisPosition = 1;
+                    }
+                    /*
+                     * At this point we have the horizontal and vertical components. The horizontal component
+                     * begins at 'axisPosition', which is almost always zero. Create the three-dimensional CRS.
+                     * If the result is the CRS to be returned directly by this method (components.length == 2),
+                     * use the properties given in argument. Otherwise we need to use other properties; current
+                     * implementation recycles the properties of the existing two-dimensional CRS.
+                     */
+                    final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[3];
+                    axes[axisPosition++   ] = cs.getAxis(0);
+                    axes[axisPosition++   ] = cs.getAxis(1);
+                    axes[axisPosition %= 3] = vertical.getCoordinateSystem().getAxis(0);
+                    cs = csFactory.createEllipsoidalCS(getProperties(cs), axes[0], axes[1], axes[2]);
+                    crs = crsFactory.createGeographicCRS((components.length == 2) ? properties : getProperties(crs),
+                            ((GeodeticCRS) crs).getDatum(), cs);
+                    /*
+                     * Remove the VerticalCRS and store the three-dimensional GeographicCRS in place of the previous
+                     * two-dimensional GeographicCRS. Then let the loop continues in case there is other CRS to merge
+                     * (should never happen, but we are paranoiac).
+                     */
+                    components = ArraysExt.remove(components, i, 1);
+                    if (axisPosition != 0) i--;             // GeographicCRS before VerticalCRS (usual case).
+                    components[i] = crs;
+                }
+            }
+        }
+        switch (components.length) {
+            case 0:  return null;
+            case 1:  return components[0];
+            default: return crsFactory.createCompoundCRS(properties, components);
+        }
+    }
+
+    /**
+     * Returns the coordinate system if the given CRS is a two-dimensional geographic CRS, or {@code null} otherwise.
+     */
+    private static EllipsoidalCS getCsIfGeographic2D(final CoordinateReferenceSystem crs) {
+        if (crs instanceof GeodeticCRS) {
+            final CoordinateSystem cs = crs.getCoordinateSystem();
+            if (cs instanceof EllipsoidalCS && cs.getDimension() == 2) {
+                return (EllipsoidalCS) cs;
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns an axis direction from a pole along a meridian.
      * The given meridian is usually, but not necessarily, relative to the Greenwich meridian.
      *
@@ -514,7 +599,8 @@ public class ReferencingServices extends
      * @since 0.6
      */
     public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
-        return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(), name);
+        return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(), name,
+                NameToIdentifier.Simplifier.DEFAULT);
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/VerticalDatumTypes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/VerticalDatumTypes.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/VerticalDatumTypes.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/VerticalDatumTypes.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -39,7 +39,7 @@ import org.apache.sis.util.Characters;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class VerticalDatumTypes implements CodeList.Filter {
@@ -108,12 +108,19 @@ public final class VerticalDatumTypes im
 
     /**
      * Returns the legacy code for the datum type, or 0 if unknown.
+     * This method is used for WKT 1 formatting.
      *
-     * @param  ordinal The {@linkplain CodeList#ordinal() ordinal} value of the {@link VerticalDatumType}.
+     * @param  type The vertical datum type, or {@code null} if unknown.
      * @return The legacy code for the given datum type, or 0 if unknown.
      */
-    public static int toLegacy(final int ordinal) {
-        return (ordinal >= 0 && ordinal < LEGACY_CODES.length) ? LEGACY_CODES[ordinal] : 0;
+    public static int toLegacy(final VerticalDatumType type) {
+        if (type != null) {
+            final int ordinal = type.ordinal();
+            if (ordinal >= 0 && ordinal < LEGACY_CODES.length) {
+                return LEGACY_CODES[ordinal];
+            }
+        }
+        return 0;
     }
 
     /**
@@ -219,6 +226,8 @@ public final class VerticalDatumTypes im
      * We do not test the characters following the prefix because the word may be incomplete
      * (e.g. {@code "geoid"} versus {@code "geoidal"}).
      *
+     * <p>This method is public as an implementation side-effect and should be ignored.</p>
+     *
      * @param code The code to test.
      * @return {@code true} if the code matches the criterion.
       */
@@ -230,6 +239,7 @@ public final class VerticalDatumTypes im
 
     /**
      * Returns {@code null} for disabling the creation of new code list elements.
+     * This method is public as an implementation side-effect and should be ignored.
      *
      * @return {@code null}.
      */

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -65,8 +65,8 @@ public class Colors implements Cloneable
         map.put(ElementKind.CODE_LIST,  X364.FOREGROUND_CYAN);
         map.put(ElementKind.PARAMETER,  X364.FOREGROUND_GREEN);
         map.put(ElementKind.METHOD,     X364.FOREGROUND_GREEN);
-        map.put(ElementKind.DATUM,      X364.FOREGROUND_BLUE);  // Because datum names in SIS are like identifiers.
-        map.put(ElementKind.IDENTIFIER, X364.FOREGROUND_BLUE);
+        map.put(ElementKind.DATUM,      X364.FOREGROUND_GREEN);     // Note: datum names in SIS are like identifiers.
+        map.put(ElementKind.IDENTIFIER, X364.FOREGROUND_RED);
         map.put(ElementKind.SCOPE,      X364.FOREGROUND_GRAY);
         map.put(ElementKind.EXTENT,     X364.FOREGROUND_GRAY);
         map.put(ElementKind.CITATION,   X364.FOREGROUND_GRAY);

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -108,11 +108,13 @@ public abstract class FormattableObject
 
     /**
      * Returns a <cite>Well Known Text</cite> (WKT) or an alternative text representation for this object.
-     * If this object can not be represented in a standard way, then this method fallbacks on a non-standard
-     * representation.
+     * If this object can not be represented in a standard way, then this method may fallback on non-standard
+     * representation, or leave unformattable elements empty and append warnings after the WKT.
      *
      * <p>By default this method formats this object according the {@link Convention#WKT2_SIMPLIFIED} rules,
-     * except that Unicode characters are kept <i>as-is</i> (they are not converted to ASCII).</p>
+     * except that Unicode characters are kept <i>as-is</i> (they are not converted to ASCII).
+     * Consequently the WKT is not guaranteed to be ISO 19162 compliant.
+     * For stricter conformance, use {@link #toWKT()} instead.</p>
      *
      * @return The Well Known Text (WKT) or an alternative representation of this object.
      */
@@ -124,6 +126,10 @@ public abstract class FormattableObject
     /**
      * Returns a <cite>Well Known Text</cite> (WKT) for this object using the specified convention.
      * Unicode characters are kept <i>as-is</i> (they are not converted to ASCII).
+     * The returned string may contain non-standard elements or warnings
+     * if this object can not be formatted according the given convention.
+     *
+     * <p>For stricter conformance to ISO 19162 standard, use {@link #toWKT()} or {@link WKTFormat} instead.</p>
      *
      * @param  convention The WKT convention to use.
      * @return The Well Known Text (WKT) or a pseudo-WKT representation of this object.
@@ -157,6 +163,7 @@ public abstract class FormattableObject
     /**
      * Returns a WKT for this object using the specified convention.
      * If {@code strict} is true, then an exception is thrown if the WKT is not standard-compliant.
+     * If {@code strict} if false, then warnings are appended after the WKT instead.
      *
      * @param  convention  The convention for choosing WKT element names.
      * @param  colorize    {@code true} for applying syntax coloring, or {@code false} otherwise.
@@ -183,6 +190,7 @@ public abstract class FormattableObject
         if (!strict) {
             formatter.transliterator = Transliterator.IDENTITY;
         }
+        formatter.verifyCharacterValidity = strict;
         final String wkt;
         try {
             formatter.append(this);
@@ -197,6 +205,7 @@ public abstract class FormattableObject
                     throw new UnformattableObjectException(warnings.getMessage(n), warnings.getException(n));
                 }
             }
+            formatter.appendWarnings();
             wkt = formatter.toWKT();
         } finally {
             formatter.clear();

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -17,7 +17,9 @@
 package org.apache.sis.io.wkt;
 
 import java.util.Map;
+import java.util.Set;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -62,10 +64,13 @@ import org.apache.sis.util.Debug;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Numbers;
 import org.apache.sis.util.Localized;
+import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.internal.util.X364;
 import org.apache.sis.internal.util.Citations;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.PatchedUnitFormat;
@@ -98,7 +103,7 @@ import org.apache.sis.internal.jdk7.JDK7
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
@@ -183,10 +188,18 @@ public class Formatter implements Locali
      * {@link Transliterator#IDENTITY} for preserving non-ASCII characters. The default value is
      * {@link Transliterator#DEFAULT}, which causes replacements like "é" → "e" in all elements
      * except {@code REMARKS["…"]}. May also be a user-supplied transliterator.
+     *
+     * @see #getTransliterator()
      */
     Transliterator transliterator;
 
     /**
+     * {@code true} if this {@code Formatter} should verify the validity of characters in quoted texts.
+     * ISO 19162 restricts quoted texts to ASCII characters with addition of degree symbol (°).
+     */
+    boolean verifyCharacterValidity = true;
+
+    /**
      * The enclosing WKT element being formatted.
      *
      * @see #getEnclosingElement(int)
@@ -472,9 +485,14 @@ public class Formatter implements Locali
             if (colorApplied == 0) {
                 final String color = colors.getAnsiSequence(type);
                 if (color == null) {
-                    return; // Do not increment 'colorApplied' for giving a chance to children to apply their colors.
+                    // Do not increment 'colorApplied' for giving a chance to children to apply their colors.
+                    return;
                 }
+                final boolean isStart = (buffer.length() == elementStart);
                 buffer.append(color);
+                if (isStart) {
+                    elementStart = buffer.length();
+                }
             }
             colorApplied++;
         }
@@ -1019,25 +1037,27 @@ public class Formatter implements Locali
         final int base = buffer.appendCodePoint(symbols.getOpeningQuote(0)).length();
         if (type != ElementKind.REMARKS) {
             text = transliterator.filter(text);
-            int startAt = 0; // Index of the last space character.
-            final int length = text.length();
-            for (int i = 0; i < length;) {
-                int c = text.codePointAt(i);
-                int n = Character.charCount(c);
-                if (!Characters.isValidWKT(c)) {
-                    final String illegal = text.substring(i, i+n);
-                    while ((i += n) < length) {
-                        c = text.codePointAt(i);
-                        n = Character.charCount(c);
-                        if (c == ' ' || c == '_') break;
+            if (verifyCharacterValidity) {
+                int startAt = 0;                                        // Index of the last space character.
+                final int length = text.length();
+                for (int i = 0; i < length;) {
+                    int c = text.codePointAt(i);
+                    int n = Character.charCount(c);
+                    if (!Characters.isValidWKT(c)) {
+                        final String illegal = text.substring(i, i+n);
+                        while ((i += n) < length) {
+                            c = text.codePointAt(i);
+                            n = Character.charCount(c);
+                            if (c == ' ' || c == '_') break;
+                        }
+                        warnings().add(Errors.formatInternational(Errors.Keys.IllegalCharacterForFormat_3,
+                                "Well-Known Text", text.substring(startAt, i), illegal), null, null);
+                        break;
+                    }
+                    i += n;
+                    if (c == ' ' || c == '_') {
+                        startAt = i;
                     }
-                    warnings().add(Errors.formatInternational(Errors.Keys.IllegalCharacterForFormat_3,
-                            "Well-Known Text", text.substring(startAt, i), illegal), null, null);
-                    break;
-                }
-                i += n;
-                if (c == ' ' || c == '_') {
-                    startAt = i;
                 }
             }
         }
@@ -1074,14 +1094,24 @@ public class Formatter implements Locali
      * Appends an enumeration or code list value.
      * The {@linkplain Symbols#getSeparator() element separator} will be written before the code list if needed.
      *
+     * <p>For the WKT 2 format, this method uses the {@linkplain Types#getCodeName ISO name if available}
+     * (for example {@code "northEast"}).
+     * For the WKT 1 format, this method uses the programmatic name instead (for example {@code "NORTH_EAST"}).</p>
+     *
      * @param code The code list to append to the WKT, or {@code null} if none.
      */
     public void append(final CodeList<?> code) {
         if (code != null) {
             appendSeparator();
-            setColor(ElementKind.CODE_LIST);
-            buffer.append(convention.majorVersion() == 1 ? code.name() : Types.getCodeName(code));
-            resetColor();
+            final String name = convention.majorVersion() == 1 ? code.name() : Types.getCodeName(code);
+            if (CharSequences.isUnicodeIdentifier(name)) {
+                setColor(ElementKind.CODE_LIST);
+                buffer.append(name);
+                resetColor();
+            } else {
+                quote(name, ElementKind.CODE_LIST);
+                setInvalidWKT(code.getClass(), null);
+            }
         }
     }
 
@@ -1599,6 +1629,38 @@ public class Formatter implements Locali
     }
 
     /**
+     * Appends the warnings after the WKT string. If there is no warnings, then this method does nothing.
+     * If this method is invoked, then it shall be the last method before {@link #toWKT()}.
+     */
+    final void appendWarnings() {
+        final Warnings warnings = this.warnings;                    // Protect against accidental changes.
+        if (warnings != null) {
+            final StringBuffer buffer = this.buffer;
+            final String ln = JDK7.lineSeparator();
+            buffer.append(ln).append(ln);
+            if (colors != null) {
+                buffer.append(X364.BACKGROUND_RED.sequence()).append(X364.BOLD.sequence()).append(' ');
+            }
+            buffer.append(Vocabulary.getResources(locale).getLabel(Vocabulary.Keys.Warnings));
+            if (colors != null) {
+                buffer.append(' ').append(X364.RESET.sequence()).append(X364.FOREGROUND_RED.sequence());
+            }
+            buffer.append(ln);
+            final int n = warnings.getNumMessages();
+            final Set<String> done = new HashSet<String>();
+            for (int i=0; i<n; i++) {
+                String message = Exceptions.getLocalizedMessage(warnings.getException(i), locale);
+                if (message == null) {
+                    message = warnings.getMessage(i);
+                }
+                if (done.add(message)) {
+                    buffer.append("  • ").append(message).append(ln);
+                }
+            }
+        }
+    }
+
+    /**
      * Returns the WKT formatted by this object.
      *
      * @return The WKT formatted by this formatter.

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -819,14 +819,14 @@ final class GeodeticObjectParser extends
                     direction = AxisDirection.UP;
                     if (datum instanceof VerticalDatum) {
                         final VerticalDatumType vt = ((VerticalDatum) datum).getVerticalDatumType();
-                        if (VerticalDatumType.GEOIDAL.equals(vt)) {
+                        if (vt == VerticalDatumType.GEOIDAL) {
                             nz = AxisNames.GRAVITY_RELATED_HEIGHT;
                             z  = "H";
-                        } else if (VerticalDatumType.DEPTH.equals(vt)) {
+                        } else if (vt == VerticalDatumType.DEPTH) {
                             direction = AxisDirection.DOWN;
                             nz = AxisNames.DEPTH;
                             z  = "D";
-                        } else if (VerticalDatumTypes.ELLIPSOIDAL.equals(vt)) {
+                        } else if (vt == VerticalDatumTypes.ELLIPSOIDAL) {
                             // Not allowed by ISO 19111 as a standalone axis, but SIS is
                             // tolerant to this case since it is sometime hard to avoid.
                             nz = AxisNames.ELLIPSOIDAL_HEIGHT;
@@ -2020,12 +2020,15 @@ final class GeodeticObjectParser extends
      *     COMPD_CS["<name>", <head cs>, <tail cs> {,<authority>}]
      * }
      *
+     * In the particular case where there is a geographic CRS and an ellipsoidal height,
+     * this method rather build a three-dimensional geographic CRS.
+     *
      * @param  mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
      * @param  parent The parent element.
      * @return The {@code "CompoundCRS"} element as a {@link CompoundCRS} object.
      * @throws ParseException if the {@code "CompoundCRS"} element can not be parsed.
      */
-    private CompoundCRS parseCompoundCRS(final int mode, final Element parent) throws ParseException {
+    private CoordinateReferenceSystem parseCompoundCRS(final int mode, final Element parent) throws ParseException {
         final Element element = parent.pullElement(mode, WKTKeywords.CompoundCRS, WKTKeywords.Compd_CS);
         if (element == null) {
             return null;
@@ -2037,7 +2040,7 @@ final class GeodeticObjectParser extends
             components.add(crs);
         }
         try {
-            return crsFactory.createCompoundCRS(parseMetadataAndClose(element, name, null),
+            return referencing.createCompoundCRS(crsFactory, csFactory, parseMetadataAndClose(element, name, null),
                     components.toArray(new CoordinateReferenceSystem[components.size()]));
         } catch (FactoryException exception) {
             throw element.parseFailed(exception);

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/VerticalDatumTypesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/VerticalDatumTypesTest.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/VerticalDatumTypesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/VerticalDatumTypesTest.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -30,7 +30,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final strictfp class VerticalDatumTypesTest extends TestCase {
@@ -49,9 +49,9 @@ public final strictfp class VerticalDatu
      */
     @Test
     public void testToLegacy() {
-        assertEquals(2002, VerticalDatumTypes.toLegacy(VerticalDatumTypes.ELLIPSOIDAL.ordinal()));
-        assertEquals(2005, VerticalDatumTypes.toLegacy(VerticalDatumType .GEOIDAL    .ordinal()));
-        assertEquals(2006, VerticalDatumTypes.toLegacy(VerticalDatumType .DEPTH      .ordinal()));
+        assertEquals(2002, VerticalDatumTypes.toLegacy(VerticalDatumTypes.ELLIPSOIDAL));
+        assertEquals(2005, VerticalDatumTypes.toLegacy(VerticalDatumType .GEOIDAL));
+        assertEquals(2006, VerticalDatumTypes.toLegacy(VerticalDatumType .DEPTH));
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -40,7 +40,7 @@ public final strictfp class ColorsTest e
         final Colors colors = Colors.DEFAULT;
         assertEquals("cyan",  colors.getName(ElementKind.CODE_LIST));
         assertEquals("green", colors.getName(ElementKind.METHOD));
-        assertEquals("blue",  colors.getName(ElementKind.DATUM));
+        assertEquals("red",   colors.getName(ElementKind.IDENTIFIER));
         assertEquals("red",   colors.getName(ElementKind.ERROR));
     }
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -98,7 +98,7 @@ public final class Legacy implements Axi
 
     /**
      * Returns the coordinate system of a geocentric CRS using axes in the given unit of measurement.
-     * This method presume that the given {@code cs} uses {@link SI#METRE} (this is not verified).
+     * This method presumes that the given {@code cs} uses {@link SI#METRE} (this is not verified).
      *
      * @param  cs The coordinate system for which to perform the unit replacement.
      * @param  unit The unit of measurement for the geocentric CRS axes.
@@ -113,17 +113,25 @@ public final class Legacy implements Axi
         return cs;
     }
 
+
+
+
+    // -----------------------------------------------------------------
+    //         AxisFilter implementation for internal usage only
+    // -----------------------------------------------------------------
+
     /**
-     * For internal usage by {@link #replaceUnit(CartesianCS, Unit)} only.
+     * The value to be returned by {@link #getUnitReplacement(Unit)},
+     * or {@code null} if no replacement should be done.
      */
-    private Legacy(final Unit<?> unit) {
-        this.unit = unit;
-    }
+    private final Unit<?> replacement;
 
     /**
-     * The value to be returned by {@link #getUnitReplacement(Unit)}.
+     * For internal usage by {@link #replaceUnit(CartesianCS, Unit)} only.
      */
-    private final Unit<?> unit;
+    private Legacy(final Unit<?> unit) {
+        replacement = unit;
+    }
 
     /**
      * For internal usage by {@link #replaceUnit(CartesianCS, Unit)} only.
@@ -133,7 +141,7 @@ public final class Legacy implements Axi
      */
     @Override
     public Unit<?> getUnitReplacement(final Unit<?> unit) {
-        return this.unit;
+        return replacement;
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -16,21 +16,24 @@
  */
 package org.apache.sis.internal.referencing;
 
+import java.util.Map;
+import java.util.HashMap;
 import java.util.Collection;
 import javax.measure.unit.Unit;
 import javax.measure.quantity.Angle;
 import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
+import org.opengis.metadata.Identifier;
 import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.*;
+import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
@@ -47,7 +50,7 @@ import static java.util.Collections.sing
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.5
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class ReferencingUtilities extends Static {
@@ -239,6 +242,48 @@ public final class ReferencingUtilities
     }
 
     /**
+     * Returns the properties of the given object but potentially with a modified name.
+     * Current implement truncates the name at the first non-white character which is not
+     * a valid Unicode identifier part.
+     *
+     * <div class="note"><b>Example:</b><ul>
+     *   <li><cite>"WGS 84 (3D)"</cite> is truncated as <cite>"WGS 84"</cite>.</li>
+     *   <li><cite>"Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: degree"</cite>
+     *       is truncated as <cite>"Ellipsoidal 2D CS"</cite>.</li>
+     * </ul></div>
+     *
+     * @param  object The identified object to view as a properties map.
+     * @param  excludes The keys of properties to exclude from the map.
+     * @return A view of the identified object properties.
+     *
+     * @see IdentifiedObjects#getProperties(IdentifiedObject, String...)
+     *
+     * @since 0.7
+     */
+    public static Map<String,?> getPropertiesForModifiedCRS(final IdentifiedObject object, final String... excludes) {
+        final Map<String,?> properties = IdentifiedObjects.getProperties(object, excludes);
+        final Identifier id = (Identifier) properties.get(IdentifiedObject.NAME_KEY);
+        if (id != null) {
+            String name = id.getCode();
+            if (name != null) {
+                for (int i=0; i < name.length();) {
+                    final int c = name.codePointAt(i);
+                    if (!Character.isUnicodeIdentifierPart(c) && !Character.isSpaceChar(c)) {
+                        name = CharSequences.trimWhitespaces(name, 0, i).toString();
+                        if (!name.isEmpty()) {
+                            final Map<String,Object> copy = new HashMap<String,Object>(properties);
+                            copy.put(IdentifiedObject.NAME_KEY, name);
+                            return copy;
+                        }
+                    }
+                    i += Character.charCount(c);
+                }
+            }
+        }
+        return properties;
+    }
+
+    /**
      * Returns the XML property name of the given interface.
      *
      * For {@link CoordinateSystem} base type, the returned value shall be one of
@@ -249,6 +294,8 @@ public final class ReferencingUtilities
      * @param  type The interface or classes for which to get the XML property name.
      * @return The XML property name for the given class or interface, or {@code null} if none.
      *
+     * @see WKTUtilities#toType(Class, Class)
+     *
      * @since 0.6
      */
     public static StringBuilder toPropertyName(final Class<?> base, final Class<?> type) {
@@ -272,64 +319,4 @@ public final class ReferencingUtilities
         }
         return null;
     }
-
-    /**
-     * Returns the WKT type of the given interface.
-     *
-     * For {@link CoordinateSystem} base type, the returned value shall be one of
-     * {@code affine}, {@code Cartesian}, {@code cylindrical}, {@code ellipsoidal}, {@code linear},
-     * {@code parametric}, {@code polar}, {@code spherical}, {@code temporal} or {@code vertical}.
-     *
-     * @param  base The abstract base interface.
-     * @param  type The interface or classes for which to get the WKT type.
-     * @return The WKT type for the given class or interface, or {@code null} if none.
-     */
-    public static String toWKTType(final Class<?> base, final Class<?> type) {
-        if (type != base) {
-            final StringBuilder name = toPropertyName(base, type);
-            if (name != null) {
-                int end = name.length() - 2;
-                if (CharSequences.regionMatches(name, end, "CS")) {
-                    name.setLength(end);
-                    if ("time".contentEquals(name)) {
-                        return "temporal";
-                    }
-                    if (CharSequences.regionMatches(name, 0, "cartesian")) {
-                        name.setCharAt(0, 'C');     // "Cartesian"
-                    }
-                    return name.toString();
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Invoked by private setter methods (themselves invoked by JAXB at unmarshalling time)
-     * when an element is already set. Invoking this method from those setter methods serves
-     * three purposes:
-     *
-     * <ul>
-     *   <li>Make sure that a singleton property is not defined twice in the XML document.</li>
-     *   <li>Protect ourselves against changes in immutable objects outside unmarshalling. It should
-     *       not be necessary since the setter methods shall not be public, but we are paranoiac.</li>
-     *   <li>Be a central point where we can trace all setter methods, in case we want to improve
-     *       warning or error messages in future SIS versions.</li>
-     * </ul>
-     *
-     * @param  classe The caller class, used only in case of warning message to log.
-     * @param  method The caller method, used only in case of warning message to log.
-     * @param  name   The property name, used only in case of error message to format.
-     * @throws IllegalStateException If {@code isDefined} is {@code true} and we are not unmarshalling an object.
-     */
-    public static void propertyAlreadySet(final Class<?> classe, final String method, final String name)
-            throws IllegalStateException
-    {
-        final Context context = Context.current();
-        if (context != null) {
-            Context.warningOccured(context, classe, method, Errors.class, Errors.Keys.ElementAlreadyPresent_1, name);
-        } else {
-            throw new IllegalStateException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, name));
-        }
-    }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -40,6 +40,7 @@ import org.apache.sis.io.wkt.ElementKind
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Vocabulary;
 
 
@@ -53,7 +54,7 @@ import org.apache.sis.util.resources.Voc
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class WKTUtilities extends Static {
@@ -220,4 +221,37 @@ public final class WKTUtilities extends
             formatter.newLine();
         }
     }
+
+    /**
+     * Returns the WKT type of the given interface.
+     *
+     * For {@link CoordinateSystem} base type, the returned value shall be one of
+     * {@code affine}, {@code Cartesian}, {@code cylindrical}, {@code ellipsoidal}, {@code linear},
+     * {@code parametric}, {@code polar}, {@code spherical}, {@code temporal} or {@code vertical}.
+     *
+     * @param  base The abstract base interface.
+     * @param  type The interface or classes for which to get the WKT type.
+     * @return The WKT type for the given class or interface, or {@code null} if none.
+     *
+     * @see ReferencingUtilities#toPropertyName(Class, Class)
+     */
+    public static String toType(final Class<?> base, final Class<?> type) {
+        if (type != base) {
+            final StringBuilder name = ReferencingUtilities.toPropertyName(base, type);
+            if (name != null) {
+                int end = name.length() - 2;
+                if (CharSequences.regionMatches(name, end, "CS")) {
+                    name.setLength(end);
+                    if ("time".contentEquals(name)) {
+                        return "temporal";
+                    }
+                    if (CharSequences.regionMatches(name, 0, "cartesian")) {
+                        name.setCharAt(0, 'C');     // "Cartesian"
+                    }
+                    return name.toString();
+                }
+            }
+        }
+        return null;
+    }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -30,7 +30,7 @@ import org.opengis.parameter.GeneralPara
 import org.opengis.parameter.ParameterNotFoundException;
 import org.opengis.parameter.InvalidParameterNameException;
 import org.apache.sis.internal.jaxb.referencing.CC_OperationParameterGroup;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.resources.Errors;
@@ -453,7 +453,7 @@ public class DefaultParameterDescriptorG
             verifyNames(null, parameters);
             descriptors = asList(parameters);
         } else {
-            ReferencingUtilities.propertyAlreadySet(DefaultParameterValue.class, "setDescriptors", "parameter");
+            MetadataUtilities.propertyAlreadySet(DefaultParameterValue.class, "setDescriptors", "parameter");
         }
     }
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -40,7 +40,7 @@ import org.apache.sis.io.wkt.ElementKind
 import org.apache.sis.internal.jaxb.gml.Measure;
 import org.apache.sis.internal.jaxb.gml.MeasureList;
 import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.util.Numerics;
@@ -1152,7 +1152,7 @@ public class DefaultParameterValue<T> ex
                 value = (T) xmlValue;
             }
         } else {
-            ReferencingUtilities.propertyAlreadySet(DefaultParameterValue.class, "setXmlValue", "value");
+            MetadataUtilities.propertyAlreadySet(DefaultParameterValue.class, "setXmlValue", "value");
         }
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] Wed Mar  2 22:31:02 2016
@@ -34,7 +34,7 @@ import org.opengis.parameter.GeneralPara
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
 import org.opengis.parameter.InvalidParameterCardinalityException;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;
@@ -534,7 +534,7 @@ scan:   for (final GeneralParameterValue
         if (values == null) {
             values = new ParameterValueList(descriptor);
         } else {
-            ReferencingUtilities.propertyAlreadySet(DefaultParameterValue.class, "setDescriptor", "group");
+            MetadataUtilities.propertyAlreadySet(DefaultParameterValue.class, "setDescriptor", "group");
         }
     }