org.nuiton.topia.migration
Class TopiaMigrationEngine

java.lang.Object
  extended by 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 TopiaMigrationCallback 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: TopiaMigrationEngine.java 2010 2010-06-13 18:18:35Z tchemit $
Author:
tchemit

Field Summary
protected  TopiaMigrationCallback callback
          CallbackHandler list (initialise en pre-init)
protected  TopiaContextListener contextListener
          delegate context listener.
protected  boolean dbNotVersioned
          Drapeau pour savoir si la base est versionnée ou non
protected  org.nuiton.util.Version dbVersion
          Version courante de la base (initialise en pre-init)
protected  boolean init
          Un drapeau pour savoir si le service a bien ete initialise (i.e a bien fini la methode preInit)
protected  org.hibernate.cfg.Configuration legacyVersionConfiguration
          Configuration hibernate ne mappant que l'entite version de l'ancien systeme de migration (initialise en pre-init)
protected  boolean legacyVersionTableExist
          Un drapeau pour savoir si la table version (de l'ancien service Manual) existe en base (initialise en pre-init)
protected  boolean migrateOnInit
          Un drapeau pour effectuer la migration au demarrage (initialise en pre-init)
protected  TopiaContextImplementor rootContext
          topia root context (initialise en pre-init)
protected  boolean showProgression
          Un drapeau pour afficher la progression des requetes sql executees
protected  boolean showSql
          Un drapeau pour afficher les requetes sql executees
protected  TopiaTransactionVetoable transactionVetoable
          delgate transaction listener
protected  org.hibernate.cfg.Configuration versionConfiguration
          Configuration hibernate ne mappant que l'entite version (initialise en pre-init)
protected  boolean versionDetected
          A flag to check if version was detected in database.
protected  boolean versionTableExist
          Un drapeau pour savoir si la table version existe en base (initialise en pre-init)
 
Fields inherited from interface org.nuiton.topia.migration.TopiaMigrationService
MIGRATION_CALLBACK, MIGRATION_MIGRATE_ON_INIT, MIGRATION_SHOW_PROGRESSION, MIGRATION_SHOW_SQL, SERVICE_NAME, TOPIA_SERVICE_NAME
 
Constructor Summary
TopiaMigrationEngine()
           
 
Method Summary
protected  void checkInit()
           
protected  org.hibernate.cfg.Configuration creaHibernateConfiguration(org.hibernate.cfg.Configuration configuration)
           
protected  void detectDbVersion()
          Recupere depuis la base les états internes du service :

versionTableExist dbVersion

 void doMigrateSchema()
           
 Class<?>[] getPersistenceClasses()
           
protected  String getSafeParameter(Properties config, String key)
           
 String getServiceName()
           
protected  org.nuiton.util.Version getVersion(boolean versionTableExist, String tableName)
           
 boolean migrateSchema()
           
 boolean postInit(TopiaContextImplementor context)
           
 boolean preInit(TopiaContextImplementor context)
           
protected  void saveApplicationVersion()
          Enregistre la version donnee en base avec creation de la table si elle n'existe pas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionConfiguration

protected org.hibernate.cfg.Configuration versionConfiguration
Configuration hibernate ne mappant que l'entite version (initialise en pre-init)


versionTableExist

protected boolean versionTableExist
Un drapeau pour savoir si la table version existe en base (initialise en pre-init)


legacyVersionConfiguration

protected org.hibernate.cfg.Configuration legacyVersionConfiguration
Configuration hibernate ne mappant que l'entite version de l'ancien systeme de migration (initialise en pre-init)


legacyVersionTableExist

protected boolean legacyVersionTableExist
Un drapeau pour savoir si la table version (de l'ancien service Manual) existe en base (initialise en pre-init)


dbVersion

protected org.nuiton.util.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


migrateOnInit

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


callback

protected TopiaMigrationCallback 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 Detail

TopiaMigrationEngine

public TopiaMigrationEngine()
Method Detail

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 :


getVersion

protected org.nuiton.util.Version getVersion(boolean versionTableExist,
                                             String tableName)

getSafeParameter

protected String getSafeParameter(Properties config,
                                  String key)

checkInit

protected void checkInit()

creaHibernateConfiguration

protected org.hibernate.cfg.Configuration creaHibernateConfiguration(org.hibernate.cfg.Configuration configuration)


Copyright © 2004-2010 CodeLutin. All Rights Reserved.