AllAuthoritiesFactory changes for revisions 25049:25050

The only change in this commit is to rename FactoryFinder as ReferencingFactoryFinder. However this change does not apply to SIS since we do not plan to port [Referencing]FactoryFinder. The plan is to replace them by some dependency injection mechanism.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r25049:25050 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/factory/AllAuthoritiesFactory.java
Revision 25049Revision 25050
import org.geotools.factory.Hints;
import org.geotools.factory.Factory;
import org.geotools.factory.FactoryRegistryException;
import org.geotools.referencing.FactoryFinder;
import org.geotools.metadata.iso.citation.Citations;
import org.geotools.metadata.iso.citation.CitationImpl;
import org.geotools.util.GenericName;
import org.geotools.factory.Hints;
import org.geotools.factory.Factory;
import org.geotools.factory.FactoryRegistryException;
import org.geotools.referencing.ReferencingFactoryFinder;
import org.geotools.metadata.iso.citation.Citations;
import org.geotools.metadata.iso.citation.CitationImpl;
import org.geotools.util.GenericName;
* This class parses the authority name and delegates the work the corresponding factory. For
* example if any {@code createFoo(...)} method in this class is invoked with a code starting
* by {@code "EPSG:"}, then this class delegates the object creation to the authority factory
* provided by <code>FactoryFinder.{@linkplain FactoryFinder#getCRSAuthorityFactory
* getCRSAuthorityFactory}("EPSG", hints)</code>.
* <p>
* This class is not registered in {@link FactoryFinder}, because it is not a real authority
* factory. There is not a single authority name associated to this factory, but rather a set
* of names determined from all available authority factories. If this "authority" factory is
* wanted, then users need to refer explicitly to the {@link #DEFAULT} constant or to create
* This class parses the authority name and delegates the work the corresponding factory. For
* example if any {@code createFoo(...)} method in this class is invoked with a code starting
* by {@code "EPSG:"}, then this class delegates the object creation to the authority factory
* provided by <code>FactoryFinder.{@linkplain ReferencingFactoryFinder#getCRSAuthorityFactory
* getCRSAuthorityFactory}("EPSG", hints)</code>.
* <p>
* This class is not registered in {@link ReferencingFactoryFinder}, because it is not a real authority
* factory. There is not a single authority name associated to this factory, but rather a set
* of names determined from all available authority factories. If this "authority" factory is
* wanted, then users need to refer explicitly to the {@link #DEFAULT} constant or to create
};

/**
 * A set of user-specified factories to try before to delegate to {@link FactoryFinder},
 * or {@code null} if none.
 */
private final Collection/*<AuthorityFactory>*/ factories;
};

/**
 * A set of user-specified factories to try before to delegate to {@link ReferencingFactoryFinder},
 * or {@code null} if none.
 */
private final Collection/*<AuthorityFactory>*/ factories;
* first scan the supplied factories in their iteration order. The first factory implementing
* the appropriate interface and having the expected {@linkplain AuthorityFactory#getAuthority
* authority name} will be used. Only if no suitable factory is found, then this class delegates
* to {@link FactoryFinder}.
* <p>
* If the {@code factories} collection contains more than one factory for the same authority
* and interface, then all additional factories will be {@linkplain FallbackAuthorityFactory
* first scan the supplied factories in their iteration order. The first factory implementing
* the appropriate interface and having the expected {@linkplain AuthorityFactory#getAuthority
* authority name} will be used. Only if no suitable factory is found, then this class delegates
* to {@link ReferencingFactoryFinder}.
* <p>
* If the {@code factories} collection contains more than one factory for the same authority
* and interface, then all additional factories will be {@linkplain FallbackAuthorityFactory
 *
 * @param hints An optional set of hints, or {@code null} if none.
 * @param factories A set of user-specified factories to try before to delegate
 *        to {@link FactoryFinder}, or {@code null} if none.
 */
public AllAuthoritiesFactory(final Hints hints,
                             final Collection/*<? extends AuthorityFactory>*/ factories)
 *
 * @param hints An optional set of hints, or {@code null} if none.
 * @param factories A set of user-specified factories to try before to delegate
 *        to {@link ReferencingFactoryFinder}, or {@code null} if none.
 */
public AllAuthoritiesFactory(final Hints hints,
                             final Collection/*<? extends AuthorityFactory>*/ factories)
*
* @param hints An optional set of hints, or {@code null} if none.
* @param factories A set of user-specified factories to try before to delegate
*        to {@link FactoryFinder}, or {@code null} if none.
* @param separator The separator between the authority name and the code.
*
* @deprecated Override the {@link #getSeparator} method instead.
*
* @param hints An optional set of hints, or {@code null} if none.
* @param factories A set of user-specified factories to try before to delegate
*        to {@link ReferencingFactoryFinder}, or {@code null} if none.
* @param separator The separator between the authority name and the code.
*
* @deprecated Override the {@link #getSeparator} method instead.
/**
 * Searchs for a factory of the given type. This method first search in user-supplied
 * factories. If no user factory is found, then this method request for a factory using
 * {@link FactoryFinder}. The authority name is inferred from the specified code.
 *
 * @param  type The interface to be implemented.
 * @param  code The code of the object to create.
/**
 * Searchs for a factory of the given type. This method first search in user-supplied
 * factories. If no user factory is found, then this method request for a factory using
 * {@link ReferencingFactoryFinder}. The authority name is inferred from the specified code.
 *
 * @param  type The interface to be implemented.
 * @param  code The code of the object to create.
final AuthorityFactory factory;
try {
    if (CRSAuthorityFactory.class.equals(type)) {
        factory = FactoryFinder.getCRSAuthorityFactory(authority, userHints);
    } else if (CSAuthorityFactory.class.equals(type)) {
        factory = FactoryFinder.getCSAuthorityFactory(authority, userHints);
    } else if (DatumAuthorityFactory.class.equals(type)) {
        factory = FactoryFinder.getDatumAuthorityFactory(authority, userHints);
    } else if (CoordinateOperationAuthorityFactory.class.equals(type)) {
        factory = FactoryFinder.getCoordinateOperationAuthorityFactory(authority, userHints);
    } else {
        continue;
    }
final AuthorityFactory factory;
try {
    if (CRSAuthorityFactory.class.equals(type)) {
        factory = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, userHints);
    } else if (CSAuthorityFactory.class.equals(type)) {
        factory = ReferencingFactoryFinder.getCSAuthorityFactory(authority, userHints);
    } else if (DatumAuthorityFactory.class.equals(type)) {
        factory = ReferencingFactoryFinder.getDatumAuthorityFactory(authority, userHints);
    } else if (CoordinateOperationAuthorityFactory.class.equals(type)) {
        factory = ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory(authority, userHints);
    } else {
        continue;
    }
done.add(this); // Safety for avoiding recursive calls.
inProgress.set(Boolean.TRUE);
try {
    for (final Iterator it=FactoryFinder.getAuthorityNames().iterator(); it.hasNext();) {
        final String authority = ((String) it.next()).trim();
        final char separator = getSeparator(authority);
        /*
done.add(this); // Safety for avoiding recursive calls.
inProgress.set(Boolean.TRUE);
try {
    for (final Iterator it=ReferencingFactoryFinder.getAuthorityNames().iterator(); it.hasNext();) {
        final String authority = ((String) it.next()).trim();
        final char separator = getSeparator(authority);
        /*