|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFactory
ReferencingFactory
AbstractAuthorityFactory
DirectAuthorityFactory
WKTParsingAuthorityFactory
PropertyAuthorityFactory
PropertyEpsgFactory
@ThreadSafe public class PropertyEpsgFactory
Authority factory for Coordinate Reference Systems beyong the one defined in the EPSG database. This factory is used as a fallback when a requested code is not found in the EPSG database, or when there is no connection at all to the EPSG database. The CRS are defined as Well Known Text in a property file named "epsg.properties". The search path is as below, in that order:
If a value for Hints.CRS_AUTHORITY_EXTRA_DIRECTORY exists in the hints map
given at construction time, then that value will be used as the directory where to
search for the "epsg.properties" file. Reminder: such hint can be
defined system-wide for convenience.
The "epsg.properties" files found in all org/geotoolkit/referencing/factory/epsg
directories on the classpath are merged with the values found in previous step, if any.
If the same value is defined twice, the value of previous step have precedence.
In order to provide a custom extension, you can create a subclass that invoke the
PropertyEpsgFactory(Hints, String, Citation[]) constructor with different constants.
You can also subclass PropertyAuthorityFactory directly for getting more control.
In order to make the factory be an override, override the
setOrdering(...) method as below:
protected void setOrdering(Organizer organizer) {
organizer.before(ThreadedEpsgFactory.class);
}
Caching of CRS objects
This factory doesn't cache any result. Any call to a createFoo method
will trig a new WKT parsing. For adding caching service, this factory should
be wrapped in CachingAuthorityFactory.
Note that this is done automatically when this factory is used through the
CRS static methods.
Troubleshotting
If the "epsg.properties" file is on the classpath but seems to be ignored,
the following actions may provide some useful informations:
Print the list of every registered factories using the code snippet documented
in the FactoryDependencies class and verify
that PropertyEpsgFactory is presents.
Set the logging level for the org.geotoolkit loggers to CONFIG.
See Java
Logging Overview for the standard way, or use the following Geotk convenience method:
Logging.GEOTOOLKIT.forceMonolineConsoleOutput(Level.CONFIG);
Force the system to ignore any factory other than PropertyEpsgFactory:
Hints.putSystemDefault(Hints.CRS_AUTHORITY_FACTORY, PropertyEpsgFactory.class);
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Factory |
|---|
Factory.Availability, Factory.Organizer |
| Field Summary | |
|---|---|
static String |
FILENAME
The default filename to read, which is "epsg.properties". |
| Fields inherited from class DirectAuthorityFactory |
|---|
factories |
| Fields inherited from class AbstractAuthorityFactory |
|---|
nameFactory |
| Fields inherited from class ReferencingFactory |
|---|
LOGGER |
| Fields inherited from class Factory |
|---|
EMPTY_HINTS, hints |
| Constructor Summary | |
|---|---|
PropertyEpsgFactory()
Constructs a default authority factory. |
|
PropertyEpsgFactory(Hints userHints)
Constructs an authority factory from the given hints. |
|
PropertyEpsgFactory(Hints userHints,
String filename,
Citation... authorities)
Constructs an authority factory for the given authorities. |
|
| Method Summary | |
|---|---|
Set<String> |
reportDuplicates(PrintWriter out)
Prints a list of codes that duplicate the ones provided by ThreadedEpsgFactory. |
Set<String> |
reportInstantiationFailures(PrintWriter out)
Prints a list of CRS that can't be instantiated. |
protected void |
setOrdering(Factory.Organizer organizer)
Invoked by FactoryRegistry on registration. |
| Methods inherited from class PropertyAuthorityFactory |
|---|
dispose, load |
| Methods inherited from class WKTParsingAuthorityFactory |
|---|
availability, createCoordinateReferenceSystem, createObject, getAuthority, getAuthorityCodes, getDescriptionText, getIdentifiedObjectFinder, trimAuthority |
| Methods inherited from class DirectAuthorityFactory |
|---|
getImplementationHints |
| Methods inherited from class ReferencingFactory |
|---|
ensureNonNull, getVendor |
| Methods inherited from class Factory |
|---|
equals, hasCompatibleHints, hashCode, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface CRSAuthorityFactory |
|---|
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS |
| Methods inherited from interface AuthorityFactory |
|---|
createObject, getAuthority, getAuthorityCodes, getDescriptionText |
| Methods inherited from interface Factory |
|---|
getVendor |
| Methods inherited from interface CSAuthorityFactory |
|---|
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS |
| Methods inherited from interface DatumAuthorityFactory |
|---|
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum |
| Field Detail |
|---|
public static final String FILENAME
PropertyEpsgFactory implementation will search for every occurrences of
org/geotoolkit/referencing/factory/espg/epsg.properties on the classpath.
However a different directory for this filename can be specified using
Hints.CRS_AUTHORITY_EXTRA_DIRECTORY.
| Constructor Detail |
|---|
public PropertyEpsgFactory()
throws IOException
IOException - If an error occurred while reading the definition files.
Note that do exception is thrown if there is no file - in this case
the factory is only considered not available.
public PropertyEpsgFactory(Hints userHints)
throws IOException
This constructor recognizes also CRS, CS,
DATUM and MATH_TRANSFORM
FACTORY hints.
userHints - An optional set of hints, or null if none.
IOException - If an error occurred while reading the definition files.
Note that do exception is thrown if there is no file - in this case
the factory is only considered not available.
public PropertyEpsgFactory(Hints userHints,
String filename,
Citation... authorities)
throws IOException
PropertyEpsgFactory(Hints). The authorities argument
should enumerate all relevant authorities, with EPSG in last
position. For example EsriExtension returns {ESRI,
EPSG}.
userHints - An optional set of hints, or null if none.filename - The name of the file to look in the Hints.CRS_AUTHORITY_EXTRA_DIRECTORY
directory and in every org/geotoolkit/referencing/factory/espg directories
found on the classpath.authorities - The organizations or parties responsible for definition and maintenance of the
database. Should contains at least Citations.EPSG.
IOException - If an error occurred while reading the definition files.
Note that do exception is thrown if there is no file - in this case
the factory is only considered not available.| Method Detail |
|---|
protected void setOrdering(Factory.Organizer organizer)
FactoryRegistry on registration. The default implementation
declares that this factory should give precedence to ThreadedEpsgFactory
and LongitudeFirstEpsgFactory.
setOrdering in class Factory
public Set<String> reportDuplicates(PrintWriter out)
throws FactoryException
ThreadedEpsgFactory.
This is used in order to check the content of the "epsg.properties" file (or whatever
property file used as backing store for this factory) from the command line.
java -jar geotk-referencing.jar test duplicates
out - The writer where to print the report.
FactoryException - if an error occurred.ReferencingCommands.test()
public Set<String> reportInstantiationFailures(PrintWriter out)
throws FactoryException
java -jar geotk-referencing.jar test creates
out - The writer where to print the report.
FactoryException - if an error occurred while
fetching authority codes.ReferencingCommands.test()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||