abstractpublic class AbstractAuthorityFactory extends ReferencingFactory implements AuthorityFactory(Code)
Base class for authority factories. An authority is an organization that maintains
definitions of authority codes. An authority code is a compact string defined by
an authority to reference a particular spatial reference object. For example the
European Petroleum Survey Group (EPSG) maintains
a database of coordinate systems, and other spatial referencing objects, where each
object has a code number ID. For example, the EPSG code for a WGS84 Lat/Lon coordinate
system is
"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
AbstractAuthorityFactory.createObject , 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 version: $Id: AbstractAuthorityFactory.java 26212 2007-07-12 02:34:18Z jgarnett $ author: Martin Desruisseaux
Constructor Summary
protected
AbstractAuthorityFactory(int priority) Constructs an instance using the specified priority level.
dispose() Releases resources immediately instead of waiting for the garbage collector.
Once a factory has been disposed, further
create(...) invocations
may throw a
FactoryException .
abstractpublic Citation
getAuthority() Returns the organization or party responsible for definition and maintenance of the
database.
public CartesianCS createCartesianCS(String code) throws FactoryException(Code)
Creates a cartesian coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createCompoundCRS
public CompoundCRS createCompoundCRS(String code) throws FactoryException(Code)
Creates a 3D coordinate reference system from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createCoordinateOperation
public CoordinateOperation createCoordinateOperation(String code) throws FactoryException(Code)
Creates an operation from a single operation code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. since: 2.2
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException(Code)
public CoordinateSystem createCoordinateSystem(String code) throws FactoryException(Code)
Returns an arbitrary
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createCoordinateSystemAxis
public CoordinateSystemAxis createCoordinateSystemAxis(String code) throws FactoryException(Code)
Returns a
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createCylindricalCS
public CylindricalCS createCylindricalCS(String code) throws FactoryException(Code)
Creates a cylindrical coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createDatum
public Datum createDatum(String code) throws FactoryException(Code)
public DerivedCRS createDerivedCRS(String code) throws FactoryException(Code)
Creates a derived coordinate reference system from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createEllipsoid
public Ellipsoid createEllipsoid(String code) throws FactoryException(Code)
Returns an
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createGeodeticDatum
createEllipsoidalCS
public EllipsoidalCS createEllipsoidalCS(String code) throws FactoryException(Code)
Creates an ellipsoidal coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createEngineeringCRS
public EngineeringCRS createEngineeringCRS(String code) throws FactoryException(Code)
Creates a
from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createEngineeringDatum
public EngineeringDatum createEngineeringDatum(String code) throws FactoryException(Code)
Creates a
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createEngineeringCRS
createExtent
public Extent createExtent(String code) throws FactoryException(Code)
Returns a
(usually an area of validity) from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
Creates an operation from coordinate reference system codes. The default implementation
returns an
. We do not delegate to some kind
of
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
will invoke this method. If this method invoked the coordinate operation factory in turn, the
application could be trapped in infinite recursive calls.
Parameters: sourceCode - Coded value of source coordinate reference system. Parameters: targetCode - Coded value of target coordinate reference system. throws: NoSuchAuthorityCodeException - if a specified code was not found. throws: FactoryException - if the object creation failed for some other reason. since: 2.2
createGeocentricCRS
public GeocentricCRS createGeocentricCRS(String code) throws FactoryException(Code)
Returns a
from a code.
Parameters: code - Value allocated by authority. throws: FactoryException - if the object creation failed. See Also:AbstractAuthorityFactory.createGeodeticDatum
createGeodeticDatum
public GeodeticDatum createGeodeticDatum(String code) throws FactoryException(Code)
public GeographicCRS createGeographicCRS(String code) throws FactoryException(Code)
Returns a
from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createGeodeticDatum
createImageCRS
public ImageCRS createImageCRS(String code) throws FactoryException(Code)
Creates a
from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createImageDatum
public ImageDatum createImageDatum(String code) throws FactoryException(Code)
Creates a
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createImageCRS
createObject
public IdentifiedObject createObject(String code) throws FactoryException(Code)
Returns an arbitrary object from a code. The returned object will typically be an instance
of
Datum ,
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.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createCoordinateReferenceSystem See Also:AbstractAuthorityFactory.createDatum See Also:AbstractAuthorityFactory.createEllipsoid See Also:AbstractAuthorityFactory.createUnit
createOperationMethod
public OperationMethod createOperationMethod(String code) throws FactoryException(Code)
Creates an operation method from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. since: 2.2
createParameterDescriptor
public ParameterDescriptor createParameterDescriptor(String code) throws FactoryException(Code)
Creates a parameter descriptor from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. since: 2.2
createPolarCS
public PolarCS createPolarCS(String code) throws FactoryException(Code)
Creates a polar coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createPrimeMeridian
public PrimeMeridian createPrimeMeridian(String code) throws FactoryException(Code)
Returns a
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createGeodeticDatum
createProjectedCRS
public ProjectedCRS createProjectedCRS(String code) throws FactoryException(Code)
Returns a
from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createGeodeticDatum
createSphericalCS
public SphericalCS createSphericalCS(String code) throws FactoryException(Code)
Creates a spherical coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createTemporalCRS
public TemporalCRS createTemporalCRS(String code) throws FactoryException(Code)
Creates a
from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createTemporalDatum
createTemporalDatum
public TemporalDatum createTemporalDatum(String code) throws FactoryException(Code)
Creates a
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createTemporalCRS
createTimeCS
public TimeCS createTimeCS(String code) throws FactoryException(Code)
Creates a temporal coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createUnit
public Unit createUnit(String code) throws FactoryException(Code)
Returns an
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createVerticalCRS
public VerticalCRS createVerticalCRS(String code) throws FactoryException(Code)
Creates a
from a code.
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createVerticalDatum
createVerticalCS
public VerticalCS createVerticalCS(String code) throws FactoryException(Code)
Creates a vertical coordinate system from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason.
createVerticalDatum
public VerticalDatum createVerticalDatum(String code) throws FactoryException(Code)
Creates a
from a code.
The default implementation invokes
(code).
Parameters: code - Value allocated by authority. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. See Also:AbstractAuthorityFactory.createVerticalCRS
dispose
public void dispose() throws FactoryException(Code)
Releases resources immediately instead of waiting for the garbage collector.
Once a factory has been disposed, further
create(...) invocations
may throw a
FactoryException . Disposing a previously-disposed factory,
however, has no effect.
throws: FactoryException - if an error occured while disposing the factory.
Returns a description of the underlying backing store, or
null if unknown.
This is for example the database software used for storing the data.
The default implementation returns always
null .
throws: FactoryException - if a failure occurs while fetching the engine description.
Returns a finder which can be used for looking up unidentified objects. The finder
fetchs a fully
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 like GeographicCRS.class , but this method accepts also implementationclass. If the type is unknown, use IdentifiedObject.class . A moreaccurate type may help to speed up the search, since it reduces the amountof tables to scan in some implementations like the factories backed byEPSG database. A finder to use for looking up unidentified objects. throws: FactoryException - if the finder can not be created. since: 2.4
Returns
true if this factory is available. This method may returns
false for example if a connection to the EPSG database failed. This method is defined here for
implementation convenience, but not yet public because not yet applicable. It will be made
public in
DeferredAuthorityFactory and
AuthorityFactoryAdapter subclasses,
which implement the
org.geotools.factory.OptionalFactory interface.
noSuchAuthorityCode
final protected NoSuchAuthorityCodeException noSuchAuthorityCode(Class type, String code)(Code)
Creates an exception for an unknow authority code. This convenience method is provided
for implementation of
createXXX methods.
Parameters: type - The GeoAPI interface that was to be created(e.g. CoordinateReferenceSystem.class ). Parameters: code - The unknow authority code. An exception initialized with an error message builtfrom the specified informations.
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. The code without the authority scope.
Fields inherited from org.geotools.referencing.factory.ReferencingFactory