public abstract class DatabaseUpdater extends Object
Since the updater is run as a part of the startup process, implementors have to make sure that the individual changes to the schema or content are not run again if they have already been executed before.
Constructor and Description |
---|
DatabaseUpdater() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doExecute(DatabaseUpdateType updateType)
Will be invoked by
execute(DatabaseUpdateType) to do the actual update. |
void |
execute(DatabaseUpdateType updateType)
Execute the given update.
|
boolean |
skipUpdates()
Return whether updates should be skipped.
|
void |
updateDatabase()
Executes the first and second pass updates if updates should not be skipped.
|
abstract boolean |
updaterRunBefore()
Returns whether the updater run at least once against the database.
|
boolean |
updateRunInSession(DatabaseUpdateType updateType)
Return whether this updater has run the given update after this instance was created.
|
protected abstract void doExecute(DatabaseUpdateType updateType) throws DatabaseUpdateException
execute(DatabaseUpdateType)
to do the actual update.updateType
- the type of update that should be executedDatabaseUpdateException
- in case of an error database update errorpublic void execute(DatabaseUpdateType updateType) throws DatabaseUpdateException
updateType
- the type of update that should be executedDatabaseUpdateException
- in case of an error database update errorpublic boolean skipUpdates()
public void updateDatabase() throws DatabaseUpdateException
DatabaseUpdateException
public abstract boolean updaterRunBefore()
public boolean updateRunInSession(DatabaseUpdateType updateType)
updateType
- the update type to check for having been runCopyright © 2019 Communote team. All rights reserved.