sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1723082 [1/2] - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/ sis-referencing/src/main/java/org/apache/sis/parameter/ sis-referencing/src/main/java/org/apache/sis/referencing/factory/ sis-referenc...
Date Tue, 05 Jan 2016 14:20:08 GMT
Author: desruisseaux
Date: Tue Jan  5 14:20:08 2016
New Revision: 1723082

URL: http://svn.apache.org/viewvc?rev=1723082&view=rev
Log:
Improve the caching done by ConcurrentAuthorityFactory: if a specialized method delegates to a more generic one
(e.g. if createGeographicCRS(String) delegates to createCoordinateReferenceSystem(String)), check the cache for
the type of objects of the more generic method.  This avoid creating the same object twice if the two different
methods are invoked.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/TransformationAccuracy.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.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/EPSGFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/TransformationAccuracy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/TransformationAccuracy.java?rev=1723082&r1=1723081&r2=1723082&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/TransformationAccuracy.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/TransformationAccuracy.java [UTF-8] Tue Jan  5 14:20:08 2016
@@ -25,10 +25,11 @@ import org.opengis.metadata.quality.Eval
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult;
 import org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy;
+import org.apache.sis.util.collection.WeakValueHashMap;
 import org.apache.sis.util.iso.DefaultRecordSchema;
+import org.apache.sis.util.iso.DefaultRecord;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.Static;
-import org.apache.sis.util.iso.DefaultRecord;
 
 
 /**
@@ -57,6 +58,11 @@ public final class TransformationAccurac
     }
 
     /**
+     * Cache the positional accuracies. Most coordinate operation use a small set of accuracy values.
+     */
+    private static final WeakValueHashMap<Double,PositionalAccuracy> CACHE = new WeakValueHashMap<>(Double.class);
+
+    /**
      * Do not allow instantiation of this class.
      */
     private TransformationAccuracy() {
@@ -64,24 +70,33 @@ public final class TransformationAccurac
 
     /**
      * Creates a positional accuracy for the given value, in metres.
+     * This method may return a cached value.
      *
      * @param accuracy The accuracy in metres.
      * @return A positional accuracy with the given value.
      */
     public static PositionalAccuracy create(final Double accuracy) {
-        final DefaultRecord record = new DefaultRecord(TYPE);
-        record.setAll(accuracy);
-
-        final DefaultQuantitativeResult result = new DefaultQuantitativeResult();
-        result.setValues(Collections.singletonList(record));
-        result.setValueUnit(SI.METRE);              // In metres by definition in the EPSG database.
-        result.setValueType(TYPE);
-
-        final DefaultAbsoluteExternalPositionalAccuracy element =
-                new DefaultAbsoluteExternalPositionalAccuracy(result);
-        element.setNamesOfMeasure(Collections.singleton(TRANSFORMATION_ACCURACY));
-        element.setEvaluationMethodType(EvaluationMethodType.DIRECT_EXTERNAL);
-        element.freeze();
-        return element;
+        PositionalAccuracy p = CACHE.get(accuracy);
+        if (p == null) {
+            final DefaultRecord record = new DefaultRecord(TYPE);
+            record.setAll(accuracy);
+
+            final DefaultQuantitativeResult result = new DefaultQuantitativeResult();
+            result.setValues(Collections.singletonList(record));
+            result.setValueUnit(SI.METRE);              // In metres by definition in the EPSG database.
+            result.setValueType(TYPE);
+
+            final DefaultAbsoluteExternalPositionalAccuracy element =
+                    new DefaultAbsoluteExternalPositionalAccuracy(result);
+            element.setNamesOfMeasure(Collections.singleton(TRANSFORMATION_ACCURACY));
+            element.setEvaluationMethodType(EvaluationMethodType.DIRECT_EXTERNAL);
+            element.freeze();
+
+            p = CACHE.putIfAbsent(accuracy, element);
+            if (p == null) {
+                p = element;
+            }
+        }
+        return p;
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java?rev=1723082&r1=1723081&r2=1723082&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] Tue Jan  5 14:20:08 2016
@@ -182,6 +182,17 @@ final class UnmodifiableParameterValueGr
     }
 
     /**
+     * Returns a modifiable copy of this parameter value group.
+     */
+    @Override
+    @SuppressWarnings("CloneDoesntCallSuperClone")
+    public Parameters clone() {
+        final DefaultParameterValueGroup copy = new DefaultParameterValueGroup(descriptor);
+        Parameters.copy(this, copy);
+        return copy;
+    }
+
+    /**
      * Compares the specified object with this parameter for equality.
      * The strictness level is controlled by the second argument:
      *

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1723082&r1=1723081&r2=1723082&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Tue Jan  5 14:20:08 2016
@@ -22,11 +22,13 @@ import java.util.Deque;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.WeakHashMap;
+import java.util.IdentityHashMap;
 import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 import java.lang.ref.WeakReference;
 import java.lang.ref.PhantomReference;
 import java.io.PrintWriter;
+import java.lang.reflect.Method;
 import javax.measure.unit.Unit;
 import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.*;
@@ -98,6 +100,14 @@ public abstract class ConcurrentAuthorit
     private transient volatile Citation authority;
 
     /**
+     * The {@code createFoo(String)} methods that are <strong>not</strong> overridden in the Data Access Object (DAO).
+     * This map is created at construction time and should not be modified after construction.
+     *
+     * @see #isDefault(Class)
+     */
+    private final Map<Class<?>,Boolean> inherited = new IdentityHashMap<>();
+
+    /**
      * The pool of cached objects.
      */
     private final Cache<Key,Object> cache;
@@ -207,7 +217,7 @@ public abstract class ConcurrentAuthorit
      *
      * @see #getTimeout(TimeUnit)
      */
-    private long timeout = 60_000_000_000L;     // One minute
+    private long timeout = 10_000_000_000L;     // 10 seconds
 
     /**
      * The maximal difference between the scheduled time and the actual time in order to perform the factory disposal,
@@ -220,10 +230,11 @@ public abstract class ConcurrentAuthorit
      * by strong references. Note that those default values may change in any future SIS versions based
      * on experience gained.
      *
+     * @param dataAccessClass The class of Data Access Object (DAO) created by {@link #newDataAccess()}.
      * @param nameFactory The factory to use for parsing authority codes as {@link org.opengis.util.GenericName} instances.
      */
