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
protected  void createExtendedFieldTable()
          Create the extendedfield table in the database.
protected  void createExtendedFieldTypeTable()
          Create the extendedfieldtype table in the database.
protected  void createExtendedFieldValueTable()
          Create the extendedfieldvalue table in the database.
 void createFrontierReportMonitorTable()
          Create the frontierReportMonitor table in the database.
protected  void createGlobalCrawlerTrapExpressions()
          Creates the initial (version 1) of table 'global_crawler_trap_expressions'.
protected  void createGlobalCrawlerTrapLists()
          Creates the initial (version 1) of table 'global_crawler_trap_lists'.
protected  void createHarvestChannelTable()
           
 void createRunningJobsHistoryTable()
          Create the frontierReportMonitor table in the database.
 void createRunningJobsMonitorTable()
          Create the frontierReportMonitor table in 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.
 java.lang.String getOrderByLimitAndOffsetSubClause(long limit, long offset)
          Formats the LIMIT sub-clause of an SQL order clause.
protected  void migrateConfigurationsv3ov4()
          Migrates the 'configurations' table from version 3 to version 4.
protected  void migrateConfigurationsv4tov5()
          Migrates the 'configurations' table from version 4 to version 5.
protected  void migrateDomainsv2tov3()
          Migrates the 'domains' table from version 2 to version 3.
protected  void migrateExtendedFieldTableV1toV2()
          Migrates the 'ExtendedFieldTable' from version 1 to version 2 consisting of adding the maxlen field
protected  void migrateExtendedFieldTableValueV1toV2()
          Migrates the 'ExtendedFieldValueTable' from version 1 to version 2 changing the maxlen of content to 30000
protected  void migrateFullharvestsv2tov3()
          Migrates the 'fullharvests' table from version 2 to version 3.
protected  void migrateFullharvestsv3tov4()
          Migrates the 'fullharvests' table from version 3 to version 4.
protected  void migrateFullharvestsv4tov5()
          Migrates the 'fullharvests' table from version 4 to version 5.
protected  void migrateHarvestdefinitionsv2tov3()
          Migrates the 'harvestdefinitions' table from version 2 to version 3 consisting of adding the string audience with null as default.
protected  void migrateHarvestdefinitionsv3tov4()
          Migrates the 'harvestdefinitions' table from version 3 to version 4 consisting of adding the bigint channel_id field.
protected  void migrateJobsv3tov4()
          Migrates the 'jobs' table from version 3 to version 4 consisting of a change of the field forcemaxbytes from int to bigint and setting its default to -1.
protected  void migrateJobsv4tov5()
          Migrates the 'jobs' table from version 4 to version 5 consisting of adding new fields 'resubmitted_as_job' and 'submittedDate'.
protected  void migrateJobsv5tov6()
          Migrates the 'jobs' table from version 5 to version 6.
protected  void migrateJobsv6tov7()
          Migrates the 'jobs' table from version 6 to version 7 consisting of adding the bigint fieldcontinuationof with null as default.
protected  void migrateJobsv7tov8()
          Migrates the 'jobs' table from version 7 to version 8 consisting of adding the date creationdate with null as default.
protected  void migrateJobsv8tov9()
          Migrates the 'jobs' table from version 8 to version 9 consisting of adding the string harvestname_prefix with null as default.
protected  void migrateJobsv9tov10()
          Migrates the 'jobs' table from version 9 to version 10 consisting of adding the channel (varchar 300) and a 'snapshot'
protected  void migrateRunningJobsHistoryTableV1ToV2()
          Migrates the 'runningjobshistory' table from version 1 to version 2.
protected  void migrateRunningJobsMonitorTableV1ToV2()
          Migrates the 'runningjobsmonitor' table from version 1 to version 2.
 boolean supportsClob()
          Returns true if the target RDBMS supports CLOBs.
 
Methods inherited from class dk.netarkivet.harvester.datamodel.DBSpecifics
updateTable, updateTables
 
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.

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

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

migrateJobsv3tov4

protected void migrateJobsv3tov4()
Migrates the 'jobs' table from version 3 to version 4 consisting of a change of the field forcemaxbytes from int to bigint and setting its default to -1. Furthermore the default value for field num_configs is set to 0.

