Class AbstractAuthorityFactory
- All Implemented Interfaces:
AuthorityFactory
,Factory
,Factory
,RegistrableFactory
- Direct Known Subclasses:
AbstractAuthorityMediator
,AbstractCachedAuthorityFactory
,AuthorityFactoryAdapter
,BufferedAuthorityFactory
,CachedAuthorityDecorator
,CachedCRSAuthorityDecorator
,DirectAuthorityFactory
,ThreadedAuthorityFactory
"4326"
.
This class defines a default implementation for most methods defined in the DatumAuthorityFactory
,
CSAuthorityFactory
and CRSAuthorityFactory
interfaces. However, those interfaces do not appear in the
implements
clause of this class declaration. This is up to subclasses to decide which interfaces they declare
to implement.
The default implementation for all createFoo
methods ultimately invokes createObject(java.lang.String)
, which may
be the only method that a subclass need to override. However, other methods may be overridden as well for better
performances.
- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
-
Field Summary
Fields inherited from class ReferencingFactory
LOGGER
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractAuthorityFactory
(int priority) Constructs an instance using the specified priority level. -
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.void
dispose()
Releases resources immediately instead of waiting for the garbage collector.abstract Citation
Returns the organization or party responsible for definition and maintenance of the database.Returns a description of the underlying backing store, ornull
if unknown.getIdentifiedObjectFinder
(Class<? extends IdentifiedObject> type) Returns a finder which can be used for looking up unidentified objects.protected final NoSuchAuthorityCodeException
noSuchAuthorityCode
(Class type, String code) Creates an exception for an unknow authority code.protected String
trimAuthority
(String code) Trims the authority scope, if present.Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
Methods inherited from class AbstractFactory
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toString
Methods inherited from interface AuthorityFactory
getAuthorityCodes, getDescriptionText
-
Constructor Details
-
AbstractAuthorityFactory
protected AbstractAuthorityFactory(int priority) Constructs an instance using the specified priority level.- Parameters:
priority
- The priority for this factory, as a number betweenMINIMUM_PRIORITY
andMAXIMUM_PRIORITY
inclusive.
-
-
Method Details
-
getAuthority
Returns the organization or party responsible for definition and maintenance of the database.- Specified by:
getAuthority
in interfaceAuthorityFactory
- Returns:
- The organization reponsible for definition of the database.
-
getBackingStoreDescription
Returns a description of the underlying backing store, ornull
if unknown. This is for example the database software used for storing the data. The default implementation returns alwaysnull
.- Returns:
- The description of the underlying backing store, or
null
. - Throws:
FactoryException
- if a failure occurs while fetching the engine description.
-
createObject
public IdentifiedObject createObject(String code) throws NoSuchAuthorityCodeException, FactoryException Returns an arbitrary object from a code. The returned object will typically be an instance ofDatum
,CoordinateSystem
,CoordinateReferenceSystem
orCoordinateOperation
. The default implementation always throw an exception. Subclasses should override this method if they are capable to automatically detect the object type from its code.- Specified by:
createObject
in interfaceAuthorityFactory
- Parameters:
code
- Value allocated by authority.- Returns:
- The object for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createDatum
Returns an arbitrary datum from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createEngineeringDatum
public EngineeringDatum createEngineeringDatum(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a engineering datum from a code. The default implementation invokescreateDatum(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createImageDatum
public ImageDatum createImageDatum(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a image datum from a code. The default implementation invokescreateDatum(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createVerticalDatum
public VerticalDatum createVerticalDatum(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a vertical datum from a code. The default implementation invokescreateDatum(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createTemporalDatum
public TemporalDatum createTemporalDatum(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a temporal datum from a code. The default implementation invokescreateDatum(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createGeodeticDatum
public GeodeticDatum createGeodeticDatum(String code) throws NoSuchAuthorityCodeException, FactoryException Returns a geodetic datum from a code. The default implementation invokescreateDatum(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The datum for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createEllipsoid
Returns an ellipsoid from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The ellipsoid for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createPrimeMeridian
public PrimeMeridian createPrimeMeridian(String code) throws NoSuchAuthorityCodeException, FactoryException Returns a prime meridian from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The prime meridian for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createExtent
Returns a extent (usually an area of validity) from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The extent for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createCoordinateSystem
public CoordinateSystem createCoordinateSystem(String code) throws NoSuchAuthorityCodeException, FactoryException Returns an arbitrary coordinate system from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createCartesianCS
public CartesianCS createCartesianCS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a cartesian coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createPolarCS
Creates a polar coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createCylindricalCS
public CylindricalCS createCylindricalCS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a cylindrical coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createSphericalCS
public SphericalCS createSphericalCS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a spherical coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createEllipsoidalCS
public EllipsoidalCS createEllipsoidalCS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates an ellipsoidal coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createVerticalCS
public VerticalCS createVerticalCS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a vertical coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createTimeCS
Creates a temporal coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createCoordinateSystemAxis
public CoordinateSystemAxis createCoordinateSystemAxis(String code) throws NoSuchAuthorityCodeException, FactoryException Returns a coordinate system axis from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The axis for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createUnit
Returns an unit from a code. The default implementation invokescreateObject(code)
.- Parameters:
code
- Value allocated by authority.- Returns:
- The unit for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws NoSuchAuthorityCodeException, FactoryException Returns an arbitrary coordinate reference system from a code. If the coordinate reference system type is know at compile time, it is recommended to invoke the most precise method instead of this one (for examplecreateGeographicCRS(code)
instead ofcreateCoordinateReferenceSystem(code)
if the caller know he is asking for a geographic coordinate reference system).- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createCompoundCRS
public CompoundCRS createCompoundCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a 3D coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createDerivedCRS
public DerivedCRS createDerivedCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a derived coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createEngineeringCRS
public EngineeringCRS createEngineeringCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a engineering coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createGeographicCRS
public GeographicCRS createGeographicCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Returns a geographic coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createGeocentricCRS
public GeocentricCRS createGeocentricCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Returns a geocentric coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed.- See Also:
-
createImageCRS
Creates a image coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.
-
createProjectedCRS
public ProjectedCRS createProjectedCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Returns a projected coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createTemporalCRS
public TemporalCRS createTemporalCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a temporal coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createVerticalCRS
public VerticalCRS createVerticalCRS(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a vertical coordinate reference system from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
-
createParameterDescriptor
public ParameterDescriptor createParameterDescriptor(String code) throws NoSuchAuthorityCodeException, FactoryException Creates a parameter descriptor from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- Since:
- 2.2
-
createOperationMethod
public OperationMethod createOperationMethod(String code) throws NoSuchAuthorityCodeException, FactoryException Creates an operation method from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The operation method for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- Since:
- 2.2
-
createCoordinateOperation
public CoordinateOperation createCoordinateOperation(String code) throws NoSuchAuthorityCodeException, FactoryException Creates an operation from a single operation code.- Parameters:
code
- Value allocated by authority.- Returns:
- The operation for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- Since:
- 2.2
-
createFromCoordinateReferenceSystemCodes
public Set<CoordinateOperation> createFromCoordinateReferenceSystemCodes(String sourceCRS, String targetCRS) throws NoSuchAuthorityCodeException, FactoryException Creates an operation from coordinate reference system codes. The default implementation returns an {@linkplain Collections.emptySet() empty set}. We do not delegate to some kind of coordinate operation factory method because the usual contract for this method is to extract the information from an authority database like EPSG, not to compute operations on-the-fly.Rational: Coordinate operation factory backed by an authority will invoke this method. If this method invoked the coordinate operation factory in turn, the application could be trapped in infinite recursive calls.
- Parameters:
sourceCRS
- Coded value of source coordinate reference system.targetCRS
- Coded value of target coordinate reference system.- Returns:
- The operations from
sourceCRS
totargetCRS
. - Throws:
NoSuchAuthorityCodeException
- if a specified code was not found.FactoryException
- if the object creation failed for some other reason.- Since:
- 2.2
-
getIdentifiedObjectFinder
public IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type) throws FactoryException Returns a finder which can be used for looking up unidentified objects. The finder fetchs a fully identified object from an incomplete one, for example from an object without identifier or "AUTHORITY[...]
" element in Well Known Text terminology.- 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 finder can not be created.- Since:
- 2.4
-
dispose
Releases 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.- Throws:
FactoryException
- if an error occured while disposing the factory.
-
trimAuthority
Trims the authority scope, if present. For example if this factory is an EPSG authority factory and the specified code start with the "EPSG:" prefix, then the prefix is removed. Otherwise, the string is returned unchanged (except for leading and trailing spaces).- Parameters:
code
- The code to trim.- Returns:
- The code without the authority scope.
-
noSuchAuthorityCode
Creates an exception for an unknow authority code. This convenience method is provided for implementation ofcreateXXX
methods.- Parameters:
type
- The GeoAPI interface that was to be created (e.g.CoordinateReferenceSystem.class
).code
- The unknow authority code.- Returns:
- An exception initialized with an error message built from the specified informations.
-