-    protected ConcurrentAuthorityFactory(final NameFactory nameFactory) {
-        this(nameFactory, 100, 8);
+    protected ConcurrentAuthorityFactory(Class<? extends GeodeticAuthorityFactory> dataAccessClass, NameFactory nameFactory) {
+        this(dataAccessClass, nameFactory, 100, 8);
         /*
          * NOTE: if the default maximum number of Data Access Objects (currently 8) is augmented,
          * make sure to augment the number of runner threads in the "StressTest" class to a greater amount.
@@ -235,26 +246,40 @@ public abstract class ConcurrentAuthorit
      * If a number of object greater than {@code maxStrongReferences} are created, then the strong references
      * for the eldest ones will be replaced by weak references.
      *
+     * @param dataAccessClass The class of Data Access Object (DAO) created by {@link #newDataAccess()}.
      * @param nameFactory The factory to use for parsing authority code as {@link org.opengis.util.GenericName} instances.
      * @param maxStrongReferences The maximum number of objects to keep by strong reference.
      * @param maxConcurrentQueries The maximal amount of Data Access Objects to use concurrently.
      *        If more than this amount of threads are querying this {@code ConcurrentAuthorityFactory} concurrently,
      *        additional threads will be blocked until a Data Access Object become available.
      */
-    protected ConcurrentAuthorityFactory(final NameFactory nameFactory,
-            final int maxStrongReferences, final int maxConcurrentQueries)
+    protected ConcurrentAuthorityFactory(final Class<? extends GeodeticAuthorityFactory> dataAccessClass,
+            final NameFactory nameFactory, final int maxStrongReferences, final int maxConcurrentQueries)
     {
         super(nameFactory);
+        ArgumentChecks.ensureNonNull("dataAccessClass", dataAccessClass);
         ArgumentChecks.ensurePositive("maxStrongReferences", maxStrongReferences);
         ArgumentChecks.ensureStrictlyPositive("maxConcurrentQueries", maxConcurrentQueries);
-        remainingDAOs = maxConcurrentQueries;
-        cache = new Cache<>(20, maxStrongReferences, false);
         /*
+         * Detect which methods in the DAO have been overridden.
+         */
+        for (final Method method : dataAccessClass.getMethods()) {
+            if (method.getDeclaringClass() == GeodeticAuthorityFactory.class && method.getName().startsWith("create")) {
+                final Class<?>[] p = method.getParameterTypes();
+                if (p.length == 1 && p[0] == String.class) {
+                    inherited.put(method.getReturnType(), Boolean.TRUE);
+                }
+            }
+        }
+        /*
+         * Create a cache allowing key collisions.
          * Key collision is usually an error. But in this case we allow them in order to enable recursivity.
          * If during the creation of an object the program asks to this ConcurrentAuthorityFactory for the same
          * object (using the same key), then the default Cache implementation considers that situation as an
          * error unless the above property has been set to 'true'.
          */
+        remainingDAOs = maxConcurrentQueries;
+        cache = new Cache<>(20, maxStrongReferences, false);
         cache.setKeyCollisionAllowed(true);
         /*
          * The shutdown hook serves two purposes:
@@ -613,6 +638,17 @@ public abstract class ConcurrentAuthorit
     }
 
     /**
+     * Returns {@code true} if the Data Access Object (DAO) does not provide a {@code create} method for the
+     * given type of object. The intend is to decide if the caller should delegate to the DAO or delegate to
+     * a more generic method of this class (e.g. {@code createCoordinateReferenceSystem(String)} instead of
+     * {@code createGeographicCRS(String)}) in order to give to {@code ConcurrentAuthorityFactory} a chance
+     * to reuse a value presents in the cache.
+     */
+    private boolean isDefault(final Class<?> type) {
+        return inherited.containsKey(type);
+    }
+
+    /**
      * Returns an arbitrary object from a code.
      * The default implementation performs the following steps:
      * <ul>
@@ -639,9 +675,12 @@ public abstract class ConcurrentAuthorit
      * Returns an arbitrary coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCoordinateReferenceSystem(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCoordinateReferenceSystem(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -649,6 +688,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CoordinateReferenceSystem createCoordinateReferenceSystem(final String code) throws FactoryException {
+        if (isDefault(CoordinateReferenceSystem.class)) {
+            return super.createCoordinateReferenceSystem(code);
+        }
         return create(AuthorityFactoryProxy.CRS, code);
     }
 
@@ -656,9 +698,12 @@ public abstract class ConcurrentAuthorit
      * Returns a geographic coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createGeographicCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createGeographicCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -666,6 +711,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public GeographicCRS createGeographicCRS(final String code) throws FactoryException {
+        if (isDefault(GeographicCRS.class)) {
+            return super.createGeographicCRS(code);
+        }
         return create(AuthorityFactoryProxy.GEOGRAPHIC_CRS, code);
     }
 
@@ -673,9 +721,12 @@ public abstract class ConcurrentAuthorit
      * Returns a geocentric coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createGeocentricCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createGeocentricCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -683,6 +734,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public GeocentricCRS createGeocentricCRS(final String code) throws FactoryException {
+        if (isDefault(GeocentricCRS.class)) {
+            return super.createGeocentricCRS(code);
+        }
         return create(AuthorityFactoryProxy.GEOCENTRIC_CRS, code);
     }
 
@@ -690,9 +744,12 @@ public abstract class ConcurrentAuthorit
      * Returns a projected coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createProjectedCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createProjectedCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -700,6 +757,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public ProjectedCRS createProjectedCRS(final String code) throws FactoryException {
+        if (isDefault(ProjectedCRS.class)) {
+            return super.createProjectedCRS(code);
+        }
         return create(AuthorityFactoryProxy.PROJECTED_CRS, code);
     }
 
@@ -707,9 +767,12 @@ public abstract class ConcurrentAuthorit
      * Returns a vertical coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createVerticalCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createVerticalCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -717,6 +780,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public VerticalCRS createVerticalCRS(final String code) throws FactoryException {
+        if (isDefault(VerticalCRS.class)) {
+            return super.createVerticalCRS(code);
+        }
         return create(AuthorityFactoryProxy.VERTICAL_CRS, code);
     }
 
@@ -724,9 +790,12 @@ public abstract class ConcurrentAuthorit
      * Returns a temporal coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createTemporalCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createTemporalCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -734,6 +803,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public TemporalCRS createTemporalCRS(final String code) throws FactoryException {
+        if (isDefault(TemporalCRS.class)) {
+            return super.createTemporalCRS(code);
+        }
         return create(AuthorityFactoryProxy.TEMPORAL_CRS, code);
     }
 
@@ -741,9 +813,12 @@ public abstract class ConcurrentAuthorit
      * Returns a 3D or 4D coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCompoundCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCompoundCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -751,6 +826,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CompoundCRS createCompoundCRS(final String code) throws FactoryException {
+        if (isDefault(CompoundCRS.class)) {
+            return super.createCompoundCRS(code);
+        }
         return create(AuthorityFactoryProxy.COMPOUND_CRS, code);
     }
 
@@ -758,9 +836,12 @@ public abstract class ConcurrentAuthorit
      * Returns a derived coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createDerivedCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createDerivedCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -768,6 +849,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public DerivedCRS createDerivedCRS(final String code) throws FactoryException {
+        if (isDefault(DerivedCRS.class)) {
+            return super.createDerivedCRS(code);
+        }
         return create(AuthorityFactoryProxy.DERIVED_CRS, code);
     }
 
@@ -775,9 +859,12 @@ public abstract class ConcurrentAuthorit
      * Returns an engineering coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createEngineeringCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createEngineeringCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -785,6 +872,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public EngineeringCRS createEngineeringCRS(final String code) throws FactoryException {
+        if (isDefault(EngineeringCRS.class)) {
+            return super.createEngineeringCRS(code);
+        }
         return create(AuthorityFactoryProxy.ENGINEERING_CRS, code);
     }
 
@@ -792,9 +882,12 @@ public abstract class ConcurrentAuthorit
      * Returns an image coordinate reference system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createImageCRS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createImageCRS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate reference system for the given code.
@@ -802,6 +895,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public ImageCRS createImageCRS(final String code) throws FactoryException {
+        if (isDefault(ImageCRS.class)) {
+            return super.createImageCRS(code);
+        }
         return create(AuthorityFactoryProxy.IMAGE_CRS, code);
     }
 
@@ -809,9 +905,12 @@ public abstract class ConcurrentAuthorit
      * Returns an arbitrary datum from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createDatum(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createDatum(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The datum for the given code.
@@ -819,6 +918,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public Datum createDatum(final String code) throws FactoryException {
+        if (isDefault(Datum.class)) {
+            return super.createDatum(code);
+        }
         return create(AuthorityFactoryProxy.DATUM, code);
     }
 
@@ -826,9 +928,12 @@ public abstract class ConcurrentAuthorit
      * Returns a geodetic datum from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createGeodeticDatum(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createGeodeticDatum(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createDatum(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The datum for the given code.
@@ -836,6 +941,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public GeodeticDatum createGeodeticDatum(final String code) throws FactoryException {
+        if (isDefault(GeodeticDatum.class)) {
+            return super.createGeodeticDatum(code);
+        }
         return create(AuthorityFactoryProxy.GEODETIC_DATUM, code);
     }
 
@@ -843,9 +951,12 @@ public abstract class ConcurrentAuthorit
      * Returns a vertical datum from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createVerticalDatum(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createVerticalDatum(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createDatum(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The datum for the given code.
@@ -853,6 +964,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public VerticalDatum createVerticalDatum(final String code) throws FactoryException {
+        if (isDefault(VerticalDatum.class)) {
+            return super.createVerticalDatum(code);
+        }
         return create(AuthorityFactoryProxy.VERTICAL_DATUM, code);
     }
 
@@ -860,9 +974,12 @@ public abstract class ConcurrentAuthorit
      * Returns a temporal datum from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createTemporalDatum(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createTemporalDatum(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createDatum(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The datum for the given code.
@@ -870,6 +987,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public TemporalDatum createTemporalDatum(final String code) throws FactoryException {
+        if (isDefault(TemporalDatum.class)) {
+            return super.createTemporalDatum(code);
+        }
         return create(AuthorityFactoryProxy.TEMPORAL_DATUM, code);
     }
 
@@ -877,9 +997,12 @@ public abstract class ConcurrentAuthorit
      * Returns an engineering datum from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createEngineeringDatum(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createEngineeringDatum(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createDatum(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The datum for the given code.
@@ -887,6 +1010,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public EngineeringDatum createEngineeringDatum(final String code) throws FactoryException {
+        if (isDefault(EngineeringDatum.class)) {
+            return super.createEngineeringDatum(code);
+        }
         return create(AuthorityFactoryProxy.ENGINEERING_DATUM, code);
     }
 
@@ -894,9 +1020,12 @@ public abstract class ConcurrentAuthorit
      * Returns an image datum from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createImageDatum(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createImageDatum(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createDatum(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The datum for the given code.
@@ -904,6 +1033,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public ImageDatum createImageDatum(final String code) throws FactoryException {
+        if (isDefault(ImageDatum.class)) {
+            return super.createImageDatum(code);
+        }
         return create(AuthorityFactoryProxy.IMAGE_DATUM, code);
     }
 
@@ -911,9 +1043,12 @@ public abstract class ConcurrentAuthorit
      * Returns an ellipsoid from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createEllipsoid(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createEllipsoid(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The ellipsoid for the given code.
@@ -921,6 +1056,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public Ellipsoid createEllipsoid(final String code) throws FactoryException {
+        if (isDefault(Ellipsoid.class)) {
+            return super.createEllipsoid(code);
+        }
         return create(AuthorityFactoryProxy.ELLIPSOID, code);
     }
 
@@ -928,9 +1066,12 @@ public abstract class ConcurrentAuthorit
      * Returns a prime meridian from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createPrimeMeridian(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createPrimeMeridian(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The prime meridian for the given code.
@@ -938,6 +1079,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public PrimeMeridian createPrimeMeridian(final String code) throws FactoryException {
+        if (isDefault(PrimeMeridian.class)) {
+            return super.createPrimeMeridian(code);
+        }
         return create(AuthorityFactoryProxy.PRIME_MERIDIAN, code);
     }
 
@@ -945,9 +1089,11 @@ public abstract class ConcurrentAuthorit
      * Returns an extent (usually a domain of validity) from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createExtent(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createExtent(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class.</li>
      * </ul>
      *
      * @return The extent for the given code.
@@ -955,6 +1101,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public Extent createExtent(final String code) throws FactoryException {
+        if (isDefault(Extent.class)) {
+            return super.createExtent(code);
+        }
         return create(AuthorityFactoryProxy.EXTENT, code);
     }
 
@@ -962,9 +1111,12 @@ public abstract class ConcurrentAuthorit
      * Returns an arbitrary coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCoordinateSystem(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCoordinateSystem(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -972,6 +1124,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CoordinateSystem createCoordinateSystem(final String code) throws FactoryException {
+        if (isDefault(CoordinateSystem.class)) {
+            return super.createCoordinateSystem(code);
+        }
         return create(AuthorityFactoryProxy.COORDINATE_SYSTEM, code);
     }
 
@@ -979,9 +1134,12 @@ public abstract class ConcurrentAuthorit
      * Returns an ellipsoidal coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createEllipsoidalCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createEllipsoidalCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -989,6 +1147,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public EllipsoidalCS createEllipsoidalCS(final String code) throws FactoryException {
+        if (isDefault(EllipsoidalCS.class)) {
+            return super.createEllipsoidalCS(code);
+        }
         return create(AuthorityFactoryProxy.ELLIPSOIDAL_CS, code);
     }
 
@@ -996,9 +1157,12 @@ public abstract class ConcurrentAuthorit
      * Returns a vertical coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createVerticalCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createVerticalCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -1006,6 +1170,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public VerticalCS createVerticalCS(final String code) throws FactoryException {
+        if (isDefault(VerticalCS.class)) {
+            return super.createVerticalCS(code);
+        }
         return create(AuthorityFactoryProxy.VERTICAL_CS, code);
     }
 
@@ -1013,9 +1180,12 @@ public abstract class ConcurrentAuthorit
      * Returns a temporal coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createTimeCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createTimeCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -1023,6 +1193,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public TimeCS createTimeCS(final String code) throws FactoryException {
+        if (isDefault(TimeCS.class)) {
+            return super.createTimeCS(code);
+        }
         return create(AuthorityFactoryProxy.TIME_CS, code);
     }
 
@@ -1030,9 +1203,12 @@ public abstract class ConcurrentAuthorit
      * Returns a Cartesian coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCartesianCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCartesianCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -1040,6 +1216,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CartesianCS createCartesianCS(final String code) throws FactoryException {
+        if (isDefault(CartesianCS.class)) {
+            return super.createCartesianCS(code);
+        }
         return create(AuthorityFactoryProxy.CARTESIAN_CS, code);
     }
 
@@ -1047,9 +1226,12 @@ public abstract class ConcurrentAuthorit
      * Returns a spherical coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createSphericalCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createSphericalCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -1057,6 +1239,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public SphericalCS createSphericalCS(final String code) throws FactoryException {
+        if (isDefault(SphericalCS.class)) {
+            return super.createSphericalCS(code);
+        }
         return create(AuthorityFactoryProxy.SPHERICAL_CS, code);
     }
 
@@ -1064,9 +1249,12 @@ public abstract class ConcurrentAuthorit
      * Returns a cylindrical coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCylindricalCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCylindricalCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -1074,6 +1262,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CylindricalCS createCylindricalCS(final String code) throws FactoryException {
+        if (isDefault(CylindricalCS.class)) {
+            return super.createCylindricalCS(code);
+        }
         return create(AuthorityFactoryProxy.CYLINDRICAL_CS, code);
     }
 
@@ -1081,9 +1272,12 @@ public abstract class ConcurrentAuthorit
      * Returns a polar coordinate system from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createPolarCS(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createPolarCS(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The coordinate system for the given code.
@@ -1091,6 +1285,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public PolarCS createPolarCS(final String code) throws FactoryException {
+        if (isDefault(PolarCS.class)) {
+            return super.createPolarCS(code);
+        }
         return create(AuthorityFactoryProxy.POLAR_CS, code);
     }
 
@@ -1098,9 +1295,12 @@ public abstract class ConcurrentAuthorit
      * Returns a coordinate system axis from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCoordinateSystemAxis(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCoordinateSystemAxis(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The axis for the given code.
@@ -1108,6 +1308,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CoordinateSystemAxis createCoordinateSystemAxis(final String code) throws FactoryException {
+        if (isDefault(CoordinateSystemAxis.class)) {
+            return super.createCoordinateSystemAxis(code);
+        }
         return create(AuthorityFactoryProxy.AXIS, code);
     }
 
@@ -1115,9 +1318,11 @@ public abstract class ConcurrentAuthorit
      * Returns an unit of measurement from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createUnit(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createUnit(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class.</li>
      * </ul>
      *
      * @return The unit of measurement for the given code.
@@ -1125,6 +1330,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public Unit<?> createUnit(final String code) throws FactoryException {
+        if (isDefault(Unit.class)) {
+            return super.createUnit(code);
+        }
         return create(AuthorityFactoryProxy.UNIT, code);
     }
 
@@ -1132,9 +1340,12 @@ public abstract class ConcurrentAuthorit
      * Returns a parameter descriptor from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createParameterDescriptor(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createParameterDescriptor(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The parameter descriptor for the given code.
@@ -1142,6 +1353,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public ParameterDescriptor<?> createParameterDescriptor(final String code) throws FactoryException {
+        if (isDefault(ParameterDescriptor.class)) {
+            return super.createParameterDescriptor(code);
+        }
         return create(AuthorityFactoryProxy.PARAMETER, code);
     }
 
@@ -1149,9 +1363,12 @@ public abstract class ConcurrentAuthorit
      * Returns an operation method from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createOperationMethod(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createOperationMethod(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The operation method for the given code.
@@ -1159,6 +1376,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public OperationMethod createOperationMethod(final String code) throws FactoryException {
+        if (isDefault(OperationMethod.class)) {
+            return super.createOperationMethod(code);
+        }
         return create(AuthorityFactoryProxy.METHOD, code);
     }
 
@@ -1166,9 +1386,12 @@ public abstract class ConcurrentAuthorit
      * Returns an operation from a code.
      * The default implementation performs the following steps:
      * <ul>
-     *   <li>Returns the cached instance for the given code if such instance already exists.</li>
+     *   <li>Return the cached instance for the given code if such instance already exists.</li>
+     *   <li>Otherwise if the Data Access Object (DAO) overrides the {@code createCoordinateOperation(String)}
+     *       method, invoke that method and cache the result for future use.</li>
      *   <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createCoordinateOperation(String)}
-     *       method of a Data Access Object and cache the result for future use.</li>
+     *       method in the parent class. This allows to check if the more generic
+     *       {@link #createObject(String)} method cached a value before to try that method.</li>
      * </ul>
      *
      * @return The operation for the given code.
@@ -1176,6 +1399,9 @@ public abstract class ConcurrentAuthorit
      */
     @Override
     public CoordinateOperation createCoordinateOperation(final String code) throws FactoryException {
+        if (isDefault(CoordinateOperation.class)) {
+            return super.createCoordinateOperation(code);
+        }
         return create(AuthorityFactoryProxy.OPERATION, code);
     }
 
@@ -1265,7 +1491,7 @@ public abstract class ConcurrentAuthorit
                     final T result;
                     final GeodeticAuthorityFactory factory = getDataAccess();
                     try {
-                        result = proxy.create(factory, code);
+                        result = proxy.create(factory, key.code);
                     } finally {
                         release();
                     }

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=1723082&r1=1723081&r2=1723082&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] Tue Jan  5 14:20:08 2016
@@ -1156,7 +1156,7 @@ public abstract class GeodeticAuthorityF
      * @param  code The code to trim.
      * @return The code without the authority scope.
      */
-    final String trimAuthority(String code) {
+    protected String trimAuthority(String code) {
         return trimAuthority(code, null);
     }
 
@@ -1173,7 +1173,7 @@ public abstract class GeodeticAuthorityF
             if (authority == null) {
                 authority = getAuthority();     // Costly operation for EPSGDataAccess.
             }
-            if (Citations.identifierMatches(authority, null, scope.toString())) {
+            if (Citations.identifierMatches(authority, null, scope.toString().trim())) {
                 return name.tip().toString().trim();
             }
         }

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=1723082&r1=1723081&r2=1723082&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] Tue Jan  5 14:20:08 2016
@@ -57,7 +57,6 @@ import org.opengis.metadata.Identifier;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.OnLineFunction;
-import org.opengis.metadata.quality.PositionalAccuracy;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
@@ -228,13 +227,6 @@ public class EPSGDataAccess extends Geod
     private final Map<Integer,Boolean> isProjection = new HashMap<>();
 
     /**
-     * Cache the positional accuracies. Most coordinate operation use a small set of accuracy values.
-     *
-     * @see #getAccuracy(double)
-     */
-    private final Map<Double,PositionalAccuracy> accuracies = new HashMap<>();
-
-    /**
      * Cache of naming systems other than EPSG. There is usually few of them (at most 15).
      * This is used for aliases.
      *
@@ -599,10 +591,10 @@ addURIs:    for (int i=0; ; i++) {
                     }
                 }
                 if (statement == null) {
-                    final String query = "SELECT " + codeColumn + " FROM " + table +
-                                         " WHERE " + nameColumn + " = ?";
+                    final String query = "SELECT " + codeColumn + " FROM [" + table + "] WHERE " + nameColumn + " = ?";
                     statement = connection.prepareStatement(translator.apply(query));
                     statements.put(KEY, statement);
+                    lastTableForName = table;
                 }
                 statement.setString(1, code);
                 Integer resolved = null;
@@ -651,9 +643,9 @@ addURIs:    for (int i=0; ; i++) {
             final String sql, final String... codes) throws SQLException, FactoryException
     {
         assert Thread.holdsLock(this);
-        assert sql.contains(table) : table;
-        assert (codeColumn == null) || sql.contains(codeColumn) || table.equals("[Area]") : codeColumn;
-        assert (nameColumn == null) || sql.contains(nameColumn) || table.equals("[Area]") : nameColumn;
+        assert sql.contains('[' + table + ']') : table;
+        assert (codeColumn == null) || sql.contains(codeColumn) || table.equals("Area") : codeColumn;
+        assert (nameColumn == null) || sql.contains(nameColumn) || table.equals("Area") : nameColumn;
         return executeQuery(table, sql, toPrimaryKeys(table, codeColumn, nameColumn, codes));
     }
 
@@ -904,12 +896,12 @@ addURIs:    for (int i=0; ; i++) {
      * @param  locale The locale for logging messages.
      * @return A message proposing a replacement, or {@code null} if none.
      */
-    private InternationalString getDeprecation(final String table, final Integer code, final Locale locale)
+    private InternationalString getSupersession(final String table, final Integer code, final Locale locale)
             throws SQLException
     {
         String reason = null;
         Object replacedBy = null;
-        try (ResultSet result = executeQuery("[Deprecation]",
+        try (ResultSet result = executeQuery("Deprecation",
                 "SELECT OBJECT_TABLE_NAME, DEPRECATION_REASON, REPLACED_BY" +
                 " FROM [Deprecation] WHERE OBJECT_CODE = ?", code))
         {
@@ -980,7 +972,7 @@ addURIs:    for (int i=0; ; i++) {
             final String codeString = code.toString();
             final ImmutableIdentifier identifier;
             if (deprecated) {
-                identifier = new DeprecatedCode(authority, Constants.EPSG, codeString, version, getDeprecation(table, code, locale));
+                identifier = new DeprecatedCode(authority, Constants.EPSG, codeString, version, getSupersession(table, code, locale));
             } else {
                 identifier = new ImmutableIdentifier(authority, Constants.EPSG, codeString, version,
                                     (gn != null) ? gn.toInternationalString() : null);
@@ -993,7 +985,7 @@ addURIs:    for (int i=0; ; i++) {
          * record is really from the table we are looking for since different tables may have objects with the same ID.
          */
         final List<GenericName> aliases = new ArrayList<>();
-        try (ResultSet result = executeQuery("[Alias]",
+        try (ResultSet result = executeQuery("Alias",
                 "SELECT OBJECT_TABLE_NAME, NAMING_SYSTEM_NAME, ALIAS" +
                 " FROM [Alias] INNER JOIN [Naming System]" +
                   " ON [Alias].NAMING_SYSTEM_CODE =" +
@@ -1164,7 +1156,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         CoordinateReferenceSystem returnValue = null;
-        try (ResultSet result = executeQuery("[Coordinate Reference System]", "COORD_REF_SYS_CODE", "COORD_REF_SYS_NAME",
+        try (ResultSet result = executeQuery("Coordinate Reference System", "COORD_REF_SYS_CODE", "COORD_REF_SYS_NAME",
                 "SELECT COORD_REF_SYS_CODE,"          +     // [ 1]
                       " COORD_REF_SYS_NAME,"          +     // [ 2]
                       " AREA_OF_USE_CODE,"            +     // [ 3]
@@ -1219,7 +1211,7 @@ addURIs:    for (int i=0; ; i++) {
                                 endOfRecursivity(GeographicCRS.class, epsg);
                             }
                         }
-                        crs = crsFactory.createGeographicCRS(createProperties("[Coordinate Reference System]",
+                        crs = crsFactory.createGeographicCRS(createProperties("Coordinate Reference System",
                                 name, epsg, area, scope, remarks, deprecated), datum, cs);
                         break;
                     }
@@ -1240,7 +1232,7 @@ addURIs:    for (int i=0; ; i++) {
                             final GeographicCRS baseCRS  = parent.createGeographicCRS(geoCode);
                             final CoordinateOperation op = parent.createCoordinateOperation(opCode);
                             if (op instanceof Conversion) {
-                                crs = crsFactory.createProjectedCRS(createProperties("[Coordinate Reference System]",
+                                crs = crsFactory.createProjectedCRS(createProperties("Coordinate Reference System",
                                         name, epsg, area, scope, remarks, deprecated), baseCRS, (Conversion) op, cs);
                             } else {
                                 throw noSuchAuthorityCode(Projection.class, opCode);
@@ -1256,7 +1248,7 @@ addURIs:    for (int i=0; ; i++) {
                     case "vertical": {
                         final VerticalCS    cs    = parent.createVerticalCS   (getString(code, result, 8));
                         final VerticalDatum datum = parent.createVerticalDatum(getString(code, result, 9));
-                        crs = crsFactory.createVerticalCRS(createProperties("[Coordinate Reference System]",
+                        crs = crsFactory.createVerticalCRS(createProperties("Coordinate Reference System",
                                 name, epsg, area, scope, remarks, deprecated), datum, cs);
                         break;
                     }
@@ -1270,7 +1262,7 @@ addURIs:    for (int i=0; ; i++) {
                     case "temporal": {
                         final TimeCS        cs    = parent.createTimeCS       (getString(code, result, 8));
                         final TemporalDatum datum = parent.createTemporalDatum(getString(code, result, 9));
-                        crs = crsFactory.createTemporalCRS(createProperties("[Coordinate Reference System]",
+                        crs = crsFactory.createTemporalCRS(createProperties("Coordinate Reference System",
                                 name, epsg, area, scope, remarks, deprecated), datum, cs);
                         break;
                     }
@@ -1293,7 +1285,7 @@ addURIs:    for (int i=0; ; i++) {
                             endOfRecursivity(CompoundCRS.class, epsg);
                         }
                         // Note: Do not invoke 'createProperties' sooner.
-                        crs  = crsFactory.createCompoundCRS(createProperties("[Coordinate Reference System]",
+                        crs  = crsFactory.createCompoundCRS(createProperties("Coordinate Reference System",
                                 name, epsg, area, scope, remarks, deprecated), crs1, crs2);
                         break;
                     }
@@ -1303,7 +1295,7 @@ addURIs:    for (int i=0; ; i++) {
                     case "geocentric": {
                         final CoordinateSystem cs = parent.createCoordinateSystem(getString(code, result, 8));
                         final GeodeticDatum datum = parent.createGeodeticDatum   (getString(code, result, 9));
-                        final Map<String,Object> properties = createProperties("[Coordinate Reference System]",
+                        final Map<String,Object> properties = createProperties("Coordinate Reference System",
                                 name, epsg, area, scope, remarks, deprecated);
                         if (cs instanceof CartesianCS) {
                             crs = crsFactory.createGeocentricCRS(properties, datum, (CartesianCS) cs);
@@ -1321,7 +1313,7 @@ addURIs:    for (int i=0; ; i++) {
                     case "engineering": {
                         final CoordinateSystem cs    = parent.createCoordinateSystem(getString(code, result, 8));
                         final EngineeringDatum datum = parent.createEngineeringDatum(getString(code, result, 9));
-                        crs = crsFactory.createEngineeringCRS(createProperties("[Coordinate Reference System]",
+                        crs = crsFactory.createEngineeringCRS(createProperties("Coordinate Reference System",
                                 name, epsg, area, scope, remarks, deprecated), datum, cs);
                         break;
                     }
@@ -1374,7 +1366,7 @@ addURIs:    for (int i=0; ; i++) {
     public synchronized Datum createDatum(final String code) throws NoSuchAuthorityCodeException, FactoryException {
         ArgumentChecks.ensureNonNull("code", code);
         Datum returnValue = null;
-        try (ResultSet result = executeQuery("[Datum]", "DATUM_CODE", "DATUM_NAME",
+        try (ResultSet result = executeQuery("Datum", "DATUM_CODE", "DATUM_NAME",
                 "SELECT DATUM_CODE," +
                       " DATUM_NAME," +
                       " DATUM_TYPE," +
@@ -1399,7 +1391,7 @@ addURIs:    for (int i=0; ; i++) {
                 final String  scope      = getOptionalString (result, 7);
                 final String  remarks    = getOptionalString (result, 8);
                 final boolean deprecated = getOptionalBoolean(result, 9);
-                Map<String,Object> properties = createProperties("[Datum]",
+                Map<String,Object> properties = createProperties("Datum",
                         name, epsg, area, scope, remarks, deprecated);
                 if (anchor != null) {
                     properties.put(Datum.ANCHOR_POINT_KEY, anchor);
@@ -1617,7 +1609,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         Ellipsoid returnValue = null;
-        try (ResultSet result = executeQuery("[Ellipsoid]", "ELLIPSOID_CODE", "ELLIPSOID_NAME",
+        try (ResultSet result = executeQuery("Ellipsoid", "ELLIPSOID_CODE", "ELLIPSOID_NAME",
                 "SELECT ELLIPSOID_CODE," +
                       " ELLIPSOID_NAME," +
                       " SEMI_MAJOR_AXIS," +
@@ -1644,7 +1636,7 @@ addURIs:    for (int i=0; ; i++) {
                 final String  remarks           = getOptionalString (result, 7);
                 final boolean deprecated        = getOptionalBoolean(result, 8);
                 final Unit<Length> unit         = parent.createUnit(unitCode).asType(Length.class);
-                final Map<String,Object> properties = createProperties("[Ellipsoid]", name, epsg, remarks, deprecated);
+                final Map<String,Object> properties = createProperties("Ellipsoid", name, epsg, remarks, deprecated);
                 final Ellipsoid ellipsoid;
                 if (Double.isNaN(inverseFlattening)) {
                     if (Double.isNaN(semiMinorAxis)) {
@@ -1706,7 +1698,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         PrimeMeridian returnValue = null;
-        try (ResultSet result = executeQuery("[Prime Meridian]", "PRIME_MERIDIAN_CODE", "PRIME_MERIDIAN_NAME",
+        try (ResultSet result = executeQuery("Prime Meridian", "PRIME_MERIDIAN_CODE", "PRIME_MERIDIAN_NAME",
                 "SELECT PRIME_MERIDIAN_CODE," +
                       " PRIME_MERIDIAN_NAME," +
                       " GREENWICH_LONGITUDE," +
@@ -1725,7 +1717,7 @@ addURIs:    for (int i=0; ; i++) {
                 final boolean deprecated = getOptionalBoolean(result, 6);
                 final Unit<Angle> unit = parent.createUnit(unitCode).asType(Angle.class);
                 final PrimeMeridian primeMeridian = parent.datumFactory.createPrimeMeridian(
-                        createProperties("[Prime Meridian]", name, epsg, remarks, deprecated), longitude, unit);
+                        createProperties("Prime Meridian", name, epsg, remarks, deprecated), longitude, unit);
                 returnValue = ensureSingleton(primeMeridian, returnValue, code);
             }
         } catch (SQLException exception) {
@@ -1764,7 +1756,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         Extent returnValue = null;
-        try (ResultSet result = executeQuery("[Area]", "AREA_CODE", "AREA_NAME",
+        try (ResultSet result = executeQuery("Area", "AREA_CODE", "AREA_NAME",
                 "SELECT AREA_OF_USE," +
                       " AREA_SOUTH_BOUND_LAT," +
                       " AREA_NORTH_BOUND_LAT," +
@@ -1843,7 +1835,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         CoordinateSystem returnValue = null;
-        try (ResultSet result = executeQuery("[Coordinate System]", "COORD_SYS_CODE", "COORD_SYS_NAME",
+        try (ResultSet result = executeQuery("Coordinate System", "COORD_SYS_CODE", "COORD_SYS_NAME",
                 "SELECT COORD_SYS_CODE," +
                       " COORD_SYS_NAME," +
                       " COORD_SYS_TYPE," +
@@ -1861,8 +1853,7 @@ addURIs:    for (int i=0; ; i++) {
                 final String  remarks    = getOptionalString (result, 5);
                 final boolean deprecated = getOptionalBoolean(result, 6);
                 final CoordinateSystemAxis[] axes = createCoordinateSystemAxes(epsg, dimension);
-                final Map<String,Object> properties = createProperties("[Coordinate System]",    // Must be after axes.
-                                                            name, epsg, remarks, deprecated);
+                final Map<String,Object> properties = createProperties("Coordinate System", name, epsg, remarks, deprecated);   // Must be after axes.
                 final CSFactory csFactory = parent.csFactory;
                 CoordinateSystem cs = null;
                 switch (type.toLowerCase(Locale.US)) {
@@ -2035,7 +2026,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         CoordinateSystemAxis returnValue = null;
-        try (ResultSet result = executeQuery("[Coordinate Axis]", "COORD_AXIS_CODE", null,
+        try (ResultSet result = executeQuery("Coordinate Axis", "COORD_AXIS_CODE", null,
                 "SELECT COORD_AXIS_CODE," +
                       " COORD_AXIS_NAME_CODE," +
                       " COORD_AXIS_ORIENTATION," +
@@ -2058,7 +2049,7 @@ addURIs:    for (int i=0; ; i++) {
                 }
                 final AxisName an = getAxisName(nameCode);
                 final CoordinateSystemAxis axis = parent.csFactory.createCoordinateSystemAxis(
-                        createProperties("[Coordinate Axis]", an.name, epsg, an.description, false),
+                        createProperties("Coordinate Axis", an.name, epsg, an.description, false),
                         abbreviation, direction, parent.createUnit(unit));
                 returnValue = ensureSingleton(axis, returnValue, code);
             }
@@ -2079,7 +2070,7 @@ addURIs:    for (int i=0; ; i++) {
         assert Thread.holdsLock(this);
         AxisName returnValue = axisNames.get(code);
         if (returnValue == null) {
-            try (ResultSet result = executeQuery("[Coordinate Axis Name]",
+            try (ResultSet result = executeQuery("Coordinate Axis Name",
                     "SELECT COORD_AXIS_NAME, DESCRIPTION, REMARKS" +
                     " FROM [Coordinate Axis Name]" +
                     " WHERE COORD_AXIS_NAME_CODE = ?", code))
@@ -2135,7 +2126,7 @@ addURIs:    for (int i=0; ; i++) {
     public synchronized Unit<?> createUnit(final String code) throws NoSuchAuthorityCodeException, FactoryException {
         ArgumentChecks.ensureNonNull("code", code);
         Unit<?> returnValue = null;
-        try (ResultSet result = executeQuery("[Unit of Measure]", "UOM_CODE", "UNIT_OF_MEAS_NAME",
+        try (ResultSet result = executeQuery("Unit of Measure", "UOM_CODE", "UNIT_OF_MEAS_NAME",
                 "SELECT UOM_CODE," +
                       " FACTOR_B," +
                       " FACTOR_C," +
@@ -2210,7 +2201,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         ParameterDescriptor<?> returnValue = null;
-        try (ResultSet result = executeQuery("[Coordinate_Operation Parameter]", "PARAMETER_CODE", "PARAMETER_NAME",
+        try (ResultSet result = executeQuery("Coordinate_Operation Parameter", "PARAMETER_CODE", "PARAMETER_NAME",
                 "SELECT PARAMETER_CODE," +
                       " PARAMETER_NAME," +
                       " DESCRIPTION," +
@@ -2255,7 +2246,7 @@ addURIs:    for (int i=0; ; i++) {
                  * Now creates the parameter descriptor.
                  */
                 final ParameterDescriptor<?> descriptor = new DefaultParameterDescriptor<>(
-                        createProperties("[Coordinate_Operation Parameter]", name, epsg, remarks, deprecated),
+                        createProperties("Coordinate_Operation Parameter", name, epsg, remarks, deprecated),
                         1, 1, type, valueDomain, null, null);
                 returnValue = ensureSingleton(descriptor, returnValue, code);
             }
@@ -2277,7 +2268,7 @@ addURIs:    for (int i=0; ; i++) {
      */
     private ParameterDescriptor<?>[] createParameterDescriptors(final Integer method) throws FactoryException, SQLException {
         final List<ParameterDescriptor<?>> descriptors = new ArrayList<>();
-        try (ResultSet result = executeQuery("[Coordinate_Operation Parameter Usage]",
+        try (ResultSet result = executeQuery("Coordinate_Operation Parameter Usage",
                 "SELECT PARAMETER_CODE" +
                 " FROM [Coordinate_Operation Parameter Usage]" +
                 " WHERE COORD_OP_METHOD_CODE = ?" +
@@ -2301,7 +2292,7 @@ addURIs:    for (int i=0; ; i++) {
     private void fillParameterValues(final Integer method, final Integer operation, final ParameterValueGroup parameters)
             throws FactoryException, SQLException
     {
-        try (ResultSet result = executeQuery("[Coordinate_Operation Parameter Value]",
+        try (ResultSet result = executeQuery("Coordinate_Operation Parameter Value",
                 "SELECT CP.PARAMETER_NAME," +
                       " CV.PARAMETER_VALUE," +
                       " CV.PARAM_VALUE_FILE_REF," +
@@ -2394,7 +2385,7 @@ addURIs:    for (int i=0; ; i++) {
     {
         ArgumentChecks.ensureNonNull("code", code);
         OperationMethod returnValue = null;
-        try (ResultSet result = executeQuery("[Coordinate_Operation Method]", "COORD_OP_METHOD_CODE", "COORD_OP_METHOD_NAME",
+        try (ResultSet result = executeQuery("Coordinate_Operation Method", "COORD_OP_METHOD_CODE", "COORD_OP_METHOD_NAME",
                 "SELECT COORD_OP_METHOD_CODE," +
                       " COORD_OP_METHOD_NAME," +
                       " FORMULA," +
@@ -2411,7 +2402,7 @@ addURIs:    for (int i=0; ; i++) {
                 final boolean deprecated = getOptionalBoolean(result, 5);
                 final Integer[] dim = getDimensionsForMethod(epsg);
                 final ParameterDescriptor<?>[] descriptors = createParameterDescriptors(epsg);
-                Map<String,Object> properties = createProperties("[Coordinate_Operation Method]", name, epsg, remarks, deprecated);
+                Map<String,Object> properties = createProperties("Coordinate_Operation Method", name, epsg, remarks, deprecated);
                 properties.put(OperationMethod.FORMULA_KEY, formula);
                 final OperationMethod method = new DefaultOperationMethod(properties, dim[0], dim[1],
                             new DefaultParameterDescriptorGroup(properties, 1, 1, descriptors));
@@ -2453,7 +2444,7 @@ addURIs:    for (int i=0; ; i++) {
         ArgumentChecks.ensureNonNull("code", code);
         CoordinateOperation returnValue = null;
         try {
-            try (ResultSet result = executeQuery("[Coordinate_Operation]", "COORD_OP_CODE", "COORD_OP_NAME",
+            try (ResultSet result = executeQuery("Coordinate_Operation", "COORD_OP_CODE", "COORD_OP_NAME",
                     "SELECT COORD_OP_CODE," +
                           " COORD_OP_NAME," +
                           " COORD_OP_TYPE," +
@@ -2547,16 +2538,12 @@ addURIs:    for (int i=0; ; i++) {
                      *       methods like createCoordinateReferenceSystem and createOperationMethod
                      *       overwrite the properties map.
                      */
-                    Map<String,Object> opProperties = createProperties("[Coordinate_Operation]",
+                    Map<String,Object> opProperties = createProperties("Coordinate_Operation",
                             name, epsg, area, scope, remarks, deprecated);
                     opProperties.put(CoordinateOperation.OPERATION_VERSION_KEY, version);
                     if (!Double.isNaN(accuracy)) {
-                        PositionalAccuracy element = accuracies.get(accuracy);
-                        if (element == null) {
-                            element = TransformationAccuracy.create(accuracy);
-                            accuracies.put(accuracy, element);
-                        }
-                        opProperties.put(CoordinateOperation.COORDINATE_OPERATION_ACCURACY_KEY, element);
+                        opProperties.put(CoordinateOperation.COORDINATE_OPERATION_ACCURACY_KEY,
+                                TransformationAccuracy.create(accuracy));
                     }
                     /*
                      * Creates the operation. Conversions should be the only operations allowed to have
@@ -2575,7 +2562,7 @@ addURIs:    for (int i=0; ; i++) {
                         result.close();
                         opProperties = new HashMap<>(opProperties);     // Because this class uses a shared map.
                         final List<String> codes = new ArrayList<>();
-                        try (ResultSet cr = executeQuery("[Coordinate_Operation Path]",
+                        try (ResultSet cr = executeQuery("Coordinate_Operation Path",
                                 "SELECT SINGLE_OPERATION_CODE" +
                                  " FROM [Coordinate_Operation Path]" +
                                 " WHERE (CONCAT_OPERATION_CODE = ?)" +
@@ -2783,12 +2770,12 @@ addURIs:    for (int i=0; ; i++) {
         @Override
         protected Set<String> getCodeCandidates(final IdentifiedObject object) throws FactoryException {
             String select = "COORD_REF_SYS_CODE";
-            String from   = "[Coordinate Reference System]";
+            String from   = "Coordinate Reference System";
             final String where;
             final Comparable<?> code;
             if (object instanceof Ellipsoid) {
                 select = "ELLIPSOID_CODE";
-                from   = "[Ellipsoid]";
+                from   = "Ellipsoid";
                 where  = "SEMI_MAJOR_AXIS";
                 code   = ((Ellipsoid) object).getSemiMajorAxis();
             } else {
@@ -2802,7 +2789,7 @@ addURIs:    for (int i=0; ; i++) {
                 } else if (object instanceof GeodeticDatum) {
                     dependency = ((GeodeticDatum) object).getEllipsoid();
                     select     = "DATUM_CODE";
-                    from       = "[Datum]";
+                    from       = "Datum";
                     where      = "ELLIPSOID_CODE";
                 } else {
                     // Not a supported type. Returns all codes.
@@ -2843,7 +2830,7 @@ addURIs:    for (int i=0; ; i++) {
              *   with a tolerance threshold of 1 cm for a planet of the size of Earth.
              */
             final StringBuilder buffer = new StringBuilder(60);
-            buffer.append("SELECT ").append(select).append(" FROM ").append(from).append(" WHERE ").append(where);
+            buffer.append("SELECT ").append(select).append(" FROM [").append(from).append("] WHERE ").append(where);
             if (code instanceof Number) {
                 final double value = ((Number) code).doubleValue();
                 final double tolerance = Math.abs(value * (Formulas.LINEAR_TOLERANCE / ReferencingServices.AUTHALIC_RADIUS));
@@ -2984,7 +2971,7 @@ addURIs:    for (int i=0; ; i++) {
             boolean changed = false;
             for (int i=0; i<codes.length; i++) {
                 final String code = codes[i].toString();
-                try (ResultSet result = executeQuery("[Supersession]", null, null,
+                try (ResultSet result = executeQuery("Supersession", null, null,
                         "SELECT SUPERSEDED_BY" +
                         " FROM [Supersession]" +
                         " WHERE OBJECT_CODE = ?" +

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java?rev=1723082&r1=1723081&r2=1723082&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java [UTF-8] Tue Jan  5 14:20:08 2016
@@ -145,7 +145,7 @@ public class EPSGFactory extends Concurr
                        final SQLTranslator              translator)
             throws FactoryException
     {
-        super(factory(NameFactory.class, nameFactory));
+        super(EPSGDataAccess.class, factory(NameFactory.class, nameFactory));
         if (dataSource != null) {
             this.dataSource = dataSource;
         } else try {




Mime
View raw message