dk.netarkivet.harvester.datamodel
Class MySQLSpecifics

java.lang.Object
  extended by dk.netarkivet.common.utils.SettingsFactory<DBSpecifics>
      extended by dk.netarkivet.harvester.datamodel.DBSpecifics
          extended by dk.netarkivet.harvester.datamodel.MySQLSpecifics

public class MySQLSpecifics
extends DBSpecifics

MySQL-specific implementation of DB methods.


Field Summary
(package private)  org.apache.commons.logging.Log log
          The log.
 
Constructor Summary
MySQLSpecifics()
           
 
Method Summary
 void backupDatabase(java.io.File backupDir)
          Backup the database.
 void dropJobConfigsTmpTable(java.sql.Connection c, java.lang.String tableName)
          Dispose of a temporary table created with getTemporaryTable.
 java.lang.String getDriverClassName()
          Get the name of the JDBC driver class that handles interfacing to this server.
static DBSpecifics getInstance()
          Get an instance of the MySQL specifics class.
 java.lang.String getJobConfigsTmpTable(java.sql.Connection c)
          Get a temporary table for short-time use.
 void shutdownDatabase()
          Shutdown the database system, if running embeddedly.
 
Methods inherited from class dk.netarkivet.harvester.datamodel.DBSpecifics
updateTable
 
Methods inherited from class dk.netarkivet.common.utils.SettingsFactory
getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

org.apache.commons.logging.Log log
The log.

Constructor Detail

MySQLSpecifics

public MySQLSpecifics()
Method Detail

getInstance

public static DBSpecifics getInstance()
Get an instance of the MySQL specifics class.

Returns:
Instance of the MySQL specifics class.

shutdownDatabase

public void shutdownDatabase()
Shutdown the database system, if running embeddedly. Otherwise, this is ignored. Will log a warning on errors, but otherwise ignore them.

Specified by:
shutdownDatabase in class DBSpecifics

getJobConfigsTmpTable

public java.lang.String getJobConfigsTmpTable(java.sql.Connection c)
                                       throws java.sql.SQLException
Get a temporary table for short-time use. The table should be disposed of with dropTemporaryTable. The table has two columns domain_name varchar(Constants.MAX_NAME_SIZE) config_name varchar(Constants.MAX_NAME_SIZE)

Specified by:
getJobConfigsTmpTable in class DBSpecifics
Parameters:
c - The DB connection to use.
Returns:
The name of the created table
Throws:
java.sql.SQLException - if there is a problem getting the table.

dropJobConfigsTmpTable

public void dropJobConfigsTmpTable(java.sql.Connection c,
                                   java.lang.String tableName)
Dispose of a temporary table created with getTemporaryTable. This can be expected to be called from within a finally clause, so it mustn't throw exceptions.

Specified by:
dropJobConfigsTmpTable in class DBSpecifics
Parameters:
c - The DB connection to use.
tableName - The name of the temporary table

backupDatabase

public void backupDatabase(java.io.File backupDir)
                    throws java.sql.SQLException
Backup the database. For server-based databases, where the administrator is expected to perform the backups, this method should do nothing. This method gets called within one hour of the hour-of-day indicated by the DB_BACKUP_INIT_HOUR settings.

Specified by:
backupDatabase in class DBSpecifics
Parameters:
backupDir - Directory to which the database should be backed up
Throws:
java.sql.SQLException

getDriverClassName

public java.lang.String getDriverClassName()
Get the name of the JDBC driver class that handles interfacing to this server.

Specified by:
getDriverClassName in class DBSpecifics
Returns:
The name of a JDBC driver class