|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractFactory
ReferencingFactory
AbstractAuthorityFactory
CachedAuthorityDecorator
public final class CachedAuthorityDecorator
An authority factory that caches all objects created by delegate factories. This class is set up to cache the full complement of referencing objects: In many cases a single implementation will be used for several the authority factory interfaces - but this is not a requirement.
The behaviour 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 AuthorityFactory authority factory and the result is cached for next time.
This object is responsible for owning a {{ReferencingObjectCache}}; there are several implementations to choose from on construction.
| Field Summary |
|---|
| Fields inherited from class ReferencingFactory |
|---|
LOGGER |
| Fields inherited from class AbstractFactory |
|---|
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority |
| Constructor Summary | |
|---|---|
|
CachedAuthorityDecorator(AuthorityFactory factory)
Constructs an instance wrapping the specified factory with a default cache. |
protected |
CachedAuthorityDecorator(AuthorityFactory factory,
ObjectCache cache)
Constructs an instance wrapping the specified factory. |
| Method Summary | |
|---|---|
protected static ObjectCache |
createCache(Hints hints)
Utility method used to produce cache based on hint |
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)
Creates a cylindrical coordinate system from a 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 |
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()
Releases resources immediately instead of waiting for the garbage collector. |
Citation |
getAuthority()
Returns the organization or party responsible for definition and maintenance of the database. |
Set |
getAuthorityCodes(Class type)
Returns the set of authority codes of the given type. |
String |
getBackingStoreDescription()
Returns a description of the underlying backing store, or null if unknown. |
InternationalString |
getDescriptionText(String code)
Gets a description of the object corresponding to a code. |
IdentifiedObjectFinder |
getIdentifiedObjectFinder(Class type)
Returns a finder which can be used for looking up unidentified objects. |
protected String |
toKey(String code)
|
| Methods inherited from class AbstractAuthorityFactory |
|---|
createExtent, createOperationMethod, createParameterDescriptor, noSuchAuthorityCode, trimAuthority |
| Methods inherited from class ReferencingFactory |
|---|
ensureNonNull, getVendor |
| Methods inherited from class AbstractFactory |
|---|
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface Factory |
|---|
getVendor |
| Methods inherited from interface Factory |
|---|
getImplementationHints |
| Constructor Detail |
|---|
public CachedAuthorityDecorator(AuthorityFactory factory)
The provided authority factory must implement
DatumAuthorityFactory, CSAuthorityFactory,
CRSAuthorityFactory and
CoordinateOperationAuthorityFactory .
factory - The factory to cache. Can not be null.
protected CachedAuthorityDecorator(AuthorityFactory factory,
ObjectCache cache)
maxStrongReferences argument specify the maximum number of
objects to keep by strong reference. If a greater amount of objects are
created, then the strong references for the oldest ones are replaced by
weak references.
This constructor is protected because subclasses must declare which of
the DatumAuthorityFactory, CSAuthorityFactory,
CRSAuthorityFactory SearchableAuthorityFactory and
CoordinateOperationAuthorityFactory interfaces they choose to
implement.
factory - The factory to cache. Can not be null.maxStrongReferences - The maximum number of objects to keep by strong reference.| Method Detail |
|---|
protected static ObjectCache createCache(Hints hints)
throws FactoryRegistryException
FactoryRegistryExceptionprotected String toKey(String code)
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)public Citation getAuthority()
AbstractAuthorityFactory
getAuthority in interface AuthorityFactorygetAuthority in class AbstractAuthorityFactory
public Set 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.
public InternationalString getDescriptionText(String code)
throws FactoryException
AuthorityFactory
getDescriptionText 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 CompoundCRS createCompoundCRS(String code)
throws FactoryException
AbstractAuthorityFactory
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)
public DerivedCRS createDerivedCRS(String code)
throws FactoryException
AbstractAuthorityFactory
createDerivedCRS 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
AbstractAuthorityFactory
createEngineeringCRS 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
AbstractAuthorityFactory
createGeocentricCRS 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
AbstractAuthorityFactory
createGeographicCRS 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
AbstractAuthorityFactory
createImageCRS 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
AbstractAuthorityFactory
createProjectedCRS 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
AbstractAuthorityFactory
createTemporalCRS 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
AbstractAuthorityFactory
createVerticalCRS 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
AbstractAuthorityFactorycreateCoordinateSystem(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.
public 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.
public CylindricalCS createCylindricalCS(String code)
throws FactoryException
AbstractAuthorityFactorycreateCoordinateSystem(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
AbstractAuthorityFactorycreateCoordinateSystem(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
AbstractAuthorityFactorycreateCoordinateSystem(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
AbstractAuthorityFactorycreateCoordinateSystem(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
AbstractAuthorityFactorycreateObject(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.
public VerticalCS createVerticalCS(String code)
throws FactoryException
AbstractAuthorityFactorycreateCoordinateSystem(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)
public 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)
public 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)
public 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
AbstractAuthorityFactory
createCoordinateOperation 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.
public Set 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.
public IdentifiedObjectFinder getIdentifiedObjectFinder(Class type)
throws FactoryException
AbstractAuthorityFactoryAUTHORITY[...]" element in
Well Known Text terminology.
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.
public void dispose()
throws FactoryException
AbstractAuthorityFactorycreate(...) invocations
may throw a FactoryException. Disposing a previously-disposed factory,
however, has no effect.
dispose in class AbstractAuthorityFactoryFactoryException - if an error occured while disposing the factory.
public String getBackingStoreDescription()
throws FactoryException
AbstractAuthorityFactorynull if unknown.
This is for example the database software used for storing the data.
The default implementation returns always null.
getBackingStoreDescription in class AbstractAuthorityFactorynull.
FactoryException - if a failure occurs while fetching the engine description.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||