Specified by:
migrateJobsv3tov4 in class DBSpecifics
Throws:
IOFailure - in case of problems in interacting with the database

migrateJobsv4tov5

protected void migrateJobsv4tov5()
Migrates the 'jobs' table from version 4 to version 5 consisting of adding new fields 'resubmitted_as_job' and 'submittedDate'.

Specified by:
migrateJobsv4tov5 in class DBSpecifics
Throws:
IOFailure - in case of problems in interacting with the database

migrateConfigurationsv3ov4

protected void migrateConfigurationsv3ov4()
Migrates the 'configurations' table from version 3 to version 4. This consists of altering the default value of field 'maxbytes' to -1.

Specified by:
migrateConfigurationsv3ov4 in class DBSpecifics

migrateFullharvestsv2tov3

protected void migrateFullharvestsv2tov3()
Migrates the 'fullharvests' table from version 2 to version 3. This consists of altering the default value of field 'maxbytes' to -1

Specified by:
migrateFullharvestsv2tov3 in class DBSpecifics

createGlobalCrawlerTrapLists

protected void createGlobalCrawlerTrapLists()
Creates the initial (version 1) of table 'global_crawler_trap_lists'.

Specified by:
createGlobalCrawlerTrapLists in class DBSpecifics

createGlobalCrawlerTrapExpressions

protected void createGlobalCrawlerTrapExpressions()
Creates the initial (version 1) of table 'global_crawler_trap_expressions'.

Specified by:
createGlobalCrawlerTrapExpressions in class DBSpecifics

supportsClob

public boolean supportsClob()
Description copied from class: DBSpecifics
Returns true if the target RDBMS supports CLOBs. If possible seedlists will be stored as CLOBs.

Specified by:
supportsClob in class DBSpecifics
Returns:
true if CLOBs are supported, false otherwise.

getOrderByLimitAndOffsetSubClause

public java.lang.String getOrderByLimitAndOffsetSubClause(long limit,
                                                          long offset)
Description copied from class: DBSpecifics
Formats the LIMIT sub-clause of an SQL order clause. This sub-clause allows to paginate query results and its syntax might be dependant on the target RDBMS

Specified by:
getOrderByLimitAndOffsetSubClause in class DBSpecifics
Parameters:
limit - the maximum number of rows to fetch.
offset - the starting offset in the full query results.
Returns:
the proper sub-clause.

createFrontierReportMonitorTable

public void createFrontierReportMonitorTable()
Description copied from class: DBSpecifics
Create the frontierReportMonitor table in the database.

Specified by:
createFrontierReportMonitorTable in class DBSpecifics

createRunningJobsHistoryTable

public void createRunningJobsHistoryTable()
Description copied from class: DBSpecifics
Create the frontierReportMonitor table in the database.

Specified by:
createRunningJobsHistoryTable in class DBSpecifics

createRunningJobsMonitorTable

public void createRunningJobsMonitorTable()
Description copied from class: DBSpecifics
Create the frontierReportMonitor table in the database.

Specified by:
createRunningJobsMonitorTable in class DBSpecifics

migrateRunningJobsHistoryTableV1ToV2

protected void migrateRunningJobsHistoryTableV1ToV2()
Migrates the 'runningjobshistory' table from version 1 to version 2. This consists of adding the new column 'retiredQueuesCount'.

Specified by:
migrateRunningJobsHistoryTableV1ToV2 in class DBSpecifics

migrateRunningJobsMonitorTableV1ToV2

protected void migrateRunningJobsMonitorTableV1ToV2()
Migrates the 'runningjobsmonitor' table from version 1 to version 2. This consists of adding the new column 'retiredQueuesCount'.

Specified by:
migrateRunningJobsMonitorTableV1ToV2 in class DBSpecifics

migrateDomainsv2tov3

protected void migrateDomainsv2tov3()
Description copied from class: DBSpecifics
Migrates the 'domains' table from version 2 to version 3. This consists of altering the type of the crawlertraps column to "text" in postgres, and noop in derbyDB

Specified by:
migrateDomainsv2tov3 in class DBSpecifics

migrateConfigurationsv4tov5

protected void migrateConfigurationsv4tov5()
Description copied from class: DBSpecifics
Migrates the 'configurations' table from version 4 to version 5. This consists of altering the field 'maxobjects' from being an int to a bigint.

