|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfiletools.filegenerators.HelpFileIndexDBCompendiumGenerator
public abstract class HelpFileIndexDBCompendiumGenerator
Abstract base class for generating files with data from the matlab-helpfile-DB. This class encapsulates the DB-connection and provides general processing functionality and some tools.
Field Summary | |
---|---|
private static java.lang.String |
DB_DBNAME_DEF
|
private static java.lang.String |
DB_DBNAME_KEY
db connection data property names |
private static java.lang.String |
DB_DRIVER
db connection data |
private static java.lang.String |
DB_HOSTNAME_DEF
db connection data default values |
private static java.lang.String |
DB_HOSTNAME_KEY
|
protected static java.lang.String |
DB_TABLENAME
|
private static java.lang.String |
DB_USERNAME_DEF
|
private static java.lang.String |
DB_USERNAME_KEY
|
private static java.lang.String |
DB_USERPWD_DEF
|
private static java.lang.String |
DB_USERPWD_KEY
|
private java.sql.Statement |
dbStatement
|
protected static java.lang.String |
HTML_EXTENSION
|
protected java.io.FileWriter |
outputFileWriter
|
protected java.util.Properties |
properties
|
Constructor Summary | |
---|---|
HelpFileIndexDBCompendiumGenerator()
|
Method Summary | |
---|---|
protected boolean |
connectToDB()
Tries to get a connection with a MySQL DB specified by the properties |
protected void |
endProcessQuery(java.sql.ResultSet resultSet)
This function is called for every query after the processing of its results. |
boolean |
generateFile(java.lang.String filename)
Generate a file which contains data in a specific format. |
protected void |
includeFile(java.lang.String filename)
Reads an ASCII file and writes its content into the target file. |
protected abstract void |
processRow(java.sql.ResultSet row)
In this function concrete classes need to define what to do with a single row of the result of the last executed query. |
protected abstract void |
processTask()
This function contains the code which manages the whole task. |
static java.util.Properties |
readPropertiesFromFile(java.lang.String filename)
Reads properties from a specified file and returns them as a java.util.Properties object |
protected void |
sendAndProcessQuery(java.lang.String query)
Executes one specified query and manages the processing of the result. |
void |
setProperties(java.util.Properties properties)
Set all relevant properties. |
protected void |
startProcessQuery(java.sql.ResultSet resultSet)
This function is called for every query before the processing of its results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String DB_HOSTNAME_DEF
private static final java.lang.String DB_DBNAME_DEF
private static final java.lang.String DB_USERNAME_DEF
private static final java.lang.String DB_USERPWD_DEF
private static final java.lang.String DB_DBNAME_KEY
private static final java.lang.String DB_USERNAME_KEY
private static final java.lang.String DB_USERPWD_KEY
private static final java.lang.String DB_HOSTNAME_KEY
private static final java.lang.String DB_DRIVER
protected static final java.lang.String DB_TABLENAME
protected static final java.lang.String HTML_EXTENSION
private java.sql.Statement dbStatement
protected java.io.FileWriter outputFileWriter
protected java.util.Properties properties
Constructor Detail |
---|
public HelpFileIndexDBCompendiumGenerator()
Method Detail |
---|
public void setProperties(java.util.Properties properties)
IFileGenerator
setProperties
in interface IFileGenerator
properties
- Properties to setpublic static java.util.Properties readPropertiesFromFile(java.lang.String filename)
filename
- File which contains the properties. It has to be in a
format which is compatible with java.util.Properties
public boolean generateFile(java.lang.String filename)
IFileGenerator
generateFile
in interface IFileGenerator
filename
- Name of the file to generate
IFileGenerator.generateFile(java.lang.String)
protected boolean connectToDB()
protected void sendAndProcessQuery(java.lang.String query) throws java.sql.SQLException, java.io.IOException
query
- Query to send
java.sql.SQLException
java.io.IOException
protected void includeFile(java.lang.String filename) throws java.io.IOException
filename
- File to include
java.io.IOException
protected abstract void processTask()
protected abstract void processRow(java.sql.ResultSet row) throws java.sql.SQLException, java.io.IOException
row
- ResultSet in which the row to process is the actual one.
So one can get the results by using the get... functions of row
java.sql.SQLException
java.io.IOException
protected void startProcessQuery(java.sql.ResultSet resultSet) throws java.sql.SQLException, java.io.IOException
resultSet
- ResultSet as it was returned from the query.
java.sql.SQLException
java.io.IOException
protected void endProcessQuery(java.sql.ResultSet resultSet) throws java.sql.SQLException, java.io.IOException
resultSet
- ResultSet after all rows of the result were processed.
java.sql.SQLException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |