sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1727581 [3/5] - in /sis/trunk: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metad...
Date Fri, 29 Jan 2016 13:35:44 GMT
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -221,13 +221,15 @@ public abstract class ConcurrentAuthorit
     /**
      * {@code true} if the call to {@link #closeExpired()} is scheduled for future execution in the background
      * cleaner thread. A value of {@code true} implies that this factory contains at least one active data access.
-     * However the reciprocal is not true: this field may be set to {@code false} while a worker factory is currently
-     * in use because this field is set to {@code true} only when a worker factory is {@linkplain #release() released}.
+     * However the reciprocal is not true: this field may be set to {@code false} while a DAO is currently in use
+     * because this field is set to {@code true} only when a worker factory is {@linkplain #release released}.
      *
      * <p>Note that we can not use {@code !availableDAOs.isEmpty()} as a replacement of {@code isCleanScheduled}
      * because the queue is empty if all Data Access Objects are currently in use.</p>
      *
      * <p>Every access to this field must be performed in a block synchronized on {@link #availableDAOs}.</p>
+     *
+     * @see #isCleanScheduled()
      */
     private boolean isCleanScheduled;
 
@@ -313,6 +315,8 @@ public abstract class ConcurrentAuthorit
     /**
      * Returns the number of Data Access Objects available for reuse. This count does not include the
      * Data Access Objects that are currently in use. This method is used only for testing purpose.
+     *
+     * @see #isCleanScheduled()
      */
     @Debug
     final int countAvailableDataAccess() {
@@ -481,6 +485,23 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
+     * {@code true} if the call to {@link #closeExpired()} is scheduled for future execution in the background
+     * cleaner thread. A value of {@code true} implies that this factory contains at least one active data access.
+     * However the reciprocal is not true: this field may be set to {@code false} while a DAO is currently in use
+     * because this field is set to {@code true} only when a worker factory is {@linkplain #release released}.
+     *
+     * <p>This method is used only for testing purpose.</p>
+     *
+     * @see #countAvailableDataAccess()
+     */
+    @Debug
+    final boolean isCleanScheduled() {
+        synchronized (availableDAOs) {
+            return isCleanScheduled;
+        }
+    }
+
+    /**
      * Confirms that the given factories can be closed. If any factory is still in use,
      * it will be removed from that {@cod factories} list and re-injected in the {@link #availableDAOs} queue.
      */
@@ -659,7 +680,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns the organization or party responsible for definition and maintenance of the underlying database.
+     * Returns the database or specification that defines the codes recognized by this factory.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Returns the cached value if it exists.</li>
@@ -771,9 +792,8 @@ public abstract class ConcurrentAuthorit
      *
      * <p>The default implementation performs the following steps:</p>
      * <ol>
-     *   <li>Removes the authority scope if presents. For example if the {@linkplain #getAuthority() authority}
-     *       is EPSG and the given code starts with the {@code "EPSG:"} prefix, then that prefix is removed.
-     *       Otherwise, the scope is unchanged.</li>
+     *   <li>Removes the namespace if presents. For example if the {@linkplain #getCodeSpaces() codespace}
+     *       is EPSG and the given code starts with the {@code "EPSG:"} prefix, then that prefix is removed.</li>
      *   <li>Removes leading and trailing spaces.</li>
      * </ol>
      *
@@ -786,7 +806,7 @@ public abstract class ConcurrentAuthorit
      * @throws FactoryException if an error occurred while normalizing the given code.
      */
     protected String normalizeCode(String code) throws FactoryException {
-        return trimAuthority(code, null);
+        return trimNamespace(code);
     }
 
     /**
@@ -836,7 +856,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a geographic coordinate reference system from a code.
+     * Returns a 2- or 3-dimensional coordinate reference system based on an ellipsoidal approximation of the geoid.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -859,7 +879,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a geocentric coordinate reference system from a code.
+     * Returns a 3-dimensional coordinate reference system with the origin at the approximate centre of mass of the earth.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -882,7 +902,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a projected coordinate reference system from a code.
+     * Returns a 2-dimensional coordinate reference system used to approximate the shape of the earth on a planar surface.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -905,7 +925,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a vertical coordinate reference system from a code.
+     * Returns a 1-dimensional coordinate reference system used for recording heights or depths.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -928,7 +948,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a temporal coordinate reference system from a code.
+     * Returns a 1-dimensional coordinate reference system used for the recording of time.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -951,7 +971,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a 3D or 4D coordinate reference system from a code.
+     * Returns a CRS describing the position of points through two or more independent coordinate reference systems.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -974,7 +994,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a derived coordinate reference system from a code.
+     * Returns a CRS that is defined by its coordinate conversion from another CRS (not by a datum).
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -997,7 +1017,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an engineering coordinate reference system from a code.
+     * Returns a 1-, 2- or 3-dimensional contextually local coordinate reference system.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1020,7 +1040,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an image coordinate reference system from a code.
+     * Returns a 2-dimensional engineering coordinate reference system applied to locations in images.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1043,7 +1063,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an arbitrary datum from a code.
+     * Returns an arbitrary datum from a code. The returned object will typically be an
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1066,7 +1086,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a geodetic datum from a code.
+     * Returns a datum defining the location and orientation of an ellipsoid that approximates the shape of the earth.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1089,7 +1109,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a vertical datum from a code.
+     * Returns a datum identifying a particular reference level surface used as a zero-height surface.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1112,7 +1132,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a temporal datum from a code.
+     * Returns a datum defining the origin of a temporal coordinate reference system.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1135,7 +1155,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an engineering datum from a code.
+     * Returns a datum defining the origin of an engineering coordinate reference system.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1158,7 +1178,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an image datum from a code.
+     * Returns a datum defining the origin of an image coordinate reference system.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1181,7 +1201,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an ellipsoid from a code.
+     * Returns a geometric figure that can be used to describe the approximate shape of the earth.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1204,7 +1224,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a prime meridian from a code.
+     * Returns a prime meridian defining the origin from which longitude values are determined.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1227,7 +1247,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an extent (usually a domain of validity) from a code.
+     * Returns information about spatial, vertical, and temporal extent (usually a domain of validity) from a code.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1272,7 +1292,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an ellipsoidal coordinate system from a code.
+     * Returns a 2- or 3-dimensional coordinate system for geodetic latitude and longitude, sometime with ellipsoidal height.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1295,7 +1315,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a vertical coordinate system from a code.
+     * Returns a 1-dimensional coordinate system for heights or depths of points.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1318,7 +1338,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a temporal coordinate system from a code.
+     * Returns a 1-dimensional coordinate system for heights or depths of points.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1341,7 +1361,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a Cartesian coordinate system from a code.
+     * Returns a 2- or 3-dimensional Cartesian coordinate system made of straight orthogonal axes.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1364,7 +1384,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a spherical coordinate system from a code.
+     * Returns a 3-dimensional coordinate system with one distance measured from the origin and two angular coordinates.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1387,7 +1407,8 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a cylindrical coordinate system from a code.
+     * Returns a 3-dimensional coordinate system made of a polar coordinate system
+     * extended by a straight perpendicular axis.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1410,7 +1431,8 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a polar coordinate system from a code.
+     * Returns a 2-dimensional coordinate system for coordinates represented by a distance from the origin
+     * and an angle from a fixed direction.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1433,7 +1455,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a coordinate system axis from a code.
+     * Returns a coordinate system axis with name, direction, unit and range of values.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1478,7 +1500,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns a parameter descriptor from a code.
+     * Returns a definition of a single parameter used by an operation method.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1501,7 +1523,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an operation method from a code.
+     * Returns a description of the algorithm and parameters used to perform a coordinate operation.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1524,7 +1546,7 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
-     * Returns an operation from a code.
+     * Returns an operation for transforming coordinates in the source CRS to coordinates in the target CRS.
      * The default implementation performs the following steps:
      * <ul>
      *   <li>Return the cached instance for the given code if such instance already exists.</li>
@@ -1792,19 +1814,6 @@ public abstract class ConcurrentAuthorit
             }
         }
 
-        /**
-         * Returns the authority of the factory examined by this finder.
-         */
-        @Override
-        public synchronized Citation getAuthority() throws FactoryException {
-            try {
-                acquire();
-                return finder.getAuthority();
-            } finally {
-                release();
-            }
-        }
-
         /**
          * Returns a set of authority codes that <strong>may</strong> identify the same
          * object than the specified one. This method delegates to the data access object.

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/FilteredCodes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/FilteredCodes.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/FilteredCodes.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/FilteredCodes.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -88,10 +88,17 @@ final class FilteredCodes extends Abstra
     }
 
     /**
-     * Ignored, except that it must be non-null.
+     * Returns a non-null value if the given code is included in the set.
      */
     @Override
     public Boolean get(final Object key) {
-        return Boolean.TRUE;
+        Class<?> t = codes.get(key);
+        if (t == null && key instanceof String) {
+            t = codes.get(CommonAuthorityFactory.reformat((String) key));
+            if (t == null) {
+                return null;
+            }
+        }
+        return type.isAssignableFrom(t) ? Boolean.TRUE : null;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -71,12 +71,12 @@ public abstract class GeodeticAuthorityF
     }
 
     /**
-     * Returns the organization or party responsible for definition and maintenance of the database.
+     * Returns the database or specification that defines the codes recognized by this factory.
      * This method may return {@code null} if it can not obtain this information, for example because
      * the connection to a database is not available.
      *
-     * <div class="note"><b>Example</b>
-     * A factory that create coordinate reference system objects from EPSG codes could return
+     * <div class="note"><b>Example:</b>
+     * a factory that create coordinate reference system objects from EPSG codes could return
      * a citation like below:
      *
      * {@preformat text
@@ -102,6 +102,43 @@ public abstract class GeodeticAuthorityF
     public abstract Citation getAuthority();
 
     /**
+     * Returns all namespaces recognized by this factory. Those namespaces can appear before codes in
+     * calls to {@code createFoo(String)} methods, for example {@code "EPSG"} in {@code "EPSG::4326"}.
+     * Namespaces are case-insensitive.
+     *
+     * <p>The namespaces are closely related to the {@linkplain #getAuthority() authority}. Often the namespace is
+     * the authority {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitation#getIdentifiers() identifier},
+     * but not always.</p>
+     *
+     * <div class="note"><b>Examples:</b>
+     * <ul class="verbose">
+     *   <li>The {@link org.apache.sis.referencing.factory.sql.EPSGFactory} authority identifier is {@code "EPSG"}
+     *       and its {@code getCodeSpaces()} method returns a set containing {@code "EPSG"}. So in this example,
+     *       authority and namespace match. That namespace value means that {@code EPSGFactory.createFoo(String)}
+     *       methods accept both {@code "EPSG::4326"} (case-insensitive) and {@code "4326"} codes as argument.</li>
+     *
+     *   <li>The {@link org.apache.sis.referencing.factory.sql.EPSGDataAccess} authority identifier is {@code "EPSG"}
+     *       but its {@code getCodeSpaces()} method returns an empty set. This means that despite the EPSG authority,
+     *       {@code EPSGDataAccess.createFoo(String)} methods accept only codes like {@code "4326"} without
+     *       {@code "EPSG:"} prefix (the reason is that {@code EPSGDataAccess} is not expected to be used directly).</li>
+     *
+     *   <li>The {@link CommonAuthorityFactory} authority identifiers are ISO 19128 and OGC 06-042 (the WMS specification)
+     *       but its {@code getCodeSpaces()} method returns a set containing {@code "CRS"}, {@code "AUTO"} and {@code "AUTO2"}.
+     *       While ISO 19128 is defined as the first authority, the namespace is actually defined by OGC.</li>
+     * </ul></div>
+     *
+     * The default implementation infers the namespace from the {@linkplain #getAuthority() authority}.
+     * Subclasses can override this method, but the set should always contain the same elements during
+     * all factory lifetime.
+     *
+     * @return The namespaces recognized by this factory, or an empty set if none.
+     */
+    public Set<String> getCodeSpaces() {
+        final String authority = Citations.getCodeSpace(getAuthority());
+        return (authority != null) ? Collections.singleton(authority) : Collections.<String>emptySet();
+    }
+
+    /**
      * Returns a description of the object corresponding to a code.
      * The description can be used for example in a combo box in a graphical user interface.
      *
@@ -750,7 +787,7 @@ public abstract class GeodeticAuthorityF
     }
 
     /**
-     * Creates 2- or 3-dimensional coordinate system for geodetic latitude and longitude,
+     * Creates a 2- or 3-dimensional coordinate system for geodetic latitude and longitude,
      * sometime with ellipsoidal height.
      *
      * <div class="note"><b>Example:</b>
@@ -1031,7 +1068,7 @@ public abstract class GeodeticAuthorityF
     }
 
     /**
-     * Creates description of the algorithm and parameters used to perform a coordinate operation.
+     * Creates a description of the algorithm and parameters used to perform a coordinate operation.
      * An {@code OperationMethod} is a kind of metadata: it does not perform any coordinate operation
      * (e.g. map projection) by itself, but tells us what is needed in order to perform such operation.
      *
@@ -1112,46 +1149,55 @@ public abstract class GeodeticAuthorityF
     }
 
     /**
-     * Returns a finder which can be used for looking up unidentified objects.
+     * Creates a finder which can be used for looking up unidentified objects.
      * The finder tries to fetch a fully {@linkplain AbstractIdentifiedObject identified object}
      * from an incomplete one, for example from an object without "{@code ID[…]}" or
      * "{@code AUTHORITY[…]}" element in <cite>Well Known Text</cite>.
      *
      * @return A finder to use for looking up unidentified objects.
      * @throws FactoryException if the finder can not be created.
+     *
+     * @see org.apache.sis.referencing.IdentifiedObjects#newFinder(String)
      */
     public IdentifiedObjectFinder newIdentifiedObjectFinder() throws FactoryException {
         return new IdentifiedObjectFinder(this);
     }
 
     /**
-     * Trims the authority scope, if present. For example if this factory is an EPSG authority factory
+     * Returns {@code true} if the given portion of the code is equal, ignoring case, to the given namespace.
+     */
+    static boolean regionMatches(final String namespace, final String code, final int start, final int end) {
+        return (namespace.length() == end - start) && code.regionMatches(true, start, namespace, 0, namespace.length());
+    }
+
+    /**
+     * Trims the namespace, if present. For example if this factory is an EPSG authority factory
      * and the specified code start with the {@code "EPSG:"} prefix, then the prefix is removed.
      * Otherwise, the string is returned unchanged (except for leading and trailing spaces).
      *
      * @param  code The code to trim.
-     * @param  authority The authority factory, or {@code null} for {@link #getAuthority()}.
-     * @return The code with the authority part removed if that part matched the expected authority.
+     * @return The code with the namespace part removed if that part matched one of the values given by
+     *         {@link #getCodeSpaces()}.
      */
-    final String trimAuthority(final String code, Citation authority) {
+    final String trimNamespace(final String code) {
         int s = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR);
         if (s >= 0) {
-            if (authority == null) {
-                authority = getAuthority();     // Costly operation for EPSGDataAccess.
-            }
-            if (Citations.identifierMatches(authority, null, code.substring(0, s))) {    // Comparison ignores spaces.
-                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 part between the two separators is the verion number, which we ignore in
-                     * this simple version.
-                     */
-                    s = n;
+            final int end   = CharSequences.skipTrailingWhitespaces(code, 0, s);
+            final int start = CharSequences.skipLeadingWhitespaces (code, 0, end);
+            for (final String codespace : getCodeSpaces()) {
+                if (regionMatches(codespace, code, start, end)) {
+                    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 part between the two separators is the verion number, which we ignore in
+                         * this simple version.
+                         */
+                        s = n;
+                    }
+                    final int length = code.length();
+                    return CharSequences.trimWhitespaces(code, s+1, length).toString();
                 }
-                final int length = code.length();
-                s = CharSequences.skipLeadingWhitespaces(code, s+1, length);
-                return code.substring(s, CharSequences.skipTrailingWhitespaces(code, s, length));
             }
         }
         return CharSequences.trimWhitespaces(code);
@@ -1191,7 +1237,7 @@ public abstract class GeodeticAuthorityF
         final Identifier id = object.getName();
         final Citation authority = (id != null) ? id.getAuthority() : getAuthority();
         throw new NoSuchAuthorityCodeException(Errors.format(Errors.Keys.UnexpectedTypeForReference_3, code, type, actual),
-                Citations.getIdentifier(authority, false), trimAuthority(code, authority), code);
+                Citations.getIdentifier(authority, false), trimNamespace(code), code);
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -23,15 +23,14 @@ import java.util.LinkedHashSet;
 import org.opengis.util.GenericName;
 import org.opengis.util.FactoryException;
 import org.opengis.metadata.Identifier;
-import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.internal.util.Citations;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.collection.BackingStoreException;
+import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
@@ -154,6 +153,13 @@ public class IdentifiedObjectFinder {
     private boolean ignoreAxes;
 
     /**
+     * {@code true} if the search should ignore names, aliases and identifiers. This is set to {@code true}
+     * only when this finder is wrapped by a {@link MultiAuthoritiesFactory} finder, which performs it own
+     * search based on identifiers.
+     */
+    boolean ignoreIdentifiers;
+
+    /**
      * Creates a finder using the specified factory.
      *
      * <div class="note"><b>Design note:</b>
@@ -186,17 +192,6 @@ public class IdentifiedObjectFinder {
     }
 
     /**
-     * Returns the authority of the factory used by this finder.
-     * The default implementation delegates to {@link GeodeticAuthorityFactory#getAuthority()}.
-     *
-     * @return The authority of the factory used for the searches, or {@code null} if unknown.
-     * @throws FactoryException If an error occurred while fetching the authority.
-     */
-    public Citation getAuthority() throws FactoryException {
-        return factory.getAuthority();
-    }
-
-    /**
      * Returns the domain of the search (for example whether to include deprecated objects in the search).
      * If {@code DECLARATION}, only a fast lookup based on embedded identifiers and names will be performed.
      * Otherwise an exhaustive full scan against all registered objects will be performed (may be slow).
@@ -305,23 +300,25 @@ public class IdentifiedObjectFinder {
             final AuthorityFactoryProxy<?> previous = proxy;
             proxy = AuthorityFactoryProxy.getInstance(object.getClass());
             try {
-                /*
-                 * First check if one of the identifiers can be used to find directly an identified object.
-                 * Verify that the object that we found is actually equal to given one; we do not blindly
-                 * trust the identifiers in the user object.
-                 */
-                IdentifiedObject candidate = createFromIdentifiers(object);
-                if (candidate != null) {
-                    return Collections.singleton(candidate);    // Not worth to cache.
-                }
-                /*
-                 * We are unable to find the object from its identifiers. Try a quick name lookup.
-                 * Some implementations like the one backed by the EPSG database are capable to find
-                 * an object from its name.
-                 */
-                candidate = createFromNames(object);
-                if (candidate != null) {
-                    return Collections.singleton(candidate);    // Not worth to cache.
+                if (!ignoreIdentifiers) {
+                    /*
+                     * First check if one of the identifiers can be used to find directly an identified object.
+                     * Verify that the object that we found is actually equal to given one; we do not blindly
+                     * trust the identifiers in the user object.
+                     */
+                    IdentifiedObject candidate = createFromIdentifiers(object);
+                    if (candidate != null) {
+                        return Collections.singleton(candidate);    // Not worth to cache.
+                    }
+                    /*
+                     * We are unable to find the object from its identifiers. Try a quick name lookup.
+                     * Some implementations like the one backed by the EPSG database are capable to find
+                     * an object from its name.
+                     */
+                    candidate = createFromNames(object);
+                    if (candidate != null) {
+                        return Collections.singleton(candidate);    // Not worth to cache.
+                    }
                 }
                 /*
                  * Here we exhausted the quick paths.
@@ -385,10 +382,15 @@ public class IdentifiedObjectFinder {
      * @see #createFromNames(IdentifiedObject)
      */
     private IdentifiedObject createFromIdentifiers(final IdentifiedObject object) throws FactoryException {
-        final Citation authority = getAuthority();
         for (final Identifier id : object.getIdentifiers()) {
-            if (Citations.identifierMatches(authority, id.getAuthority())) {
-                final String code = IdentifiedObjects.toString(id);
+            final String code = IdentifiedObjects.toString(id);
+            /*
+             * We will process only codes with a namespace (e.g. "AUTHORITY:CODE") for avoiding ambiguity.
+             * We do not try to check by ourselves if the identifier is in the namespace of the factory,
+             * because calling factory.getAuthorityCodes() or factory.getCodeSpaces() may be costly for
+             * some implementations.
+             */
+            if (code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR) >= 0) {
                 final IdentifiedObject candidate;
                 try {
                     candidate = create(code);
@@ -458,11 +460,11 @@ public class IdentifiedObjectFinder {
     /**
      * Creates an object equals (optionally ignoring metadata), to the specified object.
      * This method scans the {@linkplain #getCodeCandidates(IdentifiedObject) authority codes},
-     * create the objects and returns the first one which is equal to the specified object in
+     * creates the objects and returns the first one which is equal to the specified object in
      * the sense of {@link Utilities#deepEquals(Object, Object, ComparisonMode)}.
      *
-     * <p>This method may be used in order to get a fully {@linkplain AbstractIdentifiedObject identified
-     * object} from an object without {@linkplain AbstractIdentifiedObject#getIdentifiers() identifiers}.</p>
+     * <p>This method may be used in order to get a fully {@linkplain AbstractIdentifiedObject identified object}
+     * from an object without {@linkplain AbstractIdentifiedObject#getIdentifiers() identifiers}.</p>
      *
      * <p>Scanning the whole set of authority codes may be slow. Users should try
      * <code>{@linkplain #createFromIdentifiers createFromIdentifiers}(object)</code> and/or
@@ -476,7 +478,7 @@ public class IdentifiedObjectFinder {
      * @see #createFromIdentifiers(IdentifiedObject)
      * @see #createFromNames(IdentifiedObject)
      */
-    private Set<IdentifiedObject> createFromCodes(final IdentifiedObject object) throws FactoryException {
+    Set<IdentifiedObject> createFromCodes(final IdentifiedObject object) throws FactoryException {
         final Set<IdentifiedObject> result = new LinkedHashSet<IdentifiedObject>();     // We need to preserve order.
         for (final String code : getCodeCandidates(object)) {
             final IdentifiedObject candidate;
@@ -536,6 +538,6 @@ public class IdentifiedObjectFinder {
      * Invoked when an exception occurred during the creation of a candidate from a code.
      */
     private static void exceptionOccurred(final FactoryException exception) {
-        Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), IdentifiedObjectFinder.class, "fine", exception);
+        Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), IdentifiedObjectFinder.class, "find", exception);
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -342,9 +342,23 @@ public class EPSGDataAccess extends Geod
     }
 
     /**
-     * Returns the authority for this EPSG database. The returned citation contains the database version
+     * Returns the authority for this EPSG dataset. The returned citation contains the database version
      * in the {@linkplain Citation#getEdition() edition} attribute, together with date of last update in
      * the {@linkplain Citation#getEditionDate() edition date}.
+     * Example (the exact content will vary with Apache SIS versions, JDBC driver and EPSG dataset versions):
+     *
+     * {@preformat text
+     *   Citation
+     *   ├─ Title ……………………………………………………… EPSG Geodetic Parameter Dataset
+     *   ├─ Identifier ………………………………………… EPSG
+     *   ├─ Online resource (1 of 2)
+     *   │  ├─ Linkage ………………………………………… http://epsg-registry.org/
+     *   │  └─ 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.
+     *      └─ Function ……………………………………… Connection
+     * }
      */
     @Override
     public synchronized Citation getAuthority() {
@@ -385,6 +399,9 @@ 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.
+             *
+             * TODO: A future version should use Citations.EPSG as a template.
+             *       See the "EPSG" case in ServiceForUtility.createCitation(String).
              */
             final DatabaseMetaData metadata  = connection.getMetaData();
 addURIs:    for (int i=0; ; i++) {
@@ -527,6 +544,17 @@ addURIs:    for (int i=0; ; i++) {
     }
 
     /**
+     * Returns an empty set since this data access class expects no namespace.
+     * Code shall be given to {@code createFoo(String)} methods directly, without {@code "EPSG:"} prefix.
+     *
+     * @return Empty set.
+     */
+    @Override
+    public Set<String> getCodeSpaces() {
+        return Collections.emptySet();
+    }
+
+    /**
      * Gets a description of the object corresponding to a code.
      * This method returns the object name in a lightweight manner, without creating the full {@link IdentifiedObject}.
      *

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -16,10 +16,13 @@
  */
 package org.apache.sis.referencing.factory.sql;
 
+import java.util.Collections;
 import java.util.Locale;
+import java.util.Set;
 import java.sql.Connection;
 import java.sql.SQLException;
 import javax.sql.DataSource;
+import java.util.concurrent.TimeUnit;
 import org.opengis.util.NameFactory;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.crs.CRSFactory;
@@ -33,6 +36,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.internal.metadata.sql.Initializer;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.referencing.factory.ConcurrentAuthorityFactory;
 import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.util.ArgumentChecks;
@@ -59,6 +63,13 @@ public class EPSGFactory extends Concurr
         CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory, Localized
 {
     /**
+     * The namespace of EPSG codes.
+     *
+     * @see #getCodeSpaces()
+     */
+    private static final Set<String> CODESPACES = Collections.singleton(Constants.EPSG);
+
+    /**
      * The factory to use for creating {@link Connection}s to the EPSG database.
      */
     protected final DataSource dataSource;
@@ -168,6 +179,7 @@ public class EPSGFactory extends Concurr
         this.mtFactory    = factory(MathTransformFactory.class, mtFactory);
         this.translator   = translator;
         this.locale       = Locale.getDefault();
+        super.setTimeout(10, TimeUnit.SECONDS);
     }
 
     /**
@@ -181,6 +193,16 @@ public class EPSGFactory extends Concurr
     }
 
     /**
+     * Returns the namespace of EPSG codes.
+     *
+     * @return The {@code "EPSG"} string in a singleton map.
+     */
+    @Override
+    public Set<String> getCodeSpaces() {
+        return CODESPACES;
+    }
+
+    /**
      * Returns the locale used by this factory for producing error messages.
      * This locale does not change the way data are read from the EPSG database.
      *

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -266,7 +266,7 @@ public class DefaultMathTransformFactory
          *
          * Wrapping the ServiceLoader in a LazySet avoid this issue.
          */
-        this(new LazySet<OperationMethod>(ServiceLoader.load(OperationMethod.class).iterator()));
+        this(new LazySet<OperationMethod>(ServiceLoader.load(OperationMethod.class)));
     }
 
     /**
@@ -1299,8 +1299,7 @@ public class DefaultMathTransformFactory
             methodsByName.clear();
             Iterable<? extends OperationMethod> m = methods;
             if (m instanceof LazySet<?>) { // Workaround for JDK bug. See DefaultMathTransformFactory() constructor.
-                ((LazySet<?>) m).reload();
-                m = ((LazySet<? extends OperationMethod>) m).source;
+                m = ((LazySet<? extends OperationMethod>) m).reload();
             }
             if (m instanceof ServiceLoader<?>) {
                 ((ServiceLoader<?>) m).reload();

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -255,7 +255,7 @@ abstract class MolodenskyFormula extends
      *   <li><cite>"X-axis translation"</cite> (Molodensky only)</li>
      *   <li><cite>"Y-axis translation"</cite> (Molodensky only)</li>
      *   <li><cite>"Z-axis translation"</cite> (Molodensky only)</li>
-     *   <li><cite>"Geocentric translations file"</cite> (Geocentric interpolations only)</li>
+     *   <li><cite>"Geocentric translation file"</cite> (Geocentric interpolations only)</li>
      *   <li><cite>"Semi-major axis length difference"</cite> (Always for Molodensky, internal WKT only for geocentric interpolations)</li>
      *   <li><cite>"Flattening difference"</cite> (Always for Molodensky, internal WKT only for geocentric interpolations)</li>
      * </ul>

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -19,12 +19,12 @@ package org.apache.sis.referencing.opera
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Set;
-import java.util.AbstractSet;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.ServiceLoader;
 import org.opengis.referencing.operation.SingleOperation;
 import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.internal.util.SetOfUnknownSize;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 
 
@@ -43,10 +43,10 @@ import org.apache.sis.referencing.operat
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
-final class OperationMethodSet extends AbstractSet<OperationMethod> {
+final class OperationMethodSet extends SetOfUnknownSize<OperationMethod> {
     /**
      * The operation type we are looking for.
      */
@@ -163,6 +163,14 @@ final class OperationMethodSet extends A
     }
 
     /**
+     * Returns {@code true} if the {@link #size()} method is cheap.
+     */
+    @Override
+    protected synchronized boolean isSizeKnown() {
+        return methodIterator == null;
+    }
+
+    /**
      * Returns {@code true} if {@link #next(int)} can return an operation method at the given index.
      */
     final synchronized boolean hasNext(final int index) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -272,16 +272,16 @@ public class TransformSeparator {
      * Returns the input dimensions to keep or kept in the separated transform.
      * This method performs the first applicable action in the following list:
      *
-     * <ol>
-     *   <li><p>Source dimensions have been explicitly set by at least one call to {@link #addSourceDimensions(int...)}
+     * <ol class="verbose">
+     *   <li>Source dimensions have been explicitly set by at least one call to {@link #addSourceDimensions(int...)}
      *       or {@link #addSourceDimensionRange(int, int)} since construction or since last call to {@link #clear()}.
-     *       In such case, this method returns all specified source dimensions.</p></li>
+     *       In such case, this method returns all specified source dimensions.</li>
      *
-     *   <li><p>No source dimensions were set but {@link #separate()} has been invoked.
+     *   <li>No source dimensions were set but {@link #separate()} has been invoked.
      *       In such case, this method returns the sequence of source dimensions that {@code separate()} chooses to retain.
-     *       It is often, but not necessarily, all source dimensions of the transform given at construction time.</p></li>
+     *       It is often, but not necessarily, all source dimensions of the transform given at construction time.</li>
      *
-     *   <li><p>Otherwise an exception is thrown.</p></li>
+     *   <li>Otherwise an exception is thrown.</li>
      * </ol>
      *
      * @return The input dimension as a sequence of strictly increasing values.
@@ -333,16 +333,16 @@ public class TransformSeparator {
      * Returns the output dimensions to keep or kept in the separated transform.
      * This method performs the first applicable action in the following list:
      *
-     * <ol>
-     *   <li><p>Target dimensions have been explicitly set by at least one call to {@link #addTargetDimensions(int...)}
+     * <ol class="verbose">
+     *   <li>Target dimensions have been explicitly set by at least one call to {@link #addTargetDimensions(int...)}
      *       or {@link #addTargetDimensionRange(int, int)} since construction or since last call to {@link #clear()}.
-     *       In such case, this method returns all specified target dimensions.</p></li>
+     *       In such case, this method returns all specified target dimensions.</li>
      *
-     *   <li><p>No target dimensions were set but {@link #separate()} has been invoked.
+     *   <li>No target dimensions were set but {@link #separate()} has been invoked.
      *       In such case, the target dimensions are inferred automatically from the {@linkplain #getSourceDimensions()
-     *       source dimensions} and the transform.</p></li>
+     *       source dimensions} and the transform.</li>
      *
-     *   <li><p>Otherwise an exception is thrown.</p></li>
+     *   <li>Otherwise an exception is thrown.</li>
      * </ol>
      *
      * @return The output dimension as a sequence of strictly increasing values.
@@ -362,14 +362,14 @@ public class TransformSeparator {
      * source dimensions} and return only the {@linkplain #addTargetDimensions(int...) specified target dimensions}.
      * If the source or target dimensions were not specified, then they will be inferred as below:
      *
-     * <ul>
-     *   <li><p>If source dimensions were unspecified, then the returned transform will keep at least all source
+     * <ul class="verbose">
+     *   <li>If source dimensions were unspecified, then the returned transform will keep at least all source
      *       dimensions needed for computing the specified target dimensions. In many cases the returned transform
      *       unconditionally keep all source dimensions, but not necessarily. If all source dimensions need to be
-     *       kept, it is better to {@linkplain #addSourceDimensionRange(int, int) specify that explicitely}.</p></li>
+     *       kept, it is better to {@linkplain #addSourceDimensionRange(int, int) specify that explicitely}.</li>
      *
-     *   <li><p>If target dimensions were unspecified, then the returned transform will expect only the specified
-     *       source dimensions as inputs, and the target dimensions will be inferred automatically.</p></li>
+     *   <li>If target dimensions were unspecified, then the returned transform will expect only the specified
+     *       source dimensions as inputs, and the target dimensions will be inferred automatically.</li>
      * </ul>
      *
      * The source and target dimensions actually used can be queried by calls to {@link #getSourceDimensions()}
@@ -446,7 +446,7 @@ public class TransformSeparator {
      *
      * <p>Subclasses can override this method if they need to handle some {@code MathTransform} implementations
      * in a special way. However all implementations of this method shall obey to the following contract:</p>
-     * <ul>
+     * <ul class="verbose">
      *   <li>{@link #sourceDimensions} and {@link #targetDimensions} should not be assumed accurate
      *       since they may be temporarily outdated or modified during recursive calls to this method.</li>
      *   <li>{@link #sourceDimensions} should not be modified by this method.</li>

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -22,6 +22,10 @@ import org.opengis.referencing.crs.Singl
 import org.opengis.util.FactoryException;
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.Utilities;
+
+// Test imports
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -35,18 +39,23 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.7
  * @module
  */
 @DependsOn({
-    CommonCRSTest.class
+    CommonCRSTest.class,
+    AuthorityFactoriesTest.class
 })
 public final strictfp class CRSTest extends TestCase {
     /**
      * Asserts that the result of {@link CRS#forCode(String)} is the given CRS.
      */
     private static void verifyForCode(final SingleCRS expected, final String code) throws FactoryException {
-        assertSame(code, expected, CRS.forCode(code));
+        final CoordinateReferenceSystem actual = CRS.forCode(code);
+        assertTrue(code, Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG));
+        if (!EPSGFactoryFallback.FORCE_HARDCODED) {
+            assertSame(code, expected, actual);
+        }
     }
 
     /**
@@ -60,6 +69,7 @@ public final strictfp class CRSTest exte
     public void testForEpsgCode() throws FactoryException {
         verifyForCode(CommonCRS.WGS84 .geographic(),   "EPSG:4326");
         verifyForCode(CommonCRS.WGS84 .geographic(),   "urn:ogc:def:crs:EPSG::4326");
+        verifyForCode(CommonCRS.WGS84 .geographic(),   "urn:x-ogc:def:crs:EPSG::4326");
         verifyForCode(CommonCRS.WGS84 .geographic(),   "http://www.opengis.net/gml/srs/epsg.xml#4326");
         verifyForCode(CommonCRS.WGS72 .geographic(),   "EPSG:4322");
         verifyForCode(CommonCRS.SPHERE.geographic(),   "EPSG:4047");
@@ -74,7 +84,13 @@ public final strictfp class CRSTest exte
         verifyForCode(CommonCRS.WGS72 .geographic3D(), "EPSG:4985");
         verifyForCode(CommonCRS.ETRS89.geographic3D(), "EPSG:4937");
         verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(), "EPSG:5714");
-        verifyForCode(CommonCRS.Vertical.DEPTH.crs(), "EPSG:5715");
+        /*
+         * Following test is skipped when using the EPSG factory because EPSG uses
+         * the "Gravity-related depth" axis name while ISO 19111 mandates "Depth".
+         */
+        if (EPSGFactoryFallback.PENDING_NEXT_EPSG) {
+            verifyForCode(CommonCRS.Vertical.DEPTH.crs(), "EPSG:5715");
+        }
     }
 
     /**
@@ -90,6 +106,8 @@ public final strictfp class CRSTest exte
         verifyForCode(CommonCRS.WGS84.normalizedGeographic(), "CRS:84");
         verifyForCode(CommonCRS.NAD83.normalizedGeographic(), "CRS:83");
         verifyForCode(CommonCRS.NAD27.normalizedGeographic(), "CRS:27");
+        verifyForCode(CommonCRS.WGS84.normalizedGeographic(), "http://www.opengis.net/gml/srs/crs.xml#84");
+        verifyForCode(CommonCRS.NAD83.normalizedGeographic(), "http://www.opengis.net/gml/srs/crs.xml#83");
     }
 
     /**
@@ -234,4 +252,16 @@ public final strictfp class CRSTest exte
         assertEquals(0,          CRS.getGreenwichLongitude(HardCodedCRS.WGS84), STRICT);
         assertEquals(2.33722917, CRS.getGreenwichLongitude(HardCodedCRS.NTF),   1E-12);
     }
+
+    /**
+     * Tests {@link IdentifiedObjects#lookupEPSG(IdentifiedObject)} and
+     * {@link IdentifiedObjects#lookupURN(IdentifiedObject, Citation)}.
+     *
+     * @throws FactoryException if an error occurred during the lookup.
+     */
+    @Test
+    public void testIdentifiedObjectLookup() throws FactoryException {
+        IdentifiedObjectsTest.testLookupEPSG();
+        IdentifiedObjectsTest.testLookupWMS();
+    }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -18,8 +18,6 @@ package org.apache.sis.referencing;
 
 import java.util.Date;
 import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.util.FactoryException;
-import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
@@ -165,10 +163,13 @@ public final strictfp class CommonCRSTes
                  */
                 Validators.validate(crs);
             }
-            assertSame  (name, datum,          e.datum()); // Datum before CRS creation.
-            assertSame  (name, crs.getDatum(), e.datum()); // Datum after CRS creation.
+            assertSame  (name, datum,          e.datum());                      // Datum before CRS creation.
+            assertSame  (name, crs.getDatum(), e.datum());                      // Datum after CRS creation.
             assertEquals(name, datumName, datum.getName().getCode());
             assertEquals(name, datumType, datum.getVerticalDatumType());
+            if (!EPSGFactoryFallback.PENDING_NEXT_EPSG && e == CommonCRS.Vertical.DEPTH) {
+                continue;   // Pending the renaming of "Gravity-related depth" as "Depth" in EPSG database.
+            }
             assertEquals(name, axisName,  crs.getCoordinateSystem().getAxis(0).getName().getCode());
         }
     }
@@ -222,43 +223,4 @@ public final strictfp class CommonCRSTes
         assertSame("Expected a cached instance.", crs, CommonCRS.WGS72.UTM(-45, -122));
         assertNotSame("Expected a new instance.", crs, CommonCRS.WGS72.UTM(+45, -122));
     }
-
-    /**
-     * Tests {@link CommonCRS#forCode(String, String, FactoryException)}.
-     *
-     * @throws FactoryException If a CRS can not be constructed.
-     *
-     * @see CRSTest#testForEpsgCode()
-     * @see CRSTest#testForCrsCode()
-     *
-     * @since 0.5
-     */
-    @Test
-    public void testForCode() throws FactoryException {
-        verifyForCode(CommonCRS.WGS84 .geographic(),            Constants.EPSG, "4326");
-        verifyForCode(CommonCRS.WGS72 .geographic(),            Constants.EPSG, "4322");
-        verifyForCode(CommonCRS.SPHERE.geographic(),            Constants.EPSG, "4047");
-        verifyForCode(CommonCRS.NAD83 .geographic(),            Constants.EPSG, "4269");
-        verifyForCode(CommonCRS.NAD27 .geographic(),            Constants.EPSG, "4267");
-        verifyForCode(CommonCRS.ETRS89.geographic(),            Constants.EPSG, "4258");
-        verifyForCode(CommonCRS.ED50  .geographic(),            Constants.EPSG, "4230");
-        verifyForCode(CommonCRS.WGS84 .geocentric(),            Constants.EPSG, "4978");
-        verifyForCode(CommonCRS.WGS72 .geocentric(),            Constants.EPSG, "4984");
-        verifyForCode(CommonCRS.ETRS89.geocentric(),            Constants.EPSG, "4936");
-        verifyForCode(CommonCRS.WGS84 .geographic3D(),          Constants.EPSG, "4979");
-        verifyForCode(CommonCRS.WGS72 .geographic3D(),          Constants.EPSG, "4985");
-        verifyForCode(CommonCRS.ETRS89.geographic3D(),          Constants.EPSG, "4937");
-        verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(),  Constants.EPSG, "5714");
-        verifyForCode(CommonCRS.Vertical.DEPTH.crs(),           Constants.EPSG, "5715");
-        verifyForCode(CommonCRS.WGS84.normalizedGeographic(),   Constants.CRS,  "84");
-        verifyForCode(CommonCRS.NAD83.normalizedGeographic(),   Constants.CRS,  "83");
-        verifyForCode(CommonCRS.NAD27.normalizedGeographic(),   Constants.CRS,  "27");
-    }
-
-    /**
-     * Asserts that the result of {@link CommonCRS#forCode(String, String, FactoryException)} is the given CRS.
-     */
-    private static void verifyForCode(final SingleCRS expected, final String authority, final String code) throws FactoryException {
-        assertSame(code, expected, CommonCRS.forCode(authority, code, null));
-    }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -18,8 +18,11 @@ package org.apache.sis.referencing;
 
 import org.opengis.util.GenericName;
 import org.opengis.util.NameFactory;
+import org.opengis.util.FactoryException;
+import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.test.mock.IdentifiedObjectMock;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -30,10 +33,13 @@ import static org.apache.sis.referencing
 
 /**
  * Tests the {@link IdentifiedObjects} static methods.
+ * This test class intentionally declares {@code testLookup()} method without {@link Test} annotation
+ * because those tests should not be executed only after the EPSG tests. Those tests will be executed
+ * by {@link CRSTest} instead.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 public final strictfp class IdentifiedObjectsTest extends TestCase {
@@ -73,4 +79,40 @@ public final strictfp class IdentifiedOb
         assertTrue (isHeuristicMatchForName(object, "Réunion"));
         assertTrue (isHeuristicMatchForName(object, "Reunion"));
     }
+
+    /**
+     * Tests {@link IdentifiedObjects#lookupEPSG(IdentifiedObject)} and
+     * {@link IdentifiedObjects#lookupURN(IdentifiedObject, Citation)}
+     * with a CRS which is expected to be found in the EPSG dataset.
+     *
+     * <p>This method is intentionally not annotated with {@link Test}.
+     * See class javadoc for explanation.</p>
+     *
+     * @throws FactoryException if an error occurred during the lookup.
+     *
+     * @see CRSTest#testIdentifiedObjectLookup()
+     */
+    public static void testLookupEPSG() throws FactoryException {
+        assertEquals("EPSG:4326", Integer.valueOf(4326), IdentifiedObjects.lookupEPSG(HardCodedCRS.WGS84_φλ));
+        String urn = IdentifiedObjects.lookupURN(HardCodedCRS.WGS84_φλ, null);
+        assertTrue(urn, urn.matches("urn\\:ogc\\:def\\:crs\\:EPSG\\:.*\\:4326"));
+    }
+
+    /**
+     * Tests {@link IdentifiedObjects#lookupEPSG(IdentifiedObject)} and
+     * {@link IdentifiedObjects#lookupURN(IdentifiedObject, Citation)}.
+     * with a CRS which is expected to be found in the WMS definitions.
+     *
+     * <p>This method is intentionally not annotated with {@link Test}.
+     * See class javadoc for explanation.</p>
+     *
+     * @throws FactoryException if an error occurred during the lookup.
+     *
+     * @see CRSTest#testIdentifiedObjectLookup()
+     */
+    public static void testLookupWMS() throws FactoryException {
+        assertNull("CRS:84", IdentifiedObjects.lookupEPSG(HardCodedCRS.WGS84));
+        String urn = IdentifiedObjects.lookupURN(HardCodedCRS.WGS84, null);
+        assertTrue(urn, urn.matches("urn\\:ogc\\:def\\:crs\\:OGC\\:.*\\:CRS84"));
+    }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -32,7 +32,7 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.internal.util.Constants;
 
 // Test dependencies
-import org.apache.sis.test.mock.GeodeticDatumMock;
+import org.apache.sis.referencing.datum.GeodeticDatumMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -194,7 +194,7 @@ public final strictfp class StandardDefi
         crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.NAVD88.crs, datum);
         assertEquals("name", "NAVD88 height", crs.getName().getCode());
         assertEquals("identifier", "5703", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
-        assertEquals("identifier",   "88", IdentifiedObjects.getIdentifier(crs, Citations.OGC ).getCode());
+        assertEquals("identifier",   "88", IdentifiedObjects.getIdentifier(crs, Citations.WMS ).getCode());
         assertEquals("direction", AxisDirection.UP, crs.getCoordinateSystem().getAxis(0).getDirection());
 
         datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.MEAN_SEA_LEVEL.datum);

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -30,7 +30,6 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.test.mock.GeodeticDatumMock.WGS84;
 
 
 /**
@@ -52,7 +51,7 @@ public final strictfp class BursaWolfPar
      * Area of validity is the World.
      */
     static BursaWolfParameters createWGS72_to_WGS84() {
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(WGS84, Extents.WORLD);
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(GeodeticDatumMock.WGS84, Extents.WORLD);
         bursaWolf.tZ = 4.5;
         bursaWolf.rZ = 0.554;
         bursaWolf.dS = 0.219;
@@ -67,7 +66,7 @@ public final strictfp class BursaWolfPar
      * Area of validity is the North Sea: 5.05°W to 11.13°E in longitude and 51.04°N to 62.0°N in latitude.
      */
     static BursaWolfParameters createED87_to_WGS84() {
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(WGS84, new DefaultExtent("Europe - North Sea",
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(GeodeticDatumMock.WGS84, new DefaultExtent("Europe - North Sea",
                 new DefaultGeographicBoundingBox(-5.05, 11.13, 51.04, 62.0), null, null));
         bursaWolf.tX =  -82.981;
         bursaWolf.tY =  -99.719;
@@ -88,7 +87,7 @@ public final strictfp class BursaWolfPar
      * This transformation uses only translation parameters.
      */
     static BursaWolfParameters createNTF_to_WGS84() {
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(WGS84, Extents.WORLD);
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(GeodeticDatumMock.WGS84, Extents.WORLD);
         bursaWolf.tX = -168;
         bursaWolf.tY =  -60;
         bursaWolf.tZ =  320;

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -22,7 +22,6 @@ import javax.measure.unit.NonSI;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -37,7 +37,6 @@ import org.apache.sis.test.TestStep;
 import org.junit.Test;
 
 import static org.apache.sis.test.MetadataAssert.*;
-import static org.apache.sis.test.mock.GeodeticDatumMock.*;
 import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
 
 
@@ -105,7 +104,7 @@ public final strictfp class DefaultGeode
      */
     @Test
     public void testIsHeuristicMatchForName() {
-        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(WGS84);
+        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(GeodeticDatumMock.WGS84);
         assertFalse(datum.isHeuristicMatchForName("WGS72"));
         assertTrue (datum.isHeuristicMatchForName("WGS84"));
         assertTrue (datum.isHeuristicMatchForName("WGS 84"));
@@ -136,28 +135,29 @@ public final strictfp class DefaultGeode
          * Build the datum using WGS 72 ellipsoid (so at least one of the BursaWolfParameters is real).
          */
         final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(properties,
-                WGS72.getEllipsoid(), WGS72.getPrimeMeridian());
+                GeodeticDatumMock.WGS72.getEllipsoid(),
+                GeodeticDatumMock.WGS72.getPrimeMeridian());
         /*
          * Search for BursaWolfParameters around the North Sea area.
          */
         final DefaultGeographicBoundingBox areaOfInterest = new DefaultGeographicBoundingBox(-2, 8, 55, 60);
         final DefaultExtent extent = new DefaultExtent("Around the North Sea", areaOfInterest, null, null);
-        Matrix matrix = datum.getPositionVectorTransformation(NAD83, extent);
+        Matrix matrix = datum.getPositionVectorTransformation(GeodeticDatumMock.NAD83, extent);
         assertNull("No BursaWolfParameters for NAD83", matrix);
-        matrix = datum.getPositionVectorTransformation(WGS84, extent);
+        matrix = datum.getPositionVectorTransformation(GeodeticDatumMock.WGS84, extent);
         assertNotNull("BursaWolfParameters for WGS84", matrix);
         checkTransformationSignature(local, matrix, 0);
         /*
          * Expand the area of interest to something greater than North Sea, and test again.
          */
         areaOfInterest.setWestBoundLongitude(-8);
-        matrix = datum.getPositionVectorTransformation(WGS84, extent);
+        matrix = datum.getPositionVectorTransformation(GeodeticDatumMock.WGS84, extent);
         assertNotNull("BursaWolfParameters for WGS84", matrix);
         checkTransformationSignature(global, matrix, 0);
         /*
          * Search in the reverse direction.
          */
-        final DefaultGeodeticDatum targetDatum = new DefaultGeodeticDatum(WGS84);
+        final DefaultGeodeticDatum targetDatum = new DefaultGeodeticDatum(GeodeticDatumMock.WGS84);
         matrix = targetDatum.getPositionVectorTransformation(datum, extent);
         global.invert(); // Expected result is the inverse.
         checkTransformationSignature(global, matrix, 1E-6);
@@ -182,7 +182,7 @@ public final strictfp class DefaultGeode
      */
     @Test
     public void testToWKT() {
-        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(WGS84);
+        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(GeodeticDatumMock.WGS84);
         assertWktEquals(Convention.WKT2,
                 "DATUM[“WGS84”,\n" +
                 "  ELLIPSOID[“WGS84”, 6378137.0, 298.257223563, LENGTHUNIT[“metre”, 1]]]",
@@ -222,7 +222,7 @@ public final strictfp class DefaultGeode
                 "    </gml:Ellipsoid>\n" +
                 "  </gml:ellipsoid>\n" +
                 "</gml:GeodeticDatum>",
-                marshal(new DefaultGeodeticDatum(WGS84)), "xmlns:*");
+                marshal(new DefaultGeodeticDatum(GeodeticDatumMock.WGS84)), "xmlns:*");
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -36,7 +36,6 @@ import org.junit.Test;
 import static java.util.Collections.singletonMap;
 import static org.apache.sis.test.MetadataAssert.*;
 import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
-import static org.apache.sis.test.mock.PrimeMeridianMock.GREENWICH;
 
 
 /**
@@ -59,7 +58,7 @@ public final strictfp class DefaultPrime
      */
     @Test
     public void testToWKT() {
-        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(GREENWICH);
+        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(PrimeMeridianMock.GREENWICH);
         assertIsGreenwich(pm);
         assertWktEquals(Convention.WKT2, "PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”, 0.017453292519943295]]", pm);
         assertWktEquals(Convention.WKT2_SIMPLIFIED, "PrimeMeridian[“Greenwich”, 0.0]", pm);
@@ -123,7 +122,7 @@ public final strictfp class DefaultPrime
      */
     @Test
     public void testMarshall() throws JAXBException {
-        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(GREENWICH);
+        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(PrimeMeridianMock.GREENWICH);
         assertXmlEquals(getGreenwichXml(Namespaces.GML), marshal(pm), "xmlns:*");
     }
 
@@ -135,7 +134,7 @@ public final strictfp class DefaultPrime
     @Test
     @DependsOnMethod("testMarshall")
     public void testMarshallGML31() throws JAXBException {
-        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(GREENWICH);
+        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(PrimeMeridianMock.GREENWICH);
         final MarshallerPool pool = getMarshallerPool();
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.setProperty(XML.GML_VERSION, LegacyNamespaces.VERSION_3_0);

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -23,7 +23,6 @@ import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import org.opengis.referencing.datum.PixelInCell;
 import org.opengis.referencing.datum.VerticalDatumType;
-import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -28,7 +28,6 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.date;
-import static org.apache.sis.test.mock.GeodeticDatumMock.WGS84;
 import static org.apache.sis.internal.referencing.Formulas.JULIAN_YEAR_LENGTH;
 
 
@@ -48,7 +47,7 @@ public final strictfp class TimeDependen
      * For the purpose of this test, the target datum does not matter anyway.
      */
     private static TimeDependentBWP create() {
-        final TimeDependentBWP p = new TimeDependentBWP(WGS84, null, date("1994-01-01 00:00:00"));
+        final TimeDependentBWP p = new TimeDependentBWP(GeodeticDatumMock.WGS84, null, date("1994-01-01 00:00:00"));
         p.tX = -0.08468;    p.dtX = +1.42;
         p.tY = -0.01942;    p.dtY = +1.34;
         p.tZ = +0.03201;    p.dtZ = +0.90;

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java?rev=1727581&r1=1727580&r2=1727581&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java [UTF-8] Fri Jan 29 13:35:42 2016
@@ -21,10 +21,16 @@ import org.opengis.referencing.Identifie
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.crs.*;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.datum.Datum;
 import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultProjectedCRS;
 import org.apache.sis.referencing.crs.DefaultDerivedCRS;
+import org.apache.sis.referencing.crs.AbstractCRS;
 
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -61,13 +67,36 @@ public final strictfp class AuthorityFac
      * Tests {@link AuthorityFactoryProxy#getInstance(Class)}.
      */
     @Test
-    public void testType() {
-        assertEquals(ProjectedCRS.class,  AuthorityFactoryProxy.getInstance(ProjectedCRS.class)        .type);
-        assertEquals(ProjectedCRS.class,  AuthorityFactoryProxy.getInstance(DefaultProjectedCRS.class) .type);
-        assertEquals(GeographicCRS.class, AuthorityFactoryProxy.getInstance(GeographicCRS.class)       .type);
-        assertEquals(GeographicCRS.class, AuthorityFactoryProxy.getInstance(DefaultGeographicCRS.class).type);
-        assertEquals(DerivedCRS.class,    AuthorityFactoryProxy.getInstance(DefaultDerivedCRS.class)   .type);
-        assertEquals(GeodeticDatum.class, AuthorityFactoryProxy.getInstance(DefaultGeodeticDatum.class).type);
+    public void testGetInstance() {
+        assertEquals(ProjectedCRS.class,              AuthorityFactoryProxy.getInstance(ProjectedCRS.class)        .type);
+        assertEquals(ProjectedCRS.class,              AuthorityFactoryProxy.getInstance(DefaultProjectedCRS.class) .type);
+        assertEquals(GeographicCRS.class,             AuthorityFactoryProxy.getInstance(GeographicCRS.class)       .type);
+        assertEquals(GeographicCRS.class,             AuthorityFactoryProxy.getInstance(DefaultGeographicCRS.class).type);
+        assertEquals(DerivedCRS.class,                AuthorityFactoryProxy.getInstance(DefaultDerivedCRS.class)   .type);
+        assertEquals(GeodeticDatum.class,             AuthorityFactoryProxy.getInstance(DefaultGeodeticDatum.class).type);
+        assertEquals(CoordinateReferenceSystem.class, AuthorityFactoryProxy.getInstance(AbstractCRS.class)         .type);
+        assertEquals(CoordinateSystem.class,          AuthorityFactoryProxy.getInstance(CoordinateSystem.class)    .type);
+        assertEquals(CoordinateSystemAxis.class,      AuthorityFactoryProxy.getInstance(CoordinateSystemAxis.class).type);
+        assertEquals(PrimeMeridian.class,             AuthorityFactoryProxy.getInstance(PrimeMeridian.class)       .type);
+        assertEquals(Ellipsoid.class,                 AuthorityFactoryProxy.getInstance(Ellipsoid.class)           .type);
+        assertEquals(Datum.class,                     AuthorityFactoryProxy.getInstance(Datum.class)               .type);
+    }
+
+    /**
+     * Tests {@link AuthorityFactoryProxy#specialize(String)}.
+     */
+    @Test
+    public void testSpecialize() {
+        final AuthorityFactoryProxy<IdentifiedObject> base = AuthorityFactoryProxy.OBJECT;
+        assertEquals(CoordinateReferenceSystem.class, base.specialize("CRS")      .type);
+        assertEquals(CoordinateSystem.class,          base.specialize("CS")       .type);
+        assertEquals(CoordinateSystemAxis.class,      base.specialize("aXis")     .type);
+        assertEquals(PrimeMeridian.class,             base.specialize("Meridian") .type);
+        assertEquals(Ellipsoid.class,                 base.specialize("ellipsoid").type);
+        assertEquals(Datum.class,                     base.specialize("datum")    .type);
+
+        assertEquals(GeodeticDatum.class, AuthorityFactoryProxy.GEODETIC_DATUM.specialize("datum").type);
+        assertNull(AuthorityFactoryProxy.COORDINATE_SYSTEM.specialize("datum"));
     }
 
     /**



Mime
View raw message