|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractFactory
ReferencingFactory
AbstractAuthorityFactory
BufferedAuthorityFactory
DeferredAuthorityFactory
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 | |
|---|---|
protected DataSource |
datasource
The data source, or null if the connection has not yet been etablished. |
static String |
DATASOURCE_NAME
The default JDBC data source name in JNDI. |
protected boolean |
dynamicDataSource
Whether the DataSource is created along with the backing store, or it's a stable, long lived one |
| Fields inherited from class ReferencingFactory |
|---|
LOGGER |
| Fields inherited from class 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 DataSource |
createDataSource()
Setup a data source for a connection to the EPSG database. |
void |
dispose()
Releases resources immediately instead of waiting for the garbage collector. |
protected void |
disposeBackingStore()
Disposes of the backing store |
Citation |
getAuthority()
Returns the authority for this EPSG database. |
DataSource |
getDataSource()
Returns the data source for the EPSG database. |
void |
setDataSource(DataSource datasource)
Set the data source for the EPSG database. |
| Methods inherited from class DeferredAuthorityFactory |
|---|
exit, getBackingStore, isAvailable, isConnected, setTimeout |
| Methods inherited from class AbstractAuthorityFactory |
|---|
noSuchAuthorityCode, trimAuthority |
| Methods inherited from class ReferencingFactory |
|---|
ensureNonNull |
| Methods inherited from class AbstractFactory |
|---|
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, 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 CSAuthorityFactory |
|---|
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS |
| Methods inherited from interface DatumAuthorityFactory |
|---|
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum |
| 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 |
|---|
public static final String DATASOURCE_NAME
EPSG_DATA_SOURCE hint.
createDataSource(),
Constant Field Valuesprotected DataSource datasource
null if the connection has not yet been etablished.
protected boolean dynamicDataSource
| Constructor 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 Citation getAuthority()
getAuthority in interface AuthorityFactorygetAuthority in class BufferedAuthorityFactory
public final DataSource getDataSource()
throws SQLException
createDataSource().
Note: invoking this method may force immediate connection to the EPSG
database.
SQLException - if the connection to the EPSG database failed.setDataSource(javax.sql.DataSource),
createDataSource()
public void setDataSource(DataSource datasource)
throws SQLException
ReferencingFactoryFinder, since it could have a system-wide effect.
datasource - The new datasource.
SQLException - if an error occured.
protected DataSource createDataSource()
throws 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.
SQLException - if an error occured while creating the data source.
protected AbstractAuthorityFactory createBackingStore(Hints hints)
throws 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.
SQLException - if connection to the database failed.
protected AbstractAuthorityFactory createBackingStore()
throws FactoryException
createBackingStore in class DeferredAuthorityFactorycreateXXX(...) methods.
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 DeferredAuthorityFactorybackingStore - The backing store in process of being disposed.protected void disposeBackingStore()
DeferredAuthorityFactory
disposeBackingStore in class DeferredAuthorityFactory
public void dispose()
throws FactoryException
DeferredAuthorityFactoryDeferredAuthorityFactory.canDisposeBackingStore(org.geotools.referencing.factory.AbstractAuthorityFactory) value.
dispose in class DeferredAuthorityFactoryFactoryException - if an error occured while disposing the factory.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||