com.xpn.xwiki.store.migration.hibernate
Class AbstractHibernateDataMigration

java.lang.Object
  extended by com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration
All Implemented Interfaces:
DataMigration, HibernateDataMigration
Direct Known Subclasses:
LegacyDataMigration, R15428XWIKI2977DataMigration, R35100XWIKI7564DataMigration, R35101XWIKI7645DataMigration, R35102XWIKI7771DataMigration, R40000XWIKI6990DataMigration, R42000XWIKI7726DataMigration, R43000XWIKI6691DataMigration, R4340XWIKI883DataMigration, R4359XWIKI1459DataMigration, R6079XWIKI1878DataMigration, R7350XWIKI2079DataMigration

public abstract class AbstractHibernateDataMigration
extends Object
implements HibernateDataMigration

Template for data migration of hibernate store.

Since:
3.4M1
Version:
$Id: e27251311336ce87185e7029859064f9936492f9 $
See Also:
DataMigration

Field Summary
protected  org.xwiki.component.manager.ComponentManager componentManager
          Component manager used to access stores.
 
Constructor Summary
AbstractHibernateDataMigration()
           
 
Method Summary
 String getLiquibaseChangeLog()
           
 String getName()
           
 String getPreHibernateLiquibaseChangeLog()
           
protected  XWikiHibernateBaseStore getStore()
           
protected  XWikiContext getXWikiContext()
           
protected abstract  void hibernateMigrate()
          Execute the migration itself.
 void migrate()
          Run migration.
 boolean shouldExecute(XWikiDBVersion startupVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.xpn.xwiki.store.migration.DataMigration
getDescription, getVersion
 

Field Detail

componentManager

@Inject
protected org.xwiki.component.manager.ComponentManager componentManager
Component manager used to access stores.

Constructor Detail

AbstractHibernateDataMigration

public AbstractHibernateDataMigration()
Method Detail

getXWikiContext

protected XWikiContext getXWikiContext()
Returns:
XWikiContext to access the store

getStore

protected XWikiHibernateBaseStore getStore()
                                    throws DataMigrationException
Returns:
store system for execute store-specific actions.
Throws:
DataMigrationException - if the store could not be reached

getName

public String getName()
Specified by:
getName in interface DataMigration
Returns:
the data migration hint. For example "R4340XWIKI883".

shouldExecute

public boolean shouldExecute(XWikiDBVersion startupVersion)
Specified by:
shouldExecute in interface DataMigration
Parameters:
startupVersion - the database version when the migration process starts (before any dataMigration is applied). This is useful for data migration which need to run only when the database is in a certain version.
Returns:
true if the migration should be executed or false otherwise

hibernateMigrate

protected abstract void hibernateMigrate()
                                  throws DataMigrationException,
                                         XWikiException
Execute the migration itself.

Throws:
DataMigrationException - on migration error.
XWikiException - on error from the store.

migrate

public void migrate()
             throws DataMigrationException
Description copied from interface: DataMigration
Run migration.

Specified by:
migrate in interface DataMigration
Throws:
DataMigrationException - if any error

getPreHibernateLiquibaseChangeLog

public String getPreHibernateLiquibaseChangeLog()
                                         throws DataMigrationException
Specified by:
getPreHibernateLiquibaseChangeLog in interface HibernateDataMigration
Returns:
some liquibase changelogs for refactoring the database before the hibernate schema update is processed
Throws:
DataMigrationException - on error

getLiquibaseChangeLog

public String getLiquibaseChangeLog()
                             throws DataMigrationException
Specified by:
getLiquibaseChangeLog in interface HibernateDataMigration
Returns:
some liquibase changelogs for refactoring the database after the hibernate schema update has been processed
Throws:
DataMigrationException - on error


Copyright © 2004-2013 XWiki. All Rights Reserved.