Class TopiaMigrationEngine

java.lang.Object
org.nuiton.topia.migration.TopiaMigrationEngine
All Implemented Interfaces:
TopiaService, TopiaMigrationService

public class TopiaMigrationEngine extends Object implements TopiaMigrationService
Le moteur de migration proposé par topia. Il est basé sur un AbstractTopiaMigrationCallback qui donne la version de l'application, les version de mises à jour disponibles. Le call back offre aussi les commandes sql à passer pour chaque version de mise à jour. FIXME Finir cette documentation
Since:
2.3.4
Version:
$Id$
Author:
tchemit
  • Field Details

    • tmsVersionPersister

      protected TMSVersionPersister tmsVersionPersister
      Pour enregistrer les version en base (initialise en pre-init)
    • dbVersion

      protected org.nuiton.version.Version dbVersion
      Version courante de la base (initialise en pre-init)
    • dbNotVersioned

      protected boolean dbNotVersioned
      Drapeau pour savoir si la base est versionnée ou non
    • dbEmpty

      protected boolean dbEmpty
      A flag to know if none of the dealed entities tables exists in db.
      Since:
      2.5.3
    • migrateOnInit

      protected boolean migrateOnInit
      Un drapeau pour effectuer la migration au demarrage (initialise en pre-init)
    • callback

      protected AbstractTopiaMigrationCallback callback
      CallbackHandler list (initialise en pre-init)
    • rootContext

      protected TopiaContextImplementor rootContext
      topia root context (initialise en pre-init)
    • init

      protected boolean init
      Un drapeau pour savoir si le service a bien ete initialise (i.e a bien fini la methode preInit)
    • versionDetected

      protected boolean versionDetected
      A flag to check if version was detected in database. This flag is set to true at the end of method detectDbVersion().
    • showSql

      protected boolean showSql
      Un drapeau pour afficher les requetes sql executees
    • showProgression

      protected boolean showProgression
      Un drapeau pour afficher la progression des requetes sql executees
    • contextListener

      protected final TopiaContextListener contextListener
      delegate context listener.
    • transactionVetoable

      protected final TopiaTransactionVetoable transactionVetoable
      delgate transaction listener
  • Constructor Details

    • TopiaMigrationEngine

      public TopiaMigrationEngine()
  • Method Details

    • getPersistenceClasses

      public Class<?>[] getPersistenceClasses()
      Specified by:
      getPersistenceClasses in interface TopiaService
    • getServiceName

      public String getServiceName()
      Specified by:
      getServiceName in interface TopiaService
    • preInit

      public boolean preInit(TopiaContextImplementor context)
      Specified by:
      preInit in interface TopiaService
    • postInit

      public boolean postInit(TopiaContextImplementor context)
      Specified by:
      postInit in interface TopiaService
    • doMigrateSchema

      public void doMigrateSchema() throws MigrationServiceException
      Throws:
      MigrationServiceException
    • migrateSchema

      public boolean migrateSchema() throws MigrationServiceException
      Specified by:
      migrateSchema in interface TopiaMigrationService
      Throws:
      MigrationServiceException
    • saveApplicationVersion

      protected void saveApplicationVersion()
      Enregistre la version donnee en base avec creation de la table si elle n'existe pas.
    • detectDbVersion

      protected void detectDbVersion()
      Recupere depuis la base les états internes du service :
    • detectDbEmpty

      protected boolean detectDbEmpty()
      Detects if there is some schema existing for at least one of the dealed entity of the underlying db context.
      Returns:
      true if there is no schema for any of the dealed entities, false otherwise.
      Since:
      2.5.3
    • getVersion

      protected org.nuiton.version.Version getVersion(boolean versionTableExist, String tableName)
    • getSafeParameter

      protected String getSafeParameter(Properties config, String key)
    • checkInit

      protected void checkInit()
    • filterVersions

      protected List<org.nuiton.version.Version> filterVersions(Set<org.nuiton.version.Version> versions, org.nuiton.version.Version min, org.nuiton.version.Version max, boolean includeMin, boolean includeMax)
      Filter versions.
      Parameters:
      versions - versions to filter
      min - min version to accept
      max - max version to accept
      includeMin - flag to include min version
      includeMax - flag to include max version
      Returns:
      versions between min and max