public class ManyAuthoritiesFactory extends AuthorityFactoryAdapter implements CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory
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.
LOGGER
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
Constructor and Description |
---|
ManyAuthoritiesFactory(Collection<? extends AuthorityFactory> factories)
Creates a new factory using the specified set of user factories.
|
Modifier and Type | Method and Description |
---|---|
IdentifiedObject |
createObject(String code)
Returns an arbitrary object from a code.
|
Citation |
getAuthority()
Returns the organization or party responsible for definition and maintenance of the database.
|
Set<String> |
getAuthorityCodes(Class<? extends IdentifiedObject> type)
Returns the set of authority codes of the given type.
|
protected AuthorityFactory |
getAuthorityFactory(String code)
Returns a generic object authority factory for the specified
"AUTHORITY:NUMBER" code. |
Set<String> |
getAuthorityNames()
Returns the authority names of every factories given at construction time.
|
String |
getBackingStoreDescription()
Returns a description of the underlying backing store, or
null if unknow. |
protected CoordinateOperationAuthorityFactory |
getCoordinateOperationAuthorityFactory(String code)
Returns the operation authority factory for the specified
"AUTHORITY:NUMBER" code. |
protected CRSAuthorityFactory |
getCRSAuthorityFactory(String code)
Returns the CRS authority factory for the specified
"AUTHORITY:NUMBER" code. |
protected CSAuthorityFactory |
getCSAuthorityFactory(String code)
Returns the CS authority factory for the specified
"AUTHORITY:NUMBER" code. |
protected DatumAuthorityFactory |
getDatumAuthorityFactory(String code)
Returns the datum authority factory for the specified
"AUTHORITY:NUMBER" code. |
InternationalString |
getDescriptionText(String code)
Gets a description of the object corresponding to a code.
|
IdentifiedObjectFinder |
getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
Returns a finder which can be used for looking up unidentified objects.
|
protected char |
getSeparator(String code)
Returns the character separator for the specified code.
|
Citation |
getVendor()
Returns the vendor responsible for creating this factory implementation.
|
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, toBackingFactoryCode
noSuchAuthorityCode, trimAuthority
ensureNonNull
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toString
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum
createCoordinateOperation, createFromCoordinateReferenceSystemCodes
getImplementationHints
public ManyAuthoritiesFactory(Collection<? extends AuthorityFactory> factories)
createFoo(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 factories
collection 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.
factories
- A set of user-specified factories to try before to delegate to GeometryFactoryFinder
.protected char getSeparator(String code)
':'
, 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.
public Citation getVendor()
getVendor
in class AuthorityFactoryAdapter
public Citation getAuthority()
getAuthority
in interface AuthorityFactory
getAuthority
in class AuthorityFactoryAdapter
public Set<String> getAuthorityNames()
public String getBackingStoreDescription() throws FactoryException
null
if unknow.getBackingStoreDescription
in class AuthorityFactoryAdapter
null
.FactoryException
- if a failure occured while fetching the engine description.protected AuthorityFactory getAuthorityFactory(String code) throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER"
code.getAuthorityFactory
in class AuthorityFactoryAdapter
code
- The code to parse.NoSuchAuthorityCodeException
- if no authority name has been found.protected DatumAuthorityFactory getDatumAuthorityFactory(String code) throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER"
code.getDatumAuthorityFactory
in class AuthorityFactoryAdapter
code
- The code to parse.NoSuchAuthorityCodeException
- if no authority name has been found.protected CSAuthorityFactory getCSAuthorityFactory(String code) throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER"
code.getCSAuthorityFactory
in class AuthorityFactoryAdapter
code
- The code to parse.NoSuchAuthorityCodeException
- if no authority name has been found.protected CRSAuthorityFactory getCRSAuthorityFactory(String code) throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER"
code.getCRSAuthorityFactory
in class AuthorityFactoryAdapter
code
- The code to parse.NoSuchAuthorityCodeException
- if no authority name has been found.protected CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory(String code) throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER"
code.getCoordinateOperationAuthorityFactory
in class AuthorityFactoryAdapter
code
- The code to parse.NoSuchAuthorityCodeException
- if no authority name has been found.public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException
getAuthorityCodes
in interface AuthorityFactory
getAuthorityCodes
in class AuthorityFactoryAdapter
type
- The spatial reference objects type (may be IdentifiedObject.class
).FactoryException
- if access to the underlying database failed.public InternationalString getDescriptionText(String code) throws FactoryException
getDescriptionText
in interface AuthorityFactory
getDescriptionText
in class AuthorityFactoryAdapter
code
- Value allocated by authority.null
if the object corresponding to the
specified code
has no description.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the query failed for some other reason.public IdentifiedObject createObject(String code) throws FactoryException
createObject
in interface AuthorityFactory
createObject
in class AuthorityFactoryAdapter
code
- Value allocated by authority.FactoryException
- if the object creation failed.AuthorityFactoryAdapter.createCoordinateReferenceSystem(java.lang.String)
,
AuthorityFactoryAdapter.createDatum(java.lang.String)
,
AuthorityFactoryAdapter.createEllipsoid(java.lang.String)
,
AuthorityFactoryAdapter.createUnit(java.lang.String)
public IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type) throws FactoryException
getIdentifiedObjectFinder
in class AuthorityFactoryAdapter
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 like
the factories backed by EPSG database.FactoryException
- if the object creation failed.Copyright © 1996–2019 Geotools. All rights reserved.