Package org.geotools.referencing.factory
Class AuthorityFactoryAdapter
Object
AbstractFactory
ReferencingFactory
AbstractAuthorityFactory
AuthorityFactoryAdapter
- All Implemented Interfaces:
AuthorityFactory,Factory,Factory,OptionalFactory,RegistrableFactory
- Direct Known Subclasses:
Abstract_URI_AuthorityFactory,FallbackAuthorityFactory,HTTP_AuthorityFactory,ManyAuthoritiesFactory,TransformedAuthorityFactory
An authority factory which delegates CRS, CS or
datum objects creation to some other factory implementations.
All constructors are protected because this class must be subclassed in order to determine which of the
DatumAuthorityFactory, CSAuthorityFactory and CRSAuthorityFactory interfaces to implement.
- Since:
- 2.2
- 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
ConstructorsModifierConstructorDescriptionprotectedAuthorityFactoryAdapter(String authority, Hints userHints) Creates a wrappers around the default factories for the specified authority.protectedAuthorityFactoryAdapter(AuthorityFactory factory) Creates a wrapper around the specified factory.protectedAuthorityFactoryAdapter(CRSAuthorityFactory crsFactory, CSAuthorityFactory csFactory, DatumAuthorityFactory datumFactory, CoordinateOperationAuthorityFactory opFactory) Creates a wrapper around the specified factories. -
Method Summary
Modifier and TypeMethodDescriptioncreateCartesianCS(String code) Creates a cartesian coordinate system from a code.createCompoundCRS(String code) Creates a 3D coordinate reference system from a code.Creates an operation from a single operation code.Returns an arbitrary coordinate reference system from a code.createCoordinateSystem(String code) Returns an arbitrary coordinate system from a code.Returns a coordinate system axis from a code.createCylindricalCS(String code) Creates a cylindrical coordinate system from a code.createDatum(String code) Returns an arbitrary datum from a code.createDerivedCRS(String code) Creates a derived coordinate reference system from a code.createEllipsoid(String code) Returns an ellipsoid from a code.createEllipsoidalCS(String code) Creates an ellipsoidal coordinate system from a code.createEngineeringCRS(String code) Creates a engineering coordinate reference system from a code.createEngineeringDatum(String code) Creates a engineering datum from a code.createExtent(String code) Returns a extent (usually an area of validity) from a code.createFromCoordinateReferenceSystemCodes(String sourceCRS, String targetCRS) Creates an operation from coordinate reference system codes.createGeocentricCRS(String code) Returns a geocentric coordinate reference system from a code.createGeodeticDatum(String code) Returns a geodetic datum from a code.createGeographicCRS(String code) Returns a geographic coordinate reference system from a code.createImageCRS(String code) Creates a image coordinate reference system from a code.createImageDatum(String code) Creates a image datum from a code.createObject(String code) Returns an arbitrary object from a code.createOperationMethod(String code) Creates an operation method from a code.Creates a parameter descriptor from a code.createPolarCS(String code) Creates a polar coordinate system from a code.createPrimeMeridian(String code) Returns a prime meridian from a code.createProjectedCRS(String code) Returns a projected coordinate reference system from a code.createSphericalCS(String code) Creates a spherical coordinate system from a code.createTemporalCRS(String code) Creates a temporal coordinate reference system from a code.createTemporalDatum(String code) Creates a temporal datum from a code.createTimeCS(String code) Creates a temporal coordinate system from a code.Unit<?>createUnit(String code) Returns an unit from a code.createVerticalCRS(String code) Creates a vertical coordinate reference system from a code.createVerticalCS(String code) Creates a vertical coordinate system from a code.createVerticalDatum(String code) Creates a vertical datum from a code.voiddispose()Releases resources immediately instead of waiting for the garbage collector.Returns the organization or party responsible for definition and maintenance of the database.getAuthorityCodes(Class<? extends IdentifiedObject> type) Returns the set of authority code for the specified type.protected AuthorityFactorygetAuthorityFactory(String code) Returns a generic object factory to use for the specified code.Returns a description of the underlying backing store, ornullif unknow.protected CoordinateOperationAuthorityFactoryReturns the coordinate operation factory to use for the specified code.protected CRSAuthorityFactorygetCRSAuthorityFactory(String code) Returns the coordinate reference system factory to use for the specified code.protected CSAuthorityFactorygetCSAuthorityFactory(String code) Returns the coordinate system factory to use for the specified code.protected DatumAuthorityFactoryReturns the datum factory to use for the specified code.getDescriptionText(String code) Returns a description for the object identified by the specified code.getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type) Returns a finder which can be used for looking up unidentified objects.Returns the vendor responsible for creating this factory implementation.booleanReturnstrueif this factory is ready for use.protected voidnotifySuccess(String method, String code, CRSAuthorityFactory factory, CoordinateReferenceSystem crs) Log a message when a CRS is found.protected StringtoBackingFactoryCode(String code) Returns the code to be given to the wrapped factories.Methods 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 Factory
getImplementationHints
-
Constructor Details
-
AuthorityFactoryAdapter
Creates a wrapper around the specified factory. Thepriorityfield will be set to the same value than the specified factory. Subclasses should override thegetPriority()method if they want to set a higher or lower priority for this instance.- Parameters:
factory- The factory to wrap.
-
AuthorityFactoryAdapter
protected AuthorityFactoryAdapter(CRSAuthorityFactory crsFactory, CSAuthorityFactory csFactory, DatumAuthorityFactory datumFactory, CoordinateOperationAuthorityFactory opFactory) Creates a wrapper around the specified factories. Thepriorityfield will be set to the highest priority found in the specified factories. Subclasses should override thegetPriority()method if they want to set a higher or lower priority for this instance.- Parameters:
crsFactory- The coordinate reference system authority factory, ornull.csFactory- The coordinate system authority factory, ornull.datumFactory- The datum authority factory, ornull.opFactory- The coordinate operation authority factory, ornull.
-
AuthorityFactoryAdapter
protected AuthorityFactoryAdapter(String authority, Hints userHints) throws FactoryRegistryException Creates a wrappers around the default factories for the specified authority. The factories are fetched usingReferencingFactoryFinder.- Parameters:
authority- The authority to wraps (example:"EPSG"). Ifnull, then all authority factories must be explicitly specified in the set of hints.userHints- An optional set of hints, ornullif none.- Throws:
FactoryRegistryException- if at least one factory can not be obtained.- Since:
- 2.4
-
-
Method Details
-
isAvailable
public boolean isAvailable()Returnstrueif this factory is ready for use. This default implementation checks the availability of CRS, CS, datum and operation authority factories specified at construction time.- Specified by:
isAvailablein interfaceOptionalFactory- Returns:
trueif this factory is ready for use.
-
getBackingStoreDescription
Returns a description of the underlying backing store, ornullif unknow.- Overrides:
getBackingStoreDescriptionin classAbstractAuthorityFactory- Returns:
- The description of the underlying backing store, or
null. - Throws:
FactoryException- if a failure occured while fetching the engine description.
-
getVendor
Returns the vendor responsible for creating this factory implementation.- Specified by:
getVendorin interfaceFactory- Overrides:
getVendorin classReferencingFactory- Returns:
- The vendor for this factory implementation.
-
getAuthority
Returns the organization or party responsible for definition and maintenance of the database.- Specified by:
getAuthorityin interfaceAuthorityFactory- Specified by:
getAuthorityin classAbstractAuthorityFactory- Returns:
- The organization reponsible for definition of the database.
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException Returns the set of authority code for the specified type.- Specified by:
getAuthorityCodesin interfaceAuthorityFactory- Parameters:
type- The spatial reference objects type.- 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 empty set.
- Throws:
FactoryException- if access to the underlying database failed.
-
getDescriptionText
Returns a description for the object identified by the specified code.- Specified by:
getDescriptionTextin interfaceAuthorityFactory- 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 classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The object for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createDatum
Returns an arbitrary datum from a code.- Overrides:
createDatumin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createEngineeringDatum
Creates a engineering datum from a code.- Overrides:
createEngineeringDatumin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createImageDatum
Creates a image datum from a code.- Overrides:
createImageDatumin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createVerticalDatum
Creates a vertical datum from a code.- Overrides:
createVerticalDatumin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createTemporalDatum
Creates a temporal datum from a code.- Overrides:
createTemporalDatumin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createGeodeticDatum
Returns a geodetic datum from a code.- Overrides:
createGeodeticDatumin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createEllipsoid
Returns an ellipsoid from a code.- Overrides:
createEllipsoidin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The ellipsoid for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createPrimeMeridian
Returns a prime meridian from a code.- Overrides:
createPrimeMeridianin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The prime meridian for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createExtent
Returns a extent (usually an area of validity) from a code.- Overrides:
createExtentin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The extent for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCoordinateSystem
Returns an arbitrary coordinate system from a code.- Overrides:
createCoordinateSystemin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCartesianCS
Creates a cartesian coordinate system from a code.- Overrides:
createCartesianCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createPolarCS
Creates a polar coordinate system from a code.- Overrides:
createPolarCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCylindricalCS
Creates a cylindrical coordinate system from a code.- Overrides:
createCylindricalCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createSphericalCS
Creates a spherical coordinate system from a code.- Overrides:
createSphericalCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createEllipsoidalCS
Creates an ellipsoidal coordinate system from a code.- Overrides:
createEllipsoidalCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createVerticalCS
Creates a vertical coordinate system from a code.- Overrides:
createVerticalCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createTimeCS
Creates a temporal coordinate system from a code.- Overrides:
createTimeCSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCoordinateSystemAxis
Returns a coordinate system axis from a code.- Overrides:
createCoordinateSystemAxisin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The axis for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createUnit
Returns an unit from a code.- Overrides:
createUnitin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The unit for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException Returns an arbitrary coordinate reference system from a code.- Overrides:
createCoordinateReferenceSystemin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createCompoundCRS
Creates a 3D coordinate reference system from a code.- Overrides:
createCompoundCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createDerivedCRS
Creates a derived coordinate reference system from a code.- Overrides:
createDerivedCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createEngineeringCRS
Creates a engineering coordinate reference system from a code.- Overrides:
createEngineeringCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createGeographicCRS
Returns a geographic coordinate reference system from a code.- Overrides:
createGeographicCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createGeocentricCRS
Returns a geocentric coordinate reference system from a code.- Overrides:
createGeocentricCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createImageCRS
Creates a image coordinate reference system from a code.- Overrides:
createImageCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createProjectedCRS
Returns a projected coordinate reference system from a code.- Overrides:
createProjectedCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createTemporalCRS
Creates a temporal coordinate reference system from a code.- Overrides:
createTemporalCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createVerticalCRS
Creates a vertical coordinate reference system from a code.- Overrides:
createVerticalCRSin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.- See Also:
-
createParameterDescriptor
Creates a parameter descriptor from a code.- Overrides:
createParameterDescriptorin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createOperationMethod
Creates an operation method from a code.- Overrides:
createOperationMethodin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The operation method for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCoordinateOperation
Creates an operation from a single operation code.- Overrides:
createCoordinateOperationin classAbstractAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The operation for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createFromCoordinateReferenceSystemCodes
public Set<CoordinateOperation> createFromCoordinateReferenceSystemCodes(String sourceCRS, String targetCRS) throws FactoryException Creates an operation from coordinate reference system codes.- Overrides:
createFromCoordinateReferenceSystemCodesin classAbstractAuthorityFactory- Parameters:
sourceCRS- Coded value of source coordinate reference system.targetCRS- Coded value of target coordinate reference system.- Returns:
- The operations from
sourceCRStotargetCRS. - Throws:
FactoryException- if the object creation failed.
-
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 factory.- Overrides:
getIdentifiedObjectFinderin classAbstractAuthorityFactory- 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.- Since:
- 2.4
-
notifySuccess
protected void notifySuccess(String method, String code, CRSAuthorityFactory factory, CoordinateReferenceSystem crs) Log a message when a CRS is found. Child objects that doesn't create their own CRS-objects should not report. -
getAuthorityFactory
Returns a generic object factory to use for the specified code. The default implementation returns one of the factory specified at construction time. Subclasses can override this method in order to select a different factory implementation depending on the code value.Note: The value of the
codeargument given to this method may benullwhen a factory is needed for some global task, likegetAuthorityCodes(java.lang.Class<? extends org.geotools.api.referencing.IdentifiedObject>)method execution.- Parameters:
code- The authority code given to this class. Note that the code to be given to the returned factory may be different.- Returns:
- A factory for the specified authority code (never
null). - Throws:
FactoryException- if no suitable factory were found.- Since:
- 2.4
-
getDatumAuthorityFactory
Returns the datum factory to use for the specified code. The default implementation always returns the factory specified at construction time. Subclasses can override this method in order to select a different factory implementation depending on the code value.- Parameters:
code- The authority code given to this class. Note that the code to be given to the returned factory may be different.- Returns:
- A factory for the specified authority code (never
null). - Throws:
FactoryException- if no datum factory were specified at construction time.- Since:
- 2.4
-
getCSAuthorityFactory
Returns the coordinate system factory to use for the specified code. The default implementation always returns the factory specified at construction time. Subclasses can override this method in order to select a different factory implementation depending on the code value.- Parameters:
code- The authority code given to this class. Note that the code to be given to the returned factory may be different.- Returns:
- A factory for the specified authority code (never
null). - Throws:
FactoryException- if no coordinate system factory were specified at construction time.- Since:
- 2.4
-
getCRSAuthorityFactory
Returns the coordinate reference system factory to use for the specified code. The default implementation always returns the factory specified at construction time. Subclasses can override this method in order to select a different factory implementation depending on the code value.- Parameters:
code- The authority code given to this class. Note that the code to be given to the returned factory may be different.- Returns:
- A factory for the specified authority code (never
null). - Throws:
FactoryException- if no coordinate reference system factory were specified at construction time.- Since:
- 2.4
-
getCoordinateOperationAuthorityFactory
protected CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory(String code) throws FactoryException Returns the coordinate operation factory to use for the specified code. The default implementation always returns the factory specified at construction time. Subclasses can override this method in order to select a different factory implementation depending on the code value.- Parameters:
code- The authority code given to this class. Note that the code to be given to the returned factory may be different.- Returns:
- A factory for the specified authority code (never
null). - Throws:
FactoryException- if no coordinate operation factory were specified at construction time.- Since:
- 2.4
-
toBackingFactoryCode
Returns the code to be given to the wrapped factories. This method is automatically invoked by allcreatemethods before to forward the code to the CRS, CS, datum or operation factory. The default implementation returns thecodeunchanged.- Parameters:
code- The code given to this factory.- Returns:
- The code to give to the underlying factories.
- Throws:
FactoryException- if the code can't be converted.- Since:
- 2.4
-
dispose
Description copied from class:AbstractAuthorityFactoryReleases resources immediately instead of waiting for the garbage collector. Once a factory has been disposed, furthercreate(...)invocations may throw aFactoryException. Disposing a previously-disposed factory, however, has no effect.- Overrides:
disposein classAbstractAuthorityFactory- Throws:
FactoryException- if an error occured while disposing the factory.
-