public abstract class AbstractCachedAuthorityFactory extends AbstractAuthorityFactory implements AuthorityFactory, CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory, BufferedFactory
createFoo(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}}.
| Modifier and Type | Field and 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.
|
LOGGERhints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority| Modifier | Constructor and 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.
|
createExtent, createOperationMethod, createParameterDescriptor, getBackingStoreDescription, noSuchAuthorityCodeensureNonNull, getVendoraddImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toStringgetImplementationHintsprotected ObjectCache<Object,Object> cache
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.
protected ReferencingFactoryContainer factories
protected AbstractCachedAuthorityFactory(int priority)
priority - The priority for this factory, as a number between *
MINIMUM_PRIORITY and MAXIMUM_PRIORITY inclusive.protected AbstractCachedAuthorityFactory(int priority,
Hints hints)
priority - The priority for this factory, as a number between #MINIMUM_PRIORITY
MINIMUM_PRIORITY and MAXIMUM_PRIORITY * inclusive.protected AbstractCachedAuthorityFactory(int priority,
ObjectCache<Object,Object> cache,
ReferencingFactoryContainer container)
This constructor is protected because subclasses must declare which of the DatumAuthorityFactory, CSAuthorityFactory, CRSAuthorityFactory and CoordinateOperationAuthorityFactory interfaces they choose to implement.
priority - The priority for this factory, as a number between #MINIMUM_PRIORITY
MINIMUM_PRIORITY and MAXIMUM_PRIORITY * inclusive.cache - The cache to useprotected String trimAuthority(String code)
trimAuthority in class AbstractAuthorityFactorycode - The code to trim.protected NoSuchAuthorityCodeException noSuchAuthorityCode(Class type, String code, ClassCastException cause)
createXXX methods.type - The GeoAPI interface that was to be created (e.g. CoordinateReferenceSystem.class).code - The unknown authority code.cause - The cause of this error, or null.public abstract Citation getAuthority()
AbstractAuthorityFactorygetAuthority in interface AuthorityFactorygetAuthority in class AbstractAuthorityFactorypublic Set<String> getAuthorityCodes(Class type) throws FactoryException
AuthorityFactorytype argument specify the
base class. For example if this factory is an instance of CRSAuthorityFactory, then:
CoordinateReferenceSystem.class
asks for all authority codes accepted by one of createGeographicCRS, createProjectedCRS,
createVerticalCRS, createTemporalCRS
and their friends.
ProjectedCRS.class
asks only for authority codes accepted by createProjectedCRS.
getAuthorityCodes in interface AuthorityFactorytype - The spatial reference objects type.FactoryException - if access to the underlying database failed.protected abstract Set<String> generateAuthorityCodes(Class type) throws FactoryException
FactoryExceptionpublic abstract InternationalString getDescriptionText(String code) throws FactoryException
AuthorityFactorygetDescriptionText in interface AuthorityFactorycode - 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
AbstractAuthorityFactoryDatum, CoordinateSystem, CoordinateReferenceSystem or CoordinateOperation. 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.createObject in interface AuthorityFactorycreateObject in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createCoordinateReferenceSystem(java.lang.String),
AbstractAuthorityFactory.createDatum(java.lang.String),
AbstractAuthorityFactory.createEllipsoid(java.lang.String),
AbstractAuthorityFactory.createUnit(java.lang.String)protected abstract IdentifiedObject generateObject(String code) throws FactoryException
FactoryExceptionpublic CompoundCRS createCompoundCRS(String code) throws FactoryException
createCompoundCRS in interface CRSAuthorityFactorycreateCompoundCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException
AbstractAuthorityFactory
createGeographicCRS(code) instead of
createCoordinateReferenceSystem(code) if the caller know he is
asking for a geographic coordinate reference system).createCoordinateReferenceSystem in interface CRSAuthorityFactorycreateCoordinateReferenceSystem in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.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)protected abstract CoordinateReferenceSystem generateCoordinateReferenceSystem(String code) throws FactoryException
FactoryExceptionpublic DerivedCRS createDerivedCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateDerivedCRS in interface CRSAuthorityFactorycreateDerivedCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public EngineeringCRS createEngineeringCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateEngineeringCRS in interface CRSAuthorityFactorycreateEngineeringCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public GeocentricCRS createGeocentricCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateGeocentricCRS in interface CRSAuthorityFactorycreateGeocentricCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed.AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)public GeographicCRS createGeographicCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateGeographicCRS in interface CRSAuthorityFactorycreateGeographicCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)public ImageCRS createImageCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateImageCRS in interface CRSAuthorityFactorycreateImageCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public ProjectedCRS createProjectedCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateProjectedCRS in interface CRSAuthorityFactorycreateProjectedCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)public TemporalCRS createTemporalCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateTemporalCRS in interface CRSAuthorityFactorycreateTemporalCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createTemporalDatum(java.lang.String)public VerticalCRS createVerticalCRS(String code) throws FactoryException
AbstractAuthorityFactorycreateVerticalCRS in interface CRSAuthorityFactorycreateVerticalCRS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createVerticalDatum(java.lang.String)public CartesianCS createCartesianCS(String code) throws FactoryException
createCoordinateSystem(code).createCartesianCS in interface CSAuthorityFactorycreateCartesianCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public CoordinateSystem createCoordinateSystem(String code) throws FactoryException
AbstractAuthorityFactorycreateObject(code).createCoordinateSystem in interface CSAuthorityFactorycreateCoordinateSystem in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.protected abstract CoordinateSystem generateCoordinateSystem(String code) throws FactoryException
FactoryExceptionpublic CoordinateSystemAxis createCoordinateSystemAxis(String code) throws FactoryException
AbstractAuthorityFactorycreateObject(code).createCoordinateSystemAxis in interface CSAuthorityFactorycreateCoordinateSystemAxis in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.protected abstract CoordinateSystemAxis generateCoordinateSystemAxis(String code) throws FactoryException
FactoryExceptionpublic CylindricalCS createCylindricalCS(String code) throws FactoryException
createCoordinateSystem(code).createCylindricalCS in interface CSAuthorityFactorycreateCylindricalCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public EllipsoidalCS createEllipsoidalCS(String code) throws FactoryException
AbstractAuthorityFactorycreateCoordinateSystem(code).createEllipsoidalCS in interface CSAuthorityFactorycreateEllipsoidalCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public PolarCS createPolarCS(String code) throws FactoryException
AbstractAuthorityFactory
createCoordinateSystem(code).createPolarCS in interface CSAuthorityFactorycreatePolarCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public SphericalCS createSphericalCS(String code) throws FactoryException
AbstractAuthorityFactory
createCoordinateSystem(code).createSphericalCS in interface CSAuthorityFactorycreateSphericalCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public TimeCS createTimeCS(String code) throws FactoryException
AbstractAuthorityFactory
createCoordinateSystem(code).createTimeCS in interface CSAuthorityFactorycreateTimeCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public Unit<?> createUnit(String code) throws FactoryException
AbstractAuthorityFactory
createObject(code).createUnit in interface CSAuthorityFactorycreateUnit in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.protected abstract Unit<?> generateUnit(String code) throws FactoryException
FactoryExceptionpublic VerticalCS createVerticalCS(String code) throws FactoryException
AbstractAuthorityFactory
createCoordinateSystem(code).createVerticalCS in interface CSAuthorityFactorycreateVerticalCS in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.public Datum createDatum(String code) throws FactoryException
AbstractAuthorityFactorycreateObject(code).createDatum in interface DatumAuthorityFactorycreateDatum in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createGeodeticDatum(java.lang.String),
AbstractAuthorityFactory.createVerticalDatum(java.lang.String),
AbstractAuthorityFactory.createTemporalDatum(java.lang.String)protected abstract Datum generateDatum(String code) throws FactoryException
FactoryExceptionpublic Ellipsoid createEllipsoid(String code) throws FactoryException
AbstractAuthorityFactorycreateObject(code).createEllipsoid in interface DatumAuthorityFactorycreateEllipsoid in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)protected abstract Ellipsoid generateEllipsoid(String code) throws FactoryException
FactoryExceptionpublic EngineeringDatum createEngineeringDatum(String code) throws FactoryException
AbstractAuthorityFactorycreateDatum(code).createEngineeringDatum in interface DatumAuthorityFactorycreateEngineeringDatum in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createEngineeringCRS(java.lang.String)public GeodeticDatum createGeodeticDatum(String code) throws FactoryException
AbstractAuthorityFactorycreateDatum(code).createGeodeticDatum in interface DatumAuthorityFactorycreateGeodeticDatum in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createEllipsoid(java.lang.String),
AbstractAuthorityFactory.createPrimeMeridian(java.lang.String),
AbstractAuthorityFactory.createGeographicCRS(java.lang.String),
AbstractAuthorityFactory.createProjectedCRS(java.lang.String)public ImageDatum createImageDatum(String code) throws FactoryException
AbstractAuthorityFactorycreateDatum(code).createImageDatum in interface DatumAuthorityFactorycreateImageDatum in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createImageCRS(java.lang.String)public PrimeMeridian createPrimeMeridian(String code) throws FactoryException
AbstractAuthorityFactorycreateObject(code).createPrimeMeridian in interface DatumAuthorityFactorycreatePrimeMeridian in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createGeodeticDatum(java.lang.String)protected abstract PrimeMeridian generatePrimeMeridian(String code) throws FactoryException
FactoryExceptionpublic TemporalDatum createTemporalDatum(String code) throws FactoryException
AbstractAuthorityFactorycreateDatum(code).createTemporalDatum in interface DatumAuthorityFactorycreateTemporalDatum in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createTemporalCRS(java.lang.String)public VerticalDatum createVerticalDatum(String code) throws FactoryException
AbstractAuthorityFactorycreateDatum(code).createVerticalDatum in interface DatumAuthorityFactorycreateVerticalDatum in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.AbstractAuthorityFactory.createVerticalCRS(java.lang.String)public CoordinateOperation createCoordinateOperation(String code) throws FactoryException
AbstractAuthorityFactorycreateCoordinateOperation in interface CoordinateOperationAuthorityFactorycreateCoordinateOperation in class AbstractAuthorityFactorycode - Value allocated by authority.NoSuchAuthorityCodeException - if the specified code was not found.FactoryException - if the object creation failed for some other reason.protected abstract CoordinateOperation generateCoordinateOperation(String code) throws FactoryException
FactoryExceptionpublic Set<CoordinateOperation> createFromCoordinateReferenceSystemCodes(String sourceCode, String targetCode) throws FactoryException
AbstractAuthorityFactoryRational: 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.
createFromCoordinateReferenceSystemCodes in interface CoordinateOperationAuthorityFactorycreateFromCoordinateReferenceSystemCodes in class AbstractAuthorityFactorysourceCode - Coded value of source coordinate reference system.targetCode - Coded value of target coordinate reference system.sourceCRS to targetCRS.NoSuchAuthorityCodeException - if a specified code was not found.FactoryException - if the object creation failed for some other reason.protected abstract Set generateFromCoordinateReferenceSystemCodes(String sourceCode, String targetCode) throws FactoryException
FactoryExceptionpublic void dispose()
throws FactoryException
dispose in class AbstractAuthorityFactoryFactoryException - if an error occured while disposing the factory.public IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type) throws FactoryException
getIdentifiedObjectFinder in class AbstractAuthorityFactorytype - 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 finder can not be created.Copyright © 1996–2021 Geotools. All rights reserved.