|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.referencing.factory.epsg.SimpleDataSource
Open a connection to an EPSG database using DriverManager
. This implementation is not
suitable for uses with Java Naming and Directory (JNDI), but it provides a convenient base class
for connections determined from properties files.
The default implementation doesn't make any assumption about where the properties file is
located. The properties file location must be supplied at construction time. Because this
base class dosn't have a no-argument constructor, it can't be registered in the
directory. If such a registration is wanted (for automatic detection
by FactoryFinder
, then users must provide a subclass with a
no-argument constructor.
The properties file to be supplied at construction time shall contains the following:
Property | Description | Default |
---|---|---|
The URL to the EPSG database | ||
The schema containing EPSG tables in the database | ||
User used to make database connections | ||
Password used to make database connections | ||
The JDBC driver to load | ||
The EPSG factory to instantiate |
Field Summary | |
protected java.util.Properties |
properties
The properties used for etablishing the database connection. |
Fields inherited from interface org.geotools.referencing.factory.epsg.DataSource |
MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY |
Constructor Summary | |
SimpleDataSource(java.io.File file)
Constructs a data source with properties loaded from the specified file. |
|
SimpleDataSource(java.util.Properties properties)
Constructs a data source with the specified properties. |
Method Summary | |
AbstractAuthorityFactory |
createFactory(Hints hints)
Opens a connection and creates an EPSG factory for it. |
java.sql.Connection |
getConnection()
Attempts to establish a connection with the data source. |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Attempts to establish a connection with the data source. |
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. |
java.io.PrintWriter |
getLogWriter()
Retrieves the log writer. |
int |
getPriority()
Returns the priority for this data source. |
void |
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. |
void |
setLogWriter(java.io.PrintWriter out)
Sets the log writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.util.Properties properties
Constructor Detail |
public SimpleDataSource(java.util.Properties properties)
properties
- The properties, or for an empty set.public SimpleDataSource(java.io.File file) throws java.io.IOException
file
- The properties file to load.
java.io.IOException
- if an error occured while loading the properties file.Method Detail |
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
DriverManager
,
which returns a system-wide logger.
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
DriverManager
,
which have a system-wide effect.
setLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
public int getPriority()
NORMAL_PRIORITY
.
getPriority
in interface DataSource
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if a database access error occurs.public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
username
- The database user on whose behalf the connection is being made.password
- The user's password.
java.sql.SQLException
- if a database access error occurs.public AbstractAuthorityFactory createFactory(Hints hints) throws java.sql.SQLException
Hints
,
Connection
.
createFactory
in interface DataSource
hints
- A map of hints, including the low-level factories to use for CRS creation.
This argument should be given unchanged to constructor.
java.sql.SQLException
- if connection to the database failed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |