sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1785863 [1/4] - in /sis/branches/JDK7: ./ 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...
Date Tue, 07 Mar 2017 17:45:00 GMT
Author: desruisseaux
Date: Tue Mar  7 17:44:59 2017
New Revision: 1785863

URL: http://svn.apache.org/viewvc?rev=1785863&view=rev
Log:
Merge from the JDK8 branch.

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

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  7 17:44:59 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1782434
+/sis/branches/JDK8:1584960-1785861
 /sis/branches/JDK9:1773327-1773512
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java [UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java [UTF-8] Tue Mar  7 17:44:59 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;
@@ -204,7 +205,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) {
@@ -232,7 +233,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/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java [UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/pom.xml?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/pom.xml (original)
+++ sis/branches/JDK7/core/pom.xml Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -73,8 +73,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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Tue Mar  7 17:44:59 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.metadata.Identifier;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.IdentifiedObject;
@@ -70,7 +73,7 @@ import org.apache.sis.util.Deprecable;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public class ReferencingServices extends OptionalDependency {
@@ -275,6 +278,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();
+    }
+
 
 
 
@@ -503,6 +520,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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] Tue Mar  7 17:44:59 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 {
@@ -258,4 +260,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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Tue Mar  7 17:44:59 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;
@@ -1618,7 +1619,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;
@@ -1627,7 +1628,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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/CacheKey.java [UTF-8] Tue Mar  7 17:44:59 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;
     }

Copied: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java (from r1785861, sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java?p2=sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java&p1=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java&r1=1785861&r2=1785863&rev=1785863&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Freezer.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -146,7 +146,8 @@ final class Freezer extends Cloner {
          *          by their unmodifiable variant. The keys are assumed already immutable.
          */
         if (object instanceof Map<?,?>) {
-            final Map<Object,Object> map = new LinkedHashMap<>((Map<?,?>) object);
+            @SuppressWarnings("unchecked")
+            final Map<Object,Object> map = new LinkedHashMap<>((Map) object);
             for (final Map.Entry<Object,Object> entry : map.entrySet()) {
                 entry.setValue(clone(entry.getValue()));
             }

Copied: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java (from r1785861, sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java?p2=sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java&p1=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java&r1=1785861&r2=1785863&rev=1785863&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -216,7 +216,8 @@ public class MetadataCopier {
                 return c;
             }
             if (metadata instanceof Map<?,?>) {
-                final Map<Object,Object> copy = new LinkedHashMap<>((Map<?,?>) metadata);
+                @SuppressWarnings("unchecked")
+                final Map<Object,Object> copy = new LinkedHashMap<>((Map) metadata);
                 for (final Map.Entry<Object,Object> entry : copy.entrySet()) {
                     entry.setValue(copyRecursively(type, entry.getValue()));
                 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -365,11 +365,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;
             }
@@ -594,7 +595,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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -31,7 +31,7 @@ import org.apache.sis.util.collection.Ba
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -66,7 +66,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
@@ -161,7 +161,7 @@ final class StandardImplementation exten
                         Logging.recoverableException(Logging.getLogger(Modules.METADATA),
                                 MetadataStandard.class, "getImplementation", e);
                     }
-                    implementations.put(type, Void.TYPE); // Marker for "class not found".
+                    implementations.put(type, Void.TYPE);                       // Marker for "class not found".
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNodeChildren.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] Tue Mar  7 17:44:59 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;
@@ -50,6 +52,7 @@ import static org.apache.sis.internal.me
 
 // Branch-dependent imports
 import org.opengis.geometry.Geometry;
+import org.apache.sis.internal.jdk8.JDK8;
 
 
 /**
@@ -409,6 +412,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/branches/JDK7/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql [UTF-8] Tue Mar  7 17:44:59 2017
@@ -95,19 +95,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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java [UTF-8] Tue Mar  7 17:44:59 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.CoverageDescription;
 import org.opengis.metadata.content.FeatureCatalogueDescription;
@@ -36,7 +37,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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -189,7 +189,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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -92,7 +92,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);
     }
 
     /**
@@ -200,7 +200,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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] Tue Mar  7 17:44:59 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" +
+            "  │   ├─Code…………………………………………………………………… 9782505004509\n" +
             "  │   └─Code space…………………………………………………… ISBN\n"+
             "  ├─Cited responsible party (1 of 2)\n" +
             "  │   ├─Party\n" +

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBoxTest.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1785863&r1=1785862&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Tue Mar  7 17:44:59 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/branches/JDK7/core/sis-referencing-by-identifiers/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing-by-identifiers/pom.xml?rev=1785863&r1=1785861&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing-by-identifiers/pom.xml (original)
+++ sis/branches/JDK7/core/sis-referencing-by-identifiers/pom.xml Tue Mar  7 17:44:59 2017
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.sis</groupId>
     <artifactId>core</artifactId>
-    <version>0.8-jdk8-SNAPSHOT</version>
+    <version>0.8-jdk7-SNAPSHOT</version>
   </parent>
 
   <groupId>org.apache.sis.core</groupId>

Modified: sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java?rev=1785863&r1=1785861&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -67,7 +67,8 @@ abstract class AbstractLocationType impl
      */
     public static List<LocationType> snapshot(final ReferenceSystemUsingIdentifiers rs, final LocationType... types) {
         ArgumentChecks.ensureNonNull("types", types);
-        final List<LocationType> snapshot = FinalLocationType.snapshot(Arrays.asList(types), rs, new IdentityHashMap<>());
+        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) {
             checkForCycles(type, parents);
@@ -97,7 +98,7 @@ abstract class AbstractLocationType impl
      * @throws IllegalArgumentException if an infinite recursivity is detected.
      */
     final void checkForCycles() {
-        checkForCycles(this, new IdentityHashMap<>());
+        checkForCycles(this, new IdentityHashMap<LocationType,Boolean>());
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java?rev=1785863&r1=1785861&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -56,6 +56,7 @@ import org.apache.sis.measure.Longitude;
 import org.apache.sis.measure.Latitude;
 
 // Branch-dependent imports
+import org.apache.sis.internal.jdk8.JDK8;
 import org.opengis.metadata.citation.Party;
 import org.opengis.referencing.gazetteer.Location;
 import org.opengis.referencing.gazetteer.LocationType;
@@ -438,7 +439,7 @@ public class MilitaryGridReferenceSystem
          */
         public void setPrecision(final double precision) {
             final double p = Math.floor(Math.log10(precision));
-            if (!Double.isFinite(p)) {
+            if (!JDK8.isFinite(p)) {
                 throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2, "precision", precision));
             }
             // The -3 is an arbitrary limit to millimetre precision.

Modified: sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java?rev=1785863&r1=1785861&r2=1785863&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java [UTF-8] Tue Mar  7 17:44:59 2017
@@ -32,7 +32,8 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.iso.Types;
 
 // Branch-dependent imports
-import java.util.function.Function;
+import org.apache.sis.internal.jdk8.JDK8;
+import org.apache.sis.internal.jdk8.Function;
 import org.opengis.metadata.citation.Party;
 import org.opengis.referencing.gazetteer.ReferenceSystemUsingIdentifiers;
 
@@ -213,7 +214,11 @@ public class ModifiableLocationType exte
      */
     @Override
     public InternationalString getTheme() {
-        return (theme != null) ? theme : inherit(ModifiableLocationType::getTheme);
+        return (theme != null) ? theme : inherit(new Function<ModifiableLocationType, InternationalString>() {
+            @Override public InternationalString apply(final ModifiableLocationType type) {
+                return type.getTheme();
+            }
+        });
     }
 
     /**
@@ -253,8 +258,11 @@ public class ModifiableLocationType exte
      */
     @Override
     public Collection<InternationalString> getIdentifications() {
-        return identifications.isEmpty() ? inherit(ModifiableLocationType::getIdentifications)
-                : Collections.unmodifiableCollection(identifications.values());
+        return identifications.isEmpty() ? inherit(new Function<ModifiableLocationType, Collection<InternationalString>>() {
+            @Override public Collection<InternationalString> apply(final ModifiableLocationType type) {
+                return type.getIdentifications();
+            }
+        }) : Collections.unmodifiableCollection(identifications.values());
     }
 
     /**
@@ -269,7 +277,7 @@ public class ModifiableLocationType exte
     public void addIdentification(final CharSequence value) {
         ArgumentChecks.ensureNonNull("value", value);
         final String key = value.toString();
-        if (identifications.putIfAbsent(key, Types.toInternationalString(value)) != null) {
+        if (JDK8.putIfAbsent(identifications, key, Types.toInternationalString(value)) != null) {
             throw new IllegalArgumentException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, key));
         }
     }
@@ -298,7 +306,11 @@ public class ModifiableLocationType exte
      */
     @Override
     public InternationalString getDefinition() {
-        return (definition != null) ? definition : inherit(ModifiableLocationType::getDefinition);
+        return (definition != null) ? definition : inherit(new Function<ModifiableLocationType, InternationalString>() {
+            @Override public InternationalString apply(final ModifiableLocationType type) {
+                return type.getDefinition();
+            }
+        });
     }
 
     /**
@@ -322,7 +334,11 @@ public class ModifiableLocationType exte
      */
     @Override
     public GeographicExtent getTerritoryOfUse() {
-        return (territoryOfUse != null) ? territoryOfUse : inherit(ModifiableLocationType::getTerritoryOfUse);
+        return (territoryOfUse != null) ? territoryOfUse : inherit(new Function<ModifiableLocationType, GeographicExtent>() {
+            @Override public GeographicExtent apply(final ModifiableLocationType type) {
+                return type.getTerritoryOfUse();
+            }
+        });
     }
 
     /**
@@ -361,7 +377,11 @@ public class ModifiableLocationType exte
      */
     @Override
     public Party getOwner() {
-        return (owner != null) ? owner : inherit(ModifiableLocationType::getOwner);
+        return (owner != null) ? owner : inherit(new Function<ModifiableLocationType, Party>() {
+            @Override public Party apply(final ModifiableLocationType type) {
+                return type.getOwner();
+            }
+        });
     }
 
     /**
@@ -426,11 +446,11 @@ public class ModifiableLocationType exte
     public void addParent(final ModifiableLocationType parent) {
         ArgumentChecks.ensureNonNull("parent", parent);
         final String parentName = parent.name.toString();
-        if (parents.putIfAbsent(parentName, parent) != null) {
+        if (JDK8.putIfAbsent(parents, parentName, parent) != null) {
             throw new IllegalStateException(Resources.format(Resources.Keys.ParentAlreadyExists_1, parentName));
         }
         final String childName = name.toString();
-        if (parent.children.putIfAbsent(childName, this) != null) {
+        if (JDK8.putIfAbsent(parent.children, childName, this) != null) {
             if (parents.remove(parentName) != parent) {
                 throw new ConcurrentModificationException();                    // Paranoiac check.
             }



Mime
View raw message