|
||||||||||
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 | |
---|---|
static String |
DATASOURCE_NAME
The default JDBC data source name in JNDI. |
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. |
Citation |
getAuthority()
Returns the authority for this EPSG database. |
DataSource |
getDataSource()
Returns the data source for the EPSG database. |
void |
onDeregistration(ServiceRegistry registry,
Class category)
Called when this factory is removed from the given category of the given
registry . |
void |
onRegistration(ServiceRegistry registry,
Class category)
Called when this factory is added to the given category of the given
registry . |
void |
setDataSource(DataSource datasource)
Set the data source for the EPSG database. |
Methods inherited from class DeferredAuthorityFactory |
---|
dispose, 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, 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 AuthorityFactory |
---|
createObject, getAuthorityCodes, getDescriptionText |
Methods inherited from interface Factory |
---|
getVendor |
Methods inherited from interface CSAuthorityFactory |
---|
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS |
Methods inherited from interface AuthorityFactory |
---|
createObject, getAuthorityCodes, getDescriptionText |
Methods inherited from interface Factory |
---|
getVendor |
Methods inherited from interface DatumAuthorityFactory |
---|
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum |
Methods inherited from interface AuthorityFactory |
---|
createObject, getAuthorityCodes, getDescriptionText |
Methods inherited from interface Factory |
---|
getVendor |
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 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 Citation getAuthority()
getAuthority
in interface AuthorityFactory
getAuthority
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
("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 DeferredAuthorityFactory
createXXX(...)
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 DeferredAuthorityFactory
backingStore
- The backing store in process of being disposed.public void onRegistration(ServiceRegistry registry, Class category)
category
of the given
registry
. The object may already be registered under another category.
onRegistration
in interface RegisterableService
onRegistration
in class AbstractFactory
registry
- A service registry where this factory has been registered.category
- The registry category under which this object has been registered.AbstractFactory.MINIMUM_PRIORITY
,
AbstractFactory.MAXIMUM_PRIORITY
public void onDeregistration(ServiceRegistry registry, Class category)
category
of the given
registry
. The object may still be registered under another category.
onDeregistration
in interface RegisterableService
onDeregistration
in class AbstractFactory
registry
- A service registry from which this object is being (wholly or partially)
deregistered.category
- The registry category from which this object is being deregistered.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |