org.geotools.referencing.factory.epsg
Class ThreadedH2EpsgFactory
java.lang.Object
org.geotools.factory.AbstractFactory
org.geotools.referencing.factory.ReferencingFactory
org.geotools.referencing.factory.AbstractAuthorityFactory
org.geotools.referencing.factory.BufferedAuthorityFactory
org.geotools.referencing.factory.DeferredAuthorityFactory
org.geotools.referencing.factory.epsg.ThreadedEpsgFactory
org.geotools.referencing.factory.epsg.ThreadedH2EpsgFactory
- All Implemented Interfaces:
- javax.imageio.spi.RegisterableService, BufferedFactory, Factory, OptionalFactory, org.opengis.referencing.AuthorityFactory, org.opengis.referencing.crs.CRSAuthorityFactory, org.opengis.referencing.cs.CSAuthorityFactory, org.opengis.referencing.datum.DatumAuthorityFactory, org.opengis.referencing.operation.CoordinateOperationAuthorityFactory
public class ThreadedH2EpsgFactory
- extends ThreadedEpsgFactory
Connection to the EPSG database in H2 database engine format using JDBC. The EPSG
database can be downloaded from http://www.epsg.org.
The SQL scripts (modified for the HSQL syntax as explained
here) are bundled into this plugin. The database version is given in the
edition attribute
of the authority.
The HSQL database is read only.
Implementation note
The SQL scripts are executed the first time a connection is required. The database
is then created as cached tables (HSQL.properties
and HSQL.data
files)
in a temporary directory. Future connections to the EPSG database while reuse the cached
tables, if available. Otherwise, the scripts will be executed again in order to recreate
them.
If the EPSG database should be created in a different directory (or already exists in that
directory), it may be specified as a system property
nammed "EPSG-H2.directory".
- Since:
- 2.6
- Version:
- $Id: ThreadedH2EpsgFactory.java 35634 2010-05-31 15:11:41Z aaime $
- Author:
- Martin Desruisseaux, Didier Richard, Andrea Aime
Field Summary |
static java.lang.String |
DATABASE_NAME
The database name. |
static java.lang.String |
DIRECTORY_KEY
The key for fetching the database directory from system properties. |
static Version |
VERSION
Current version of EPSG-h2 plugin. |
Methods inherited from class org.geotools.referencing.factory.BufferedAuthorityFactory |
createCartesianCS, createCompoundCRS, createCoordinateOperation, createCoordinateReferenceSystem, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createDatum, createDerivedCRS, createEllipsoid, createEllipsoidalCS, createEngineeringCRS, createEngineeringDatum, createExtent, createFromCoordinateReferenceSystemCodes, createGeocentricCRS, createGeodeticDatum, createGeographicCRS, createImageCRS, createImageDatum, createObject, createOperationMethod, createParameterDescriptor, createPolarCS, createPrimeMeridian, createProjectedCRS, createSphericalCS, createTemporalCRS, createTemporalDatum, createTimeCS, createUnit, createVerticalCRS, createVerticalCS, createVerticalDatum, getAuthorityCodes, getBackingStoreDescription, getDescriptionText, getIdentifiedObjectFinder, getVendor |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opengis.referencing.crs.CRSAuthorityFactory |
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS |
Methods inherited from interface org.opengis.referencing.cs.CSAuthorityFactory |
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS |
Methods inherited from interface org.opengis.referencing.datum.DatumAuthorityFactory |
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum |
Methods inherited from interface org.opengis.referencing.operation.CoordinateOperationAuthorityFactory |
createCoordinateOperation, createFromCoordinateReferenceSystemCodes |
Methods inherited from interface org.opengis.referencing.AuthorityFactory |
createObject, getAuthorityCodes, getDescriptionText |
Methods inherited from interface org.opengis.referencing.Factory |
getVendor |
VERSION
public static final Version VERSION
- Current version of EPSG-h2 plugin. This is usually the same version number than the
one in the EPSG database bundled in this plugin. However this field may contains
additional minor version number if there is some changes related to the EPSG-H2
plugin rather then the EPSG database itself (for example additional database index).
DIRECTORY_KEY
public static final java.lang.String DIRECTORY_KEY
- The key for fetching the database directory from system properties.
- See Also:
- Constant Field Values
DATABASE_NAME
public static final java.lang.String DATABASE_NAME
- The database name.
- See Also:
- Constant Field Values
ThreadedH2EpsgFactory
public ThreadedH2EpsgFactory()
- Creates a new instance of this factory. If the "EPSG-H2.directory"
system property is defined and contains
the name of a directory with a valid parent, then the
"EPSG" database will be saved in that directory. Otherwise, a
temporary directory will be used.
ThreadedH2EpsgFactory
public ThreadedH2EpsgFactory(Hints hints)
- Creates a new instance of this data source using the specified hints. The priority
is set to a lower value than the FactoryOnAccess's one in order to give
precedence to the Access-backed database, if presents. Priorities are set that way
because:
- The MS-Access format is the primary EPSG database format.
- If a user downloads the MS-Access database himself, he probably wants to use it.
isUnpacked
public static boolean isUnpacked()
- Tests of the EPSG database is unpacked into the required directory.
This method exists to allow client applications to check if the EPSG
database is unpacked and ready to go; or if more time shoudld be
alloted to let the database be constructed.
- Returns:
- true if directory intended for h2 exists (assumed from a previous run)
createDataSource
protected javax.sql.DataSource createDataSource()
throws java.sql.SQLException
- Returns a data source for the HSQL database.
- Overrides:
createDataSource
in class ThreadedEpsgFactory
- Returns:
- The EPSG data source, or
null
if none where found.
- Throws:
java.sql.SQLException
- if an error occured while creating the data source.
createBackingStore
protected AbstractAuthorityFactory createBackingStore(Hints hints)
throws java.sql.SQLException
- Returns the backing-store factory for HSQL syntax. If the cached tables are not available,
they will be created now from the SQL scripts bundled in this plugin.
- Overrides:
createBackingStore
in class ThreadedEpsgFactory
- Parameters:
hints
- A map of hints, including the low-level factories to use for CRS creation.
- Returns:
- The EPSG factory using HSQL syntax.
- Throws:
java.sql.SQLException
- if connection to the database failed.
Copyright © 1996-2010 Geotools. All Rights Reserved.