|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectEpsgInstaller
@ThreadSafe public class EpsgInstaller
Installs the EPSG database. By default this class performs the following operations:
This default behavior can be changed by the setter methods defined in this class. They allow to use a different set of scripts, or to execute them on a different database (for example PostgreSQL).
The scripts are read and the database is created only when the call() method
is invoked. This method can be run in a background thread by an
executor service.
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary | |
|---|---|
static class |
EpsgInstaller.Result
A simple data structure holding the result of an EPSG database creation. |
| Field Summary | |
|---|---|
static String |
DEFAULT_SCHEMA
The schema where the installer will create the tables in the JavaDB database. |
| Constructor Summary | |
|---|---|
EpsgInstaller()
Creates a new installer. |
|
| Method Summary | |
|---|---|
EpsgInstaller.Result |
call()
Processes to the creation of the EPSG database. |
boolean |
exists()
Verifies if the database exists. |
void |
setDatabase(Connection connection)
Sets the connection to the database. |
void |
setDatabase(String url)
Sets the URL to the database, using the JDBC syntax. |
void |
setDatabase(String url,
String user,
String password)
Sets the URL to the database, together with the user and password. |
void |
setSchema(String schema)
Sets the schema where the installer will create the tables. |
void |
setScriptDirectory(File directory)
Sets the directory which contain the SQL scripts to execute. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_SCHEMA
geotk-epsg.jar file is reachable on
the classpath, the referencing module will look for this schema in order to
decide if it needs to install the EPSG database or not.
setSchema(String),
Constant Field Values| Constructor Detail |
|---|
public EpsgInstaller()
geotk-epsg.jar
file and the database is created on the local machine using JavaDB.
| Method Detail |
|---|
public void setScriptDirectory(File directory)
".sql" extension are
ignored):
EPSG_v6_18.mdb_Tables_PostgreSQL.sqlEPSG_v6_18.mdb_Data_PostgreSQL.sqlEPSG_v6_18.mdb_FKeys_PostgreSQL.sqlEPSG_v6_18.mdb_Indexes_PostgreSQL.sql using
a copy of the script embedded in the geotk-epsg.jar file.
The suffix may be different (for example "_MySQL.sql" instead of
"_PostgreSQL.sql") and the version number may be different. If the directory
contrains the scripts for different versions of the database, then the scripts for
the latest version are used.
If this method is never invoked or if the given directory is null, then the
scripts will be read from the geotk-epsg.jar file. If that JAR is not reachable,
then an exception will be thrown at call() invocation time.
directory - The directory of the EPSG SQL scripts to execute, or nullpublic void setDatabase(String url)
null, then the default URL is used. If this method is invoked with any URL different than the default one,
then a configuration file will need to
be provided explicitly after the database creation in order to get the referencing module
to use that database.
If the given scripts are aimed to be executed verbatism, then the setSchema(String)
method should be invoked with a null argument in order to prevent this installer to
move the tables in the "epsg" schema.
If the given scripts were downloaded from www.epsg.org, then consider adding the Indexes.sql file in the scripts directory, for performance raisons.
If a user and password were previously defined, they are left unchanged.
url - The URL to the database, or null for JavaDB on the local machine.
public void setDatabase(String url,
String user,
String password)
setDatabase(String).
url - The URL to the database, or null for JavaDB on the local machine.user - The user, or null if none.password - The password, or null if none.
public void setDatabase(Connection connection)
throws SQLException
setMetadata methods, in that invoking this method resets the database
URL and user name to values fetched from the given connection.
It is the caller's responsibility to close the given connection when it is no longer needed.
connection - The connection to use for installing the EPSG database.
SQLException - If the given connection can not be used.public void setSchema(String schema)
schema - The schema where to create the tables, or null if none.
public boolean exists()
throws FactoryException
true if the database exists, or false otherwise.
FactoryException - If an error occurred while querying the database.
public EpsgInstaller.Result call()
throws FactoryException
call in interface Callable<EpsgInstaller.Result>FactoryException - If an error occurred while running the scripts.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||