Class DatabaseConfigurationManagerImpl
java.lang.Object
com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl
- All Implemented Interfaces:
DatabaseConfigurationManager
public class DatabaseConfigurationManagerImpl
extends Object
implements DatabaseConfigurationManager
A threadsafe implementation which reads and writes configuration for the database using the given
DatabaseConfigurationLoader. Caches configuration.-
Constructor Summary
ConstructorsConstructorDescriptionDatabaseConfigurationManagerImpl(FileStores fileStores, DatabaseConfigurationLoader databaseConfigLoader, ComponentLocator componentLocator) -
Method Summary
Modifier and TypeMethodDescriptionvoidInitialises the first connection to the database and causes each enqueued runnable that registered withDatabaseConfigurationManager.doNowOrWhenDatabaseActivated(Runnable, String)to be run.voidvoidCreates a new dbconfig.xml using the values in entityengine.xml if there are any Allows for upgrade from pre 5.0 instancesvoiddoNowOrWhenDatabaseActivated(Runnable runnable, String desc) Requests that work that needs to read from and write to the database be done.voiddoNowOrWhenDatabaseConfigured(Runnable runnable, String desc) Requests that work dependent on the database configuration be done.Gets the current database configuration.Provides theDatabaseConfigthat represents the embedded JIRA database.booleanReturns true only if the database configuration is available.voidvoidsetDatabaseConfiguration(DatabaseConfig databaseConfig) Persists the given config as JIRA's database configuration.
-
Constructor Details
-
DatabaseConfigurationManagerImpl
public DatabaseConfigurationManagerImpl(FileStores fileStores, DatabaseConfigurationLoader databaseConfigLoader, ComponentLocator componentLocator)
-
-
Method Details
-
setDatabaseConfiguration
Description copied from interface:DatabaseConfigurationManagerPersists the given config as JIRA's database configuration. This must only be done once.- Specified by:
setDatabaseConfigurationin interfaceDatabaseConfigurationManager- Parameters:
databaseConfig- the config to use for JIRA's database connection.
-
createDbConfigFromEntityDefinition
public void createDbConfigFromEntityDefinition()Description copied from interface:DatabaseConfigurationManagerCreates a new dbconfig.xml using the values in entityengine.xml if there are any Allows for upgrade from pre 5.0 instances- Specified by:
createDbConfigFromEntityDefinitionin interfaceDatabaseConfigurationManager
-
getDatabaseConfiguration
Description copied from interface:DatabaseConfigurationManagerGets the current database configuration.- Specified by:
getDatabaseConfigurationin interfaceDatabaseConfigurationManager- Returns:
- the config if configured.
-
doNowOrWhenDatabaseActivated
Description copied from interface:DatabaseConfigurationManagerRequests 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 viaDatabaseConfigurationManager.activateDatabase(). Then it will be done in the thread that callsDatabaseConfigurationManager.activateDatabase().Callers can be sure that the database schema will already be updated to fit the model when the given runnable is run.
- Specified by:
doNowOrWhenDatabaseActivatedin interfaceDatabaseConfigurationManager- 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
Description copied from interface:DatabaseConfigurationManagerRequests 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 viaDatabaseConfigurationManager.activateDatabase(). Then it will be done in the thread that callsDatabaseConfigurationManager.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.
- Specified by:
doNowOrWhenDatabaseConfiguredin interfaceDatabaseConfigurationManager- 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
public boolean isDatabaseSetup()Description copied from interface:DatabaseConfigurationManagerReturns true only if the database configuration is available.- Specified by:
isDatabaseSetupin interfaceDatabaseConfigurationManager- Returns:
- whether the database is set up.
-
activateDatabase
public void activateDatabase()Description copied from interface:DatabaseConfigurationManagerInitialises the first connection to the database and causes each enqueued runnable that registered withDatabaseConfigurationManager.doNowOrWhenDatabaseActivated(Runnable, String)to be run. Should only be run once per application boot.- Specified by:
activateDatabasein interfaceDatabaseConfigurationManager
-
activateDatabaseWithoutRunningPostDbSetupRunnables
public void activateDatabaseWithoutRunningPostDbSetupRunnables()- Specified by:
activateDatabaseWithoutRunningPostDbSetupRunnablesin interfaceDatabaseConfigurationManager
-
runPostDbSetupRunnables
public void runPostDbSetupRunnables()- Specified by:
runPostDbSetupRunnablesin interfaceDatabaseConfigurationManager
-
getInternalDatabaseConfiguration
Description copied from interface:DatabaseConfigurationManagerProvides theDatabaseConfigthat 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.- Specified by:
getInternalDatabaseConfigurationin interfaceDatabaseConfigurationManager- Returns:
- the embedded database config.
-