Class ManyAuthoritiesFactory
- All Implemented Interfaces:
AuthorityFactory,CRSAuthorityFactory,CSAuthorityFactory,DatumAuthorityFactory,Factory,CoordinateOperationAuthorityFactory,Factory,OptionalFactory,RegistrableFactory
- Direct Known Subclasses:
AllAuthoritiesFactory
createFoo method are prefixed by the authority name,
for example "EPSG:4326". This is different from using a factory from a known authority, in which case the
authority part was optional (for example when using the EPSG
authority factory, the "EPSG:" part in "EPSG:4326" is optional).
This class parses the authority name and delegates the work the corresponding factory. For example if any
createFoo(...) method in this class is invoked with a code starting by "EPSG:", then this class
delegates the object creation to one of the authority factories provided to the constructor.
This class is not registered in 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.
- Since:
- 2.4
- Author:
- Martin Desruisseaux (IRD)
-
Field Summary
Fields inherited from class ReferencingFactory
LOGGERFields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority -
Constructor Summary
ConstructorsConstructorDescriptionManyAuthoritiesFactory(Collection<? extends AuthorityFactory> factories) Creates a new factory using the specified set of user factories. -
Method Summary
Modifier and TypeMethodDescriptioncreateObject(String code) Returns an arbitrary object from a code.Returns the organization or party responsible for definition and maintenance of the database.getAuthorityCodes(Class<? extends IdentifiedObject> type) Returns the set of authority codes of the given type.protected AuthorityFactorygetAuthorityFactory(String code) Returns a generic object authority factory for the specified"AUTHORITY:NUMBER"code.Returns the authority names of every factories given at construction time.Returns a description of the underlying backing store, ornullif unknow.protected CoordinateOperationAuthorityFactoryReturns the operation authority factory for the specified"AUTHORITY:NUMBER"code.protected CRSAuthorityFactorygetCRSAuthorityFactory(String code) Returns the CRS authority factory for the specified"AUTHORITY:NUMBER"code.protected CSAuthorityFactorygetCSAuthorityFactory(String code) Returns the CS authority factory for the specified"AUTHORITY:NUMBER"code.protected DatumAuthorityFactoryReturns the datum authority factory for the specified"AUTHORITY:NUMBER"code.getDescriptionText(String code) Gets a description of the object corresponding to a code.getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type) Returns a finder which can be used for looking up unidentified objects.protected chargetSeparator(String code) Returns the character separator for the specified code.Returns the vendor responsible for creating this factory implementation.protected voidnotifySuccess(String method, String code, CRSAuthorityFactory factory, CoordinateReferenceSystem crs) Log a message when a CRS is found.Methods inherited from class AuthorityFactoryAdapter
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, dispose, isAvailable, toBackingFactoryCodeMethods inherited from class AbstractAuthorityFactory
noSuchAuthorityCode, trimAuthorityMethods inherited from class ReferencingFactory
ensureNonNullMethods inherited from class AbstractFactory
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toStringMethods inherited from interface CoordinateOperationAuthorityFactory
createCoordinateOperation, createFromCoordinateReferenceSystemCodesMethods inherited from interface CRSAuthorityFactory
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRSMethods inherited from interface CSAuthorityFactory
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCSMethods inherited from interface DatumAuthorityFactory
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatumMethods inherited from interface Factory
getImplementationHints
-
Constructor Details
-
ManyAuthoritiesFactory
Creates a new factory using the specified set of user factories. Any call to acreateFoo(code)method will scan the supplied factories in their iteration order. The first factory implementing the appropriate interface and having the expected authority name will be used.If the
factoriescollection contains more than one factory for the same authority and interface, then all additional factories will be fallbacks, to be tried in iteration order only if the first acceptable factory failed to create the requested object.- Parameters:
factories- A set of user-specified factories to try
-
-
Method Details
-
getSeparator
Returns the character separator for the specified code. The default implementation returns the default name separator':', except if the code looks like a URL (e.g."http://www.opengis.net/"), in which case this method returns'/'.In the current implementation, "looks like a URL" means that the first non-aplhanumeric characters are
"://". But this heuristic rule may change in future implementations. -
getVendor
Returns the vendor responsible for creating this factory implementation. The default implementation returns Geotools.- Specified by:
getVendorin interfaceFactory- Overrides:
getVendorin classAuthorityFactoryAdapter- Returns:
- The vendor for this factory implementation.
-
getAuthority
Returns the organization or party responsible for definition and maintenance of the database. The default implementation returns a citation with title "All".- Specified by:
getAuthorityin interfaceAuthorityFactory- Overrides:
getAuthorityin classAuthorityFactoryAdapter- Returns:
- The organization reponsible for definition of the database.
-
getAuthorityNames
Returns the authority names of every factories given at construction time. -
getBackingStoreDescription
Returns a description of the underlying backing store, ornullif unknow.- Overrides:
getBackingStoreDescriptionin classAuthorityFactoryAdapter- Returns:
- The description of the underlying backing store, or
null. - Throws:
FactoryException- if a failure occured while fetching the engine description.
-
notifySuccess
protected void notifySuccess(String method, String code, CRSAuthorityFactory factory, CoordinateReferenceSystem crs) Description copied from class:AuthorityFactoryAdapterLog a message when a CRS is found. Child objects that doesn't create their own CRS-objects should not report.- Overrides:
notifySuccessin classAuthorityFactoryAdapter
-
getAuthorityFactory
Returns a generic object authority factory for the specified"AUTHORITY:NUMBER"code.- Overrides:
getAuthorityFactoryin classAuthorityFactoryAdapter- Parameters:
code- The code to parse.- Returns:
- The authority factory.
- Throws:
NoSuchAuthorityCodeException- if no authority name has been found.
-
getDatumAuthorityFactory
protected DatumAuthorityFactory getDatumAuthorityFactory(String code) throws NoSuchAuthorityCodeException Returns the datum authority factory for the specified"AUTHORITY:NUMBER"code.- Overrides:
getDatumAuthorityFactoryin classAuthorityFactoryAdapter- Parameters:
code- The code to parse.- Returns:
- The authority factory.
- Throws:
NoSuchAuthorityCodeException- if no authority name has been found.
-
getCSAuthorityFactory
Returns the CS authority factory for the specified"AUTHORITY:NUMBER"code.- Overrides:
getCSAuthorityFactoryin classAuthorityFactoryAdapter- Parameters:
code- The code to parse.- Returns:
- The authority factory.
- Throws:
NoSuchAuthorityCodeException- if no authority name has been found.
-
getCRSAuthorityFactory
protected CRSAuthorityFactory getCRSAuthorityFactory(String code) throws NoSuchAuthorityCodeException Returns the CRS authority factory for the specified"AUTHORITY:NUMBER"code.- Overrides:
getCRSAuthorityFactoryin classAuthorityFactoryAdapter- Parameters:
code- The code to parse.- Returns:
- The authority factory.
- Throws:
NoSuchAuthorityCodeException- if no authority name has been found.
-
getCoordinateOperationAuthorityFactory
protected CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory(String code) throws NoSuchAuthorityCodeException Returns the operation authority factory for the specified"AUTHORITY:NUMBER"code.- Overrides:
getCoordinateOperationAuthorityFactoryin classAuthorityFactoryAdapter- Parameters:
code- The code to parse.- Returns:
- The authority factory.
- Throws:
NoSuchAuthorityCodeException- if no authority name has been found.
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException Returns the set of authority codes of the given type.- Specified by:
getAuthorityCodesin interfaceAuthorityFactory- Overrides:
getAuthorityCodesin classAuthorityFactoryAdapter- Parameters:
type- The spatial reference objects type (may beIdentifiedObject.class).- Returns:
- The set of authority codes for spatial reference objects of the given type. If this factory doesn't contains any object of the given type, then this method returns an {@linkplain java.util.Collections.emptySet() empty set}.
- Throws:
FactoryException- if access to the underlying database failed.
-
getDescriptionText
Gets a description of the object corresponding to a code.- Specified by:
getDescriptionTextin interfaceAuthorityFactory- Overrides:
getDescriptionTextin classAuthorityFactoryAdapter- Parameters:
code- Value allocated by authority.- Returns:
- A description of the object, or
nullif the object corresponding to the specifiedcodehas no description. - Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the query failed for some other reason.
-
createObject
Returns an arbitrary object from a code.- Specified by:
createObjectin interfaceAuthorityFactory- Overrides:
createObjectin classAuthorityFactoryAdapter- Parameters:
code- Value allocated by authority.- Returns:
- The object for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
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:
getIdentifiedObjectFinderin classAuthorityFactoryAdapter- Parameters:
type- The type of objects to look for. Should be a GeoAPI interface likeGeographicCRS.class, but this method accepts also implementation class. If the type is unknown, useIdentifiedObject.class. A more accurate type may help to speed up the search, since it reduces the amount of tables to scan in some implementations like the factories backed by EPSG database.- Returns:
- A finder to use for looking up unidentified objects.
- Throws:
FactoryException- if the object creation failed.
-