Class MySQLSpecifics
- java.lang.Object
-
- dk.netarkivet.common.utils.SettingsFactory<DBSpecifics>
-
- dk.netarkivet.harvester.datamodel.DBSpecifics
-
- dk.netarkivet.harvester.datamodel.MySQLSpecifics
-
public class MySQLSpecifics extends DBSpecifics
MySQL-specific implementation of DB methods.
-
-
Constructor Summary
Constructors Constructor Description MySQLSpecifics()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createEavAttributeTable(int toVersion)
Create the EavAttributeTable table in the database.void
createEavTypeAttributeTable(int toVersion)
Create the EavTypeAttribute table in the database.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(Connection c, String tableName)
Dispose of a temporary table created with getTemporaryTable.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.String
getJobConfigsTmpTable(Connection c)
Get a temporary table for short-time use.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 fieldprotected void
migrateExtendedFieldTableValueV1toV2()
Migrates the 'ExtendedFieldValueTable' from version 1 to version 2 changing the maxlen of content to 30000protected 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
migrateOrderTemplatesTablev1tov2()
Migrates the table 'ordertemplates' from version 1 to version 2, adding a boolean 'isActive" flag.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, upgradeEavAttributeTable, upgradeEavTypeAttributeTable
-
Methods inherited from class dk.netarkivet.common.utils.SettingsFactory
getInstance
-
-
-
-
Method Detail
-
getInstance
public static DBSpecifics getInstance()
Get an instance of the MySQL specifics class.- Returns:
- Instance of the MySQL specifics class.
-
getJobConfigsTmpTable
public String getJobConfigsTmpTable(Connection c) throws 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 classDBSpecifics
- Parameters:
c
- The DB connection to use.- Returns:
- The name of the created table
- Throws:
SQLException
- if there is a problem getting the table.
-
dropJobConfigsTmpTable
public void dropJobConfigsTmpTable(Connection c, 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 classDBSpecifics
- Parameters:
c
- The DB connection to use.tableName
- The name of the temporary table
-
getDriverClassName
public String getDriverClassName()
Get the name of the JDBC driver class that handles interfacing to this server.- Specified by:
getDriverClassName
in classDBSpecifics
- 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 classDBSpecifics
- 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 classDBSpecifics
- 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 classDBSpecifics
-
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 classDBSpecifics
-
createGlobalCrawlerTrapLists
protected void createGlobalCrawlerTrapLists()
Creates the initial (version 1) of table 'global_crawler_trap_lists'.- Specified by:
createGlobalCrawlerTrapLists
in classDBSpecifics
-
createGlobalCrawlerTrapExpressions
protected void createGlobalCrawlerTrapExpressions()
Creates the initial (version 1) of table 'global_crawler_trap_expressions'.- Specified by:
createGlobalCrawlerTrapExpressions
in classDBSpecifics
-
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 classDBSpecifics
- Returns:
- true if CLOBs are supported, false otherwise.
-
getOrderByLimitAndOffsetSubClause
public 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 classDBSpecifics
- 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 classDBSpecifics
-
createRunningJobsHistoryTable
public void createRunningJobsHistoryTable()
Description copied from class:DBSpecifics
Create the frontierReportMonitor table in the database.- Specified by:
createRunningJobsHistoryTable
in classDBSpecifics
-
createRunningJobsMonitorTable
public void createRunningJobsMonitorTable()
Description copied from class:DBSpecifics
Create the frontierReportMonitor table in the database.- Specified by:
createRunningJobsMonitorTable
in classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
createExtendedFieldTypeTable
protected void createExtendedFieldTypeTable()
Description copied from class:DBSpecifics
Create the extendedfieldtype table in the database.- Specified by:
createExtendedFieldTypeTable
in classDBSpecifics
-
createExtendedFieldTable
protected void createExtendedFieldTable()
Description copied from class:DBSpecifics
Create the extendedfield table in the database.- Specified by:
createExtendedFieldTable
in classDBSpecifics
-
createExtendedFieldValueTable
protected void createExtendedFieldValueTable()
Description copied from class:DBSpecifics
Create the extendedfieldvalue table in the database.- Specified by:
createExtendedFieldValueTable
in classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
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 classDBSpecifics
-
createHarvestChannelTable
protected void createHarvestChannelTable()
- Specified by:
createHarvestChannelTable
in classDBSpecifics
-
migrateExtendedFieldTableV1toV2
protected void migrateExtendedFieldTableV1toV2()
Migrates the 'ExtendedFieldTable' from version 1 to version 2 consisting of adding the maxlen field- Specified by:
migrateExtendedFieldTableV1toV2
in classDBSpecifics
-
migrateExtendedFieldTableValueV1toV2
protected void migrateExtendedFieldTableValueV1toV2()
Migrates the 'ExtendedFieldValueTable' from version 1 to version 2 changing the maxlen of content to 30000- Specified by:
migrateExtendedFieldTableValueV1toV2
in classDBSpecifics
-
migrateOrderTemplatesTablev1tov2
protected void migrateOrderTemplatesTablev1tov2()
Description copied from class:DBSpecifics
Migrates the table 'ordertemplates' from version 1 to version 2, adding a boolean 'isActive" flag.- Specified by:
migrateOrderTemplatesTablev1tov2
in classDBSpecifics
-
createEavTypeAttributeTable
public void createEavTypeAttributeTable(int toVersion)
Description copied from class:DBSpecifics
Create the EavTypeAttribute table in the database.- Specified by:
createEavTypeAttributeTable
in classDBSpecifics
-
createEavAttributeTable
public void createEavAttributeTable(int toVersion)
Description copied from class:DBSpecifics
Create the EavAttributeTable table in the database.- Specified by:
createEavAttributeTable
in classDBSpecifics
-
-