Class AbstractDatabaseMigrator

java.lang.Object
org.frankframework.jdbc.migration.AbstractDatabaseMigrator
All Implemented Interfaces:
HasApplicationContext, IConfigurable, IScopeProvider, ConfigurableLifecycle, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
Direct Known Subclasses:
LiquibaseMigrator

public abstract class AbstractDatabaseMigrator extends Object implements ConfigurableLifecycle, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, HasApplicationContext, IScopeProvider
DatabaseMigration implementation for IAF.
Since:
7.0-B4
Author:
Niels Meijer
  • Field Details

    • log

      protected org.apache.logging.log4j.Logger log
  • Constructor Details

    • AbstractDatabaseMigrator

      public AbstractDatabaseMigrator()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • getDatasourceName

      public String getDatasourceName()
    • getResource

      protected final URL getResource(String path)
    • 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 the Writer.
      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 the Writer.
      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 interface org.springframework.context.ApplicationContextAware
    • getApplicationContext

      public final org.springframework.context.ApplicationContext getApplicationContext()
      Specified by:
      getApplicationContext in interface HasApplicationContext
    • isEnabled

      public boolean isEnabled()
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface ConfigurableLifecycle
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • setDataSourceFactory

      public void setDataSourceFactory(IDataSourceFactory dataSourceFactory)
    • getConfiguration

      public Configuration getConfiguration()
    • setDefaultDatasourceName

      public void setDefaultDatasourceName(String defaultDatasourceName)
    • getName

      public String getName()
    • 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 interface HasApplicationContext
      Specified by:
      getConfigurationClassLoader in interface IScopeProvider
      Returns:
      returns the ClassLoader created by the ClassLoaderManager.
    • setDatasourceName

      public void setDatasourceName(String datasourceName)