public class DatabaseConfigurationManagerImpl extends Object implements DatabaseConfigurationManager
DatabaseConfigurationLoader
. Caches configuration.Constructor and Description |
---|
DatabaseConfigurationManagerImpl(JiraHome jiraHome,
DatabaseConfigurationLoader databaseConfigLoader,
ComponentLocator componentLocator) |
Modifier and Type | Method and Description |
---|---|
void |
activateDatabase()
Initialises the first connection to the database and causes each enqueued runnable that registered with
DatabaseConfigurationManager.doNowOrWhenDatabaseActivated(Runnable, String) to be run. |
void |
activateDatabaseWithoutRunningPostDbSetupRunnables() |
void |
createDbConfigFromEntityDefinition()
Creates a new dbconfig.xml using 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 |
runPostDbSetupRunnables() |
void |
setDatabaseConfiguration(DatabaseConfig databaseConfig)
Persists the given config as JIRA's database configuration.
|
public DatabaseConfigurationManagerImpl(JiraHome jiraHome, DatabaseConfigurationLoader databaseConfigLoader, ComponentLocator componentLocator)
public void setDatabaseConfiguration(DatabaseConfig databaseConfig)
DatabaseConfigurationManager
setDatabaseConfiguration
in interface DatabaseConfigurationManager
databaseConfig
- the config to use for JIRA's database connection.public void createDbConfigFromEntityDefinition()
DatabaseConfigurationManager
createDbConfigFromEntityDefinition
in interface DatabaseConfigurationManager
public DatabaseConfig getDatabaseConfiguration()
DatabaseConfigurationManager
getDatabaseConfiguration
in interface DatabaseConfigurationManager
public void doNowOrWhenDatabaseActivated(Runnable runnable, String desc)
DatabaseConfigurationManager
DatabaseConfigurationManager.activateDatabase()
. Then it will be done in the thread
that calls DatabaseConfigurationManager.activateDatabase()
.
Callers can be sure that the database schema will already be updated to fit the model when the given runnable is run.
doNowOrWhenDatabaseActivated
in interface DatabaseConfigurationManager
runnable
- The work that must be done if or when the database is activated.desc
- A description (for logging purposes) of the work.public void doNowOrWhenDatabaseConfigured(Runnable runnable, String desc)
DatabaseConfigurationManager
DatabaseConfigurationManager.activateDatabase()
. Then it will be done in
the thread that calls DatabaseConfigurationManager.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.
doNowOrWhenDatabaseConfigured
in interface DatabaseConfigurationManager
runnable
- The work that must be done if or when the database is configured.desc
- A description (for logging purposes) of the work.public boolean isDatabaseSetup()
DatabaseConfigurationManager
isDatabaseSetup
in interface DatabaseConfigurationManager
public void activateDatabase()
DatabaseConfigurationManager
DatabaseConfigurationManager.doNowOrWhenDatabaseActivated(Runnable, String)
to be run. Should only be run once per application boot.activateDatabase
in interface DatabaseConfigurationManager
public void activateDatabaseWithoutRunningPostDbSetupRunnables()
activateDatabaseWithoutRunningPostDbSetupRunnables
in interface DatabaseConfigurationManager
public void runPostDbSetupRunnables()
runPostDbSetupRunnables
in interface DatabaseConfigurationManager
public DatabaseConfig getInternalDatabaseConfiguration()
DatabaseConfigurationManager
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.getInternalDatabaseConfiguration
in interface DatabaseConfigurationManager
Copyright © 2002-2021 Atlassian. All Rights Reserved.