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 application context (set during init)
|
protected AbstractTopiaMigrationCallback |
callback
CallbackHandler list (set during init)
|
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.version.Version |
dbVersion
Current database version (set during init)
|
protected boolean |
init
Flag to know if the service is correctly initialized
|
protected org.hibernate.boot.Metadata |
metaData |
protected org.hibernate.SessionFactory |
sessionFactory |
protected boolean |
showProgression
Flag to display progress or not
|
protected boolean |
showSql
Flag to display SQL requests or not
|
protected org.hibernate.cfg.Configuration |
versionConfiguration
Hibernate Configuration only with TMSVersion entity (set during init)
|
protected boolean |
versionDetected
A flag to check if version was detected in database.
|
protected boolean |
versionTableExist
Flag to know if the TMSVersion table is existing (set during 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() |
void |
close() |
protected static org.hibernate.cfg.Configuration |
createTMSHibernateConfiguration(TopiaApplicationContext appContext)
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()
|
static 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.
|
protected org.nuiton.version.Version |
getApplicationVersion() |
protected String |
getSafeParameter(Properties config,
String key) |
String |
getSchemaVersion() |
void |
initOnCreateSchema() |
void |
initTopiaService(TopiaApplicationContext topiaApplicationContext,
Map<String,String> serviceConfiguration) |
boolean |
migrateSchema()
Deprecated.
|
void |
runSchemaMigration() |
protected void |
saveApplicationVersion()
Save the application's model version in the database.
|
protected org.hibernate.cfg.Configuration versionConfiguration
protected boolean versionTableExist
protected org.nuiton.version.Version dbVersion
protected boolean dbNotVersioned
protected boolean dbEmpty
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 org.hibernate.SessionFactory sessionFactory
protected org.hibernate.boot.Metadata metaData
public void initTopiaService(TopiaApplicationContext topiaApplicationContext, Map<String,String> serviceConfiguration)
initTopiaService in interface TopiaService@Deprecated public boolean migrateSchema() throws MigrationServiceException
MigrationServiceExceptionpublic String getSchemaVersion() throws TopiaMigrationServiceException
getSchemaVersion in interface TopiaMigrationServiceTopiaMigrationServiceExceptionpublic void initOnCreateSchema()
initOnCreateSchema in interface TopiaMigrationServicepublic static 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)
versions - versions to filtermin - min version to acceptmax - max version to acceptincludeMin - flag to include min versionincludeMax - flag to include max versionpublic void runSchemaMigration()
runSchemaMigration in interface TopiaMigrationServiceprotected void saveApplicationVersion()
protected org.nuiton.version.Version getApplicationVersion()
protected void detectDbVersion()
protected boolean detectDbEmpty()
true if there is no schema for any of the dealed entities,
false otherwise.protected String getSafeParameter(Properties config, String key)
protected void checkInit()
protected static org.hibernate.cfg.Configuration createTMSHibernateConfiguration(TopiaApplicationContext appContext)
appContext - the topia application context used to copy database credentialspublic void close()
close in interface TopiaServiceCopyright © 2004–2018 CodeLutin. All rights reserved.