org.geotoolkit.referencing.factory
Class AllAuthoritiesFactory

Object
  extended by Factory
      extended by ReferencingFactory
          extended by AbstractAuthorityFactory
              extended by AuthorityFactoryAdapter
                  extended by MultiAuthoritiesFactory
                      extended by AllAuthoritiesFactory
All Implemented Interfaces:
AuthorityFactory, CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory, Factory

@ThreadSafe
public class AllAuthoritiesFactory
extends MultiAuthoritiesFactory

An authority factory that delegates the object creation to an other factory determined from the authority part in "authority:code" arguments. The set of factories to use as delegates is determined from the AuthorityFactoryFinder with the hints given at construction time.

This factory requires that every codes given to a createXXX(String) method are prefixed by the authority name, for example "EPSG:4326". When a createXXX(String) method is invoked, this class extracts the authority name from the "authority:code" argument. Then is searches for a factory for that authority in the first of the following sets:

  1. The factories given at construction time under the USER_FACTORIES_KEY key, if any. Those factories override the factories normally found by this class at the step below.
  2. The factories registered in AuthorityFactoryFinder and compatible with the hints given at construction time.

If a factory is found, then the work is delegated to that factory. Otherwise a NoSuchAuthorityCodeException is thrown.

This class is not registered in AuthorityFactoryFinder. If this factory is wanted, then users need to invoke explicitly the getInstance(Hints) method.

Since:
2.2
Version:
3.05
Author:
Martin Desruisseaux (IRD, Geomatys)
Module:
referencing/geotk-referencing (download)    View source code for this class

Nested Class Summary
 
Nested classes/interfaces inherited from class Factory
Factory.Availability, Factory.Organizer
 
Field Summary
static Hints.Key USER_FACTORIES_KEY
          The key for an optional value in the Hints map specifying custom factories in addition to the ones registered in AuthorityFactoryFinder.
 
Fields inherited from class AbstractAuthorityFactory
nameFactory
 
Fields inherited from class ReferencingFactory
LOGGER
 
Fields inherited from class Factory
EMPTY_HINTS, hints
 
Constructor Summary
protected AllAuthoritiesFactory(Hints userHints)
          Creates a new factory using the specified hints.
 
Method Summary
 Set<String> getAuthorityNames()
          Returns the set of authority names.
 List<AuthorityFactory> getFactories()
          Returns the factories on which to delegate object creations.
 IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
          Returns a finder which can be used for looking up unidentified objects.
static AllAuthoritiesFactory getInstance(Hints hints)
          Returns a factory using the specified hints.
 
Methods inherited from class MultiAuthoritiesFactory
createObject, getAuthority, getAuthorityCodes, getAuthorityFactory, getAuthorityFactory, getBackingStoreDescription, getCoordinateOperationAuthorityFactory, getCRSAuthorityFactory, getCSAuthorityFactory, getDatumAuthorityFactory, getDescriptionText, getSeparator, getVendor
 
Methods inherited from class AuthorityFactoryAdapter
availability, createCartesianCS, createCompoundCRS, createCoordinateOperation, createCoordinateReferenceSystem, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createDatum, createDerivedCRS, createEllipsoid, createEllipsoidalCS, createEngineeringCRS, createEngineeringDatum, createExtent, createFromCoordinateReferenceSystemCodes, createGeocentricCRS, createGeodeticDatum, createGeographicCRS, createImageCRS, createImageDatum, createOperationMethod, createParameterDescriptor, createPolarCS, createPrimeMeridian, createProjectedCRS, createSphericalCS, createTemporalCRS, createTemporalDatum, createTimeCS, createUnit, createVerticalCRS, createVerticalCS, createVerticalDatum, getImplementationHints, toBackingFactoryCode
 
Methods inherited from class AbstractAuthorityFactory
dispose, noSuchAuthorityCode, trimAuthority
 
Methods inherited from class ReferencingFactory
ensureNonNull
 
Methods inherited from class Factory
equals, hasCompatibleHints, hashCode, setOrdering, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface CRSAuthorityFactory
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS
 
Methods inherited from interface CSAuthorityFactory
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS
 
Methods inherited from interface DatumAuthorityFactory
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum
 
Methods inherited from interface CoordinateOperationAuthorityFactory
createCoordinateOperation, createFromCoordinateReferenceSystemCodes, createOperationMethod
 

Field Detail

USER_FACTORIES_KEY

public static final Hints.Key USER_FACTORIES_KEY
The key for an optional value in the Hints map specifying custom factories in addition to the ones registered in AuthorityFactoryFinder. The value, if defined, must be an instance of Collection<? extends AuthorityFactory>.

If the Hints map given to the constructor contains a value for USER_FACTORIES_KEY, then when a create method is invoked, AllAuthoritiesFactory will first search in the given collection of factories. If no factory is found in that collection, only then the usual AuthorityFactoryFinder will be used as a fallback.

Since:
3.03
Constructor Detail

AllAuthoritiesFactory

protected AllAuthoritiesFactory(Hints userHints)
Creates a new factory using the specified hints. This constructor is available for subclass constructors only. In order to instantiate a AllAuthoritiesFactory instance, use getInstance(hints) instead.

Parameters:
userHints - An optional set of hints, or null if none.
Method Detail

getInstance

public static AllAuthoritiesFactory getInstance(Hints hints)
Returns a factory using the specified hints. This method returns a shared instance when possible. Doing so simplify the tree of factory dependencies.

Parameters:
hints - An optional set of hints, or null if none.
Returns:
A factory using the specified hints.
Since:
3.00

getAuthorityNames

public Set<String> getAuthorityNames()
Returns the set of authority names.

Overrides:
getAuthorityNames in class MultiAuthoritiesFactory
Returns:
The authority names of every factories known to this class.
Since:
2.4

getFactories

public List<AuthorityFactory> getFactories()
Returns the factories on which to delegate object creations. This list is determined from the factories registered in the AuthorityFactoryFinder, merged with the list of factories specified by the USER_FACTORIES_KEY hint if any.

Overrides:
getFactories in class MultiAuthoritiesFactory
Returns:
The factories on which this AllAuthoritiesFactory will delegate object creations.
Since:
3.00

getIdentifiedObjectFinder

public IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
                                                 throws FactoryException
Returns a finder which can be used for looking up unidentified objects. The default implementation delegates the lookups to the underlying factories.

Overrides:
getIdentifiedObjectFinder in class MultiAuthoritiesFactory
Parameters:
type - The type of objects to look for. Should be a GeoAPI interface like GeographicCRS.class, but this method accepts also implementation class. If the type is unknown, use IdentifiedObject.class. A more accurate type may help to speed up the search, since it reduces the amount of tables to scan in some implementations (for example the factories backed by EPSG databases).
Returns:
A finder to use for looking up unidentified objects.
Throws:
FactoryException - if the finder can not be created.
Since:
2.4


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.