|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.floggy.persistence.migration.MigrationManager
public abstract class MigrationManager
A class that helps the developer migrate from a previous version of its
application to a new version.
The general use of it follows:
MigrationManager manager = MigrationManager.getInstance();
* String[] notMigratedClasses = manager.getNotMigratedClasses();
*
* for (int i = 0; i < notMigratedClasses.length; i++) {
*
* if (notMigratedClasses[i].equals("net.sourceforge.floggy.Person")) {
* //does a quickMigration because the classes didn't changed
between versions
* manager.quickMigration(Class.forName(notMigratedClasses[i]));
* }
*
* if (notMigratedClasses[i].equals("net.sourceforge.floggy.Phone")) {
* Enumeration enumeration =
manager.start(Class.forName(notMigratedClasses[i]), null);
* while (enumeration.hasMoreElements()) {
* Hashtable fields = enumeration.nextElement();
* Integer countryCode = fields.get("countryCode");
* if (countryCode == null) {
* enumeration.delete();
* } else {
* Phone phone = new Phone();
* phone.setNumber(fields.get("number"));
* phone.setType(Phone.GENERAL);
* enumeration.update(phone);
* }
* }
* }
* }
| Field Summary | |
|---|---|
static String |
ITERATION_MODE
It enables the developer to iterate over all registers without update or delete it. |
static String |
LAZY_LOAD
It drives the migration avoiding or not the loading of Persistable fields |
static String |
MIGRATE_FROM_PREVIOUS_1_3_0_VERSION
It enables the developer to migrate from a version earlier than 1.3.0 |
| Constructor Summary | |
|---|---|
MigrationManager()
|
|
| Method Summary | |
|---|---|
abstract void |
finish(Class persistableClass)
Finish the whole migration process. |
static MigrationManager |
getInstance()
Returns the current instance of PersistableManager. |
abstract String[] |
getNotMigratedClasses()
Retrieves a list with all classes that needs to be migrated. |
abstract void |
quickMigration(Class persistableClass)
Execute a quick migration in classes that didn't changed between versions. |
abstract Enumeration |
start(Class persistableClass,
Hashtable properties)
Start the migration process of the given Persistable class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ITERATION_MODE
public static final String LAZY_LOAD
public static final String MIGRATE_FROM_PREVIOUS_1_3_0_VERSION
| Constructor Detail |
|---|
public MigrationManager()
| Method Detail |
|---|
public static MigrationManager getInstance()
RuntimeException - DOCUMENT ME!
public abstract void finish(Class persistableClass)
throws FloggyException
persistableClass - The Persistable being migrated.
FloggyException - If the enumeration wasn't whole processed.public abstract String[] getNotMigratedClasses()
public abstract void quickMigration(Class persistableClass)
throws FloggyException
persistableClass - The Persistable being migrated.
FloggyException - A exception that holds the underling problem.
public abstract Enumeration start(Class persistableClass,
Hashtable properties)
throws FloggyException
persistableClass - The Persistable being migrated.properties - A list of properties that will driven the migration.
FloggyException - A exception that holds the underling problem.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||