org.geotools.referencing.factory.epsg
Class FactoryUsingAnsiSQL

java.lang.Object
  extended byorg.geotools.factory.AbstractFactory
      extended byorg.geotools.referencing.factory.AbstractFactory
          extended byorg.geotools.referencing.factory.AbstractAuthorityFactory
              extended byorg.geotools.referencing.factory.epsg.FactoryUsingSQL
                  extended byorg.geotools.referencing.factory.epsg.FactoryUsingAnsiSQL
All Implemented Interfaces:
org.opengis.referencing.AuthorityFactory, org.opengis.referencing.operation.CoordinateOperationAuthorityFactory, org.opengis.referencing.crs.CRSAuthorityFactory, org.opengis.referencing.cs.CSAuthorityFactory, org.opengis.referencing.datum.DatumAuthorityFactory, Factory, org.opengis.referencing.Factory, javax.imageio.spi.RegisterableService
Direct Known Subclasses:
FactoryUsingOracleSQL

public class FactoryUsingAnsiSQL
extends FactoryUsingSQL

An EPSG factory for the database generated by SQL scripts rather than the MS-Access one. This class overrides adaptSQL(java.lang.String) in order to translate SQL statements from MS-Access syntax to ANSI syntax. By default, the translated SQL statements use the table and field names in the Data Description Language (DDL) scripts provided by EPSG to create the schema for the database. Subclasses can changes this default behavior by modifying the map.

In order to register this ANSI version as the default EPSG factory backed by a PostgreSQL database (for example), invokes the following only once from the command line. The change will by system-wide.

java org.geotools.referencing.factory.epsg.DefaultFactory -datasource=org.postgresql.jdbc2.optional.SimpleDataSource


References:

Since:
2.1
Version:
$Id: FactoryUsingAnsiSQL.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Rueben Schulz, Martin Desruisseaux, Didier Richard, John Grange

Field Summary
protected  java.util.Map map
          Maps the MS-Access names to ANSI names.
 
Fields inherited from class org.geotools.referencing.factory.epsg.FactoryUsingSQL
connection
 
Fields inherited from class org.geotools.referencing.factory.AbstractAuthorityFactory
factories
 
Fields inherited from class org.geotools.referencing.factory.AbstractFactory
LOGGER
 
Fields inherited from class org.geotools.factory.AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
 
Constructor Summary
FactoryUsingAnsiSQL(FactoryGroup factories, java.sql.Connection connection)
          Deprecated. Use FactoryUsingAnsiSQL(Hints,Connection) instead.
FactoryUsingAnsiSQL(Hints hints, java.sql.Connection connection)
          Constructs an authority factory using the specified connection.
 
Method Summary
protected  java.lang.String adaptSQL(java.lang.String statement)
          Modifies the given SQL string to be suitable for non MS-Access databases.
protected  void setSchema(java.lang.String schema)
          Replaces the prefix by the specified schema name.
 
Methods inherited from class org.geotools.referencing.factory.epsg.FactoryUsingSQL
createCoordinateOperation, createCoordinateReferenceSystem, createCoordinateSystem, createCoordinateSystemAxis, createDatum, createEllipsoid, createExtent, createFromCoordinateReferenceSystemCodes, createObject, createOperationMethod, createParameterDescriptor, createPrimeMeridian, createUnit, dispose, finalize, getAuthority, getAuthorityCodes, getBackingStoreDescription, getDescriptionText, isPrimaryKey, shutdown
 
Methods inherited from class org.geotools.referencing.factory.AbstractAuthorityFactory
createCartesianCS, createCompoundCRS, createCylindricalCS, createDerivedCRS, createEllipsoidalCS, createEngineeringCRS, createEngineeringDatum, createGeocentricCRS, createGeodeticDatum, createGeographicCRS, createImageCRS, createImageDatum, createPolarCS, createProjectedCRS, createSphericalCS, createTemporalCRS, createTemporalDatum, createTimeCS, createVerticalCRS, createVerticalCS, createVerticalDatum, getImplementationHints, noSuchAuthorityCode, onRegistration, trimAuthority
 
Methods inherited from class org.geotools.referencing.factory.AbstractFactory
ensureNonNull, getVendor
 
Methods inherited from class org.geotools.factory.AbstractFactory
onDeregistration
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengis.referencing.Factory
getVendor
 

Field Detail

map

protected final java.util.Map map
Maps the MS-Access names to ANSI names. Keys are MS-Access names including bracket. Values are ANSI names. Keys and values are case-sensitive. The default content of this map is:
MS-Access name ANSI name
[Alias] epsg_alias
[Area] epsg_area
[Coordinate Axis] epsg_coordinateaxis
[Coordinate Axis Name] epsg_coordinateaxisname
[Coordinate_Operation] epsg_coordoperation
[Coordinate_Operation Method] epsg_coordoperationmethod
[Coordinate_Operation Parameter] epsg_coordoperationparam
[Coordinate_Operation Parameter Usage] epsg_coordoperationparamusage
[Coordinate_Operation Parameter Value] epsg_coordoperationparamvalue
[Coordinate_Operation Path] epsg_coordoperationpath
[Coordinate Reference System] epsg_coordinatereferencesystem
[Coordinate System] epsg_coordinatesystem
[Datum] epsg_datum
[Naming System] epsg_namingsystem
[Ellipsoid] epsg_ellipsoid
[Prime Meridian] epsg_primemeridian
[Supersession] epsg_supersession
[Unit of Measure] epsg_unitofmeasure
[CA.ORDER] coord_axis_order
Subclasses can modify this map in their constructor in order to provide a different mapping.

Constructor Detail

FactoryUsingAnsiSQL

public FactoryUsingAnsiSQL(FactoryGroup factories,
                           java.sql.Connection connection)
Deprecated. Use FactoryUsingAnsiSQL(Hints,Connection) instead.

Constructs an authority factory using the specified connection.

Parameters:
factories - The underlying factories used for objects creation.
connection - The connection to the underlying EPSG database.

FactoryUsingAnsiSQL

public FactoryUsingAnsiSQL(Hints hints,
                           java.sql.Connection connection)
Constructs an authority factory using the specified connection.

Parameters:
hints - The underlying factories used for objects creation.
connection - The connection to the underlying EPSG database.
Since:
2.2
Method Detail

setSchema

protected void setSchema(java.lang.String schema)
Replaces the prefix by the specified schema name. If the removal of the prefix is not wanted, append it to the schema name (e.g. ). This method should be invoked at construction time only.

Parameters:
schema - The database schema in which the epsg tables are stored.
Since:
2.2

adaptSQL

protected java.lang.String adaptSQL(java.lang.String statement)
Modifies the given SQL string to be suitable for non MS-Access databases. This replaces table and field names in the SQL with the new names in the SQL DDL scripts provided with EPSG database.

Overrides:
adaptSQL in class FactoryUsingSQL
Parameters:
statement - The statement in MS-Access syntax.
Returns:
The SQL statement in ANSI syntax.


Copyright © GeoTools. All Rights Reserved.