| org.geotools.referencing.factory.DeferredAuthorityFactory org.geotools.referencing.factory.epsg.ThreadedEpsgFactory
All known Subclasses: org.geotools.referencing.factory.epsg.ThreadedPostgreSQLEpsgFactory, org.geotools.referencing.factory.epsg.DefaultFactory,
ThreadedEpsgFactory | public class ThreadedEpsgFactory extends DeferredAuthorityFactory implements CRSAuthorityFactory,CSAuthorityFactory,DatumAuthorityFactory,CoordinateOperationAuthorityFactory(Code) | | Base class for EPSG factories to be registered in
ReferencingFactoryFinder .
Various subclasses are defined for different database backends: Access, PostgreSQL,
HSQL, etc..
Users should not creates instance of this class directly. They should invoke one of
.getFooAuthorityFactory("EPSG")
methods instead.
This class will change in Geotools 2.5; avoid direct dependence if possible. The current
ThreadedEpsgFactory name does not reflect its actual behavior in Geotools 2.4.
It should reflect the behavior expected in Geotools 2.5.
since: 2.4 version: $Id: ThreadedEpsgFactory.java 26328 2007-07-24 16:57:19Z desruisseaux $ author: Martin Desruisseaux |
Field Summary | |
final public static String | DATASOURCE_NAME The default JDBC
name in JNDI. | final static int | PRIORITY The default priority level for this factory. |
Constructor Summary | |
public | ThreadedEpsgFactory() Constructs an authority factory using the default set of factories. | public | ThreadedEpsgFactory(Hints userHints) Constructs an authority factory with the default priority. | public | ThreadedEpsgFactory(Hints userHints, int priority) Constructs an authority factory using a set of factories created from the specified hints. |
PRIORITY | final static int PRIORITY(Code) | | The default priority level for this factory.
|
ThreadedEpsgFactory | public ThreadedEpsgFactory()(Code) | | Constructs an authority factory using the default set of factories.
|
ThreadedEpsgFactory | public ThreadedEpsgFactory(Hints userHints)(Code) | | Constructs an authority factory with the default priority.
|
canDisposeBackingStore | protected boolean canDisposeBackingStore(AbstractAuthorityFactory backingStore)(Code) | | Returns
true if the backing store can be disposed now. This method is invoked
automatically after the amount of time specified by
ThreadedEpsgFactory.setTimeout if the factory
were not used during that time.
Parameters: backingStore - The backing store in process of being disposed. |
createBackingStore | protected AbstractAuthorityFactory createBackingStore(Hints hints) throws SQLException(Code) | | Creates the backing store for the specified data source. This method usually returns
a new instance of
AccessDialectEpsgFactory or
AnsiDialectEpsgFactory .
Subclasses may override this method in order to returns an instance tuned for the
SQL syntax of the underlying database. Example for a PostgreSQL data source:
protected AbstractAuthorityFactory createBackingStore(Hints hints) throws SQLException {
return new AnsiDialectEpsgFactory(hints, getDataSource().getConnection());
}
Parameters: hints - A map of hints, including the low-level factories to use for CRS creation.This argument should be given unchanged to DirectEpsgFactory constructor. The using SQL queries appropriatefor this data source. throws: SQLException - if connection to the database failed. |
createBackingStore | protected AbstractAuthorityFactory createBackingStore() throws FactoryException(Code) | | Creates the backing store authority factory.
The backing store to uses in createXXX(...) methods. throws: FactoryException - if the constructor failed to connect to the EPSG database.This exception usually has a SQLException as its cause. |
createDataSource | protected DataSource createDataSource() throws SQLException(Code) | | Setup a data source for a connection to the EPSG database. This method is invoked by
ThreadedEpsgFactory.getDataSource() when no data source has been
. The default implementation searchs for a
DataSource instance
binded to the
Hints.EPSG_DATA_SOURCE name
(
by default) using Java Naming and
Directory Interfaces (JNDI). If no data source were found, then this method
returns
null .
Subclasses override this method in order to initialize a default data source when none were
found with JNDI. For example
plugin/epsg-access defines a default data source using
the JDBC-ODBC bridge, which expects an "
EPSG " database registered as an ODBC data
source (see the
for
installation instructions). Example for a PostgreSQL data source:
protected DataSource createDataSource() throws SQLException {
DataSource candidate = super.createDataSource();
if (candidate instanceof Jdbc3SimpleDataSource) {
return candidate;
}
Jdbc3SimpleDataSource ds = new Jdbc3SimpleDataSource();
ds.setServerName("localhost");
ds.setDatabaseName("EPSG");
ds.setUser("postgre");
return ds;
}
The EPSG data source, or null if none where found. throws: SQLException - if an error occured while creating the data source. |
getAuthority | public Citation getAuthority()(Code) | | Returns the authority for this EPSG database.
This authority will contains the database version in the
attribute, together with the
.
|
onDeregistration | public synchronized void onDeregistration(ServiceRegistry registry, Class category)(Code) | | Called when this factory is removed from the given
category of the given
registry . The object may still be registered under another category.
|
onRegistration | public synchronized void onRegistration(ServiceRegistry registry, Class category)(Code) | | Called when this factory is added to the given
category of the given
registry . The object may already be registered under another category.
|
setDataSource | public synchronized void setDataSource(DataSource datasource) throws SQLException(Code) | | Set the data source for the EPSG database. If an other EPSG database was already in use,
it will be disconnected. Users should not invoke this method on the factory returned by
ReferencingFactoryFinder , since it could have a system-wide effect.
Parameters: datasource - The new datasource. throws: SQLException - if an error occured. |
|
|