Specified by:
migrateConfigurationsv4tov5 in class DBSpecifics

migrateFullharvestsv3tov4

protected void migrateFullharvestsv3tov4()
Description copied from class: DBSpecifics
Migrates the 'fullharvests' table from version 3 to version 4. This consists of adding the field 'maxjobrunningtime'.

Specified by:
migrateFullharvestsv3tov4 in class DBSpecifics

migrateJobsv5tov6

protected void migrateJobsv5tov6()
Description copied from class: DBSpecifics
Migrates the 'jobs' table from version 5 to version 6. Adds the field 'forcemaxrunningtime'.

Specified by:
migrateJobsv5tov6 in class DBSpecifics

migrateFullharvestsv4tov5

protected void migrateFullharvestsv4tov5()
Description copied from class: DBSpecifics
Migrates the 'fullharvests' table from version 4 to version 5. This consists of adding the field 'isindexready'.

Specified by:
migrateFullharvestsv4tov5 in class DBSpecifics

createExtendedFieldTypeTable

protected void createExtendedFieldTypeTable()
Description copied from class: DBSpecifics
Create the extendedfieldtype table in the database.

Specified by:
createExtendedFieldTypeTable in class DBSpecifics

createExtendedFieldTable

protected void createExtendedFieldTable()
Description copied from class: DBSpecifics
Create the extendedfield table in the database.

Specified by:
createExtendedFieldTable in class DBSpecifics

createExtendedFieldValueTable

protected void createExtendedFieldValueTable()
Description copied from class: DBSpecifics
Create the extendedfieldvalue table in the database.

Specified by:
createExtendedFieldValueTable in class DBSpecifics

migrateJobsv6tov7

protected void migrateJobsv6tov7()
Description copied from class: DBSpecifics
Migrates the 'jobs' table from version 6 to version 7 consisting of adding the bigint fieldcontinuationof with null as default.

Specified by:
migrateJobsv6tov7 in class DBSpecifics

migrateJobsv7tov8

protected void migrateJobsv7tov8()
Description copied from class: DBSpecifics
Migrates the 'jobs' table from version 7 to version 8 consisting of adding the date creationdate with null as default.

Specified by:
migrateJobsv7tov8 in class DBSpecifics

migrateJobsv8tov9

protected void migrateJobsv8tov9()
Description copied from class: DBSpecifics
Migrates the 'jobs' table from version 8 to version 9 consisting of adding the string harvestname_prefix with null as default.

Specified by:
migrateJobsv8tov9 in class DBSpecifics

migrateHarvestdefinitionsv2tov3

protected void migrateHarvestdefinitionsv2tov3()
Description copied from class: DBSpecifics
Migrates the 'harvestdefinitions' table from version 2 to version 3 consisting of adding the string audience with null as default.

Specified by:
migrateHarvestdefinitionsv2tov3 in class DBSpecifics

migrateHarvestdefinitionsv3tov4

protected void migrateHarvestdefinitionsv3tov4()
Description copied from class: DBSpecifics
Migrates the 'harvestdefinitions' table from version 3 to version 4 consisting of adding the bigint channel_id field.

Specified by:
migrateHarvestdefinitionsv3tov4 in class DBSpecifics

migrateJobsv9tov10

protected void migrateJobsv9tov10()
Description copied from class: DBSpecifics
Migrates the 'jobs' table from version 9 to version 10 consisting of adding the channel (varchar 300) and a 'snapshot'

Specified by:
migrateJobsv9tov10 in class DBSpecifics

createHarvestChannelTable

protected void createHarvestChannelTable()
Specified by:
createHarvestChannelTable in class DBSpecifics

migrateExtendedFieldTableV1toV2

protected void migrateExtendedFieldTableV1toV2()
Migrates the 'ExtendedFieldTable' from version 1 to version 2 consisting of adding the maxlen field

Specified by:
migrateExtendedFieldTableV1toV2 in class DBSpecifics

migrateExtendedFieldTableValueV1toV2

protected void migrateExtendedFieldTableValueV1toV2()
Migrates the 'ExtendedFieldValueTable' from version 1 to version 2 changing the maxlen of content to 30000

Specified by:
migrateExtendedFieldTableValueV1toV2 in class DBSpecifics