de.cesr.parma.reader
Class PmDbParameterReader

java.lang.Object
  extended by de.cesr.parma.core.PmAbstractParameterReader
      extended by de.cesr.parma.reader.PmDbParameterReader
All Implemented Interfaces:
PmParameterReader

public class PmDbParameterReader
extends PmAbstractParameterReader

Parameter retrieval from MySQL databases PARameter MAnager Connects to a MySQL database using parameter values of PmFrameworkPa.LOCATION, PmFrameworkPa.DBNAME, PmFrameworkPa.USER, and PmFrameworkPa.PASSWORD and reads in parameter values from PmFrameworkPa.TBLNAME_PARAMS (the row that is defined by parameter set id - see PmDbParameterReader(PmParameterDefinition)). This reader enables the use of other db settings and tables than defined in PmFrameworkPa via setter methods for theses settings. However, defaults are the values of PmFrameworkPa. See documentation for further instructions.


Field Summary
protected  PmParameterDefinition dbLocation
           
protected  PmParameterDefinition dbName
           
protected  PmParameterDefinition dbPassword
           
protected  PmParameterDefinition dbTable
           
protected  PmParameterDefinition dbUser
           
static String NOT_DEFINED
           
 
Constructor Summary
PmDbParameterReader()
          Uses PmFrameworkPa.PARAM_SET_ID as parameter set ID.
PmDbParameterReader(PmParameterDefinition paramSetId)
          Uses the given parameter definition as parameter set ID.
 
Method Summary
protected  ResultSet connect(String sql)
           
protected  void disconnect()
           
protected  Connection getConnection()
          Tries to establish a JDBC Connection to the MySQL database given the settings provided to the constructor.
 void initParameters()
          (Recursively) init parameters.
 
Methods inherited from class de.cesr.parma.core.PmAbstractParameterReader
deregisterAll, deregisterParameterReader, registerParameterReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_DEFINED

public static final String NOT_DEFINED
See Also:
Constant Field Values

dbTable

protected PmParameterDefinition dbTable

dbLocation

protected PmParameterDefinition dbLocation

dbName

protected PmParameterDefinition dbName

dbUser

protected PmParameterDefinition dbUser

dbPassword

protected PmParameterDefinition dbPassword
Constructor Detail

PmDbParameterReader

public PmDbParameterReader(PmParameterDefinition paramSetId)
Uses the given parameter definition as parameter set ID.

Parameters:
paramSetId - the parameter definition that specifies the parameter set id for which parameter definitions shall be fetched from DB,

PmDbParameterReader

public PmDbParameterReader()
Uses PmFrameworkPa.PARAM_SET_ID as parameter set ID.

Method Detail

initParameters

public void initParameters()
Description copied from interface: PmParameterReader
(Recursively) init parameters.

Specified by:
initParameters in interface PmParameterReader
Overrides:
initParameters in class PmAbstractParameterReader
See Also:
PmAbstractParameterReader.initParameters()

connect

protected ResultSet connect(String sql)
Parameters:
sql -
Returns:
Created by Sascha Holzhauer on 29.03.2010

getConnection

protected Connection getConnection()
                            throws InstantiationException,
                                   IllegalAccessException,
                                   ClassNotFoundException,
                                   SQLException
Tries to establish a JDBC Connection to the MySQL database given the settings provided to the constructor.

Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
SQLException

disconnect

protected void disconnect()