com.atlassian.jira.config.database
Interface DatabaseConfigurationManager

All Known Implementing Classes:
DatabaseConfigurationManagerImpl

public interface DatabaseConfigurationManager

Manager implementation that provides save, load and related operations for JIRA's database configuration.

Since:
v4.4

Method Summary
 void activateDatabase()
          Initialises the first connection to the database and causes each enqueued runnable that registered with doNowOrWhenDatabaseActivated(Runnable, String) to be run.
 void createDbConfigFromEntityDefinition()
          Creates a new dbconfig.xml usinfg the values in entityengine.xml if there are any Allows for upgrade from pre 5.0 instances
 void doNowOrWhenDatabaseActivated(Runnable runnable, String desc)
          Requests that work that needs to read from and write to the database be done.
 void doNowOrWhenDatabaseConfigured(Runnable runnable, String desc)
          Requests that work dependent on the database configuration be done.
 DatabaseConfig getDatabaseConfiguration()
          Gets the current database configuration.
 DatabaseConfig getInternalDatabaseConfiguration()
          Provides the DatabaseConfig that represents the embedded JIRA database.
 boolean isDatabaseSetup()
          Returns true only if the database configuration is available.
 void setDatabaseConfiguration(DatabaseConfig databaseConfiguration)
          Persists the given config as JIRA's database configuration.
 

Method Detail

setDatabaseConfiguration

void setDatabaseConfiguration(DatabaseConfig databaseConfiguration)
Persists the given config as JIRA's database configuration. This must only be done once.

Parameters:
databaseConfiguration - the config to use for JIRA's database connection.
Throws:
RuntimeException - if the database configuration is wrong.

getDatabaseConfiguration

DatabaseConfig getDatabaseConfiguration()
Gets the current database configuration.

Returns:
the config if configured.
Throws:
RuntimeException - if the database has not been configured or the config can't be read.

doNowOrWhenDatabaseActivated

void doNowOrWhenDatabaseActivated(Runnable runnable,
                                  String desc)
Requests that work that needs to read from and write to the database be done. If the database is already active, the runnable will be run now in the calling thread. If not, it will be enqueued until the database configuration is provided and the database is activated via activateDatabase(). Then it will be done in the thread that calls activateDatabase().

Callers can be sure that the database schema will already be updated to fit the model when the given runnable is run.

Parameters:
runnable - The work that must be done if or when the database is activated.
desc - A description (for logging purposes) of the work.

doNowOrWhenDatabaseConfigured

void doNowOrWhenDatabaseConfigured(Runnable runnable,
                                   String desc)
Requests that work dependent on the database configuration be done. If the database is already configured, the runnable will be run now in the calling thread. If not, it will be enqueued until the database configuration is provided but before the database is actually activated via activateDatabase(). Then it will be done in the thread that calls activateDatabase().

The puropse of this method is to execute tasks that want to check or read the database configuration before the schema is modified to fit the current model.

Parameters:
runnable - The work that must be done if or when the database is configured.
desc - A description (for logging purposes) of the work.

isDatabaseSetup

boolean isDatabaseSetup()
Returns true only if the database configuration is available.

Returns:
whether the database is set up.

activateDatabase

void activateDatabase()
Initialises the first connection to the database and causes each enqueued runnable that registered with doNowOrWhenDatabaseActivated(Runnable, String) to be run. Should only be run once per application boot.


getInternalDatabaseConfiguration

DatabaseConfig getInternalDatabaseConfiguration()
Provides the DatabaseConfig that represents the embedded JIRA database. This does not imply that this config is current or that there is any current configuration for the JIRA database.

Returns:
the embedded database config.

createDbConfigFromEntityDefinition

void createDbConfigFromEntityDefinition()
Creates a new dbconfig.xml usinfg the values in entityengine.xml if there are any Allows for upgrade from pre 5.0 instances



Copyright © 2002-2014 Atlassian. All Rights Reserved.