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 AbstractTopiaMigrationCallback |
callback
CallbackHandler list (initialise en pre-init)
|
protected TopiaContextListener |
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.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 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 TMSVersionPersister |
tmsVersionPersister
Pour enregistrer les version en base (initialise en pre-init)
|
protected TopiaTransactionVetoable |
transactionVetoable
delgate transaction listener
|
protected boolean |
versionDetected
A flag to check if version was detected in database.
|
MIGRATION_CALLBACK, MIGRATION_MIGRATE_ON_INIT, MIGRATION_SHOW_PROGRESSION, MIGRATION_SHOW_SQL, SERVICE_NAME, TOPIA_SERVICE_NAME| Constructor and Description |
|---|
TopiaMigrationEngine() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkInit() |
protected org.hibernate.cfg.Configuration |
creaHibernateConfiguration(org.hibernate.cfg.Configuration configuration)
Deprecated.
since 2.5.3, prefer to use the method
createHibernateConfiguration(Configuration) |
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 List<org.nuiton.util.version.Version> |
filterVersions(Set<org.nuiton.util.version.Version> versions,
org.nuiton.util.version.Version min,
org.nuiton.util.version.Version max,
boolean includeMin,
boolean includeMax)
Filter versions.
|
Class<?>[] |
getPersistenceClasses() |
protected String |
getSafeParameter(Properties config,
String key) |
String |
getServiceName() |
protected org.nuiton.util.version.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.
|
protected TMSVersionPersister tmsVersionPersister
protected org.nuiton.util.version.Version dbVersion
protected boolean dbNotVersioned
protected boolean dbEmpty
protected boolean migrateOnInit
protected AbstractTopiaMigrationCallback callback
protected TopiaContextImplementor rootContext
protected boolean init
protected boolean versionDetected
true at the end of method detectDbVersion().protected boolean showSql
protected boolean showProgression
protected final TopiaContextListener contextListener
protected final TopiaTransactionVetoable transactionVetoable
public Class<?>[] getPersistenceClasses()
getPersistenceClasses in interface TopiaServicepublic String getServiceName()
getServiceName in interface TopiaServicepublic boolean preInit(TopiaContextImplementor context)
preInit in interface TopiaServicepublic boolean postInit(TopiaContextImplementor context)
postInit in interface TopiaServicepublic void doMigrateSchema()
throws MigrationServiceException
MigrationServiceExceptionpublic boolean migrateSchema()
throws MigrationServiceException
migrateSchema in interface TopiaMigrationServiceMigrationServiceExceptionprotected void saveApplicationVersion()
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.Version getVersion(boolean versionTableExist,
String tableName)
protected String getSafeParameter(Properties config, String key)
protected void checkInit()
@Deprecated protected org.hibernate.cfg.Configuration creaHibernateConfiguration(org.hibernate.cfg.Configuration configuration)
createHibernateConfiguration(Configuration)configuration - the incoming hibernate configurationprotected org.hibernate.cfg.Configuration createHibernateConfiguration(org.hibernate.cfg.Configuration configuration)
configuration - the incoming hibernate configurationprotected List<org.nuiton.util.version.Version> filterVersions(Set<org.nuiton.util.version.Version> versions, org.nuiton.util.version.Version min, org.nuiton.util.version.Version max, boolean includeMin, boolean includeMax)
versions - versions to filtermin - min version to acceptmax - max version to acceptincludeMin - flag to include min versionincludeMax - flag to include max versionCopyright © 2004–2015 CodeLutin. All rights reserved.