sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1785905 [1/5] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadat...
Date Tue, 07 Mar 2017 23:37:50 GMT
Author: desruisseaux
Date: Tue Mar  7 23:37:49 2017
New Revision: 1785905

URL: http://svn.apache.org/viewvc?rev=1785905&view=rev
Log:
Merge from the JDK7 branch. Contains a first draft of gazetteer package, but this first draft expose a non-public class (AbstractLocationType) in public API.
This happen because the GeoAPI 3.0 branch can not use the org.opengis.referencing.gazetteer.LotationType interface. Better solution yet to be determined.

Added:
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java
      - copied unchanged from r1785895, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java
      - copied unchanged from r1785895, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataCopierTest.java
      - copied unchanged from r1785895, sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataCopierTest.java
    sis/trunk/core/sis-referencing-by-identifiers/
      - copied from r1785895, sis/branches/JDK7/core/sis-referencing-by-identifiers/
Removed:
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
    sis/trunk/core/pom.xml
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.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/ServicesForUtility.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.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/metadata/CacheKey.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
    sis/trunk/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/LocationFormat.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/SimpleLocation.java
    sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/LocationTypeTest.java
    sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.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/ParameterFormat.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/CommonCRS.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/StandardDefinitions.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/cs/DefaultCoordinateSystemAxis.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/factory/CommonAuthorityFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/TransformTestCase.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/internal/referencing/provider/TransverseMercatorTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/EPSGFactoryFallbackTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.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/referencing/operation/CoordinateOperationFinderTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/OptionalDependency.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Cloner.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/ConcatenatedConverter.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/ConventionalUnit.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/LinearConverter.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/SystemUnit.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.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/main/java/org/apache/sis/xml/XML.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
    sis/trunk/ide-project/NetBeans/build.xml
    sis/trunk/ide-project/NetBeans/nbproject/build-impl.xml
    sis/trunk/ide-project/NetBeans/nbproject/genfiles.properties
    sis/trunk/ide-project/NetBeans/nbproject/project.properties
    sis/trunk/ide-project/NetBeans/nbproject/project.xml
    sis/trunk/src/main/javadoc/stylesheet.css
    sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
    sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
    sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
    sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  7 23:37:49 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394364-1758914
-/sis/branches/JDK7:1394913-1782435
-/sis/branches/JDK8:1584960-1782434
+/sis/branches/JDK7:1394913-1785895
+/sis/branches/JDK8:1584960-1785861
 /sis/branches/JDK9:1773327-1773512

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -161,7 +161,7 @@ final class AboutCommand extends Command
                 out.print(X364.BOLD.sequence());
                 out.print(' ');
             }
