sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1730895 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ sis-referencing/src/main/java/org/apache/sis/internal/referencing/ sis-referencing/src/main/java/org/apache/sis/internal/referencing/pro...
Date Wed, 17 Feb 2016 18:30:19 GMT
Author: desruisseaux
Date: Wed Feb 17 18:30:18 2016
New Revision: 1730895

URL: http://svn.apache.org/viewvc?rev=1730895&view=rev
Log:
Upgrade EPSG database from version 8.8 to 8.9.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
    sis/branches/JDK8/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG.sql
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.internal.metadata.sql;
 
+import java.sql.SQLException;
+import java.sql.DatabaseMetaData;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
@@ -42,6 +44,21 @@ public final class SQLUtilities extends
     }
 
     /**
+     * Returns a simplified form of the URL (truncated before the first {@code ?} or {@code
;} character),
+     * for logging or informative purpose only.
+     *
+     * @param  metadata The metadata of the database.
+     * @return A simplified version of database URL.
+     * @throws SQLException if an error occurred while fetching the URL.
+     */
+    public static String getSimplifiedURL(final DatabaseMetaData metadata) throws SQLException
{
+        String url = metadata.getURL();
+        int s1 = url.indexOf('?'); if (s1 < 0) s1 = url.length();
+        int s2 = url.indexOf(';'); if (s2 < 0) s2 = url.length();
+        return url.substring(0, Math.min(s1, s2));
+    }
+
+    /**
      * Returns a string like the given string but with all characters that are not letter
or digit
      * replaced by the wildcard % character.
      *

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java?rev=1730895&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing;
+
+import java.util.Set;
+import javax.measure.unit.Unit;
+import org.apache.sis.measure.NumberRange;
+import org.apache.sis.internal.util.CollectionsExt;
+
+
+/**
+ * The domain of values of an EPSG parameter which accepts different units.
+ * An example is the EPSG:8617 (<cite>Ordinate 1 of evaluation point</cite>)
parameter,
+ * which may be used in the EPSG database with either metres or degrees units.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+public final class EPSGParameterDomain extends NumberRange<Double> {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = -8462017652419319184L;
+
+    /**
+     * The units of measurement.
+     */
+    public final Set<Unit<?>> units;
+
+    /**
+     * Creates a new parameter descriptor for the given units.
+     *
+     * @param units The units.
+     */
+    public EPSGParameterDomain(final Set<Unit<?>> units) {
+        super(Double.class, null, false, null, false);
+        this.units = CollectionsExt.unmodifiableOrCopy(units);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -77,7 +77,7 @@ public final class Mercator2SP extends A
          * projection according EPSG. But we declare them as optional parameters because
they are sometime used in
          * Well Known Text (WKT).
          */
-        builder.setRequired(false); // Will apply to all remaining parameters.
+        builder.setRequired(false);         // Will apply to all remaining parameters.
         final InternationalString remarks = notFormalParameter("Mercator (variant A)");
         final ParameterDescriptor<Double> latitudeOfOrigin = createZeroConstant(builder
                 .addNamesAndIdentifiers(Mercator1SP.LATITUDE_OF_ORIGIN)

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -684,8 +684,11 @@ public class DefaultParameterValue<T> ex
     public void setValue(final double value, final Unit<?> unit) throws InvalidParameterValueException
{
         try {
             setValue(wrap(value, descriptor.getValueClass()), unit);
+        } catch (InvalidParameterValueException e) {
+            throw e;        // Need to be thrown explicitely because it is a subclass of
IllegalArgumentException.
         } catch (IllegalArgumentException e) {
-            throw new InvalidParameterValueException(e.getLocalizedMessage(), Verifier.getDisplayName(descriptor),
value);
+            throw (InvalidParameterValueException) new InvalidParameterValueException(
+                    e.getLocalizedMessage(), Verifier.getDisplayName(descriptor), value).initCause(e);
         }
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -26,6 +26,7 @@ import org.opengis.metadata.Identifier;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.InvalidParameterValueException;
+import org.apache.sis.internal.referencing.EPSGParameterDomain;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.Units;
 import org.apache.sis.util.Numbers;
@@ -40,7 +41,7 @@ import org.apache.sis.util.resources.Voc
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 final class Verifier {
@@ -106,10 +107,13 @@ final class Verifier {
         UnitConverter converter = null;
         Object convertedValue = value;
         if (unit != null) {
-            final Unit<?> def = descriptor.getUnit();
+            Unit<?> def = descriptor.getUnit();
             if (def == null) {
-                final String name = getDisplayName(descriptor);
-                throw new InvalidParameterValueException(Errors.format(Errors.Keys.UnitlessParameter_1,
name), name, unit);
+                def = getCompatibleUnit(Parameters.getValueDomain(descriptor), unit);
+                if (def == null) {
+                    final String name = getDisplayName(descriptor);
+                    throw new InvalidParameterValueException(Errors.format(Errors.Keys.UnitlessParameter_1,
name), name, unit);
+                }
             }
             if (!unit.equals(def)) {
                 final short expectedID = getUnitMessageID(def);
@@ -161,7 +165,7 @@ final class Verifier {
                         componentType = Numbers.primitiveToWrapper(componentType);
                         for (int i=0; i<length; i++) {
                             Number n = (Number) Array.get(value, i);
-                            n = converter.convert(n.doubleValue()); // Value in units that
we can compare.
+                            n = converter.convert(n.doubleValue());         // Value in units
that we can compare.
                             try {
                                 n = Numbers.cast(n, componentType.asSubclass(Number.class));
                             } catch (IllegalArgumentException e) {
@@ -290,6 +294,22 @@ final class Verifier {
     }
 
     /**
+     * If the given domain of values accepts units of incompatible dimensions, return the
unit which is compatible
+     * with the given units. This is a non-public mechanism handling a few parameters in
the EPSG database, like
+     * <cite>Ordinate 1 of evaluation point</cite> (EPSG:8617).
+     */
+    private static Unit<?> getCompatibleUnit(final Range<?> valueDomain, final
Unit<?> unit) {
+        if (valueDomain instanceof EPSGParameterDomain) {
+            for (final Unit<?> valid : ((EPSGParameterDomain) valueDomain).units) {
+                if (unit.isCompatible(valid)) {
+                    return valid;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns an error message for the error detected by
      * {@link #ensureValidValue(Class, Set, Range, Object)}.
      *

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -88,7 +88,7 @@ public abstract class GeodeticAuthorityF
      *   │  └─ Function ……………………………………… Browse
      *   └─ Online resource (2 of 2)
      *      ├─ Linkage ………………………………………… jdbc:derby:/my/path/to/SIS_DATA/Databases/SpatialMetadata
-     *      ├─ Description ……………………………… EPSG dataset version
8.8 on “Apache Derby Embedded JDBC Driver” version 10.12.
+     *      ├─ Description ……………………………… EPSG dataset version
8.9 on “Apache Derby Embedded JDBC Driver” version 10.12.
      *      └─ Function ……………………………………… Connection
      * }
      *
@@ -1189,7 +1189,7 @@ public abstract class GeodeticAuthorityF
                     final int n = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR, s + 1);
                     if (n >= 0) {
                         /*
-                         * The separator sometime appears twice, as in "EPSG::4326" or "EPSG:8.8:4326".
+                         * The separator sometime appears twice, as in "EPSG::4326" or "EPSG:8.9:4326".
                          * The part between the two separators is the verion number, which
we ignore in
                          * this simple version.
                          */

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -71,6 +71,7 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.internal.metadata.TransformationAccuracy;
 import org.apache.sis.internal.metadata.sql.SQLUtilities;
 import org.apache.sis.internal.referencing.DeprecatedCode;
+import org.apache.sis.internal.referencing.EPSGParameterDomain;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.Constants;
@@ -107,6 +108,7 @@ import org.apache.sis.util.Localized;
 import org.apache.sis.util.Version;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.measure.MeasurementRange;
+import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.Units;
 
 import static org.apache.sis.internal.referencing.ServicesForMetadata.CONNECTION;
@@ -395,7 +397,7 @@ public class EPSGDataAccess extends Geod
      *   │  └─ Function ……………………………………… Browse
      *   └─ Online resource (2 of 2)
      *      ├─ Linkage ………………………………………… jdbc:derby:/my/path/to/SIS_DATA/Databases/SpatialMetadata
-     *      ├─ Description ……………………………… EPSG dataset version
8.8 on “Apache Derby Embedded JDBC Driver” version 10.12.
+     *      ├─ Description ……………………………… EPSG dataset version
8.9 on “Apache Derby Embedded JDBC Driver” version 10.12.
      *      └─ Function ……………………………………… Connection
      * }
      */
@@ -434,7 +436,7 @@ public class EPSGDataAccess extends Geod
              *
              *    Linkage:      jdbc:derby:/my/path/to/SIS_DATA/Databases/SpatialMetadata
              *    Function:     Connection
-             *    Description:  EPSG dataset version 8.8 on “Apache Derby Embedded JDBC
Driver” version 10.12.
+             *    Description:  EPSG dataset version 8.9 on “Apache Derby Embedded JDBC
Driver” version 10.12.
              *
              * TODO: A future version should use Citations.EPSG as a template.
              *       See the "EPSG" case in ServiceForUtility.createCitation(String).
@@ -460,7 +462,7 @@ addURIs:    for (int i=0; ; i++) {
                 }
                 final DefaultOnlineResource r = new DefaultOnlineResource();
                 try {
-                    r.setLinkage(new URI(url));
+                    r.setLinkage(new URI(SQLUtilities.getSimplifiedURL(metadata)));
                 } catch (URISyntaxException exception) {
                     unexpectedException("getAuthority", exception);
                 }
@@ -2359,37 +2361,61 @@ addURIs:    for (int i=0; ; i++) {
                 final String  name       = getString   (code, result, 2);
                 final String  remarks    = getOptionalString (result, 3);
                 final boolean deprecated = getOptionalBoolean(result, 4);
-                MeasurementRange<?> valueDomain = null;
-                final Class<?> type;
+                Class<?> type = Double.class;
                 /*
-                 * Search for units. We will choose the most commonly used one in parameter
values.
                  * If the parameter appears to have at least one non-null value in the "Parameter
File Name" column,
                  * then the type is assumed to be URI as a string. Otherwise, the type is
a floating point number.
                  */
-                try (ResultSet resultUnits = executeQuery("ParameterUnit",
-                        "SELECT MIN(UOM_CODE) AS UOM," +
-                              " MIN(PARAM_VALUE_FILE_REF) AS PARAM_FILE" +
-                            " FROM [Coordinate_Operation Parameter Value]" +
+                try (ResultSet r = executeQuery("ParameterType",
+                        "SELECT PARAM_VALUE_FILE_REF FROM [Coordinate_Operation Parameter
Value]" +
+                        " WHERE (PARAMETER_CODE = ?) AND PARAM_VALUE_FILE_REF IS NOT NULL",
epsg))
+                {
+                    while (r.next()) {
+                        String element = getOptionalString(r, 1);
+                        if (element != null && !element.isEmpty()) {
+                            type = String.class;
+                            break;
+                        }
+                    }
+                }
+                /*
+                 * Search for units.   We typically have many different units but all of
the same dimension
+                 * (for example metres, kilometres, feet, etc.). In such case, the units
Set will have only
+                 * one element and that element will be the most frequently used unit.  But
some parameters
+                 * accept units of different dimensions.   For example the "Ordinate 1 of
evaluation point"
+                 * (EPSG:8617) parameter value may be in metres or in degrees.   In such
case the units Set
+                 * will have two elements.
+                 */
+                final Set<Unit<?>> units = new LinkedHashSet<>();
+                try (ResultSet r = executeQuery("ParameterUnit",
+                        "SELECT UOM_CODE FROM [Coordinate_Operation Parameter Value]" +
                         " WHERE (PARAMETER_CODE = ?)" +
                         " GROUP BY UOM_CODE" +
                         " ORDER BY COUNT(UOM_CODE) DESC", epsg))
                 {
-                    if (resultUnits.next()) {
-                        String element = getOptionalString(resultUnits, 2);
-                        type = (element != null) ? String.class : Double.class;
-                        element = getOptionalString(resultUnits, 1);
-                        if (element != null) {
-                            valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY,
false,
-                                    Double.POSITIVE_INFINITY, false,
-                                    owner.createUnit(element));
+next:               while (r.next()) {
+                        final String c = getOptionalString(r, 1);
+                        if (c != null) {
+                            final Unit<?> candidate = owner.createUnit(c);
+                            for (final Unit<?> e : units) {
+                                if (candidate.isCompatible(e)) {
+                                    continue next;
+                                }
+                            }
+                            units.add(candidate);
                         }
-                    } else {
-                        type = Double.class;
                     }
                 }
                 /*
                  * Now creates the parameter descriptor.
                  */
+                final NumberRange<?> valueDomain;
+                switch (units.size()) {
+                    case 0:  valueDomain = null; break;
+                    default: valueDomain = new EPSGParameterDomain(units); break;
+                    case 1:  valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY,
false,
+                                    Double.POSITIVE_INFINITY, false, CollectionsExt.first(units));
break;
+                }
                 final ParameterDescriptor<?> descriptor = new DefaultParameterDescriptor<>(
                         createProperties("Coordinate_Operation Parameter", name, epsg, remarks,
deprecated),
                         1, 1, type, valueDomain, null, null);

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -31,6 +31,7 @@ import java.util.regex.Pattern;
 import java.io.BufferedReader;
 import org.apache.sis.util.StringBuilders;
 import org.apache.sis.internal.metadata.sql.ScriptRunner;
+import org.apache.sis.internal.metadata.sql.SQLUtilities;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.CharSequences;
@@ -221,7 +222,8 @@ final class EPSGInstaller extends Script
      */
     public void run(InstallationScriptProvider scriptProvider) throws SQLException, IOException
{
         long time = System.nanoTime();
-        log(Messages.getResources(null).getLogRecord(Level.INFO, Messages.Keys.CreatingSchema_2,
Constants.EPSG, getSimplifiedURL()));
+        log(Messages.getResources(null).getLogRecord(Level.INFO, Messages.Keys.CreatingSchema_2,
Constants.EPSG,
+                SQLUtilities.getSimplifiedURL(getConnection().getMetaData())));
         if (scriptProvider == null) {
             scriptProvider = lookupProvider();
         }
@@ -251,17 +253,6 @@ final class EPSGInstaller extends Script
     }
 
     /**
-     * Returns a simplified form of the URL (truncated before the first ? or ; character),
-     * for logging purpose only.
-     */
-    private String getSimplifiedURL() throws SQLException {
-        String url = getConnection().getMetaData().getURL();
-        int s1 = url.indexOf('?'); if (s1 < 0) s1 = url.length();
-        int s2 = url.indexOf(';'); if (s2 < 0) s2 = url.length();
-        return url.substring(0, Math.min(s1, s2));
-    }
-
-    /**
      * Logs a message reporting the failure to create EPSG database.
      */
     final void logFailure(final Locale locale) {

Modified: sis/branches/JDK8/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG.sql
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG.sql?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG.sql
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG.sql
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -5,6 +5,21 @@
 
 
 --
+-- Corrections to some deprecated Coordinate Reference Systems (CRS).  The errors that we
fix here are known to EPSG,
+-- but were fixed by deprecating the erroneous CRS and creating a new one. This approach
allows reproductive behavior
+-- of applications that used the erroneous CRS. However in a few cases, Apache SIS can not
instantiate the deprecated
+-- object without some minimal corrections. The following UPDATEs perform the minimal amount
of changes needed by SIS.
+--
+
+-- "Scale factor at natural origin" (EPSG:8805) shall be dimensionless (EPSG:9201), not in
"m" units (EPSG:9001).
+UPDATE epsg_coordoperationparamvalue SET uom_code = 9201 WHERE parameter_code = 8805 AND
uom_code = 9001;
+
+-- Value 44°87′ is illegal for DMS units (EPSG:9110). A value equivalent to the erroneous
DMS value is 45°27′.
+UPDATE epsg_coordoperationparamvalue SET parameter_value = 45.27 WHERE parameter_value =
44.87 AND uom_code = 9110;
+
+
+
+--
 -- Additional indexes for the EPSG database. Those indexes are not declared
 -- in the SQL scripts distributed by EPSG. They are not required for proper
 -- working of the EPSG factory, but can significantly improve performances.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -47,12 +47,12 @@ import java.nio.charset.StandardCharsets
  *
  * <ol class="verbose">
  *   <li><p>Download the latest SQL scripts for PostgreSQL from <a href="http://www.epsg.org">http://www.epsg.org</a>.</p></li>
- *   <li><p>Unzip in the directory of your choice (replace "8.8" by the appropriate
version number in the ZIP filename),
+ *   <li><p>Unzip in the directory of your choice (replace "8_9" by the appropriate
version number in the ZIP filename),
  *          and remember the path to that directory:</p>
  *
  *          {@preformat text
- *            unzip epsg-v8_8sql-PostgreSQL.zip
- *            cd epsg-v8_8sql-PostgreSQL
+ *            unzip epsg-v8_9sql-PostgreSQL.zip
+ *            cd epsg-v8_9sql-PostgreSQL
  *            export EPSG_SCRIPTS=$PWD
  *          }
  *   </li>
@@ -120,7 +120,7 @@ public final class EPSGDataFormatter ext
      * The values of those arguments are typically:
      *
      * <ol>
-     *   <li>{@code EPSG_vX.mdb_Data_MySQL.sql}</li>
+     *   <li>{@code EPSG_vX.mdb_Data_PostgreSQL.sql}</li>
      *   <li>{@code core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/Data.sql}</li>
      * </ol>
      *

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -135,8 +135,12 @@ public final strictfp class CoordinateRe
         rd("Chatham Islands Datum 1979",                                  "Chatham Islands
Datum");
         rd("Corrego Alegre 1961",                                         "Corrego Alegre");
         rd("Corrego Alegre 1970-72",                                      "Corrego Alegre");
+        rd("Danger 1950",                                                 "Saint Pierre et
Miquelon 1950");
+        rd("Dansk Normal Nul",                                            "Dansk");
+        rd("Dansk Vertikal Reference 1990",                               "Dansk");
         rd("Dealul Piscului 1930",                                        "Dealul Piscului");
         rd("Dealul Piscului 1970",                                        "Dealul Piscului");
+        rd("Deutsches Haupthoehennetz 1912",                              "Deutsches Haupthoehennetz");
         rd("Deutsches Haupthoehennetz 1985",                              "Deutsches Haupthoehennetz");
         rd("Deutsches Haupthoehennetz 1992",                              "Deutsches Haupthoehennetz");
         rd("Douala 1948",                                                 "Douala");
@@ -239,12 +243,14 @@ public final strictfp class CoordinateRe
         rd("Kuwait Utility",                                              "Kuwait Oil Company
/ Kuwait Utility");
         rd("Lao 1993",                                                    "Lao");
         rd("Lao National Datum 1997",                                     "Lao");
+        rd("Latvia 1992",                                                 "Latvia");
+        rd("Latvian Height System 2000",                                  "Latvia");
         rd("Lisbon 1890",                                                 "Lisbon");
         rd("Lisbon 1890 (Lisbon)",                                        "Lisbon");
         rd("Lisbon 1937",                                                 "Lisbon");
         rd("Lisbon 1937 (Lisbon)",                                        "Lisbon");
-        rd("Lower Low Water Large Tide", "Low Water");
-        rd("Lowest Astronomic Tide", "Low Water");
+        rd("Lower Low Water Large Tide",                                  "Low Water");
+        rd("Lowest Astronomic Tide",                                      "Low Water");
         rd("Makassar (Jakarta)",                                          "Makassar");
         rd("Manoca 1962",                                                 "Manoca");
         rd("Martinique 1938",                                             "Martinique");
@@ -319,6 +325,8 @@ public final strictfp class CoordinateRe
         rd("Rikets hojdsystem 1900",                                      "Rikets hojdsystem");
         rd("Rikets hojdsystem 1970",                                      "Rikets hojdsystem");
         rd("Rikets hojdsystem 2000",                                      "Rikets hojdsystem");
+        rd("Santa Cruz da Graciosa",                                      "Santa Cruz");
+        rd("Santa Cruz das Flores",                                       "Santa Cruz");
         rd("Sierra Leone 1968",                                           "Sierra Leone");
         rd("Sierra Leone Colony 1924",                                    "Sierra Leone");
         rd("SIRGAS-Chile",                                                "SIRGAS");
@@ -446,7 +454,7 @@ public final strictfp class CoordinateRe
         properties.setProperty("PRODUCT.URL",     "http://sis.apache.org");
         properties.setProperty("JAVADOC.GEOAPI",  "http://www.geoapi.org/snapshot/javadoc");
         properties.setProperty("FACTORY.NAME",    "EPSG");
-        properties.setProperty("FACTORY.VERSION", "8.8");
+        properties.setProperty("FACTORY.VERSION", "8.9");
         properties.setProperty("FACTORY.VERSION.SUFFIX", ", together with other sources");
         properties.setProperty("DESCRIPTION", "<p><b>Notation:</b></p>\n"
+
                 "<ul>\n" +

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -75,7 +75,7 @@ public final class CollectionsExt extend
     public static <T> T first(final Iterable<T> collection) {
         if (collection != null) {
             final Iterator<T> it = collection.iterator();
-            if (it != null && it.hasNext()) { // This check for null is paranoiac.
+            if (it != null && it.hasNext()) {                       // This check
for null is paranoiac.
                 return it.next();
             }
         }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8]
(original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8]
Wed Feb 17 18:30:18 2016
@@ -22,6 +22,7 @@ import java.util.FormattableFlags;
 import java.io.Serializable;
 import javax.measure.unit.Unit;
 import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Emptiable;
@@ -675,9 +676,13 @@ public class Range<E extends Comparable<
         }
         final Unit<?> unit = unit();
         if (unit != null) {
-            // No need to check if we should omit the space because Unit.toString()
-            // uses UCUM format, so we will never have symbol like the ° one.
-            buffer.append(' ').append(unit);
+            final String symbol = PatchedUnitFormat.toString(unit);
+            if (!symbol.isEmpty()) {
+                if (Character.isLetterOrDigit(symbol.codePointAt(0))) {
+                    buffer.append(' ');
+                }
+                buffer.append(symbol);
+            }
         }
         return buffer.toString();
     }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -277,8 +277,9 @@ class SexagesimalConverter extends UnitC
          * @param  unit  The vocabulary key for the field (minutes or seconds).
          * @return The exception to throw.
          */
-        private static IllegalArgumentException illegalField(final double value, final double
field, final int unit) {
-            return new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentField_4,
"angle", value, unit, field));
+        private static IllegalArgumentException illegalField(final double value, final double
field, final short unit) {
+            return new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentField_4,
+                    "angle", value, Vocabulary.format(unit), field));
         }
     }
 }

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java?rev=1730895&r1=1730894&r2=1730895&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
[UTF-8] Wed Feb 17 18:30:18 2016
@@ -84,7 +84,7 @@ public final strictfp class MeasurementR
         MeasurementRange<Float> range = MeasurementRange.create(10f, true, 20f, true,
SI.KILOMETRE);
         assertEquals("[10.0 … 20.0] km", range.toString());
         range = MeasurementRange.create(10f, true, 20f, true, NonSI.DEGREE_ANGLE);
-        assertEquals("[10.0 … 20.0] deg", range.toString());
+        assertEquals("[10.0 … 20.0]°", range.toString());
     }
 
     /**




Mime
View raw message