public abstract class AbstractDataMigrationManager extends Object implements DataMigrationManager, org.xwiki.component.phase.Initializable
DataMigrationManager
.Modifier and Type | Class and Description |
---|---|
protected class |
AbstractDataMigrationManager.XWikiMigration
Internal class used to find out the data migration that are being forced in the XWiki configuration file.
|
Modifier and Type | Field and Description |
---|---|
protected org.xwiki.component.manager.ComponentManager |
componentManager
Component manager used to access stores and data migrations.
|
protected com.xpn.xwiki.internal.store.hibernate.HibernateConfiguration |
hibernateConfiguration |
protected org.slf4j.Logger |
logger
Logger.
|
protected Collection<AbstractDataMigrationManager.XWikiMigration> |
migrations
Ordered list of migrators that may be applied.
|
protected org.xwiki.observation.ObservationManager |
observationManager
Component manager used to access stores and data migrations.
|
protected org.xwiki.job.event.status.JobProgressManager |
progress |
Constructor and Description |
---|
AbstractDataMigrationManager()
Unified constructor for all subclasses.
|
Modifier and Type | Method and Description |
---|---|
void |
checkDatabase()
Check current database version and proceed to migrations.
|
protected abstract List<? extends DataMigration> |
getAllMigrations() |
DataMigrationStatus |
getDataMigrationStatus() |
XWikiDBVersion |
getDBVersion() |
protected XWikiDBVersion |
getDBVersionFromConfig()
read data version from xwiki.cfg.
|
protected XWikiDBVersion |
getDBVersionFromDatabase()
Read data version from database.
|
protected Map<XWikiDBVersion,AbstractDataMigrationManager.XWikiMigration> |
getForcedMigrations() |
XWikiDBVersion |
getLatestVersion() |
protected String |
getMainXWiki() |
protected Collection<AbstractDataMigrationManager.XWikiMigration> |
getNeededMigrations() |
protected List<String> |
getVirtualWikisDatabaseNames()
Deprecated.
|
protected XWikiConfig |
getXWikiConfig()
Deprecated.
|
protected XWikiContext |
getXWikiContext() |
void |
initialize() |
protected abstract void |
initializeEmptyDB() |
void |
initNewDB()
Setup the schema of a new DB and set it to the latest version (not running migrations).
|
protected boolean |
isVirtualMode()
Deprecated.
Virtual mode is on by default, starting with XWiki 5.0M2.
|
protected void |
setDBVersion(XWikiDBVersion version)
Update database version and status cache (not after a migration, use updateMigrationStatus).
|
protected abstract void |
setDBVersionToDatabase(XWikiDBVersion version) |
protected void |
startMigrations()
Start the migration process.
|
protected void |
startMigrations(Collection<AbstractDataMigrationManager.XWikiMigration> migrations) |
protected abstract void |
updateSchema(Collection<AbstractDataMigrationManager.XWikiMigration> migrations)
Update database schema to the latest structure.
|
@Inject protected org.xwiki.component.manager.ComponentManager componentManager
@Inject protected org.xwiki.observation.ObservationManager observationManager
@Inject protected org.xwiki.job.event.status.JobProgressManager progress
@Inject protected com.xpn.xwiki.internal.store.hibernate.HibernateConfiguration hibernateConfiguration
protected Collection<AbstractDataMigrationManager.XWikiMigration> migrations
@Inject protected org.slf4j.Logger logger
public AbstractDataMigrationManager()
protected XWikiContext getXWikiContext()
@Deprecated protected XWikiConfig getXWikiConfig()
@Deprecated protected boolean isVirtualMode()
@Deprecated protected List<String> getVirtualWikisDatabaseNames() throws DataMigrationException
DataMigrationException
- on errorprotected String getMainXWiki()
public void initialize() throws org.xwiki.component.phase.InitializationException
initialize
in interface org.xwiki.component.phase.Initializable
org.xwiki.component.phase.InitializationException
protected XWikiDBVersion getDBVersionFromConfig()
protected XWikiDBVersion getDBVersionFromDatabase() throws DataMigrationException
DataMigrationException
- in case of an unexpected errorpublic final XWikiDBVersion getDBVersion() throws DataMigrationException
getDBVersion
in interface DataMigrationManager
DataMigrationException
- if any errorpublic DataMigrationStatus getDataMigrationStatus() throws DataMigrationException
getDataMigrationStatus
in interface DataMigrationManager
DataMigrationException
- if any errorpublic final XWikiDBVersion getLatestVersion()
getLatestVersion
in interface DataMigrationManager
public void initNewDB() throws DataMigrationException
DataMigrationManager
initNewDB
in interface DataMigrationManager
DataMigrationException
- if any errorprotected abstract void initializeEmptyDB() throws DataMigrationException
DataMigrationException
- if any errorprotected abstract void setDBVersionToDatabase(XWikiDBVersion version) throws DataMigrationException
version
- to setDataMigrationException
- if any errorprotected final void setDBVersion(XWikiDBVersion version) throws DataMigrationException
version
- database version to be storedDataMigrationException
- if any errorprotected abstract void updateSchema(Collection<AbstractDataMigrationManager.XWikiMigration> migrations) throws DataMigrationException
migrations
- the migration that will be executed (since 4.0M1)DataMigrationException
- if any errorpublic void checkDatabase() throws MigrationRequiredException, DataMigrationException
DataMigrationManager
checkDatabase
in interface DataMigrationManager
MigrationRequiredException
- when version is incompatible with current versionDataMigrationException
- when an error occurs during check.protected void startMigrations() throws DataMigrationException
DataMigrationException
- in case of any errorprotected Collection<AbstractDataMigrationManager.XWikiMigration> getNeededMigrations() throws DataMigrationException
DataMigration
in ascending order, which need be executed.DataMigrationException
- if any errorprotected Map<XWikiDBVersion,AbstractDataMigrationManager.XWikiMigration> getForcedMigrations() throws DataMigrationException
DataMigration
for this managerDataMigrationException
- id any errorprotected void startMigrations(Collection<AbstractDataMigrationManager.XWikiMigration> migrations) throws DataMigrationException
migrations
- - run this migrations in order of collectionDataMigrationException
- if any errorprotected abstract List<? extends DataMigration> getAllMigrations() throws DataMigrationException
DataMigration
for this managerDataMigrationException
- if any errorCopyright © 2004–2022 XWiki. All rights reserved.