-            out.print(Vocabulary.getResources(locale).getLabel(Vocabulary.Keys.Warnings));
+            Vocabulary.getResources(locale).appendLabel(Vocabulary.Keys.Warnings, out);
             if (colors) {
                 out.print(' ');
                 out.println(X364.RESET.sequence());

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.console;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Set;
@@ -208,7 +209,7 @@ final class IdentifierCommand extends Fo
     /**
      * Prints all non-null rows.
      */
-    private void print(final Iterable<Row> rows) {
+    private void print(final Iterable<Row> rows) throws IOException {
         int width = 0;
         for (final Row row : rows) {
             if (row != null) {
@@ -236,7 +237,8 @@ final class IdentifierCommand extends Fo
         states.remove(State.VALID);
         if (!states.isEmpty()) {
             out.println();
-            out.println(Vocabulary.getResources(locale).getLabel(Vocabulary.Keys.Legend));
+            Vocabulary.getResources(locale).appendLabel(Vocabulary.Keys.Legend, out);
+            out.println();
             final ResourceBundle resources = ResourceBundle.getBundle("org.apache.sis.console.IdentifierState", locale);
             for (final State state : states) {
                 final boolean warning = colors && state.text.startsWith("!");

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -281,9 +281,9 @@ final class TransformCommand extends For
      *
      * @param  key  a {@code Vocabulary.Keys} constant for the header to print.
      */
-    private void printHeader(final short key) {
+    private void printHeader(final short key) throws IOException {
         printCommentLinePrefix();
-        outHeader.append(resources.getLabel(key));
+        resources.appendLabel(key, outHeader);
         outHeader.nextColumn();
     }
 
@@ -354,7 +354,7 @@ final class TransformCommand extends For
     /**
      * Prints the accuracy.
      */
-    private void printAccuracy(double accuracy) {
+    private void printAccuracy(double accuracy) throws IOException {
         if (accuracy >= 0) {
             if (accuracy == 0) {
                 accuracy = Formulas.LINEAR_TOLERANCE;
@@ -384,7 +384,7 @@ final class TransformCommand extends For
      *
      * <blockquote>Canada - onshore and offshore</blockquote>
      */
-    private void printDomainOfValidity(final Extent domain) {
+    private void printDomainOfValidity(final Extent domain) throws IOException {
         if (domain != null) {
             final InternationalString description = domain.getDescription();
             if (description != null) {
@@ -410,7 +410,7 @@ final class TransformCommand extends For
      * Prints the coordinate operation or math transform in Well Known Text format.
      * This information is printed only if the {@code --verbose} option was specified.
      */
-    private void printDetails() {
+    private void printDetails() throws IOException {
         final boolean debug = options.containsKey(Option.DEBUG);
         final WKTFormat f = new WKTFormat(locale, timezone);
         if (colors) f.setColors(Colors.DEFAULT);

Modified: sis/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/pom.xml?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/pom.xml (original)
+++ sis/trunk/core/pom.xml Tue Mar  7 23:37:49 2017
@@ -190,6 +190,7 @@
     <module>sis-utility</module>
     <module>sis-metadata</module>
     <module>sis-referencing</module>
+    <module>sis-referencing-by-identifiers</module>
     <module>sis-feature</module>
   </modules>
 

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -64,8 +64,11 @@ import org.apache.sis.util.Characters;
  *   └────────────┴─────────┴─────────────┴───────────┘
  * }</div>
  *
+ * Like most {@link java.text.Format} implementations, this class is not thread-safe.
+ * Each thread should use its own {@code FeatureFormat} instance or apply synchronization.
+ *
  * <div class="warning"><b>Limitation:</b>
- * Current implementation supports only formatting, not parsing.
+ * the current implementation can only format features — parsing is not yet implemented.
  * </div>
  *
  * @author  Martin Desruisseaux (Geomatys)

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=1785905&r1=1785904&r2=1785905&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] Tue Mar  7 23:37:49 2017
@@ -19,9 +19,12 @@ package org.apache.sis.internal.metadata
 import java.util.Map;
 import java.util.Collections;
 import java.util.Locale;
+import java.util.TimeZone;
+import java.text.Format;
 import javax.measure.Unit;
 import javax.measure.quantity.Length;
 import org.opengis.geometry.Envelope;
+import org.opengis.geometry.DirectPosition;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.CRSFactory;
@@ -75,7 +78,7 @@ import org.opengis.util.NoSuchIdentifier
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public class ReferencingServices extends OptionalDependency {
@@ -280,6 +283,20 @@ public class ReferencingServices extends
         throw moduleNotFound();
     }
 
+    /**
+     * Creates a two-dimensional geographic position associated to the default geographic CRS.
+     * Axis order is (longitude, latitude).
+     *
+     * @param  λ  the longitude value.
+     * @param  φ  the latitude value.
+     * @return the direct position for the given geographic coordinate.
+     *
+     * @since 0.8
+     */
+    public DirectPosition geographic(final double λ, final double φ) {
+        throw moduleNotFound();
+    }
+
 
 
 
@@ -562,6 +579,19 @@ public class ReferencingServices extends
     }
 
     /**
+     * Creates a format for {@link DirectPosition} instances.
+     *
+     * @param  locale    the locale for the new {@code Format}, or {@code null} for {@code Locale.ROOT}.
+     * @param  timezone  the timezone, or {@code null} for UTC.
+     * @return a {@link org.apache.sis.geometry.CoordinateFormat}.
+     *
+     * @since 0.8
+     */
+    public Format createCoordinateFormat(final Locale locale, final TimeZone timezone) {
+        throw moduleNotFound();
+    }
+
+    /**
      * Returns an axis direction from a pole along a meridian.
      * The given meridian is usually, but not necessarily, relative to the Greenwich meridian.
      *

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -16,9 +16,11 @@
  */
 package org.apache.sis.internal.metadata;
 
+import java.text.Format;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Locale;
+import java.util.TimeZone;
 import javax.sql.DataSource;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Role;
@@ -48,7 +50,7 @@ import static java.util.Collections.sing
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class ServicesForUtility extends MetadataServices {
@@ -259,4 +261,18 @@ public final class ServicesForUtility ex
         }
         return ReferencingServices.getInstance().getInformation(key, locale);
     }
+
+    /**
+     * Creates a format for {@link org.opengis.geometry.DirectPosition} instances.
+     *
+     * @param  locale    the locale for the new {@code Format}, or {@code null} for {@code Locale.ROOT}.
+     * @param  timezone  the timezone, or {@code null} for UTC.
+     * @return a {@link org.apache.sis.geometry.CoordinateFormat}.
+     *
+     * @since 0.8
+     */
+    @Override
+    public Format createCoordinateFormat(final Locale locale, final TimeZone timezone) {
+        return ReferencingServices.getInstance().createCoordinateFormat(locale, timezone);
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -243,6 +243,7 @@ public class ScriptRunner implements Aut
     /**
      * The regular expression to use for building {@link #statementsToSkip}.
      * At most one of {@code regexOfStmtToSkip} and {@code statementsToSkip} shall be non-null.
+     * Both fields may be null if there is no statement to skip.
      */
     private StringBuilder regexOfStmtToSkip;
 
@@ -659,13 +660,15 @@ parseLine:  while (pos < length) {
      * @return whether the given SQL statement is supported by the database engine.
      */
     protected boolean isSupported(final CharSequence sql) {
-        if (regexOfStmtToSkip == null) {
+        if (statementsToSkip != null) {
             return !statementsToSkip.reset(sql).matches();
-        } else {
+        } else if (regexOfStmtToSkip != null) {
             // We do not use Pattern.CASE_INSENTITIVE for performance reasons.
             statementsToSkip = Pattern.compile(regexOfStmtToSkip.toString(), Pattern.DOTALL).matcher(sql);
             regexOfStmtToSkip = null;
             return !statementsToSkip.matches();
+        } else {
+            return true;
         }
     }
 

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=1785905&r1=1785904&r2=1785905&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] Tue Mar  7 23:37:49 2017
@@ -17,6 +17,7 @@
 package org.apache.sis.io.wkt;
 
 import java.io.Console;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.xml.bind.annotation.XmlTransient;
@@ -208,6 +209,8 @@ public abstract class FormattableObject
             }
             formatter.appendWarnings();
             wkt = formatter.toWKT();
+        } catch (IOException e) {
+            throw new UnformattableObjectException(e);      // Should never happen since we write to a StringBuffer.
         } 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=1785905&r1=1785904&r2=1785905&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] Tue Mar  7 23:37:49 2017
@@ -29,6 +29,7 @@ import java.util.Date;
 import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.text.FieldPosition;
+import java.io.IOException;
 import java.lang.reflect.Array;
 import java.math.RoundingMode;
 import javax.measure.Unit;
@@ -1617,7 +1618,7 @@ 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 void appendWarnings() throws IOException {
         final Warnings warnings = this.warnings;                    // Protect against accidental changes.
         if (warnings != null) {
             final StringBuffer buffer = this.buffer;
@@ -1626,7 +1627,7 @@ public class Formatter implements Locali
             if (colors != null) {
                 buffer.append(X364.BACKGROUND_RED.sequence()).append(X364.BOLD.sequence()).append(' ');
             }
-            buffer.append(Vocabulary.getResources(locale).getLabel(Vocabulary.Keys.Warnings));
+            Vocabulary.getResources(locale).appendLabel(Vocabulary.Keys.Warnings, buffer);
             if (colors != null) {
                 buffer.append(' ').append(X364.RESET.sequence()).append(X364.FOREGROUND_RED.sequence());
             }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.metadata;
 
+import org.apache.sis.util.Classes;
 import org.apache.sis.util.Debug;
 import org.apache.sis.util.resources.Errors;
 
@@ -96,9 +97,9 @@ final class CacheKey {
     @Debug
     @Override
     public String toString() {
-        String name = (type != null) ? type.getCanonicalName() : "null";
+        String name = Classes.getShortName(type);
         if (propertyType != Object.class) {
-            name = name + " as " + propertyType.getSimpleName();
+            name = name + " as " + Classes.getShortName(propertyType);
         }
         return name;
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -367,11 +367,12 @@ public class MetadataStandard implements
                 if (v instanceof PropertyAccessor) {
                     return v;
                 }
+                final Class<?> standardImpl = getImplementation(type);
                 final PropertyAccessor accessor;
                 if (SpecialCases.isSpecialCase(type)) {
-                    accessor = new SpecialCases(citation, type, key.type);
+                    accessor = new SpecialCases(citation, type, k.type, standardImpl);
                 } else {
-                    accessor = new PropertyAccessor(citation, type, key.type);
+                    accessor = new PropertyAccessor(citation, type, k.type, standardImpl);
                 }
                 return accessor;
             }
@@ -596,7 +597,7 @@ public class MetadataStandard implements
 
     /**
      * Returns the implementation class for the given interface, or {@code null} if none.
-     * The default implementation returns {@code null} if every cases. Subclasses shall
+     * The default implementation returns {@code null} in every cases. Subclasses shall
      * override this method in order to map GeoAPI interfaces to their implementation.
      *
      * @param  <T>   the compile-time {@code type}.

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -83,7 +83,7 @@ import static org.apache.sis.util.collec
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.8
  * @module
  */
 @XmlTransient
@@ -165,10 +165,17 @@ public abstract class ModifiableMetadata
      * </ul>
      *
      * @return an unmodifiable copy of this metadata.
+     *
+     * @see MetadataCopier
      */
     public AbstractMetadata unmodifiable() {
-        // Reminder: 'unmodifiable' is reset to null by checkWritePermission().
-        if (unmodifiable == null) {
+        /*
+         * The 'unmodifiable' field is reset to null by checkWritePermission().
+         * However this is not sufficient since the setter method of some child
+         * could have been invoked without invoking any setter method on 'this'.
+         * So we also need to perform an equality check.
+         */
+        if (unmodifiable == null || (unmodifiable != this && unmodifiable != FREEZING && !equals(unmodifiable))) {
             final ModifiableMetadata candidate;
             try {
                 /*
@@ -232,9 +239,8 @@ public abstract class ModifiableMetadata
     }
 
     /**
-     * Checks if changes in the metadata are allowed. All {@code setFoo(...)} methods in
-     * subclasses should invoke this method (directly or indirectly) before to apply any
-     * change.
+     * Checks if changes in the metadata are allowed. All {@code setFoo(…)} methods in subclasses
+     * shall invoke this method (directly or indirectly) before to apply any change.
      *
      * @throws UnmodifiableMetadataException if this metadata is unmodifiable.
      *
@@ -388,7 +394,7 @@ public abstract class ModifiableMetadata
             if (unmodifiable == FREEZING) {
                 /*
                  * freeze() method is under progress. The source collection is already
-                 * an unmodifiable instance created by Cloner.clone(Object).
+                 * an unmodifiable instance created by Freezer.clone(Object).
                  */
                 assert collectionType(elementType).isInstance(source);
                 return (Collection<E>) source;
@@ -671,6 +677,7 @@ public abstract class ModifiableMetadata
      * Creates a <strong>shallow</strong> copy of this metadata.
      * The clone operation is required for the internal working of the {@link #unmodifiable()} method,
      * which needs <em>shallow</em> copies of metadata entities.
+     * For deep copies, see {@link MetadataCopier}.
      *
      * <div class="section">API note</div>
      * While {@link Cloneable}, the {@code ModifiableMetadata} subclasses should not provide
@@ -684,6 +691,9 @@ public abstract class ModifiableMetadata
      *
      * @return a <em>shallow</em> copy of this metadata.
      * @throws CloneNotSupportedException if the clone is not supported.
+     *
+     * @see #unmodifiable()
+     * @see MetadataCopier
      */
     @Override
     protected ModifiableMetadata clone() throws CloneNotSupportedException {

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -81,7 +81,7 @@ import static org.apache.sis.util.collec
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.8
  * @module
  */
 class PropertyAccessor {
@@ -238,13 +238,15 @@ class PropertyAccessor {
      * @param  standard        the standard which define the {@code type} interface.
      * @param  type            the interface implemented by the metadata class.
      * @param  implementation  the class of metadata implementations, or {@code type} if none.
+     * @param  standardImpl    the implementation specified by the {@link MetadataStandard}, or {@code null} if none.
+     *                         This is the same than {@code implementation} unless a custom implementation is used.
      */
-    PropertyAccessor(final Citation standard, final Class<?> type, final Class<?> implementation) {
+    PropertyAccessor(final Citation standard, final Class<?> type, final Class<?> implementation, final Class<?> standardImpl) {
         assert type.isAssignableFrom(implementation) : implementation;
         this.standard       = standard;
         this.type           = type;
         this.implementation = implementation;
-        this.getters        = getGetters(type, implementation);
+        this.getters        = getGetters(type, implementation, standardImpl);
         int allCount = getters.length;
         int standardCount = allCount;
         if (allCount != 0 && getters[allCount-1] == EXTRA_GETTER) {
@@ -400,9 +402,10 @@ class PropertyAccessor {
      *
      * @param  type            the metadata interface.
      * @param  implementation  the class of metadata implementations, or {@code type} if none.
+     * @param  standardImpl    the implementation specified by the {@link MetadataStandard}, or {@code null} if none.
      * @return the getters declared in the given interface (never {@code null}).
      */
-    private static Method[] getGetters(final Class<?> type, final Class<?> implementation) {
+    private static Method[] getGetters(final Class<?> type, final Class<?> implementation, final Class<?> standardImpl) {
         /*
          * Indices map is used for choosing what to do in case of name collision.
          */
@@ -466,7 +469,7 @@ class PropertyAccessor {
          * keep the extra methods last. The code checking for the extra methods require
          * them to be last.
          */
-        Arrays.sort(getters, 0, count, new PropertyComparator(implementation));
+        Arrays.sort(getters, 0, count, new PropertyComparator(implementation, standardImpl));
         if (!hasExtraGetter) {
             if (getters.length == count) {
                 getters = Arrays.copyOf(getters, count+1);
@@ -1161,7 +1164,7 @@ class PropertyAccessor {
         assert implementation.isInstance(metadata) : metadata;
         if (setters != null) try {
             final Object[] arguments = new Object[1];
-            final Cloner cloner = new Cloner();
+            final Freezer freezer = new Freezer();
             for (int i=0; i<allCount; i++) {
                 final Method setter = setters[i];
                 if (setter != null) {
@@ -1180,7 +1183,7 @@ class PropertyAccessor {
                     }
                     final Method getter = getters[i];
                     final Object source = get(getter, metadata);
-                    final Object target = cloner.clone(source);
+                    final Object target = freezer.clone(source);
                     if (source != target) {
                         arguments[0] = target;
                         set(setter, metadata, arguments);
@@ -1201,6 +1204,42 @@ class PropertyAccessor {
     }
 
     /**
+     * Returns a potentially deep copy of the given metadata object.
+     *
+     * @param  metadata   the metadata object to copy.
+     * @param  copies     a map of metadata objects already copied.
+     * @return a copy of the given metadata object, or {@code metadata} itself if there is
+     *         no known implementation class or that implementation has no setter method.
+     * @throws Exception if an error occurred while creating the copy. This include any
+     *         checked checked exception that the no-argument constructor may throw.
+     */
+    final Object copy(final Object metadata, final MetadataCopier copier) throws Exception {
+        if (setters == null) {
+            return metadata;
+        }
+        Object copy = copier.copies.get(metadata);
+        if (copy == null) {
+            copy = implementation.newInstance();
+            copier.copies.put(metadata, copy);              // Need to be first in case of cyclic graphs.
+            final Object[] arguments = new Object[1];
+            for (int i=0; i<allCount; i++) {
+                final Method setter = setters[i];
+                if (setter != null && !setter.isAnnotationPresent(Deprecated.class)) {
+                    Object value = get(getters[i], metadata);
+                    if (value != null) {
+                        value = copier.copyAny(elementTypes[i], value);
+                        if (value != null) {
+                            arguments[0] = value;
+                            set(setter, copy, arguments);
+                        }
+                    }
+                }
+            }
+        }
+        return copy;
+    }
+
+    /**
      * Computes a hash code for the specified metadata. The hash code is defined as the sum
      * of hash code values of all non-empty properties, plus the hash code of the interface.
      * This is a similar contract than {@link java.util.Set#hashCode()} (except for the interface)

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -44,7 +44,7 @@ import org.opengis.annotation.Obligation
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.8
  * @module
  */
 final class PropertyComparator implements Comparator<Method> {
@@ -92,10 +92,32 @@ final class PropertyComparator implement
      * Creates a new comparator for the given implementation class.
      *
      * @param implementation  the implementation class, or the interface if the implementation class is unknown.
+     * @param standardImpl    the implementation specified by the {@link MetadataStandard}, or {@code null} if none.
+     *                        This is the same than {@code implementation} unless a custom implementation is used.
      */
-    PropertyComparator(Class<?> implementation) {
-        this.implementation = implementation;
+    PropertyComparator(Class<?> implementation, final Class<?> standardImpl) {
         order = new HashMap<>();
+        defineOrder(implementation, order);
+        if (order.isEmpty() && standardImpl != null && !standardImpl.isAssignableFrom(implementation)) {
+            /*
+             * We enter in this block only if the user specified its own metadata implementation and that
+             * custom implementation does not have any JAXB @XmlType annotation. In such case this method
+             * can not sort the properties. So we will use the class defined by org.apache.sis.metadata.iso
+             * instead.
+             */
+            implementation = standardImpl;
+            defineOrder(implementation, order);
+        }
+        this.implementation = implementation;
+    }
+
+    /**
+     * Uses the {@link XmlType} annotation for defining the property order.
+     *
+     * @param implementation  the implementation class where to search for {@code XmlType} annotation.
+     * @param order           the {@link #order} map where to store the properties order.
+     */
+    private static void defineOrder(Class<?> implementation, final Map<Object,Integer> order) {
         do {
             final XmlType xml = implementation.getAnnotation(XmlType.class);
             if (xml != null) {

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -31,7 +31,7 @@ import org.apache.sis.util.collection.Ba
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.8
  * @module
  */
 final class SpecialCases extends PropertyAccessor {
@@ -47,9 +47,11 @@ final class SpecialCases extends Propert
      * @param  type            the interface implemented by the metadata, which must be
      *                         the value returned by {@link #getStandardType(Class, String)}.
      * @param  implementation  the class of metadata implementations, or {@code type} if none.
+     * @param  standardImpl    the implementation specified by the {@link MetadataStandard}, or {@code null} if none.
+     *                         This is the same than {@code implementation} unless a custom implementation is used.
      */
-    SpecialCases(final Citation standard, final Class<?> type, final Class<?> implementation) {
-        super(standard, type, implementation);
+    SpecialCases(final Citation standard, final Class<?> type, final Class<?> implementation, final Class<?> standardImpl) {
+        super(standard, type, implementation, standardImpl);
         assert isSpecialCase(type) : type;
         westBoundLongitude = indexOf("westBoundLongitude", true);
         eastBoundLongitude = indexOf("eastBoundLongitude", true);

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -70,7 +70,7 @@ final class StandardImplementation exten
      * But maybe the most interesting property is that it allocates less objects since {@code IdentityHashMap}
      * implementation doesn't need the chain of objects created by {@code HashMap}.</div>
      */
-    private final transient Map<Class<?>,Class<?>> implementations; // written by reflection on deserialization.
+    private final transient Map<Class<?>,Class<?>> implementations;     // written by reflection on deserialization.
 
     /**
      * Creates a new instance working on implementation of interfaces defined in the
@@ -168,7 +168,7 @@ final class StandardImplementation exten
                         implementations.put(type, candidate);
                         return candidate.asSubclass(type);
                     }
-                    implementations.put(type, Void.TYPE); // Marker for "class not found".
+                    implementations.put(type, Void.TYPE);                       // Marker for "class not found".
                 }
             }
         }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -114,7 +114,7 @@ final class TreeNodeChildren extends Abs
         this.parent   = parent;
         this.metadata = metadata;
         this.accessor = accessor;
-        children = new TreeNode[accessor.count()];
+        this.children = new TreeNode[accessor.count()];
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -22,8 +22,8 @@ package org.apache.sis.metadata;
  * This exception may happen in the following scenarios:
  *
  * <ul>
- *   <li>A metadata instance was initially {@linkplain org.apache.sis.metadata.ModifiableMetadata
- *       modifiable}, but that instance has since be declared unmodifiable.</li>
+ *   <li>A metadata instance was initially {@linkplain org.apache.sis.metadata.ModifiableMetadata modifiable},
+ *       but that instance has since be declared unmodifiable.</li>
  *   <li>A write operation has been attempted on the {@linkplain AbstractMetadata#asMap() map view},
  *       but the metadata object has no corresponding setter methods.</li>
  * </ul>

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -196,6 +196,7 @@ public class DefaultGeographicBoundingBo
      * @param  object  the metadata to copy values from, or {@code null} if none.
      *
      * @see #castOrCopy(GeographicBoundingBox)
+     * @see #setBounds(GeographicBoundingBox)
      */
     public DefaultGeographicBoundingBox(final GeographicBoundingBox object) {
         super(object);
@@ -489,8 +490,8 @@ public class DefaultGeographicBoundingBo
     }
 
     /**
-     * Constructs a geographic bounding box from the specified envelope. If the envelope contains
-     * a CRS, then the bounding box may be projected to a geographic CRS. Otherwise, the envelope
+     * Sets the bounding box to the specified envelope. If the envelope contains* a CRS,
+     * then the bounding box may be projected to a geographic CRS. Otherwise, the envelope
      * is assumed already in appropriate CRS.
      *
      * <p>When coordinate transformation is required, the target geographic CRS is not necessarily

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.ArrayList;
 import javax.measure.Unit;
 import org.opengis.geometry.Envelope;
+import org.opengis.geometry.DirectPosition;
 import org.opengis.temporal.TemporalPrimitive;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.extent.VerticalExtent;
@@ -36,6 +37,7 @@ import org.opengis.referencing.crs.Coord
 import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.opengis.referencing.operation.TransformException;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.metadata.InvalidMetadataException;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.measure.MeasurementRange;
@@ -48,6 +50,7 @@ import org.apache.sis.util.Static;
 import static java.lang.Math.*;
 import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
 
+import org.apache.sis.internal.jdk8.JDK8;
 
 /**
  * Convenience static methods for extracting information from {@link Extent} objects.
@@ -378,6 +381,30 @@ public final class Extents extends Stati
     }
 
     /**
+     * Returns the position at the median longitude and latitude values of the given bounding box.
+     * This method does not check the {@linkplain DefaultGeographicBoundingBox#getInclusion() inclusion} status.
+     * This method takes in account bounding boxes that cross the anti-meridian.
+     *
+     * @param  bbox  the bounding box for which to get the median longitude and latitude values, or {@code null}.
+     * @return a median position of the given bounding box, or {@code null} if none.
+     */
+    public static DirectPosition centroid(final GeographicBoundingBox bbox) {
+        if (bbox != null) {
+            double y    = (bbox.getNorthBoundLatitude() + bbox.getSouthBoundLatitude()) / 2;
+            double x    =  bbox.getWestBoundLongitude();
+            double xmax =  bbox.getEastBoundLongitude();
+            if (xmax < x) {
+                xmax += (Longitude.MAX_VALUE - Longitude.MIN_VALUE);
+            }
+            x = Longitude.normalize((x + xmax) / 2);
+            if (JDK8.isFinite(x) || JDK8.isFinite(y)) {
+                return ReferencingServices.getInstance().geographic(x, y);
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns the intersection of the given geographic bounding boxes. If any of the arguments is {@code null},
      * then this method returns the other argument (which may be null). Otherwise this method returns a box which
      * is the intersection of the two given boxes.

Modified: sis/trunk/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql [UTF-8] Tue Mar  7 23:37:49 2017
@@ -96,19 +96,22 @@ INSERT INTO metadata."CI_Party" (ID, "na
   ('Apache', 'The Apache Software Foundation'),
   ('OGC',    'Open Geospatial Consortium'),
   ('ISO',    'International Organization for Standardization'),
-  ('IOGP',   'International Association of Oil & Gas producers');
+  ('IOGP',   'International Association of Oil & Gas producers'),
+  ('NATO',   'North Atlantic Treaty Organization');
 
 INSERT INTO metadata."CI_Responsibility" (ID, "party", "role") VALUES
   ('Apache', 'Apache', 'principalInvestigator'),
   ('OGC',    'OGC',    'principalInvestigator'),
   ('ISO',    'ISO',    'principalInvestigator'),
-  ('IOGP',   'IOGP',   'principalInvestigator');
+  ('IOGP',   'IOGP',   'principalInvestigator'),
+  ('NATO',   'NATO',   'principalInvestigator');
 
 INSERT INTO metadata."CI_Citation" (ID, "edition", "citedResponsibleParty", "title") VALUES
   ('SIS',         NULL,                  'Apache',  'Apache Spatial Information System'),
   ('ISO 19115-1', 'ISO 19115-1:2014(E)', 'ISO',     'Geographic Information — Metadata Part 1: Fundamentals'),
   ('ISO 19115-2', 'ISO 19115-2:2009(E)', 'ISO',     'Geographic Information — Metadata Part 2: Extensions for imagery and gridded data'),
-  ('EPSG',        NULL,                  'IOGP',    'EPSG Geodetic Parameter Dataset');
+  ('EPSG',        NULL,                  'IOGP',    'EPSG Geodetic Parameter Dataset'),
+  ('MGRS',        NULL,                  'NATO',    'Military Grid Reference System');
 
 
 --

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -21,6 +21,7 @@ import java.util.Locale;
 import java.util.Iterator;
 import java.util.Collections;
 import java.nio.charset.StandardCharsets;
+import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.content.ContentInformation;
 import org.opengis.metadata.content.FeatureCatalogueDescription;
 import org.opengis.metadata.content.ImagingCondition;
@@ -35,7 +36,6 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
-import org.opengis.metadata.citation.Citation;
 
 
 /**

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -194,7 +194,7 @@ public abstract strictfp class MetadataT
                 final Class<?> impl = getImplementation(type);
                 if (impl != null) {
                     assertTrue(type.isAssignableFrom(impl));
-                    testPropertyValues(new PropertyAccessor(standard.getCitation(), type, impl));
+                    testPropertyValues(new PropertyAccessor(standard.getCitation(), type, impl, impl));
                 }
             }
         }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -93,7 +93,7 @@ public final strictfp class PropertyAcce
      * Creates a new property accessor for the {@link DefaultCitation} class.
      */
     private static PropertyAccessor createPropertyAccessor() {
-        return new PropertyAccessor(HardCodedCitations.ISO_19115, Citation.class, DefaultCitation.class);
+        return new PropertyAccessor(HardCodedCitations.ISO_19115, Citation.class, DefaultCitation.class, DefaultCitation.class);
     }
 
     /**
@@ -201,7 +201,7 @@ public final strictfp class PropertyAcce
     @Test
     @DependsOnMethod("testConstructor")
     public void testConstructorWithInheritance() {
-        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO_19115, DataIdentification.class, DefaultDataIdentification.class),
+        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO_19115, DataIdentification.class, DefaultDataIdentification.class, DefaultDataIdentification.class),
         //……Declaring type………………………Method………………………………………………………………………JavaBeans………………………………………………………UML identifier………………………………………Sentence……………………………………………………………Type………………………………………………………………
             Identification.class, "getCitation",                   "citation",                   "citation",                  "Citation",                     Citation.class,
             Identification.class, "getAbstract",                   "abstract",                   "abstract",                  "Abstract",                     InternationalString.class,
@@ -238,7 +238,7 @@ public final strictfp class PropertyAcce
     @DependsOnMethod("testConstructorWithInheritance")
     public void testConstructorWithCovariantReturnType() {
         final Class<?> type = GeographicCRS.class;
-        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO_19111, type, type),
+        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO_19111, type, 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
@@ -368,7 +368,7 @@ public final strictfp class PropertyAcce
     @DependsOnMethod("testSet")
     public void testSetDeprecated() {
         final PropertyAccessor accessor = new PropertyAccessor(HardCodedCitations.ISO_19115,
-                CoverageDescription.class, DefaultCoverageDescription.class);
+                CoverageDescription.class, DefaultCoverageDescription.class, DefaultCoverageDescription.class);
         final int indexOfDeprecated  = accessor.indexOf("contentType", true);
         final int indexOfReplacement = accessor.indexOf("attributeGroup", true);
         assertTrue("Deprecated elements shall be sorted after non-deprecated ones.",

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -57,7 +57,7 @@ public final strictfp class SpecialCases
      */
     public SpecialCasesTest() {
         accessor = new SpecialCases(HardCodedCitations.ISO_19115,
-                GeographicBoundingBox.class, DefaultGeographicBoundingBox.class);
+                GeographicBoundingBox.class, DefaultGeographicBoundingBox.class, DefaultGeographicBoundingBox.class);
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -86,10 +86,10 @@ public final strictfp class TreeTableFor
             "  ├─Title…………………………………………………………………………… Undercurrent\n" +
             "  ├─Alternate title………………………………………………… Andākarento\n" +
             "  ├─Identifier\n" +
-            "  │   ├─Code…………………………………………………………………… 9782505004509\n" +
-            "  │   └─Authority\n" +
-            "  │       ├─Title……………………………………………………… International Standard Book Number\n" +
-            "  │       └─Alternate title…………………………… ISBN\n" +
+            "  │   ├─Authority\n" +
+            "  │   │   ├─Title……………………………………………………… International Standard Book Number\n" +
+            "  │   │   └─Alternate title…………………………… ISBN\n" +
+            "  │   └─Code…………………………………………………………………… 9782505004509\n" +
             "  ├─Cited responsible party (1 of 2)\n" +
             "  │   ├─Role…………………………………………………………………… Author\n" +
             "  │   └─Party\n" +

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -21,11 +21,12 @@ import org.opengis.metadata.extent.Geogr
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.test.DependsOnMethod;
+import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static java.lang.Double.NaN;
-import static org.junit.Assert.*;
+import static org.apache.sis.test.Assert.*;
 
 
 /**
@@ -33,7 +34,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.8
  * @module
  */
 public final strictfp class DefaultGeographicBoundingBoxTest extends TestCase {
@@ -418,4 +419,31 @@ public final strictfp class DefaultGeogr
             Boolean.TRUE
         }, map.values().toArray());
     }
+
+    /**
+     * Tests the {@code toString()} implementation of a custom geographic bounding box inside a {@link DefaultExtent}.
+     * In a previous Apache SIS version, those properties were not properly sorted.
+     *
+     * @since 0.8
+     */
+    @Test
+    public void testToString() {
+        final GeographicBoundingBox bbox = new GeographicBoundingBox() {
+            @Override public double getWestBoundLongitude() {return -40;}
+            @Override public double getEastBoundLongitude() {return  50;}
+            @Override public double getSouthBoundLatitude() {return -20;}
+            @Override public double getNorthBoundLatitude() {return  45;}
+            @Override public Boolean getInclusion() {return Boolean.TRUE;}
+        };
+        final DefaultExtent extent = new DefaultExtent(null, bbox, null, null);
+        assertSame(bbox, TestUtilities.getSingleton(extent.getGeographicElements()));
+        assertMultilinesEquals(
+                "Extent\n" +
+                "  └─Geographic element\n" +
+                "      ├─West bound longitude…… 40°W\n" +
+                "      ├─East bound longitude…… 50°E\n" +
+                "      ├─South bound latitude…… 20°S\n" +
+                "      ├─North bound latitude…… 45°N\n" +
+                "      └─Extent type code……………… true\n", extent.toString());
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -22,6 +22,7 @@ import java.util.Collections;
 import javax.measure.Unit;
 import javax.measure.UnitConverter;
 import javax.measure.IncommensurableException;
+import org.opengis.geometry.DirectPosition;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.apache.sis.measure.Units;
 import org.apache.sis.measure.MeasurementRange;
@@ -149,4 +150,26 @@ public final strictfp class ExtentsTest
         assertTrue(DefaultGeographicBoundingBoxTest.isSpanningAntiMeridian(box));
         assertEquals(9845438, Extents.area(box) / 1E6, 1);                              // Compare in km²
     }
+
+    /**
+     * Tests the {@link Extents#centroid(GeographicBoundingBox)} method. This method is defined here but executed from
+     * the {@link org.apache.sis.internal.referencing.ServicesForMetadataTest} class in {@code sis-referencing} module.
+     * This method can not be executed in the {@code sis-metadata} module because it has a dependency to a referencing
+     * implementation class.
+     *
+     * @since 0.8
+     */
+    public static void testCentroid() {
+        final DefaultGeographicBoundingBox bbox = new DefaultGeographicBoundingBox(140, 160, 30, 50);
+        DirectPosition pos = Extents.centroid(bbox);
+        assertEquals("longitude", 150, pos.getOrdinate(0), STRICT);
+        assertEquals("latitude",   40, pos.getOrdinate(1), STRICT);
+        /*
+         * Test crossing anti-meridian.
+         */
+        bbox.setEastBoundLongitude(-160);
+        pos = Extents.centroid(bbox);
+        assertEquals("longitude", 170, pos.getOrdinate(0), STRICT);
+        assertEquals("latitude",   40, pos.getOrdinate(1), STRICT);
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1785905&r1=1785904&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -52,6 +52,7 @@ import org.junit.BeforeClass;
     org.apache.sis.metadata.MetadataStandardTest.class,
     org.apache.sis.metadata.PrunerTest.class,
     org.apache.sis.metadata.AbstractMetadataTest.class,
+    org.apache.sis.metadata.MetadataCopierTest.class,
     org.apache.sis.internal.metadata.MergerTest.class,
 
     // XML marshalling.

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java?rev=1785905&r1=1785895&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -18,20 +18,20 @@ package org.apache.sis.referencing.gazet
 
 import java.util.Collection;
 import java.util.Collections;
-import org.opengis.metadata.citation.Party;
 import org.opengis.metadata.extent.TemporalExtent;
 import org.opengis.metadata.extent.GeographicExtent;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.geometry.Envelope;
 import org.opengis.geometry.coordinate.Position;
-import org.opengis.referencing.gazetteer.Location;
-import org.opengis.referencing.gazetteer.LocationType;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.geometry.Envelope2D;
 import org.apache.sis.geometry.GeneralDirectPosition;
 import org.apache.sis.util.Debug;
 
+// Branch-dependent imports
+import org.apache.sis.metadata.iso.citation.AbstractParty;
+
 
 /**
  * Identifiable geographic place. A geographic place may be identified by a name (for example “Eiffel Tower”),
@@ -66,7 +66,7 @@ import org.apache.sis.util.Debug;
  * @see ReferencingByIdentifiers
  * @see LocationFormat
  */
-public abstract class AbstractLocation implements Location {
+public abstract class AbstractLocation {
     /**
      * The description of the nature of this geographic identifier, or {@code null} if unspecified.
      *
@@ -75,7 +75,7 @@ public abstract class AbstractLocation i
      *
      * @see #getLocationType()
      */
-    private LocationType type;
+    private AbstractLocationType type;
 
     /**
      * The geographic identifier, or {@code null} if unspecified.
@@ -91,7 +91,7 @@ public abstract class AbstractLocation i
      * @param type        the description of the nature of this geographic identifier.
      * @param identifier  the geographic identifier to be returned by {@link #getGeographicIdentifier()}.
      */
-    protected AbstractLocation(final LocationType type, final CharSequence identifier) {
+    protected AbstractLocation(final AbstractLocationType type, final CharSequence identifier) {
         this.type       = type;
         this.identifier = identifier;
     }
@@ -123,7 +123,6 @@ public abstract class AbstractLocation i
      *
      * @see ModifiableLocationType#getIdentifications()
      */
-    @Override
     public InternationalString getGeographicIdentifier() {
         return Types.toInternationalString(identifier);
     }
@@ -134,7 +133,6 @@ public abstract class AbstractLocation i
      *
      * @return other identifier(s) for the location instance, or an empty collection if none.
      */
-    @Override
     public Collection<? extends InternationalString> getAlternativeGeographicIdentifiers() {
         return Collections.emptySet();
     }
@@ -145,7 +143,6 @@ public abstract class AbstractLocation i
      *
      * @return date of creation of this version of the location instance, or {@code null} if none.
      */
-    @Override
     public TemporalExtent getTemporalExtent() {
         return null;
     }
@@ -161,7 +158,6 @@ public abstract class AbstractLocation i
      * @see org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox
      * @see org.apache.sis.metadata.iso.extent.DefaultBoundingPolygon
      */
-    @Override
     public GeographicExtent getGeographicExtent() {
         return null;
     }
@@ -175,7 +171,6 @@ public abstract class AbstractLocation i
      *
      * @return envelope that encompass the location, or {@code null} if none.
      */
-    @Override
     public Envelope getEnvelope() {
         final GeographicExtent extent = getGeographicExtent();
         return (extent instanceof GeographicBoundingBox) ? new Envelope2D((GeographicBoundingBox) extent) : null;
@@ -189,7 +184,6 @@ public abstract class AbstractLocation i
      *
      * @return coordinates of a representative point for the location instance, or {@code null} if none.
      */
-    @Override
     public Position getPosition() {
         final Envelope envelope = getEnvelope();
         if (envelope == null) {
@@ -209,8 +203,7 @@ public abstract class AbstractLocation i
      *
      * @return the nature of the identifier and its associated geographic location.
      */
-    @Override
-    public LocationType getLocationType() {
+    public AbstractLocationType getLocationType() {
         return type;
     }
 
@@ -218,14 +211,18 @@ public abstract class AbstractLocation i
      * Returns the organization responsible for defining the characteristics of the location instance.
      * The default implementation returns the {@linkplain ModifiableLocationType#getOwner() owner}.
      *
+     * <div class="warning"><b>Warning:</b>
+     * in a future SIS version, the type of returned element may be generalized to the
+     * {@code org.opengis.metadata.citation.Party} interface. This change is pending
+     * GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.</div>
+     *
      * @return organization responsible for defining the characteristics of the location instance, or {@code null}.
      *
      * @see ModifiableLocationType#getOwner()
      * @see ReferencingByIdentifiers#getOverallOwner()
      */
-    @Override
-    public Party getAdministrator() {
-        final LocationType type = getLocationType();
+    public AbstractParty getAdministrator() {
+        final AbstractLocationType type = getLocationType();
         return (type != null) ? type.getOwner() : null;
     }
 
@@ -233,12 +230,16 @@ public abstract class AbstractLocation i
      * Returns location instances of a different location type, for which this location instance is a sub-division.
      * The default implementation returns an empty list.
      *
+     * <div class="warning"><b>Warning:</b>
+     * in a future SIS version, the type of collection elements may be generalized
+     * to the {@code org.opengis.referencing.gazetteer.Location} interface.
+     * This change is pending GeoAPI revision.</div>
+     *
      * @return parent locations, or an empty collection if none.
      *
      * @see ModifiableLocationType#getParents()
      */
-    @Override
-    public Collection<? extends Location> getParents() {
+    public Collection<? extends AbstractLocation> getParents() {
         return Collections.emptyList();
     }
 
@@ -246,12 +247,16 @@ public abstract class AbstractLocation i
      * Returns location instances of a different location type which subdivides this location instance.
      * The default implementation returns an empty list.
      *
+     * <div class="warning"><b>Warning:</b>
+     * in a future SIS version, the type of collection elements may be generalized
+     * to the {@code org.opengis.referencing.gazetteer.Location} interface.
+     * This change is pending GeoAPI revision.</div>
+     *
      * @return child locations, or an empty collection if none.
      *
      * @see ModifiableLocationType#getChildren()
      */
-    @Override
-    public Collection<? extends Location> getChildren() {
+    public Collection<? extends AbstractLocation> getChildren() {
         return Collections.emptyList();
     }
 

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java?rev=1785905&r1=1785895&r2=1785905&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java [UTF-8] Tue Mar  7 23:37:49 2017
@@ -31,8 +31,10 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.Utilities;
 
 // Branch-dependent imports
-import org.opengis.referencing.gazetteer.LocationType;
-import org.opengis.referencing.gazetteer.ReferenceSystemUsingIdentifiers;
+import java.util.Collection;
+import org.opengis.util.InternationalString;
+import org.opengis.metadata.extent.GeographicExtent;
+import org.apache.sis.metadata.iso.citation.AbstractParty;
 
 
 /**
@@ -44,7 +46,7 @@ import org.opengis.referencing.gazetteer
  * @version 0.8
  * @module
  */
-abstract class AbstractLocationType implements LocationType, LenientComparable {
+abstract class AbstractLocationType implements LenientComparable {
     /**
      * For sub-class constructors.
      */
@@ -65,12 +67,12 @@ abstract class AbstractLocationType impl
      * @param  types  the location types for which to take a snapshot.
      * @return unmodifiable copies of the given location types.
      */
-    public static List<LocationType> snapshot(final ReferenceSystemUsingIdentifiers rs, final LocationType... types) {
+    public static List<AbstractLocationType> snapshot(final ReferencingByIdentifiers rs, final AbstractLocationType... types) {
         ArgumentChecks.ensureNonNull("types", types);
-        final List<LocationType> snapshot = FinalLocationType.snapshot(Arrays.asList(types), rs,
-                new IdentityHashMap<LocationType,FinalLocationType>());
-        final Map<LocationType,Boolean> parents = new IdentityHashMap<>();
-        for (final LocationType type : snapshot) {
+        final List<AbstractLocationType> snapshot = FinalLocationType.snapshot(Arrays.asList(types), rs,
+                new IdentityHashMap<AbstractLocationType,FinalLocationType>());
+        final Map<AbstractLocationType,Boolean> parents = new IdentityHashMap<>();
+        for (final AbstractLocationType type : snapshot) {
             checkForCycles(type, parents);
         }
         return snapshot;
@@ -81,11 +83,11 @@ abstract class AbstractLocationType impl
      *
      * @throws IllegalArgumentException if an infinite recursivity is detected.
      */
-    private static void checkForCycles(final LocationType type, final Map<LocationType,Boolean> parents) {
+    private static void checkForCycles(final AbstractLocationType type, final Map<AbstractLocationType,Boolean> parents) {
         if (parents.put(type, Boolean.TRUE) != null) {
             throw new IllegalArgumentException(Resources.format(Resources.Keys.LocationTypeCycle_1, type.getName()));
         }
-        for (final LocationType child : type.getChildren()) {
+        for (final AbstractLocationType child : type.getChildren()) {
             checkForCycles(child, parents);
         }
         parents.remove(type);
@@ -98,10 +100,58 @@ abstract class AbstractLocationType impl
      * @throws IllegalArgumentException if an infinite recursivity is detected.
      */
     final void checkForCycles() {
-        checkForCycles(this, new IdentityHashMap<LocationType,Boolean>());
+        checkForCycles(this, new IdentityHashMap<AbstractLocationType,Boolean>());
     }
 
     /**
+     * Name of the location type.
+     */
+    public abstract InternationalString getName();
+
+    /**
+     * Property used as the defining characteristic of the location type.
+     */
+    public abstract InternationalString getTheme();
+
+    /**
+     * Method(s) of uniquely identifying location instances.
+     */
+    public abstract Collection<? extends InternationalString> getIdentifications();
+
+    /**
+     * The way in which location instances are defined.
+     */
+    public abstract InternationalString getDefinition();
+
+    /**
+     * Geographic area within which the location type occurs.
+     */
+    public abstract GeographicExtent getTerritoryOfUse();
+
+    /**
+     * The reference system that comprises this location type.
+     */
+    public abstract ReferencingByIdentifiers getReferenceSystem();
+
+    /**
+     * Name of organization or class of organization able to create and destroy location instances.
+     */
+    public abstract AbstractParty getOwner();
+
+    /**
+     * Parent location types (location types of which this location type is a sub-division).
+     * A location type can have more than one possible parent. For example the parent of a
+     * location type named <cite>“street”</cite> could be <cite>“locality”</cite>, <cite>“town”</cite>
+     * or <cite>“administrative area”</cite>.
+     */
+    public abstract Collection<? extends AbstractLocationType> getParents();
+
+    /**
+     * Child location types (location types which sub-divides this location type).
+     */
+    public abstract Collection<? extends AbstractLocationType> getChildren();
+
+    /**
      * Compares this location type with the specified object for equality.
      * This method compares the value of {@link #getName()} and {@link #getChildren()} in all modes.
      * At the opposite, values of {@link #getParents()} and {@link #getReferenceSystem()} are never
@@ -130,8 +180,8 @@ abstract class AbstractLocationType impl
                 // Fall through
             }
             case BY_CONTRACT: {
-                if (!(object instanceof LocationType)) break;
-                final LocationType that = (LocationType) object;
+                if (!(object instanceof AbstractLocationType)) break;
+                final AbstractLocationType that = (AbstractLocationType) object;
                 // Do not compare the ReferenceSystem as it may cause an infinite recursion.
                 if (!Utilities.deepEquals(getTheme(),           that.getTheme(),           mode) ||
                     !Utilities.deepEquals(getIdentifications(), that.getIdentifications(), mode) ||
@@ -144,8 +194,8 @@ abstract class AbstractLocationType impl
                 // Fall through
             }
             default: {
-                if (!(object instanceof LocationType)) break;
-                final LocationType that = (LocationType) object;
+                if (!(object instanceof AbstractLocationType)) break;
+                final AbstractLocationType that = (AbstractLocationType) object;
                 if (Objects.equals(getName(), that.getName())) {
                     /*
                      * To be safe, we should apply some check against infinite recursivity here.
@@ -187,7 +237,7 @@ abstract class AbstractLocationType impl
     @Override
     public int hashCode() {
         int code = Objects.hashCode(getName());
-        for (final LocationType child : getChildren()) {
+        for (final AbstractLocationType child : getChildren()) {
             // Take only children name without recursivity over their own children.
             code = code*31 + Objects.hashCode(child.getName());
         }
@@ -223,10 +273,10 @@ abstract class AbstractLocationType impl
      * on the assumption that subclasses verified this constraint by calls
      * to {@link #checkForCycles()}.
      */
-    private static void format(final LocationType type, final TreeTable.Node node) {
+    private static void format(final AbstractLocationType type, final TreeTable.Node node) {
         node.setValue(TableColumn.NAME, type.getName());
         node.setValue(TableColumn.VALUE_AS_TEXT, type.getDefinition());
-        for (final LocationType child : type.getChildren()) {
+        for (final AbstractLocationType child : type.getChildren()) {
             format(child, node.newChild());
         }
     }



Mime
View raw message