|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.mp3dings.export.DatabaseConnection
net.sourceforge.mp3dings.export.DatabaseImporter
public class DatabaseImporter
Imports data from a JDBC database.
| Field Summary | |
|---|---|
static String |
P_WHERE
The name of the property holding the where clause for the SQL SELECT statement. |
| Fields inherited from class net.sourceforge.mp3dings.export.DatabaseConnection |
|---|
P_CLASSPATH, P_DRIVER, P_FIELD_PREFIX, P_PASSWORD, P_TABLE, P_URL, P_USER, PREF_EXPORT, PREF_IMPORT |
| Constructor Summary | |
|---|---|
DatabaseImporter(Properties config,
ClassLoaderProvider clp,
Field[] dataStructure)
Establishes a new database connection that can import data from a database table to mp3dings. |
|
| Method Summary | |
|---|---|
static Properties |
editConfig(Frame parent,
Properties config,
Field[] availableFields,
ClassLoaderProvider clp)
Displays a wizard to interactively create or modify a JDBC configuration that can be used to establish a database import connection. |
static Properties |
editWhere(Frame parent,
Properties config)
Displays a wizard to create or modify an SQL WHERE
clause that can be used to restrict a query to the database. |
boolean |
hasResult()
Returns wether the last query returned another result not yet retrieved with nextResult(java.lang.Object[]). |
static Properties |
loadConfig()
Tries to load a previously saved database import configuration. |
Object[] |
nextResult(Object[] result)
Copies the next result of the last query to the
provided array and returns it. |
boolean |
query(Object[] input)
Looks for database entries matching the input. |
| Methods inherited from class net.sourceforge.mp3dings.export.DatabaseConnection |
|---|
close, editConfig, getConnection, isAlive, loadConfig |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String P_WHERE
SELECT statement.
| Constructor Detail |
|---|
public DatabaseImporter(Properties config,
ClassLoaderProvider clp,
Field[] dataStructure)
throws SQLException,
ExportException
editConfig method.
config - the database import configurationclp - a classloader provider that manages the dynamic class path
for loading the JDBC driver, may be nulldataStructure - the fields that are available in the mp3dings table
that will exchange data with the database
ExportException - if a required property is missing in
config, or if the JDBC driver cannot be loaded
SQLException - if an SQL/JDBC error occursMp3dingsTableModel.getFields()| Method Detail |
|---|
public boolean query(Object[] input)
throws SQLException
SELECT statement is sent to the database
whose WHERE-clause is formed from
config.getProperty(P_WHERE) by replacing expressions
like mp3dings('ARTIST') with the corresponding input
values. The default conversion between java and database
types is used.
The results of the database query can be retrieved iteratively
with nextResult(java.lang.Object[]).
input - values for the fields specified with the
dataStructure
argument of the constructor. These values will be used
to substitute expressions like
mp3dings('ARTIST') in the search condition.
SQLExceptionpublic boolean hasResult()
nextResult(java.lang.Object[]).
public Object[] nextResult(Object[] result)
throws SQLException
query to the
provided array and returns it.
The default conversion between java and database types is used.Each result can be retrieved only once. If all results of the last query have already been retrieved the argument array will be returned unchanged.
result - an array to hold the query result. If null or
an array of the wrong length is passed a new array will be allocated if
necessary.
SQLException
public static Properties editConfig(Frame parent,
Properties config,
Field[] availableFields,
ClassLoaderProvider clp)
throws SQLException
parent - the frame to use as a dialog ownerconfig - the previous configuration if any, may be nullavailableFields - the fields that are available in the mp3dings table
that will exchange data with the databaseclp - a classloader provider that manages the dynamic class path
for loading the JDBC driver, may be null
SQLExceptionMp3dingsTableModel.getFields()
public static Properties loadConfig()
throws IOException
null if no such configuration exists
IOException - if the JDBC configuration cannot be read from
the properties file whose location was stored in the preferences
public static Properties editWhere(Frame parent,
Properties config)
WHERE
clause that can be used to restrict a query to the database.
parent - the frame to use as a dialog ownerconfig - a database configuration to modify or complement. Such
a configuration should be the result of a previous call to
editConfig or loadConfig.query(java.lang.Object[])
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||