public abstract class AbstractLiquibaseDatabaseUpdater extends DatabaseUpdater implements org.springframework.context.ResourceLoaderAware
liquibase.spring.SpringLiquibase
Modifier and Type | Field and Description |
---|---|
protected static String |
CHANGESET_CONTEXT_CLIENT
Context to be used in change-sets which should be run on all databases.
|
protected static String |
CHANGESET_CONTEXT_GLOBAL
Context to be used in change-sets which should only be run on the master (aka global)
database.
|
protected static String |
CHANGESET_CONTEXT_STANDALONE
Context to be used in change-sets which should be run if the installation is a standalone
installation.
|
Constructor and Description |
---|
AbstractLiquibaseDatabaseUpdater() |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeDatabaseUpdate(DatabaseUpdateType updateType)
Is called before a database update is started.
|
protected void |
doExecute(DatabaseUpdateType updateType)
Will be invoked by
DatabaseUpdater.execute(DatabaseUpdateType) to do the actual update. |
protected Connection |
getConnection() |
protected abstract String[] |
getContexts()
The contexts of the update.
|
protected abstract String |
getDatabaseInformation(Connection connection)
Get some information about the database.
|
org.springframework.core.io.ResourceLoader |
getResourceLoader() |
protected org.hibernate.engine.SessionFactoryImplementor |
getSessionFactoryImplementor() |
protected LiquibaseUpdateDataProvider |
getUpdateDataProvider() |
protected void |
prepareLiquibase(liquibase.Liquibase liquibase,
Map<String,Object> changeLogParameters)
Prepare the liquibase instance before doing the actual update.
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
void |
setSessionFactoryImplementor(org.hibernate.engine.SessionFactoryImplementor sessionFactoryImplementor)
Set the hibernate session factory implementor to use for retrieving a connection for updating
the database.
|
void |
setUpdateDataProvider(LiquibaseUpdateDataProvider updateDataProvider)
Set the data provider to use for the update
|
protected void |
updateDatabase(String changeLog,
Map<String,Object> changeLogParameters)
Update the database that is returned by
getConnection() with the given change-log
file and change-log parameters. |
boolean |
updaterRunBefore()
Returns whether the updater run at least once against the database.
|
execute, skipUpdates, updateDatabase, updateRunInSession
protected static final String CHANGESET_CONTEXT_CLIENT
protected static final String CHANGESET_CONTEXT_GLOBAL
protected static final String CHANGESET_CONTEXT_STANDALONE
protected void beforeDatabaseUpdate(DatabaseUpdateType updateType) throws DatabaseUpdateException
updateType
- the type of the update which should be runDatabaseUpdateException
- in case of an error, like some missing preconditionsprotected void doExecute(DatabaseUpdateType updateType) throws DatabaseUpdateException
DatabaseUpdater
DatabaseUpdater.execute(DatabaseUpdateType)
to do the actual update.doExecute
in class DatabaseUpdater
updateType
- the type of update that should be executedDatabaseUpdateException
- in case of an error database update errorprotected Connection getConnection() throws SQLException
SQLException
- in case of an sql exceptionprotected abstract String[] getContexts()
protected abstract String getDatabaseInformation(Connection connection)
connection
- the database connection that was used in the update or null if the update failed
because no connection could be retrievedpublic org.springframework.core.io.ResourceLoader getResourceLoader()
protected org.hibernate.engine.SessionFactoryImplementor getSessionFactoryImplementor()
protected LiquibaseUpdateDataProvider getUpdateDataProvider()
LiquibaseUpdateDataProvider
if no custom provider was set with
setUpdateDataProvider(LiquibaseUpdateDataProvider)
protected void prepareLiquibase(liquibase.Liquibase liquibase, Map<String,Object> changeLogParameters) throws DatabaseUpdateException
liquibase
- the liquibase instance to prepare for the updatechangeLogParameters
- the parameters to replace placeholders in the change-log file. Can be null.DatabaseUpdateException
- in case the preparation lead to an errorpublic void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public void setSessionFactoryImplementor(org.hibernate.engine.SessionFactoryImplementor sessionFactoryImplementor)
sessionFactoryImplementor
- the sessionFactoryImplementor to setpublic void setUpdateDataProvider(LiquibaseUpdateDataProvider updateDataProvider)
updateDataProvider
- the data providerprotected void updateDatabase(String changeLog, Map<String,Object> changeLogParameters) throws DatabaseUpdateException
getConnection()
with the given change-log
file and change-log parameters.changeLog
- the location of the change-log file on the classpathchangeLogParameters
- mapping from key to value where the key represents a palceholder in a change-set
of the change-log file which should be replaced by the value. Can be null.DatabaseUpdateException
- in case the update failedpublic boolean updaterRunBefore()
DatabaseUpdater
updaterRunBefore
in class DatabaseUpdater
Copyright © 2019 Communote team. All rights reserved.