public class TopiaMigrationEngine extends Object implements TopiaMigrationService
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| Modifier and Type | Field and Description |
|---|---|
protected TopiaApplicationContext |
applicationContext
topia root context (initialise en pre-init)
|
protected AbstractTopiaMigrationCallback |
callback
CallbackHandler list (initialise en pre-init)
|
protected TopiaSchemaListener |
contextListener
delegate context listener.
|
protected boolean |
dbEmpty
A flag to know if none of the dealed entities tables exists in db.
|
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 init)
|
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 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)
|
MIGRATION_CALLBACK, MIGRATION_MIGRATE_ON_INIT, MIGRATION_SHOW_PROGRESSION, MIGRATION_SHOW_SQL| Constructor and Description |
|---|
TopiaMigrationEngine() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkInit() |
protected org.hibernate.cfg.Configuration |
createHibernateConfiguration(org.hibernate.cfg.Configuration configuration)
Creates the hibernate configuration to be used by the service.
|
protected boolean |
detectDbEmpty()
Detects if there is some schema existing for at least one of the dealed
entity of the underlying db context.
|
protected void |
detectDbVersion()
|
void |
doMigrateSchema() |
protected org.nuiton.util.Version |
getApplicationVersion() |
Class<?>[] |
getPersistenceClasses() |
protected String |
getSafeParameter(Properties config,
String key) |
protected org.nuiton.util.Version |
getVersion(boolean versionTableExist,
String tableName) |
void |
initOnCreateSchema() |
void |
initTopiaService(TopiaApplicationContext topiaApplicationContext,
Map<String,String> serviceConfiguration) |
boolean |
migrateSchema() |
void |
runSchemaMigration() |
protected void |
saveApplicationVersion()
Enregistre la version donnee en base avec creation de la table
si elle n'existe pas.
|
protected org.hibernate.cfg.Configuration versionConfiguration
protected boolean versionTableExist
protected org.hibernate.cfg.Configuration legacyVersionConfiguration
protected boolean legacyVersionTableExist
protected org.nuiton.util.Version dbVersion
protected boolean dbNotVersioned
protected boolean dbEmpty
protected boolean migrateOnInit
protected AbstractTopiaMigrationCallback callback
protected TopiaApplicationContext applicationContext
protected boolean init
protected boolean versionDetected
true at the end of method detectDbVersion().protected boolean showSql
protected boolean showProgression
protected final TopiaSchemaListener contextListener
protected final TopiaTransactionVetoable transactionVetoable
public Class<?>[] getPersistenceClasses()
getPersistenceClasses in interface TopiaServicepublic void initTopiaService(TopiaApplicationContext topiaApplicationContext, Map<String,String> serviceConfiguration)
initTopiaService in interface TopiaServicepublic void doMigrateSchema()
throws MigrationServiceException
MigrationServiceExceptionpublic boolean migrateSchema()
throws MigrationServiceException
MigrationServiceExceptionprotected void saveApplicationVersion()
protected org.nuiton.util.Version getApplicationVersion()
protected void detectDbVersion()
protected boolean detectDbEmpty()
true if there is no schema for any of the dealed entities,
false otherwise.protected org.nuiton.util.Version getVersion(boolean versionTableExist,
String tableName)
protected String getSafeParameter(Properties config, String key)
protected void checkInit()
protected org.hibernate.cfg.Configuration createHibernateConfiguration(org.hibernate.cfg.Configuration configuration)
configuration - the incoming hibernate configurationpublic void initOnCreateSchema()
initOnCreateSchema in interface TopiaMigrationServicepublic void runSchemaMigration()
runSchemaMigration in interface TopiaMigrationServiceCopyright © 2004–2014 CodeLutin. All rights reserved.