sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1773010 [3/8] - in /sis/branches/JDK7: ./ application/sis-console/src/main/artifact/ application/sis-openoffice/src/main/unopkg/ core/sis-build-helper/src/main/javadoc/ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-featur...
Date Wed, 07 Dec 2016 04:14:47 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -31,6 +31,7 @@ import org.apache.sis.internal.system.Lo
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.referencing.factory.MultiAuthoritiesFactory;
+import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
 import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.referencing.factory.sql.EPSGFactory;
 import org.apache.sis.util.logging.Logging;
@@ -44,15 +45,16 @@ import org.apache.sis.util.logging.Loggi
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
- * @version 0.7
+ * @version 0.8
  * @module
  */
 final class AuthorityFactories<T extends AuthorityFactory> extends LazySet<T> {
     /**
      * An array containing only the EPSG factory. Content of this array is initially null.
      * The EPSG factory will be created when first needed by {@link #initialValues()}.
+     * This array is returned directly (not cloned) by {@link #initialValues()}.
      */
-    private static final AuthorityFactory[] EPSG = new AuthorityFactory[1];
+    private static final GeodeticAuthorityFactory[] EPSG = new GeodeticAuthorityFactory[1];
 
     /**
      * The unique system-wide authority factory instance that contains all factories found on the classpath,
@@ -95,25 +97,32 @@ final class AuthorityFactories<T extends
     /**
      * Sets the EPSG factory to the given value.
      */
-    static void EPSG(final AuthorityFactory factory) {
+    static void EPSG(final GeodeticAuthorityFactory factory) {
         synchronized (EPSG) {
             EPSG[0] = factory;
         }
     }
 
     /**
-     * Returns the EPSG factory.
+     * Returns the factory connected to the EPSG geodetic dataset if possible, or the EPSG fallback otherwise.
+     * If an EPSG data source has been found, then this method returns an instance of {@link EPSGFactory} but
+     * there is no guarantee that attempts to use that factory will succeed; for example maybe the EPSG schema
+     * does not exist. Callers should be prepared to either receive an {@link EPSGFactoryFallback} directly if
+     * the EPSG data source does not exist, or replace the {@code EPSGFactory} by a {@code EPSGFactoryFallback}
+     * later if attempt to use the returned factory fails.
      */
-    static AuthorityFactory EPSG() {
+    static GeodeticAuthorityFactory EPSG() {
         synchronized (EPSG) {
-            AuthorityFactory factory = EPSG[0];
-            if (factory == null) try {
-                factory = new EPSGFactory(null);
-            } catch (FactoryException e) {
-                log(e, false);
-                factory = EPSGFactoryFallback.INSTANCE;
+            GeodeticAuthorityFactory factory = EPSG[0];
+            if (factory == null) {
+                try {
+                    factory = new EPSGFactory(null);
+                } catch (FactoryException e) {
+                    log(e, false);
+                    factory = EPSGFactoryFallback.INSTANCE;
+                }
+                EPSG[0] = factory;
             }
-            EPSG[0] = factory;
             return factory;
         }
     }
@@ -123,42 +132,53 @@ final class AuthorityFactories<T extends
      * this method replaces the {@link EPSGFactory} instance by {@link EPSGFactoryFallback} in order to prevent
      * the same exception to be thrown and logged on every calls to {@link CRS#forCode(String)}.
      */
-    static CRSAuthorityFactory fallback(final UnavailableFactoryException e) throws UnavailableFactoryException {
+    static GeodeticAuthorityFactory fallback(final UnavailableFactoryException e) throws UnavailableFactoryException {
         final boolean isTransient = (e.getCause() instanceof SQLTransientException);
         final AuthorityFactory unavailable = e.getUnavailableFactory();
-        final CRSAuthorityFactory factory;
+        GeodeticAuthorityFactory factory;
+        final boolean alreadyDone;
         synchronized (EPSG) {
-            if (unavailable != EPSG[0]) {
-                throw e;                                // Exception did not come from a factory that we control.
-            }
-            factory = EPSGFactoryFallback.INSTANCE;
-            if (!isTransient) {
-                ALL.reload();
-                EPSG[0] = factory;
+            factory = EPSG[0];
+            alreadyDone = (factory == EPSGFactoryFallback.INSTANCE);
+            if (!alreadyDone) {                             // May have been set in another thread (race condition).
+                if (unavailable != factory) {
+                    throw e;                                // Exception did not come from a factory that we control.
+                }
+                factory = EPSGFactoryFallback.INSTANCE;
+                if (!isTransient) {
+                    ALL.reload();
+                    EPSG[0] = factory;
+                }
             }
         }
-        log(e, true);
+        if (!alreadyDone) {
+            log(e, true);
+        }
         return factory;
     }
 
     /**
      * Notifies that a factory is unavailable, but without giving a fallback and without logging.
-     * The caller is responsible for logging a warning and to provide its own fallback.
+     * The caller is responsible for throwing an exception, or for logging a warning and provide its own fallback.
      *
-     * @return {@code true} on success, or {@code false} if this method did nothing.
+     * @return {@code false} if the caller can try again, or {@code true} if the failure can be considered final.
      */
     static boolean failure(final UnavailableFactoryException e) {
         if (!(e.getCause() instanceof SQLTransientException)) {
             final AuthorityFactory unavailable = e.getUnavailableFactory();
             synchronized (EPSG) {
-                if (unavailable == EPSG[0]) {
+                final GeodeticAuthorityFactory factory = EPSG[0];
+                if (factory == EPSGFactoryFallback.INSTANCE) {      // May have been set in another thread.
+                    return false;
+                }
+                if (unavailable == factory) {
                     ALL.reload();
                     EPSG[0] = EPSGFactoryFallback.INSTANCE;
-                    return true;
+                    return false;
                 }
             }
         }
-        return false;
+        return true;
     }
 
     /**
@@ -182,6 +202,8 @@ final class AuthorityFactories<T extends
      *
      * <p>This method tries to instantiate an {@link EPSGFactory} if possible,
      * or an {@link EPSGFactoryFallback} otherwise.</p>
+     *
+     * @return the EPSG factory in an array. Callers shall not modify the returned array.
      */
     @Override
     @SuppressWarnings("unchecked")

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -175,7 +175,7 @@ import org.apache.sis.internal.jdk8.JDK8
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.8
  * @module
  */
 public abstract class Builder<B extends Builder<B>> {
@@ -264,7 +264,7 @@ public abstract class Builder<B extends
      * The properties recognized by this constructor are documented
      * {@linkplain IdentifiedObjects#getProperties(IdentifiedObject, String...) here}.
      *
-     * @param object The identified object from which to inherit properties, or {@code null}.
+     * @param object  the identified object from which to inherit properties, or {@code null}.
      *
      * @since 0.6
      */
@@ -318,6 +318,37 @@ public abstract class Builder<B extends
     }
 
     /**
+     * Creates an identifier for the given authority. If and only if the given authority is the default one,
+     * then the new identifier will also contain the user-supplied code space and version (if any).
+     * The new identifier will be marked as deprecated if {@link #isDeprecated()} returns {@code true}.
+     */
+    private Identifier createIdentifier(final Citation authority, final String identifier) {
+        final String codeSpace;
+        final String version;
+        if (authority == getAuthority()) {
+            codeSpace  = getCodeSpace();
+            version    = getVersion();
+        } else {
+            // Do not use the version information since it applies to the default authority rather than the given one.
+            codeSpace = Citations.getCodeSpace(authority);
+            version   = null;
+        }
+        return createIdentifier(authority, codeSpace, identifier, version);
+    }
+
+    /**
+     * Creates an identifier for the given authority, code space and version.
+     * The new identifier will be marked as deprecated if {@link #isDeprecated()} returns {@code true}.
+     */
+    private Identifier createIdentifier(final Citation authority, final String codeSpace, final String identifier, final String version) {
+        if (isDeprecated()) {
+            return new DeprecatedCode(authority, codeSpace, identifier, version, null, getRemarks());
+        } else {
+            return new ImmutableIdentifier(authority, codeSpace, identifier, version, getDescription());
+        }
+    }
+
+    /**
      * Converts the given name into an identifier. Note that {@link NamedIdentifier}
      * implements both {@link GenericName} and {@link Identifier} interfaces.
      */
@@ -330,8 +361,8 @@ public abstract class Builder<B extends
      * is needed for all keys defined in the {@link Identifier} interface. This check is not needed for other keys,
      * so callers do not need to invoke this method for other keys.
      *
-     * @param  key The key of the property to set.
-     * @param  value The value to set.
+     * @param  key    the key of the property to set.
+     * @param  value  the value to set.
      * @return {@code true} if the property changed as a result of this method call.
      * @throws IllegalStateException if a new value is specified in a phase where the value can not be changed.
      */
@@ -354,7 +385,7 @@ public abstract class Builder<B extends
      * Returns the value of the first argument given by the last call to {@link #setCodeSpace(Citation, String)},
      * or {@code null} if none. The default value is {@code null}.
      *
-     * @return The citation specified by the last call to {@code setCodeSpace(…)}, or {@code null} if none.
+     * @return the citation specified by the last call to {@code setCodeSpace(…)}, or {@code null} if none.
      *
      * @since 0.6
      */
@@ -366,7 +397,7 @@ public abstract class Builder<B extends
      * Returns the value of the last argument given by the last call to {@link #setCodeSpace(Citation, String)},
      * or {@code null} if none. The default value is {@code null}.
      *
-     * @return The string specified by the last call to {@code setCodeSpace(…)}, or {@code null} if none.
+     * @return the string specified by the last call to {@code setCodeSpace(…)}, or {@code null} if none.
      *
      * @since 0.6
      */
@@ -393,8 +424,8 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * this property is kept unchanged until this {@code setCodeSpace(…)} method is invoked again.</p>
      *
-     * @param  authority Bibliographic reference to the authority defining the codes, or {@code null} if none.
-     * @param  codespace The {@code IdentifiedObject} codespace, or {@code null} for inferring it from the authority.
+     * @param  authority  bibliographic reference to the authority defining the codes, or {@code null} if none.
+     * @param  codespace  the {@code IdentifiedObject} codespace, or {@code null} for inferring it from the authority.
      * @return {@code this}, for method call chaining.
      * @throws IllegalStateException if {@code addName(…)} or {@code addIdentifier(…)} has been invoked at least
      *         once since builder construction or since the last call to a {@code createXXX(…)} method.
@@ -414,7 +445,7 @@ public abstract class Builder<B extends
      * Returns the value given by the last call to {@link #setVersion(String)}, or {@code null} if none.
      * The default value is {@code null}.
      *
-     * @return The value specified by the last call to {@code setVersion(…)}, or {@code null} if none.
+     * @return the value specified by the last call to {@code setVersion(…)}, or {@code null} if none.
      *
      * @since 0.6
      */
@@ -434,7 +465,7 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * this property is kept unchanged until this {@code setVersion(…)} method is invoked again.</p>
      *
-     * @param  version The version of code definitions, or {@code null} if none.
+     * @param  version  the version of code definitions, or {@code null} if none.
      * @return {@code this}, for method call chaining.
      * @throws IllegalStateException if {@code addName(…)} or {@code addIdentifier(…)} has been invoked at least
      *         once since builder construction or since the last call to a {@code createXXX(…)} method.
@@ -467,7 +498,7 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * the name and all aliases are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  name The {@code IdentifiedObject} name as a {@link String} or {@link InternationalString} instance.
+     * @param  name  the {@code IdentifiedObject} name as a {@link String} or {@link InternationalString} instance.
      * @return {@code this}, for method call chaining.
      */
     public B addName(final CharSequence name) {
@@ -503,8 +534,8 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * the name and all aliases are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  authority Bibliographic reference to the authority defining the codes, or {@code null} if none.
-     * @param  name The {@code IdentifiedObject} alias as a name in the namespace of the given authority.
+     * @param  authority  bibliographic reference to the authority defining the codes, or {@code null} if none.
+     * @param  name       the {@code IdentifiedObject} alias as a name in the namespace of the given authority.
      * @return {@code this}, for method call chaining.
      *
      * @see #addIdentifier(Citation, String)
@@ -550,7 +581,7 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * the name and all aliases are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  name The {@code IdentifiedObject} name as an identifier.
+     * @param  name  the {@code IdentifiedObject} name as an identifier.
      * @return {@code this}, for method call chaining.
      */
     public B addName(final Identifier name) {
@@ -576,7 +607,7 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * the name and all aliases are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  name The {@code IdentifiedObject} name as an identifier.
+     * @param  name  the {@code IdentifiedObject} name as an identifier.
      * @return {@code this}, for method call chaining.
      */
     public B addName(final GenericName name) {
@@ -605,12 +636,12 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * all identifiers are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  identifier The {@code IdentifiedObject} identifier.
+     * @param  identifier  the {@code IdentifiedObject} identifier.
      * @return {@code this}, for method call chaining.
      */
     public B addIdentifier(final String identifier) {
         ensureNonNull("identifier", identifier);
-        addIdentifier(getAuthority(), getCodeSpace(), identifier, getVersion());
+        identifiers.add(createIdentifier(getAuthority(), getCodeSpace(), identifier, getVersion()));
         return self();
     }
 
@@ -621,42 +652,19 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * all identifiers are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  authority  Bibliographic reference to the authority defining the codes, or {@code null} if none.
-     * @param  identifier The {@code IdentifiedObject} identifier as a code in the namespace of the given authority.
+     * @param  authority   bibliographic reference to the authority defining the codes, or {@code null} if none.
+     * @param  identifier  the {@code IdentifiedObject} identifier as a code in the namespace of the given authority.
      * @return {@code this}, for method call chaining.
      *
      * @see #addName(Citation, CharSequence)
      */
     public B addIdentifier(final Citation authority, final String identifier) {
         ensureNonNull("identifier", identifier);
-        final String codeSpace;
-        final String version;
-        if (authority == getAuthority()) {
-            codeSpace  = getCodeSpace();
-            version    = getVersion();
-        } else {
-            // Do not use the version information since it applies to the default authority rather than the given one.
-            codeSpace = Citations.getCodeSpace(authority);
-            version   = null;
-        }
-        addIdentifier(authority, codeSpace, identifier, version);
+        identifiers.add(createIdentifier(authority, identifier));
         return self();
     }
 
     /**
-     * Implementation of {@link #addIdentifier(String)} and {@link #addIdentifier(Citation, String)}.
-     */
-    private void addIdentifier(final Citation authority, final String codeSpace, final String identifier, final String version) {
-        final Identifier id;
-        if (isDeprecated()) {
-            id = new DeprecatedCode(authority, codeSpace, identifier, version, null, getRemarks());
-        } else {
-            id = new ImmutableIdentifier(authority, codeSpace, identifier, version, getDescription());
-        }
-        identifiers.add(id);
-    }
-
-    /**
      * Adds an {@code IdentifiedObject} identifier fully specified by the given identifier.
      * This method ignores the authority, {@linkplain #setCodeSpace(Citation, String) code space},
      * {@linkplain #setVersion(String) version} and {@linkplain #setDescription(CharSequence) description}
@@ -665,7 +673,7 @@ public abstract class Builder<B extends
      * <p><b>Lifetime:</b>
      * all identifiers are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  identifier The {@code IdentifiedObject} identifier.
+     * @param  identifier  the {@code IdentifiedObject} identifier.
      * @return {@code this}, for method call chaining.
      */
     public B addIdentifier(final Identifier identifier) {
@@ -691,7 +699,7 @@ public abstract class Builder<B extends
      * <p>This is a convenience method for using an existing object as a template, before to modify
      * some names by calls to {@link #rename(Citation, CharSequence[])}.</p>
      *
-     * @param  object The object from which to copy the references to names and identifiers.
+     * @param  object  the object from which to copy the references to names and identifiers.
      * @return {@code this}, for method call chaining.
      *
      * @since 0.6
@@ -734,9 +742,12 @@ public abstract class Builder<B extends
      *   </li>
      * </ul>
      *
-     * @param  authority The authority of the names to replaces.
-     * @param  replacements The new local parts for the names to replace,
-     *         or {@code null} for removing all identifiers associated to the given authority.
+     * This method could also be understood as a {@code setNames(Citation, ...)} method, except that it modifies
+     * only the names associated to the given authority and preserves the same order than previous names.
+     *
+     * @param  authority     the authority of the names to replaces.
+     * @param  replacements  the new local parts for the names to replace,
+     *         or {@code null} or an empty array for removing all names associated to the given authority.
      * @return {@code this}, for method call chaining.
      *
      * @since 0.6
@@ -812,6 +823,63 @@ public abstract class Builder<B extends
     }
 
     /**
+     * Replaces the identifiers associated to the given authority by the given new identifiers.
+     * More specifically:
+     *
+     * <ul>
+     *   <li>The first occurrence of an identifier associated to {@code authority} will be replaced by
+     *       a new identifier with the same authority and the code defined by {@code replacements[0]}.</li>
+     *   <li>The second occurrence of an identifier associated to {@code authority} will be replaced by a
+     *       new identifier with the same authority and the local part defined by {@code replacements[1]}.</li>
+     *   <li><i>etc.</i> until one of the following conditions is meet:
+     *     <ul>
+     *       <li>There is no more identifier associated to the given authority in this {@code Builder}, in which case
+     *           new identifiers are inserted for all remaining elements in the {@code replacements} array.</li>
+     *       <li>There is no more elements in the {@code replacements} array, in which case all remaining
+     *           identifiers associated to the given authority in this {@code Builder} are removed.</li>
+     *     </ul>
+     *   </li>
+     * </ul>
+     *
+     * This method could also be understood as a {@code setIdentifiers(Citation, ...)} method, except that it modifies
+     * only the identifiers associated to the given authority and preserves the same order than previous identifiers.
+     *
+     * @param  authority     the authority of the names to replaces.
+     * @param  replacements  the new local parts for the names to replace,
+     *         or {@code null} or an empty array for removing all names associated to the given authority.
+     * @return {@code this}, for method call chaining.
+     *
+     * @since 0.8
+     */
+    public B reidentify(final Citation authority, final String... replacements) {
+        ensureNonNull("authority", authority);
+        final int length = (replacements != null) ? replacements.length : 0;
+        int next = 0;
+        int insertAt = identifiers.size();
+        for (int i = 0; i < identifiers.size(); i++) {
+            final Identifier old = identifiers.get(i);
+            if (authority.equals(old.getAuthority())) {
+                if (next < length) {
+                    final String code;
+                    ensureNonNullElement("replacements", next, code = replacements[next++]);
+                    if (!code.equals(old.getCode())) {
+                        identifiers.set(i, createIdentifier(authority, code));
+                        insertAt = i + 1;
+                    }
+                } else {
+                    identifiers.remove(i--);
+                }
+            }
+        }
+        while (next < length) {
+            final String code;
+            ensureNonNullElement("replacements", next, code = replacements[next++]);
+            identifiers.add(insertAt++, createIdentifier(authority, code));
+        }
+        return self();
+    }
+
+    /**
      * Returns the parameter description specified by the last call to {@link #setDescription(CharSequence)},
      * or {@code null} if none.
      */
@@ -840,7 +908,7 @@ public abstract class Builder<B extends
      * previous descriptions are discarded by calls to {@code setDescription(…)}.
      * Descriptions are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  description The description as a {@link String} or {@link InternationalString} instance, or {@code null} if none.
+     * @param  description  the description as a {@link String} or {@link InternationalString} instance, or {@code null} if none.
      * @return {@code this}, for method call chaining.
      *
      * @see ImmutableIdentifier#getDescription()
@@ -870,7 +938,7 @@ public abstract class Builder<B extends
      * previous remarks are discarded by calls to {@code setRemarks(…)}.
      * Remarks are cleared after a {@code createXXX(…)} method has been invoked.</p>
      *
-     * @param  remarks The remarks as a {@link String} or {@link InternationalString} instance, or {@code null} if none.
+     * @param  remarks  the remarks as a {@link String} or {@link InternationalString} instance, or {@code null} if none.
      * @return {@code this}, for method call chaining.
      */
     public B setRemarks(final CharSequence remarks) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -325,7 +325,25 @@ public final class CRS extends Static {
             context = new CoordinateOperationContext();
             context.setAreaOfInterest(areaOfInterest);
         }
-        return CoordinateOperations.factory().createOperation(sourceCRS, targetCRS, context);
+        /*
+         * In principle we should just delegate to factory.createOperation(…). However this operation may fail
+         * if a connection to the EPSG database has been found, but the EPSG tables do not yet exist in that
+         * database and
+         */
+        final DefaultCoordinateOperationFactory factory = CoordinateOperations.factory();
+        try {
+            return factory.createOperation(sourceCRS, targetCRS, context);
+        } catch (UnavailableFactoryException e) {
+            if (AuthorityFactories.failure(e)) {
+                throw e;
+            } try {
+                // Above method call replaced the EPSG factory by a fallback. Try again.
+                return factory.createOperation(sourceCRS, targetCRS, context);
+            } catch (FactoryException ex) {
+                ex.addSuppressed(e);
+                throw ex;
+            }
+        }
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -27,28 +27,24 @@ import javax.measure.quantity.Time;
 import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
 import org.opengis.referencing.IdentifiedObject;
-import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.GeocentricCRS;
 import org.opengis.referencing.crs.ProjectedCRS;
-import org.opengis.referencing.crs.CRSAuthorityFactory;
 import org.opengis.referencing.cs.TimeCS;
 import org.opengis.referencing.cs.VerticalCS;
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.SphericalCS;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.AxisDirection;
-import org.opengis.referencing.cs.CSAuthorityFactory;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.opengis.referencing.datum.TemporalDatum;
-import org.opengis.referencing.datum.DatumAuthorityFactory;
 import org.apache.sis.referencing.datum.DefaultVerticalDatum;
 import org.apache.sis.referencing.datum.DefaultTemporalDatum;
 import org.apache.sis.referencing.cs.AxesConvention;
@@ -59,6 +55,7 @@ import org.apache.sis.referencing.crs.De
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultGeocentricCRS;
+import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
 import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.referencing.provider.TransverseMercator;
@@ -518,7 +515,7 @@ public enum CommonCRS {
             synchronized (this) {
                 object = geographic(cached);
                 if (object == null) {
-                    final CRSAuthorityFactory factory = crsFactory();
+                    final GeodeticAuthorityFactory factory = factory();
                     if (factory != null) try {
                         cached = object = factory.createGeographicCRS(String.valueOf(geographic));
                         return object;
@@ -574,7 +571,7 @@ public enum CommonCRS {
                 object = cachedGeo3D;
                 if (object == null) {
                     if (geo3D != 0) {
-                        final CRSAuthorityFactory factory = crsFactory();
+                        final GeodeticAuthorityFactory factory = factory();
                         if (factory != null) try {
                             cachedGeo3D = object = factory.createGeographicCRS(String.valueOf(geo3D));
                             return object;
@@ -632,7 +629,7 @@ public enum CommonCRS {
                 object = cachedGeocentric;
                 if (object == null) {
                     if (geocentric != 0) {
-                        final CRSAuthorityFactory factory = crsFactory();
+                        final GeodeticAuthorityFactory factory = factory();
                         if (factory != null) try {
                             cachedGeocentric = object = factory.createGeocentricCRS(String.valueOf(geocentric));
                             return object;
@@ -689,7 +686,7 @@ public enum CommonCRS {
                      */
                     SphericalCS cs = null;
                     if (this == DEFAULT) {
-                        final CSAuthorityFactory factory = csFactory();
+                        final GeodeticAuthorityFactory factory = factory();
                         if (factory != null) try {
                             cs = factory.createSphericalCS("6404");
                         } catch (FactoryException e) {
@@ -738,7 +735,7 @@ public enum CommonCRS {
             synchronized (this) {
                 object = datum(cached);
                 if (object == null) {
-                    final DatumAuthorityFactory factory = datumFactory();
+                    final GeodeticAuthorityFactory factory = factory();
                     if (factory != null) try {
                         cached = object = factory.createGeodeticDatum(String.valueOf(datum));
                         return object;
@@ -782,7 +779,7 @@ public enum CommonCRS {
                     if (this == NAD83) {
                         object = ETRS89.ellipsoid();            // Share the same instance for NAD83 and ETRS89.
                     } else {
-                        final DatumAuthorityFactory factory = datumFactory();
+                        final GeodeticAuthorityFactory factory = factory();
                         if (factory != null) try {
                             cached = object = factory.createEllipsoid(String.valueOf(ellipsoid));
                             return object;
@@ -822,7 +819,7 @@ public enum CommonCRS {
                     if (this != DEFAULT) {
                         object = DEFAULT.primeMeridian();           // Share the same instance for all constants.
                     } else {
-                        final DatumAuthorityFactory factory = datumFactory();
+                        final GeodeticAuthorityFactory factory = factory();
                         if (factory != null) try {
                             cached = object = factory.createPrimeMeridian(StandardDefinitions.GREENWICH);
                             return object;
@@ -945,7 +942,7 @@ public enum CommonCRS {
                 code = (isSouth ? southUTM : northUTM) & 0xFFFF;
                 if (code != 0) {
                     code += zone;
-                    final CRSAuthorityFactory factory = crsFactory();
+                    final GeodeticAuthorityFactory factory = factory();
                     if (factory != null) try {
                         return factory.createProjectedCRS(String.valueOf(code));
                     } catch (FactoryException e) {
@@ -969,7 +966,7 @@ public enum CommonCRS {
                 if (this != DEFAULT) {
                     cs = DEFAULT.UTM(latitude, longitude).getCoordinateSystem();
                 } else {
-                    cs = (CartesianCS) StandardDefinitions.createCoordinateSystem((short) 4400);
+                    cs = (CartesianCS) StandardDefinitions.createCoordinateSystem(Constants.EPSG_PROJECTED_CS);
                 }
             }
             crs = StandardDefinitions.createUTM(code, geographic(), latitude, longitude, cs);
@@ -1194,7 +1191,7 @@ public enum CommonCRS {
                     object = crs(cached);
                     if (object == null) {
                         if (isEPSG) {
-                            final CRSAuthorityFactory factory = crsFactory();
+                            final GeodeticAuthorityFactory factory = factory();
                             if (factory != null) try {
                                 cached = object = factory.createVerticalCRS(String.valueOf(crs));
                                 return object;
@@ -1259,7 +1256,7 @@ public enum CommonCRS {
                     object = datum(cached);
                     if (object == null) {
                         if (isEPSG) {
-                            final DatumAuthorityFactory factory = datumFactory();
+                            final GeodeticAuthorityFactory factory = factory();
                             if (factory != null) try {
                                 cached = object = factory.createVerticalDatum(String.valueOf(datum));
                                 return object;
@@ -1571,7 +1568,7 @@ public enum CommonCRS {
      * Returns the same properties than the given object, except for the identifier which is set to the given code.
      */
     private static Map<String,?> properties(final IdentifiedObject template, final short code) {
-        final Map<String,Object> properties = new HashMap<>(IdentifiedObjects.getProperties(template, EXCLUDE));
+        final Map<String,Object> properties = new HashMap<String,Object>(IdentifiedObjects.getProperties(template, EXCLUDE));
         properties.put(GeographicCRS.IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, String.valueOf(code)));
         return properties;
     }
@@ -1580,39 +1577,11 @@ public enum CommonCRS {
      * Returns the EPSG factory to use for creating CRS, or {@code null} if none.
      * If this method returns {@code null}, then the caller will silently fallback on hard-coded values.
      */
-    static CRSAuthorityFactory crsFactory() {
+    static GeodeticAuthorityFactory factory() {
         if (!EPSGFactoryFallback.FORCE_HARDCODED) {
-            final AuthorityFactory factory = AuthorityFactories.EPSG();
+            final GeodeticAuthorityFactory factory = AuthorityFactories.EPSG();
             if (!(factory instanceof EPSGFactoryFallback)) {
-                return (CRSAuthorityFactory) factory;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the EPSG factory to use for creating coordinate systems, or {@code null} if none.
-     * If this method returns {@code null}, then the caller will silently fallback on hard-coded values.
-     */
-    static CSAuthorityFactory csFactory() {
-        if (!EPSGFactoryFallback.FORCE_HARDCODED) {
-            final AuthorityFactory factory = AuthorityFactories.EPSG();
-            if (!(factory instanceof EPSGFactoryFallback)) {
-                return (CSAuthorityFactory) factory;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the EPSG factory to use for creating datum, ellipsoids and prime meridians, or {@code null} if none.
-     * If this method returns {@code null}, then the caller will silently fallback on hard-coded values.
-     */
-    static DatumAuthorityFactory datumFactory() {
-        if (!EPSGFactoryFallback.FORCE_HARDCODED) {
-            final AuthorityFactory factory = AuthorityFactories.EPSG();
-            if (!(factory instanceof EPSGFactoryFallback)) {
-                return (DatumAuthorityFactory) factory;
+                return factory;
             }
         }
         return null;
@@ -1626,7 +1595,7 @@ public enum CommonCRS {
         String message = Resources.format(Resources.Keys.CanNotInstantiateGeodeticObject_1, (Constants.EPSG + ':') + code);
         message = Exceptions.formatChainedMessages(null, message, e);
         final LogRecord record = new LogRecord(Level.WARNING, message);
-        if (!(e instanceof UnavailableFactoryException) || !AuthorityFactories.failure((UnavailableFactoryException) e)) {
+        if (!(e instanceof UnavailableFactoryException) || AuthorityFactories.failure((UnavailableFactoryException) e)) {
             // Append the stack trace only if the exception is the the one we expect when the factory is not available.
             record.setThrown(e);
         }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -261,7 +261,7 @@ public class DefaultGeographicCRS extend
                 if (EPSG.equals(identifier.getCodeSpace())) try {
                     final int i = Arrays.binarySearch(EPSG_CODES, Short.parseShort(identifier.getCode()));
                     if (i >= 0) {
-                        final Map<String,Object> c = new HashMap<>(properties);
+                        final Map<String,Object> c = new HashMap<String,Object>(properties);
                         c.put(IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.WMS, CRS, Short.toString(CRS_CODES[i])));
                         properties = c;
                     }

Copied: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java (from r1773005, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java?p2=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java&r1=1773005&r2=1773010&rev=1773010&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -74,7 +74,7 @@ final class Codes {
     private static int pack(final AxisDirection[] directions) {
         int packed = 0;
         int i = directions.length;
-        if (i <= Integer.BYTES) {
+        if (i <= Integer.SIZE / Byte.SIZE) {
             while (--i >= 0) {
                 final int ordinal = directions[i].ordinal();
                 if (ordinal <= 0 || ordinal > Byte.MAX_VALUE) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -31,6 +31,7 @@ import org.apache.sis.measure.Units;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.referencing.Resources;
@@ -38,6 +39,7 @@ import org.apache.sis.referencing.operat
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import static org.apache.sis.util.ArgumentChecks.ensureNonNullElement;
 
 
 /**
@@ -229,20 +231,6 @@ public final class CoordinateSystems ext
     }
 
     /**
-     * Returns the axis direction for the specified coordinate system.
-     *
-     * @param  cs  the coordinate system.
-     * @return the axis directions for the specified coordinate system.
-     */
-    private static AxisDirection[] getAxisDirections(final CoordinateSystem cs) {
-        final AxisDirection[] directions = new AxisDirection[cs.getDimension()];
-        for (int i=0; i<directions.length; i++) {
-            directions[i] = cs.getAxis(i).getDirection();
-        }
-        return directions;
-    }
-
-    /**
      * Returns an affine transform between two coordinate systems.
      * Only units and axes order (e.g. transforming from
      * ({@linkplain AxisDirection#NORTH North}, {@linkplain AxisDirection#WEST West}) to
@@ -429,7 +417,7 @@ public final class CoordinateSystems ext
      *
      * @param  cs       the coordinate system in which to replace linear units, or {@code null}.
      * @param  newUnit  the new linear unit.
-     * @return the modified coordinate system as a new instance,
+     * @return the modified coordinate system as a new instance, or {@code null} if the given {@code cs} was null,
      *         or {@code cs} if all linear units were already equal to the given one.
      *
      * @see Units#isLinear(Unit)
@@ -470,7 +458,7 @@ public final class CoordinateSystems ext
      *
      * @param  cs       the coordinate system in which to replace angular units, or {@code null}.
      * @param  newUnit  the new angular unit.
-     * @return the modified coordinate system as a new instance,
+     * @return the modified coordinate system as a new instance, or {@code null} if the given {@code cs} was null,
      *         or {@code cs} if all angular units were already equal to the given one.
      *
      * @see Units#isAngular(Unit)
@@ -495,4 +483,74 @@ public final class CoordinateSystems ext
             }
         });
     }
+
+    /**
+     * Returns the axis directions for the specified coordinate system.
+     * This method guarantees that the returned array is non-null and does not contain any null direction.
+     *
+     * @param  cs  the coordinate system.
+     * @return the axis directions for the specified coordinate system.
+     * @throws NullArgumentException if {@code cs} is null, or one of its axes is null,
+     *         or a value returned by {@link CoordinateSystemAxis#getDirection()} is null.
+     *
+     * @since 0.8
+     */
+    public static AxisDirection[] getAxisDirections(final CoordinateSystem cs) {
+        ensureNonNull("cs", cs);
+        final AxisDirection[] directions = new AxisDirection[cs.getDimension()];
+        for (int i=0; i<directions.length; i++) {
+            final CoordinateSystemAxis axis = cs.getAxis(i);
+            ensureNonNullElement("cs", i, cs);
+            ensureNonNullElement("cs[#].direction", i, directions[i] = axis.getDirection());
+        }
+        return directions;
+    }
+
+    /**
+     * Returns the EPSG code of a coordinate system using the given unit and axis directions.
+     * If no suitable coordinate system is known to Apache SIS, then this method returns {@code null}.
+     *
+     * <p>Current implementation uses a hard-coded list of known coordinate systems;
+     * it does not yet scan the EPSG database (this may change in future Apache SIS version).
+     * The current list of known coordinate systems is given below.</p>
+     *
+     * <table>
+     *   <caption>Known coordinate systems (CS)</caption>
+     *   <tr><th>EPSG</th> <th>CS type</th> <th colspan="2">Axis directions</th> <th>Unit</th></tr>
+     *   <tr><td>6424</td> <td>Ellipsoidal</td> <td>east</td>  <td>north</td> <td>degree</td></tr>
+     *   <tr><td>6422</td> <td>Ellipsoidal</td> <td>north</td> <td>east</td>  <td>degree</td></tr>
+     *   <tr><td>6425</td> <td>Ellipsoidal</td> <td>east</td>  <td>north</td> <td>grads</td></tr>
+     *   <tr><td>6403</td> <td>Ellipsoidal</td> <td>north</td> <td>east</td>  <td>grads</td></tr>
+     *   <tr><td>6429</td> <td>Ellipsoidal</td> <td>east</td>  <td>north</td> <td>radian</td></tr>
+     *   <tr><td>6428</td> <td>Ellipsoidal</td> <td>north</td> <td>east</td>  <td>radian</td></tr>
+     *   <tr><td>4400</td> <td>Cartesian</td>   <td>east</td>  <td>north</td> <td>metre</td></tr>
+     *   <tr><td>4500</td> <td>Cartesian</td>   <td>north</td> <td>east</td>  <td>metre</td></tr>
+     *   <tr><td>4491</td> <td>Cartesian</td>   <td>west</td>  <td>north</td> <td>metre</td></tr>
+     *   <tr><td>4501</td> <td>Cartesian</td>   <td>north</td> <td>west</td>  <td>metre</td></tr>
+     *   <tr><td>6503</td> <td>Cartesian</td>   <td>west</td>  <td>south</td> <td>metre</td></tr>
+     *   <tr><td>6501</td> <td>Cartesian</td>   <td>south</td> <td>west</td>  <td>metre</td></tr>
+     *   <tr><td>1039</td> <td>Cartesian</td>   <td>east</td>  <td>north</td> <td>foot</td></tr>
+     *   <tr><td>1029</td> <td>Cartesian</td>   <td>north</td> <td>east</td>  <td>foot</td></tr>
+     *   <tr><td>4403</td> <td>Cartesian</td>   <td>east</td>  <td>north</td> <td>Clarke’s foot</td></tr>
+     *   <tr><td>4502</td> <td>Cartesian</td>   <td>north</td> <td>east</td>  <td>Clarke’s foot</td></tr>
+     *   <tr><td>4497</td> <td>Cartesian</td>   <td>east</td>  <td>north</td> <td>US survey foot</td></tr>
+     * </table>
+     *
+     * @param  unit        desired unit of measurement.
+     * @param  directions  desired axis directions.
+     * @return EPSG codes for a coordinate system using the given axis directions and unit of measurement,
+     *         or {@code null} if unknown to this method. Note that a null value does not mean that a more
+     *         extensive search in the EPSG database would not find a matching coordinate system.
+     *
+     * @see Units#getEpsgCode(Unit, boolean)
+     * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createCoordinateSystem(String)
+     *
+     * @since 0.8
+     */
+    public static Integer getEpsgCode(final Unit<?> unit, final AxisDirection... directions) {
+        ensureNonNull("unit", unit);
+        ensureNonNull("directions", directions);
+        final int code = Codes.lookup(unit, directions);
+        return (code != 0) ? code : null;
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -1893,7 +1893,7 @@ public abstract class ConcurrentAuthorit
      * All access to this object must be done in a block synchronized on {@link #findPool}.
      */
     private static final class FindEntry {
-        /** Result of the search with our without ignoring axes. */
+        /** Result of the search with or without ignoring axes. */
         private Set<IdentifiedObject> strict, lenient;
 
         /** Whether the cache is the result of an explicit request instead than a dependency search. */

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -98,7 +98,7 @@ public abstract class GeodeticAuthorityF
      *
      * The online resource description with a “Connection” function is a SIS extension.</div>
      *
-     * @return The organization responsible for definition of the database, or {@code null} if unknown.
+     * @return the organization responsible for definition of the database, or {@code null} if unknown.
      *
      * @see #getVendor()
      */
@@ -135,7 +135,7 @@ public abstract class GeodeticAuthorityF
      * 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.
+     * @return the namespaces recognized by this factory, or an empty set if none.
      */
     public Set<String> getCodeSpaces() {
         final String authority = Citations.getCodeSpace(getAuthority());
@@ -152,8 +152,8 @@ public abstract class GeodeticAuthorityF
      * This may be costly since it involves a full object creation.
      * Subclasses are encouraged to provide a more efficient implementation if they can.
      *
-     * @param  code Value allocated by authority.
-     * @return A description of the object, or {@code null} if the object
+     * @param  code  value allocated by authority.
+     * @return a description of the object, or {@code null} if the object
      *         corresponding to the specified {@code code} has no description.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if an error occurred while fetching the description.
@@ -176,8 +176,8 @@ public abstract class GeodeticAuthorityF
      * Overriding this method is sufficient for supporting the more specific {@code createFoo(String)} methods,
      * but subclasses are encouraged to override the later for efficiency.
      *
-     * @param  code Value allocated by authority.
-     * @return The object for the given code.
+     * @param  code  value allocated by authority.
+     * @return the object for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -217,8 +217,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -262,8 +262,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -296,8 +296,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed.
      *
@@ -331,8 +331,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -362,8 +362,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -381,8 +381,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -400,8 +400,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -429,8 +429,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -448,8 +448,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -476,8 +476,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -496,8 +496,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate reference system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate reference system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -530,8 +530,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -563,8 +563,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -597,8 +597,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -616,8 +616,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -635,8 +635,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -666,8 +666,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -686,8 +686,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The datum for the given code.
+     * @param  code  value allocated by authority.
+     * @return the datum for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -717,8 +717,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The ellipsoid for the given code.
+     * @param  code  value allocated by authority.
+     * @return the ellipsoid for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -750,8 +750,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The prime meridian for the given code.
+     * @param  code  value allocated by authority.
+     * @return the prime meridian for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -780,8 +780,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The extent for the given code.
+     * @param  code  value allocated by authority.
+     * @return the extent for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -815,12 +815,13 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
      * @see org.apache.sis.referencing.cs.AbstractCS
+     * @see org.apache.sis.referencing.cs.CoordinateSystems#getEpsgCode(Unit, AxisDirection...)
      */
     public CoordinateSystem createCoordinateSystem(final String code) throws NoSuchAuthorityCodeException, FactoryException {
         return cast(CoordinateSystem.class, createObject(code), code);
@@ -847,8 +848,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -876,8 +877,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -895,8 +896,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -913,8 +914,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -945,8 +946,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -974,8 +975,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -993,8 +994,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1012,8 +1013,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The coordinate system for the given code.
+     * @param  code  value allocated by authority.
+     * @return the coordinate system for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1043,8 +1044,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The axis for the given code.
+     * @param  code  value allocated by authority.
+     * @return the axis for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1079,8 +1080,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The unit of measurement for the given code.
+     * @param  code  value allocated by authority.
+     * @return the unit of measurement for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1111,8 +1112,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The parameter descriptor for the given code.
+     * @param  code  value allocated by authority.
+     * @return the parameter descriptor for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1139,8 +1140,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The operation method for the given code.
+     * @param  code  value allocated by authority.
+     * @return the operation method for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1173,8 +1174,8 @@ public abstract class GeodeticAuthorityF
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
-     * @param  code Value allocated by authority.
-     * @return The operation for the given code.
+     * @param  code  value allocated by authority.
+     * @return the operation for the given code.
      * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      *
@@ -1194,9 +1195,9 @@ public abstract class GeodeticAuthorityF
      * <div class="section">Default implementation</div>
      * The default implementation returns an empty set.
      *
-     * @param  sourceCRS  Coded value of source coordinate reference system.
-     * @param  targetCRS  Coded value of target coordinate reference system.
-     * @return The operations from {@code sourceCRS} to {@code targetCRS}.
+     * @param  sourceCRS  coded value of source coordinate reference system.
+     * @param  targetCRS  coded value of target coordinate reference system.
+     * @return the operations from {@code sourceCRS} to {@code targetCRS}.
      * @throws NoSuchAuthorityCodeException if a specified code was not found.
      * @throws FactoryException if the object creation failed for some other reason.
      */
@@ -1212,7 +1213,7 @@ public abstract class GeodeticAuthorityF
      * 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.
+     * @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)
@@ -1233,8 +1234,8 @@ public abstract class GeodeticAuthorityF
      * 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.
-     * @return The code with the namespace part removed if that part matched one of the values given by
+     * @param  code  the code to trim.
+     * @return the code with the namespace part removed if that part matched one of the values given by
      *         {@link #getCodeSpaces()}.
      */
     final String trimNamespace(final String code) {
@@ -1265,10 +1266,10 @@ public abstract class GeodeticAuthorityF
      * Casts the given object to the given type, or throws an exception if the object can not be casted.
      * This convenience method is provided for implementation of {@code createXXX} methods.
      *
-     * @param  type   The type to return (e.g. {@code CoordinateReferenceSystem.class}).
-     * @param  object The object to cast.
-     * @param  code   The authority code, used only for formatting an error message.
-     * @return The object casted to the given type.
+     * @param  type    the type to return (e.g. {@code CoordinateReferenceSystem.class}).
+     * @param  object  the object to cast.
+     * @param  code    the authority code, used only for formatting an error message.
+     * @return the object casted to the given type.
      * @throws NoSuchAuthorityCodeException if the given object is not an instance of the given type.
      */
     @SuppressWarnings("unchecked")

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -443,7 +443,7 @@ public class IdentifiedObjectFinder {
             candidate = create(code);
         } catch (FactoryException e) {
             /*
-             * The identifier was not recognized. We will continue later will aliases.
+             * The identifier was not recognized. We will continue later with aliases.
              * Note: we catch a more generic exception than NoSuchAuthorityCodeException because
              *       this attempt may fail for various reasons (character string not supported
              *       by the underlying database for primary key, duplicated name found, etc.).
@@ -509,12 +509,23 @@ public class IdentifiedObjectFinder {
     }
 
     /**
-     * Creates an object for the given code. This method is invoked by the default {@link #find(IdentifiedObject)}
-     * method implementation of for each code returned by the {@link #getCodeCandidates(IdentifiedObject)} method,
-     * in iteration order.
+     * Creates an object for the given identifier, name or alias. This method is invoked by the default
+     * {@link #find(IdentifiedObject)} method implementation with the following argument values, in order
+     * (from less expensive to most expensive search operation):
+     *
+     * <ol>
+     *   <li>All {@linkplain AbstractIdentifiedObject#getIdentifier() identifiers} of the object to search,
+     *       formatted in an {@linkplain IdentifiedObjects#toString(Identifier) "AUTHORITY:CODE"} pattern.</li>
+     *   <li>The {@linkplain AbstractIdentifiedObject#getName() name} of the object to search,
+     *       {@linkplain org.apache.sis.referencing.NamedIdentifier#getCode() without authority}.</li>
+     *   <li>All {@linkplain AbstractIdentifiedObject#getAlias() aliases} of the object to search.</li>
+     *   <li>Each code returned by the {@link #getCodeCandidates(IdentifiedObject)} method, in iteration order.</li>
+     * </ol>
      *
      * @param  code  the authority code for which to create an object.
      * @return the identified object for the given code, or {@code null} to stop attempts.
+     * @throws NoSuchAuthorityCodeException if no object is found for the given code. It may happen if {@code code}
+     *         was a name or alias instead than an identifier and the factory supports only search by identifier.
      * @throws FactoryException if an error occurred while creating the object.
      */
     private IdentifiedObject create(final String code) throws FactoryException {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -533,7 +533,7 @@ public class MultiAuthoritiesFactory ext
      * condition is meet, threads can safely use their iterators concurrently.</p>
      */
     final Iterator<AuthorityFactory> getAllFactories() {
-        return new LazySynchronizedIterator<>(providers);
+        return new LazySynchronizedIterator<AuthorityFactory>(providers);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/UnavailableFactoryException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/UnavailableFactoryException.java?rev=1773010&r1=1773009&r2=1773010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/UnavailableFactoryException.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/UnavailableFactoryException.java [UTF-8] Wed Dec  7 04:14:44 2016
@@ -56,7 +56,7 @@ public class UnavailableFactoryException
     /**
      * Construct an exception with the specified detail message.
      *
-     * @param  message The detail message. The detail message is saved
+     * @param  message  the detail message. The detail message is saved
      *         for later retrieval by the {@link #getMessage()} method.
      */
     public UnavailableFactoryException(String message) {
@@ -68,9 +68,9 @@ public class UnavailableFactoryException
      * The cause is the exception thrown in the underlying database
      * (e.g. {@link java.io.IOException} or {@link java.sql.SQLException}).
      *
-     * @param  message The detail message. The detail message is saved
+     * @param  message  the detail message. The detail message is saved
      *         for later retrieval by the {@link #getMessage()} method.
-     * @param  cause The cause for this exception. The cause is saved
+     * @param  cause  the cause for this exception. The cause is saved
      *         for later retrieval by the {@link #getCause()} method.
      */
     public UnavailableFactoryException(String message, Throwable cause) {
@@ -90,7 +90,7 @@ public class UnavailableFactoryException
      * unavailable. User may want to be informed about which factory is unavailable, for example in order
      * to remove it from the list of factory managed by {@link MultiAuthoritiesFactory}.</div>
      *
-     * @param factory The factory which is unavailable.
+     * @param  factory  the factory which is unavailable.
      */
     public void setUnavailableFactory(final AuthorityFactory factory) {
         this.factory = factory;
@@ -100,7 +100,7 @@ public class UnavailableFactoryException
      * Returns the factory which has been found unavailable, or {@code null} if unspecified.
      * See {@link #setUnavailableFactory(AuthorityFactory)} for more details.
      *
-     * @return The factory that should be considered as unavailable.
+     * @return the factory that should be considered as unavailable.
      */
     public AuthorityFactory getUnavailableFactory() {
         return factory;



Mime
View raw message