Class DatabaseMigratorBase
- java.lang.Object
-
- nl.nn.adapterframework.jdbc.migration.DatabaseMigratorBase
-
- All Implemented Interfaces:
IConfigurationAware
,IScopeProvider
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
LiquibaseMigrator
public abstract class DatabaseMigratorBase extends Object implements IConfigurationAware, org.springframework.beans.factory.InitializingBean
DatabaseMigration implementation for IAF.- Since:
- 7.0-B4
- Author:
- Niels Meijer
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Constructor Description DatabaseMigratorBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
org.springframework.context.ApplicationContext
getApplicationContext()
abstract Resource
getChangeLog()
Configuration
getConfiguration()
ClassLoader
getConfigurationClassLoader()
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.String
getDatasourceName()
String
getName()
protected URL
getResource(String path)
boolean
hasMigrationScript()
Check whether the configuration contains liquibase script that can be translated into sql statements in the classpathboolean
isEnabled()
protected void
logConfigurationMessage(String message)
protected DataSource
lookupMigratorDatasource()
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setDataSourceFactory(IDataSourceFactory dataSourceFactory)
void
setDatasourceName(String datasourceName)
void
setDefaultDatasourceName(String defaultDatasourceName)
abstract void
update()
Run the migration script against the database.abstract void
update(Writer writer)
Run the migration script and write the output to theWriter
.abstract void
update(Writer writer, Resource resource)
Run the provided migration script (against the local database) and write the output to theWriter
.abstract boolean
validate()
Validate the current already executed ChangeSets against the migration script
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getDatasourceName
public String getDatasourceName()
-
lookupMigratorDatasource
protected final DataSource lookupMigratorDatasource() throws SQLException
- Throws:
SQLException
-
validate
public abstract boolean validate()
Validate the current already executed ChangeSets against the migration script
-
update
public abstract void update() throws JdbcException
Run the migration script against the database.- Throws:
JdbcException
-
update
public abstract void update(Writer writer) throws JdbcException
Run the migration script and write the output to theWriter
.- Throws:
JdbcException
-
update
public abstract void update(Writer writer, Resource resource) throws JdbcException
Run the provided migration script (against the local database) and write the output to theWriter
.- Throws:
JdbcException
-
hasMigrationScript
public boolean hasMigrationScript()
Check whether the configuration contains liquibase script that can be translated into sql statements in the classpath
-
getChangeLog
public abstract Resource getChangeLog()
-
logConfigurationMessage
protected final void logConfigurationMessage(String message)
-
setApplicationContext
public final void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
getApplicationContext
public final org.springframework.context.ApplicationContext getApplicationContext()
- Specified by:
getApplicationContext
in interfaceIConfigurationAware
-
isEnabled
public boolean isEnabled()
-
setDataSourceFactory
public void setDataSourceFactory(IDataSourceFactory dataSourceFactory)
-
getConfiguration
public Configuration getConfiguration()
-
setDefaultDatasourceName
public void setDefaultDatasourceName(String defaultDatasourceName)
-
getName
public String getName()
- Specified by:
getName
in interfaceIConfigurationAware
-
getConfigurationClassLoader
public ClassLoader getConfigurationClassLoader()
Description copied from interface:IScopeProvider
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.- Specified by:
getConfigurationClassLoader
in interfaceIScopeProvider
- Returns:
- returns the ClassLoader created by the
ClassLoaderManager
.
-
setDatasourceName
public void setDatasourceName(String datasourceName)
-
-