Class TopiaMigrationServiceContext
- java.lang.Object
-
- org.nuiton.topia.service.migration.TopiaMigrationServiceContext
-
public class TopiaMigrationServiceContext extends Object
Contains all states of the migration service.Created by tchemit on 05/05/2018.
- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Field Summary
Fields Modifier and Type Field Description protected TopiaMigrationServiceConfigurationconfigurationService configuration.protected TMSVersionHibernateDaodaoDao.protected booleandbNotVersionedIs database is versioned?protected io.ultreia.java4all.util.VersiondbVersionCurrent database version.protected MigrationVersionResourceProviderresourcesAvailable migration resources found in class-path.protected PathscriptPathPath where to store sql scripts.protected booleanversionTableExistIs TMSVersion table exists?
-
Constructor Summary
Constructors Modifier Constructor Description protectedTopiaMigrationServiceContext(TopiaMigrationServiceConfiguration configuration, boolean versionTableExist, boolean dbNotVersioned, io.ultreia.java4all.util.Version dbVersion, MigrationVersionResourceProvider resources, TMSVersionHibernateDao dao)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateSchemaIfNotExist()Optional<TopiaMigrationServiceAskUserToMigrate>getAskUserToMigrate()io.ultreia.java4all.util.VersiongetDbVersion()io.ultreia.java4all.util.VersiongetModelVersion()MigrationVersionResourcegetResource(io.ultreia.java4all.util.Version version)MigrationVersionResourceProvidergetResources()PathgetScriptPath()booleanisDbNotVersioned()booleanisVersionTableExist()TopiaMigrationServiceExecutornewExecutor(MigrationVersionResource migrationVersionResource, TopiaSqlSupport sqlSupport)org.hibernate.SessionFactorynewSessionFactory()static TopiaMigrationServiceContextof(TopiaMigrationServiceConfiguration configuration)voidsaveModelVersion()protected voidsaveVersion(io.ultreia.java4all.util.Version version)
-
-
-
Field Detail
-
configuration
protected final TopiaMigrationServiceConfiguration configuration
Service configuration.
-
dao
protected final TMSVersionHibernateDao dao
Dao.
-
resources
protected final MigrationVersionResourceProvider resources
Available migration resources found in class-path.
-
dbNotVersioned
protected final boolean dbNotVersioned
Is database is versioned?
-
scriptPath
protected final Path scriptPath
Path where to store sql scripts.
-
versionTableExist
protected boolean versionTableExist
Is TMSVersion table exists?
-
dbVersion
protected io.ultreia.java4all.util.Version dbVersion
Current database version.
-
-
Constructor Detail
-
TopiaMigrationServiceContext
protected TopiaMigrationServiceContext(TopiaMigrationServiceConfiguration configuration, boolean versionTableExist, boolean dbNotVersioned, io.ultreia.java4all.util.Version dbVersion, MigrationVersionResourceProvider resources, TMSVersionHibernateDao dao)
-
-
Method Detail
-
of
public static TopiaMigrationServiceContext of(TopiaMigrationServiceConfiguration configuration)
-
getScriptPath
public Path getScriptPath()
-
isVersionTableExist
public boolean isVersionTableExist()
-
isDbNotVersioned
public boolean isDbNotVersioned()
-
getModelVersion
public io.ultreia.java4all.util.Version getModelVersion()
-
getDbVersion
public io.ultreia.java4all.util.Version getDbVersion()
-
getResources
public MigrationVersionResourceProvider getResources()
-
createSchemaIfNotExist
public void createSchemaIfNotExist()
-
saveModelVersion
public void saveModelVersion()
-
getAskUserToMigrate
public Optional<TopiaMigrationServiceAskUserToMigrate> getAskUserToMigrate()
-
saveVersion
protected void saveVersion(io.ultreia.java4all.util.Version version)
-
newSessionFactory
public org.hibernate.SessionFactory newSessionFactory()
-
getResource
public MigrationVersionResource getResource(io.ultreia.java4all.util.Version version)
-
newExecutor
public TopiaMigrationServiceExecutor newExecutor(MigrationVersionResource migrationVersionResource, TopiaSqlSupport sqlSupport)
-
-