|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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
public class ThreadedEpsgFactory
Base class for EPSG factories to be registered in ReferencingFactoryFinder
.
Various subclasses are defined for different database backends: Access, PostgreSQL,
HSQL, etc..
This class has the following responsibilities:
Subclasses should override the following methods:
createBackingStore(org.geotools.factory.Hints)
instance capable to speak that database syntax
Users should not creates instance of this class directly. They should invoke one of
ReferencingFactoryFinder.getFooAuthorityFactory("EPSG")
methods instead.
Field Summary | |
---|---|
static java.lang.String |
DATASOURCE_NAME
The default JDBC data source name in JNDI. |
Fields inherited from class org.geotools.referencing.factory.ReferencingFactory |
---|
LOGGER |
Fields inherited from class org.geotools.factory.AbstractFactory |
---|
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority |
Constructor Summary | |
---|---|
ThreadedEpsgFactory()
Constructs an authority factory using the default set of factories. |
|
ThreadedEpsgFactory(Hints userHints)
Constructs an authority factory with the default priority. |
|
ThreadedEpsgFactory(Hints userHints,
int priority)
Constructs an authority factory using a set of factories created from the specified hints. |
Method Summary | |
---|---|
protected boolean |
canDisposeBackingStore(AbstractAuthorityFactory backingStore)
Returns true if the backing store can be disposed now. |
protected AbstractAuthorityFactory |
createBackingStore()
Creates the backing store authority factory. |
protected AbstractAuthorityFactory |
createBackingStore(Hints hints)
Creates the backing store for the specified data source. |
protected javax.sql.DataSource |
createDataSource()
Setup a data source for a connection to the EPSG database. |
org.opengis.metadata.citation.Citation |
getAuthority()
Returns the authority for this EPSG database. |
javax.sql.DataSource |
getDataSource()
Returns the data source for the EPSG database. |
void |
setDataSource(javax.sql.DataSource datasource)
Set the data source for the EPSG database. |
Methods inherited from class org.geotools.referencing.factory.DeferredAuthorityFactory |
---|
dispose, exit, isAvailable, isConnected, setTimeout |
Methods inherited from class org.geotools.referencing.factory.AbstractAuthorityFactory |
---|
noSuchAuthorityCode, trimAuthority |
Methods inherited from class org.geotools.referencing.factory.ReferencingFactory |
---|
ensureNonNull |
Methods inherited from class org.geotools.factory.AbstractFactory |
---|
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toString |
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 |
Methods inherited from interface org.geotools.factory.Factory |
---|
getImplementationHints |
Field Detail |
---|
public static final java.lang.String DATASOURCE_NAME
EPSG_DATA_SOURCE
hint.
createDataSource()
,
Constant Field ValuesConstructor Detail |
---|
public ThreadedEpsgFactory()
public ThreadedEpsgFactory(Hints userHints)
public ThreadedEpsgFactory(Hints userHints, int priority)
CRS
, CS
,
DATUM
and MATH_TRANSFORM
FACTORY
hints, in addition of EPSG_DATA_SOURCE
.
userHints
- An optional set of hints, or null
if none.priority
- The priority for this factory, as a number between
MINIMUM_PRIORITY
and
MAXIMUM_PRIORITY
inclusive.Method Detail |
---|
public org.opengis.metadata.citation.Citation getAuthority()
getAuthority
in interface org.opengis.referencing.AuthorityFactory
getAuthority
in class BufferedAuthorityFactory
public final javax.sql.DataSource getDataSource() throws java.sql.SQLException
createDataSource()
.
Note: invoking this method may force immediate connection to the EPSG
database.
java.sql.SQLException
- if the connection to the EPSG database failed.setDataSource(javax.sql.DataSource)
,
createDataSource()
public void setDataSource(javax.sql.DataSource datasource) throws java.sql.SQLException
ReferencingFactoryFinder
, since it could have a system-wide effect.
datasource
- The new datasource.
java.sql.SQLException
- if an error occured.protected javax.sql.DataSource createDataSource() throws java.sql.SQLException
getDataSource()
when no data source has been explicitly set. The default implementation searchs for a DataSource
instance
binded to the Hints.EPSG_DATA_SOURCE
name
("java:comp/env/jdbc/EPSG"
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 package javadoc 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; }
null
if none where found.
java.sql.SQLException
- if an error occured while creating the data source.protected AbstractAuthorityFactory createBackingStore(Hints hints) throws java.sql.SQLException
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()); }
hints
- A map of hints, including the low-level factories to use for CRS creation.
This argument should be given unchanged to DirectEpsgFactory
constructor.
java.sql.SQLException
- if connection to the database failed.protected AbstractAuthorityFactory createBackingStore() throws org.opengis.referencing.FactoryException
createBackingStore
in class DeferredAuthorityFactory
createXXX(...)
methods.
org.opengis.referencing.FactoryException
- if the constructor failed to connect to the EPSG database.
This exception usually has a SQLException
as its cause.protected boolean canDisposeBackingStore(AbstractAuthorityFactory backingStore)
true
if the backing store can be disposed now. This method is invoked
automatically after the amount of time specified by DeferredAuthorityFactory.setTimeout(long)
if the factory
were not used during that time.
canDisposeBackingStore
in class DeferredAuthorityFactory
backingStore
- The backing store in process of being disposed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |