Class AbstractCachedAuthorityFactory
- Object
-
- AbstractFactory
-
- ReferencingFactory
-
- AbstractAuthorityFactory
-
- AbstractCachedAuthorityFactory
-
- All Implemented Interfaces:
AuthorityFactory
,CRSAuthorityFactory
,CSAuthorityFactory
,DatumAuthorityFactory
,Factory
,CoordinateOperationAuthorityFactory
,BufferedFactory
,Factory
,RegistrableFactory
- Direct Known Subclasses:
AbstractEpsgFactory
public abstract class AbstractCachedAuthorityFactory extends AbstractAuthorityFactory implements AuthorityFactory, CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory, BufferedFactory
An authority factory that consults (a possibly shared) cache before generating content itself. The behavior of thecreateFoo(String)
methods first looks if a previously created object exists for the given code. If such an object exists, it is returned directly. The testing of the cache is synchronized and may block if the referencing object is under construction.If the object is not yet created, the definition is delegated to the appropriate the
generateFoo
method and the result is cached for next time.This object is responsible for using a provided {{ReferencingObjectCache}}.
- Since:
- 2.4
- Author:
- Jody Garnett
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjectCache<Object,Object>
cache
Cache to be used for referencing objects defined by this authority.protected ReferencingFactoryContainer
factories
A container of the "real factories" actually used to construct objects.-
Fields inherited from class ReferencingFactory
LOGGER
-
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCachedAuthorityFactory(int priority)
Constructs an instance making use of the default cache.protected
AbstractCachedAuthorityFactory(int priority, Hints hints)
Constructs an instance making use of the default cache.protected
AbstractCachedAuthorityFactory(int priority, ObjectCache<Object,Object> cache, ReferencingFactoryContainer container)
Constructs an instance making use of the indicated cache.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CartesianCS
createCartesianCS(String code)
Creates a cartesian coordinate system from a code.CompoundCRS
createCompoundCRS(String code)
Creates a 3D coordinate reference system from a code.CoordinateOperation
createCoordinateOperation(String code)
Creates an operation from a single operation code.CoordinateReferenceSystem
createCoordinateReferenceSystem(String code)
Returns an arbitrary coordinate reference system from a code.CoordinateSystem
createCoordinateSystem(String code)
Returns an arbitrary coordinate system from a code.CoordinateSystemAxis
createCoordinateSystemAxis(String code)
Returns a coordinate system axis from a code.CylindricalCS
createCylindricalCS(String code)
The default implementation invokescreateCoordinateSystem(code)
.Datum
createDatum(String code)
Returns an arbitrary datum from a code.DerivedCRS
createDerivedCRS(String code)
Creates a derived coordinate reference system from a code.Ellipsoid
createEllipsoid(String code)
Returns an ellipsoid from a code.EllipsoidalCS
createEllipsoidalCS(String code)
Creates an ellipsoidal coordinate system from a code.EngineeringCRS
createEngineeringCRS(String code)
Creates a engineering coordinate reference system from a code.EngineeringDatum
createEngineeringDatum(String code)
Creates a engineering datum from a code.Set<CoordinateOperation>
createFromCoordinateReferenceSystemCodes(String sourceCode, String targetCode)
Creates an operation from coordinate reference system codes.GeocentricCRS
createGeocentricCRS(String code)
Returns a geocentric coordinate reference system from a code.GeodeticDatum
createGeodeticDatum(String code)
Returns a geodetic datum from a code.GeographicCRS
createGeographicCRS(String code)
Returns a geographic coordinate reference system from a code.ImageCRS
createImageCRS(String code)
Creates a image coordinate reference system from a code.ImageDatum
createImageDatum(String code)
Creates a image datum from a code.IdentifiedObject
createObject(String code)
Returns an arbitrary object from a code.PolarCS
createPolarCS(String code)
Creates a polar coordinate system from a code.PrimeMeridian
createPrimeMeridian(String code)
Returns a prime meridian from a code.ProjectedCRS
createProjectedCRS(String code)
Returns a projected coordinate reference system from a code.SphericalCS
createSphericalCS(String code)
Creates a spherical coordinate system from a code.TemporalCRS
createTemporalCRS(String code)
Creates a temporal coordinate reference system from a code.TemporalDatum
createTemporalDatum(String code)
Creates a temporal datum from a code.TimeCS
createTimeCS(String code)
Creates a temporal coordinate system from a code.Unit<?>
createUnit(String code)
Returns an unit from a code.VerticalCRS
createVerticalCRS(String code)
Creates a vertical coordinate reference system from a code.VerticalCS
createVerticalCS(String code)
Creates a vertical coordinate system from a code.VerticalDatum
createVerticalDatum(String code)
Creates a vertical datum from a code.void
dispose()
We will clear out our cache and factories referenceprotected abstract Set<String>
generateAuthorityCodes(Class type)
protected abstract CoordinateOperation
generateCoordinateOperation(String code)
protected abstract CoordinateReferenceSystem
generateCoordinateReferenceSystem(String code)
protected abstract CoordinateSystem
generateCoordinateSystem(String code)
protected abstract CoordinateSystemAxis
generateCoordinateSystemAxis(String code)
protected abstract Datum
generateDatum(String code)
protected abstract Ellipsoid
generateEllipsoid(String code)
protected abstract Set
generateFromCoordinateReferenceSystemCodes(String sourceCode, String targetCode)
protected abstract IdentifiedObject
generateObject(String code)
protected abstract PrimeMeridian
generatePrimeMeridian(String code)
protected abstract Unit<?>
generateUnit(String code)
abstract Citation
getAuthority()
Returns the organization or party responsible for definition and maintenance of the database.Set<String>
getAuthorityCodes(Class type)
Returns the set of authority codes of the given type.abstract 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 NoSuchAuthorityCodeException
noSuchAuthorityCode(Class type, String code, ClassCastException cause)
Creates an exception for an unknown authority code.protected String
toKey(String code)
protected String
trimAuthority(String code)
Trims the authority scope, if present.-
Methods inherited from class AbstractAuthorityFactory
createExtent, createOperationMethod, createParameterDescriptor, getBackingStoreDescription, noSuchAuthorityCode
-
Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
-
Methods inherited from class AbstractFactory
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toString
-
Methods inherited from interface Factory
getImplementationHints
-
-
-
-
Field Detail
-
cache
protected ObjectCache<Object,Object> cache
Cache to be used for referencing objects defined by this authority. Please note that this cache may be shared!Your cache may grow to considerable size during actual use; in addition to storing CoordinateReferenceSystems (by code); it will also store all the component parts (each under its own code), along with MathTransformations between two CoordinateReferenceSystems. So even if you are only planning on working with 50 CoordinateReferenceSystems please keep in mind that you will need larger cache size in order to prevent a bottleneck.
-
factories
protected ReferencingFactoryContainer factories
A container of the "real factories" actually used to construct objects.
-
-
Constructor Detail
-
AbstractCachedAuthorityFactory
protected AbstractCachedAuthorityFactory(int priority)
Constructs an instance making use of the default cache.- Parameters:
priority
- The priority for this factory, as a number between* MINIMUM_PRIORITY
andMAXIMUM_PRIORITY
inclusive.
-
AbstractCachedAuthorityFactory
protected AbstractCachedAuthorityFactory(int priority, Hints hints)
Constructs an instance making use of the default cache.- Parameters:
priority
- The priority for this factory, as a number between {@link * #MINIMUM_PRIORITY MINIMUM_PRIORITY} andMAXIMUM_PRIORITY
* inclusive.
-
AbstractCachedAuthorityFactory
protected AbstractCachedAuthorityFactory(int priority, ObjectCache<Object,Object> cache, ReferencingFactoryContainer container)
Constructs an instance making use of the indicated cache.This constructor is protected because subclasses must declare which of the
DatumAuthorityFactory
,CSAuthorityFactory
,CRSAuthorityFactory
andCoordinateOperationAuthorityFactory
interfaces they choose to implement.- Parameters:
priority
- The priority for this factory, as a number between {@link * #MINIMUM_PRIORITY MINIMUM_PRIORITY} andMAXIMUM_PRIORITY
* inclusive.cache
- The cache to use
-
-
Method Detail
-
trimAuthority
protected String trimAuthority(String code)
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).- Overrides:
trimAuthority
in classAbstractAuthorityFactory
- Parameters:
code
- The code to trim.- Returns:
- The code without the authority scope.
-
noSuchAuthorityCode
protected NoSuchAuthorityCodeException noSuchAuthorityCode(Class type, String code, ClassCastException cause)
Creates an exception for an unknown 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 unknown authority code.cause
- The cause of this error, ornull
.- Returns:
- An exception initialized with an error message built from the specified informations.
-
getAuthority
public abstract Citation getAuthority()
Description copied from class:AbstractAuthorityFactory
Returns the organization or party responsible for definition and maintenance of the database.- Specified by:
getAuthority
in interfaceAuthorityFactory
- Specified by:
getAuthority
in classAbstractAuthorityFactory
- Returns:
- The organization reponsible for definition of the database.
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class type) throws FactoryException
Description copied from interface:AuthorityFactory
Returns the set of authority codes of the given type. Thetype
argument specify the base class. For example if this factory is an instance ofCRSAuthorityFactory
, then:CoordinateReferenceSystem.class
asks for all authority codes accepted by one ofcreateGeographicCRS
,createProjectedCRS
,createVerticalCRS
,createTemporalCRS
and their friends.ProjectedCRS.class
asks only for authority codes accepted bycreateProjectedCRS
.
- Specified by:
getAuthorityCodes
in 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.
-
generateAuthorityCodes
protected abstract Set<String> generateAuthorityCodes(Class type) throws FactoryException
- Throws:
FactoryException
-
getDescriptionText
public abstract InternationalString getDescriptionText(String code) throws FactoryException
Description copied from interface:AuthorityFactory
Gets a description of the object corresponding to a code.- Specified by:
getDescriptionText
in interfaceAuthorityFactory
- Parameters:
code
- Value allocated by authority.- Returns:
- A description of the object, or
null
if the object corresponding to the specifiedcode
has no description. - Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the query failed for some other reason.
-
createObject
public IdentifiedObject createObject(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
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
- Overrides:
createObject
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createCoordinateReferenceSystem(java.lang.String)
,AbstractAuthorityFactory.createDatum(java.lang.String)
,AbstractAuthorityFactory.createEllipsoid(java.lang.String)
,AbstractAuthorityFactory.createUnit(java.lang.String)
-
generateObject
protected abstract IdentifiedObject generateObject(String code) throws FactoryException
- Throws:
FactoryException
-
createCompoundCRS
public CompoundCRS createCompoundCRS(String code) throws FactoryException
Creates a 3D coordinate reference system from a code.- Specified by:
createCompoundCRS
in interfaceCRSAuthorityFactory
- Overrides:
createCompoundCRS
in classAbstractAuthorityFactory
- 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.
-
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
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).- Specified by:
createCoordinateReferenceSystem
in interfaceCRSAuthorityFactory
- Overrides:
createCoordinateReferenceSystem
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeographicCRS(java.lang.String)
,AbstractAuthorityFactory.createProjectedCRS(java.lang.String)
,AbstractAuthorityFactory.createVerticalCRS(java.lang.String)
,AbstractAuthorityFactory.createTemporalCRS(java.lang.String)
,AbstractAuthorityFactory.createCompoundCRS(java.lang.String)
-
generateCoordinateReferenceSystem
protected abstract CoordinateReferenceSystem generateCoordinateReferenceSystem(String code) throws FactoryException
- Throws:
FactoryException
-
createDerivedCRS
public DerivedCRS createDerivedCRS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a derived coordinate reference system from a code.- Specified by:
createDerivedCRS
in interfaceCRSAuthorityFactory
- Overrides:
createDerivedCRS
in classAbstractAuthorityFactory
- 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 FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a engineering coordinate reference system from a code.- Specified by:
createEngineeringCRS
in interfaceCRSAuthorityFactory
- Overrides:
createEngineeringCRS
in classAbstractAuthorityFactory
- 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.
-
createGeocentricCRS
public GeocentricCRS createGeocentricCRS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns a geocentric coordinate reference system from a code.- Specified by:
createGeocentricCRS
in interfaceCRSAuthorityFactory
- Overrides:
createGeocentricCRS
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)
-
createGeographicCRS
public GeographicCRS createGeographicCRS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns a geographic coordinate reference system from a code.- Specified by:
createGeographicCRS
in interfaceCRSAuthorityFactory
- Overrides:
createGeographicCRS
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)
-
createImageCRS
public ImageCRS createImageCRS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a image coordinate reference system from a code.- Specified by:
createImageCRS
in interfaceCRSAuthorityFactory
- Overrides:
createImageCRS
in classAbstractAuthorityFactory
- 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 FactoryException
Description copied from class:AbstractAuthorityFactory
Returns a projected coordinate reference system from a code.- Specified by:
createProjectedCRS
in interfaceCRSAuthorityFactory
- Overrides:
createProjectedCRS
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)
-
createTemporalCRS
public TemporalCRS createTemporalCRS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a temporal coordinate reference system from a code.- Specified by:
createTemporalCRS
in interfaceCRSAuthorityFactory
- Overrides:
createTemporalCRS
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createTemporalDatum(java.lang.String)
-
createVerticalCRS
public VerticalCRS createVerticalCRS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a vertical coordinate reference system from a code.- Specified by:
createVerticalCRS
in interfaceCRSAuthorityFactory
- Overrides:
createVerticalCRS
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createVerticalDatum(java.lang.String)
-
createCartesianCS
public CartesianCS createCartesianCS(String code) throws FactoryException
Creates a cartesian coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createCartesianCS
in interfaceCSAuthorityFactory
- Overrides:
createCartesianCS
in classAbstractAuthorityFactory
- 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.
-
createCoordinateSystem
public CoordinateSystem createCoordinateSystem(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns an arbitrary coordinate system from a code. The default implementation invokescreateObject(code)
.- Specified by:
createCoordinateSystem
in interfaceCSAuthorityFactory
- Overrides:
createCoordinateSystem
in classAbstractAuthorityFactory
- 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.
-
generateCoordinateSystem
protected abstract CoordinateSystem generateCoordinateSystem(String code) throws FactoryException
- Throws:
FactoryException
-
createCoordinateSystemAxis
public CoordinateSystemAxis createCoordinateSystemAxis(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns a coordinate system axis from a code. The default implementation invokescreateObject(code)
.- Specified by:
createCoordinateSystemAxis
in interfaceCSAuthorityFactory
- Overrides:
createCoordinateSystemAxis
in classAbstractAuthorityFactory
- 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.
-
generateCoordinateSystemAxis
protected abstract CoordinateSystemAxis generateCoordinateSystemAxis(String code) throws FactoryException
- Throws:
FactoryException
-
createCylindricalCS
public CylindricalCS createCylindricalCS(String code) throws FactoryException
The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createCylindricalCS
in interfaceCSAuthorityFactory
- Overrides:
createCylindricalCS
in classAbstractAuthorityFactory
- 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 FactoryException
Description copied from class:AbstractAuthorityFactory
Creates an ellipsoidal coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createEllipsoidalCS
in interfaceCSAuthorityFactory
- Overrides:
createEllipsoidalCS
in classAbstractAuthorityFactory
- 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
public PolarCS createPolarCS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a polar coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createPolarCS
in interfaceCSAuthorityFactory
- Overrides:
createPolarCS
in classAbstractAuthorityFactory
- 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 FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a spherical coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createSphericalCS
in interfaceCSAuthorityFactory
- Overrides:
createSphericalCS
in classAbstractAuthorityFactory
- 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
public TimeCS createTimeCS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a temporal coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createTimeCS
in interfaceCSAuthorityFactory
- Overrides:
createTimeCS
in classAbstractAuthorityFactory
- 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.
-
createUnit
public Unit<?> createUnit(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns an unit from a code. The default implementation invokescreateObject(code)
.- Specified by:
createUnit
in interfaceCSAuthorityFactory
- Overrides:
createUnit
in classAbstractAuthorityFactory
- 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.
-
generateUnit
protected abstract Unit<?> generateUnit(String code) throws FactoryException
- Throws:
FactoryException
-
createVerticalCS
public VerticalCS createVerticalCS(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a vertical coordinate system from a code. The default implementation invokescreateCoordinateSystem(code)
.- Specified by:
createVerticalCS
in interfaceCSAuthorityFactory
- Overrides:
createVerticalCS
in classAbstractAuthorityFactory
- 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.
-
createDatum
public Datum createDatum(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns an arbitrary datum from a code. The default implementation invokescreateObject(code)
.- Specified by:
createDatum
in interfaceDatumAuthorityFactory
- Overrides:
createDatum
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)
,AbstractAuthorityFactory.createVerticalDatum(java.lang.String)
,AbstractAuthorityFactory.createTemporalDatum(java.lang.String)
-
generateDatum
protected abstract Datum generateDatum(String code) throws FactoryException
- Throws:
FactoryException
-
createEllipsoid
public Ellipsoid createEllipsoid(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns an ellipsoid from a code. The default implementation invokescreateObject(code)
.- Specified by:
createEllipsoid
in interfaceDatumAuthorityFactory
- Overrides:
createEllipsoid
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)
-
generateEllipsoid
protected abstract Ellipsoid generateEllipsoid(String code) throws FactoryException
- Throws:
FactoryException
-
createEngineeringDatum
public EngineeringDatum createEngineeringDatum(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a engineering datum from a code. The default implementation invokescreateDatum(code)
.- Specified by:
createEngineeringDatum
in interfaceDatumAuthorityFactory
- Overrides:
createEngineeringDatum
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createEngineeringCRS(java.lang.String)
-
createGeodeticDatum
public GeodeticDatum createGeodeticDatum(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns a geodetic datum from a code. The default implementation invokescreateDatum(code)
.- Specified by:
createGeodeticDatum
in interfaceDatumAuthorityFactory
- Overrides:
createGeodeticDatum
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createEllipsoid(java.lang.String)
,AbstractAuthorityFactory.createPrimeMeridian(java.lang.String)
,AbstractAuthorityFactory.createGeographicCRS(java.lang.String)
,AbstractAuthorityFactory.createProjectedCRS(java.lang.String)
-
createImageDatum
public ImageDatum createImageDatum(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a image datum from a code. The default implementation invokescreateDatum(code)
.- Specified by:
createImageDatum
in interfaceDatumAuthorityFactory
- Overrides:
createImageDatum
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createImageCRS(java.lang.String)
-
createPrimeMeridian
public PrimeMeridian createPrimeMeridian(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Returns a prime meridian from a code. The default implementation invokescreateObject(code)
.- Specified by:
createPrimeMeridian
in interfaceDatumAuthorityFactory
- Overrides:
createPrimeMeridian
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)
-
generatePrimeMeridian
protected abstract PrimeMeridian generatePrimeMeridian(String code) throws FactoryException
- Throws:
FactoryException
-
createTemporalDatum
public TemporalDatum createTemporalDatum(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a temporal datum from a code. The default implementation invokescreateDatum(code)
.- Specified by:
createTemporalDatum
in interfaceDatumAuthorityFactory
- Overrides:
createTemporalDatum
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createTemporalCRS(java.lang.String)
-
createVerticalDatum
public VerticalDatum createVerticalDatum(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates a vertical datum from a code. The default implementation invokescreateDatum(code)
.- Specified by:
createVerticalDatum
in interfaceDatumAuthorityFactory
- Overrides:
createVerticalDatum
in classAbstractAuthorityFactory
- 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:
AbstractAuthorityFactory.createVerticalCRS(java.lang.String)
-
createCoordinateOperation
public CoordinateOperation createCoordinateOperation(String code) throws FactoryException
Description copied from class:AbstractAuthorityFactory
Creates an operation from a single operation code.- Specified by:
createCoordinateOperation
in interfaceCoordinateOperationAuthorityFactory
- Overrides:
createCoordinateOperation
in classAbstractAuthorityFactory
- 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.
-
generateCoordinateOperation
protected abstract CoordinateOperation generateCoordinateOperation(String code) throws FactoryException
- Throws:
FactoryException
-
createFromCoordinateReferenceSystemCodes
public Set<CoordinateOperation> createFromCoordinateReferenceSystemCodes(String sourceCode, String targetCode) throws FactoryException
Description copied from class:AbstractAuthorityFactory
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.
- Specified by:
createFromCoordinateReferenceSystemCodes
in interfaceCoordinateOperationAuthorityFactory
- Overrides:
createFromCoordinateReferenceSystemCodes
in classAbstractAuthorityFactory
- Parameters:
sourceCode
- Coded value of source coordinate reference system.targetCode
- 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.
-
generateFromCoordinateReferenceSystemCodes
protected abstract Set generateFromCoordinateReferenceSystemCodes(String sourceCode, String targetCode) throws FactoryException
- Throws:
FactoryException
-
dispose
public void dispose() throws FactoryException
We will clear out our cache and factories reference- Overrides:
dispose
in classAbstractAuthorityFactory
- Throws:
FactoryException
- if an error occured while disposing the factory.
-
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 lookup to the underlying backing store and caches the result.- Overrides:
getIdentifiedObjectFinder
in 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 finder can not be created.- Since:
- 2.4
-
-