org.geotools.referencing.factory.epsg
Interface DataSource

All Superinterfaces:
javax.sql.DataSource
All Known Implementing Classes:
AccessDataSource, HSQLDataSource, PostgreDataSource, SimpleDataSource

public interface DataSource
extends javax.sql.DataSource

A marker interface for data source to an EPSG database. This sub-interface of J2SE's is used as a category for ServiceRegistry. EPSG data sources should be registered in the following file:

META-INF/services/org.geotools.referencing.factory.epsg.DataSource
For an example, see AccessDataSource and its registration in the module. This is a very small module which can be used as a starting point for custom EPSG data sources.

How EPSG factory are found

By default, only one DefaultFactory is registered and returned by FactoryFinder. We don't need to register any other implementation for an EPSG factory backed by a SQL database. However, alone is not suffisient for querying the database. It needs one more "plugable" information: the connection to the EPSG database. This interface is there for providing such connection to .

Some time after is registered as an EPSG factory, it looks for a using the same plugins mechanism than for factories. In other words, is a second level of plugins used internally by DefaultFactory.

Since:
2.1
Version:
$Id: DataSource.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
static int MAXIMUM_PRIORITY
          The maximum priority for a data source, which is 100.
static int MINIMUM_PRIORITY
          The minimum priority for a data source, which is 1.
static int NORMAL_PRIORITY
          The default priority, which is 50.
 
Method Summary
 AbstractAuthorityFactory createFactory(Hints hints)
          Opens a connection and creates an EPSG factory for it.
 int getPriority()
          Returns the priority for this data source, as a number between MINIMUM_PRIORITY and MAXIMUM_PRIORITY inclusive.
 
Methods inherited from interface javax.sql.DataSource
getConnection, getConnection, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 

Field Detail

MINIMUM_PRIORITY

public static final int MINIMUM_PRIORITY
The minimum priority for a data source, which is 1. Data sources with lowest priority will be used only if there is no other source available.

See Also:
Constant Field Values

NORMAL_PRIORITY

public static final int NORMAL_PRIORITY
The default priority, which is 50.

See Also:
Constant Field Values

MAXIMUM_PRIORITY

public static final int MAXIMUM_PRIORITY
The maximum priority for a data source, which is 100. Data sources with highest priority will be preferred to any other data sources.

See Also:
Constant Field Values
Method Detail

getPriority

public int getPriority()
Returns the priority for this data source, as a number between MINIMUM_PRIORITY and MAXIMUM_PRIORITY inclusive.


createFactory

public AbstractAuthorityFactory createFactory(Hints hints)
                                       throws java.sql.SQLException
Opens a connection and creates an EPSG factory for it. This method may returns a sub-class of FactoryUsingSQL if it wants to use slightly different SQL queries.

Parameters:
hints - A map of hints, including the low-level factories to use for CRS creation. This argument should be given unchanged to constructor.
Returns:
The EPSG factory using SQL queries appropriate for this data source.
Throws:
java.sql.SQLException - if connection to the database failed.


Copyright © GeoTools. All Rights Reserved.