SqlDBManager

public interface SqlDBManager

Classes implementing this interface are responsible for retrieving sql properties from the bootstrap configuration, updating sql-related properties for modules and creating databases for given properties.

Methods

checkForDatabase

boolean checkForDatabase(String dbName)

Check if a database with the given name exists

Parameters:
  • dbName – database name
Returns:

true if database exists, otherwise false

createDatabase

boolean createDatabase(String dbName)

Create a database with the given name

Returns:true if the database was created properly

getChosenSQLDriver

String getChosenSQLDriver()

Returns the SQL driver class name that has been chosen during bootstrap configuration of the system.

Returns:Class name of the SQL driver, chosen during bootstrap configuration.

getSqlProperties

Properties getSqlProperties(Properties propertiesToUpdate)

Being passed raw properties, inserts correct SQL configuration in the correct places. Current replacement codes are:

  • ${sql.driver}
  • ${sql.user}
  • ${sql.password}
  • ${sql.url}
  • ${sql.quartz.delegateClass}

As a result of calling this method, all occurrences of the above keys get replaced with actual sql properties, retrieved from the provided bootstrap configuration.

Parameters:
  • propertiesToUpdate – Raw properties, containing replacement codes
Throws:
  • IOException – In case an I/O exception occurs when loading / merging properties
Returns:

Actual properties, with sql configuration from bootstrap

hasColumn

boolean hasColumn(String database, String table, String column)

Checks whether table with the given name has a column with the given name.

Parameters:
  • table – the name of the table
  • column – the name of the column
Throws:
  • SQLException – when incorrect data was given
Returns:

true if the table has that column, false otherwise