org.geotools.referencing.factory.epsg
Class ThreadedHsqlEpsgFactory

Object
  extended by AbstractFactory
      extended by ReferencingFactory
          extended by AbstractAuthorityFactory
              extended by BufferedAuthorityFactory
                  extended by DeferredAuthorityFactory
                      extended by ThreadedEpsgFactory
                          extended by ThreadedHsqlEpsgFactory
All Implemented Interfaces:
RegisterableService, BufferedFactory, Factory, OptionalFactory, AuthorityFactory, CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory

public class ThreadedHsqlEpsgFactory
extends ThreadedEpsgFactory

Connection to the EPSG database in HSQL 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-HSQL.directory".

Since:
2.4
Author:
Martin Desruisseaux, Didier Richard
Module:
modules/plugin/epsg-hsql (gt-epsg-hsql.jar)

Field Summary
static String DATABASE_NAME
          The database name.
static String DIRECTORY_KEY
          The key for fetching the database directory from system properties.
static Version VERSION
          Current version of EPSG-HSQL plugin.
 
Fields inherited from class ThreadedEpsgFactory
DATASOURCE_NAME
 
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
 
Constructor Summary
ThreadedHsqlEpsgFactory()
          Creates a new instance of this factory.
ThreadedHsqlEpsgFactory(Hints hints)
          Creates a new instance of this data source using the specified hints.
 
Method Summary
protected  AbstractAuthorityFactory createBackingStore(Hints hints)
          Returns the backing-store factory for HSQL syntax.
protected  DataSource createDataSource()
          Returns a data source for the HSQL database.
 
Methods inherited from class ThreadedEpsgFactory
canDisposeBackingStore, createBackingStore, getAuthority, getDataSource, onDeregistration, onRegistration, setDataSource
 
Methods inherited from class DeferredAuthorityFactory
dispose, isAvailable, isConnected, setTimeout
 
Methods inherited from class 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 AbstractAuthorityFactory
noSuchAuthorityCode, trimAuthority
 
Methods inherited from class ReferencingFactory
ensureNonNull
 
Methods inherited from class AbstractFactory
addImplementationHints, equals, getImplementationHints, getPriority, 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, 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 AuthorityFactory
createObject, getAuthorityCodes, getDescriptionText
 
Methods inherited from interface Factory
getVendor
 
Methods inherited from interface DatumAuthorityFactory
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum
 
Methods inherited from interface AuthorityFactory
createObject, getAuthorityCodes, getDescriptionText
 
Methods inherited from interface Factory
getVendor
 
Methods inherited from interface CoordinateOperationAuthorityFactory
createCoordinateOperation, createFromCoordinateReferenceSystemCodes
 
Methods inherited from interface AuthorityFactory
createObject, getAuthorityCodes, getDescriptionText
 
Methods inherited from interface Factory
getVendor
 
Methods inherited from interface Factory
getImplementationHints
 

Field Detail

VERSION

public static final Version VERSION
Current version of EPSG-HSQL 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-HSQL plugin rather then the EPSG database itself (for example additional database index).


DIRECTORY_KEY

public static final String DIRECTORY_KEY
The key for fetching the database directory from system properties.

See Also:
Constant Field Values

DATABASE_NAME

public static final String DATABASE_NAME
The database name.

See Also:
Constant Field Values
Constructor Detail

ThreadedHsqlEpsgFactory

public ThreadedHsqlEpsgFactory()
Creates a new instance of this factory. If the "EPSG-HSQL.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.


ThreadedHsqlEpsgFactory

public ThreadedHsqlEpsgFactory(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:

Method Detail

createDataSource

protected DataSource createDataSource()
                               throws 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:
SQLException - if an error occured while creating the data source.

createBackingStore

protected AbstractAuthorityFactory createBackingStore(Hints hints)
                                               throws 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:
SQLException - if connection to the database failed.


Copyright © 1996-2009 Geotools. All Rights Reserved.