@ThreadSafe public class SystemMigrationManager extends AbstractSimpleDAO
IDAO.EMode| Modifier and Type | Field and Description |
|---|---|
static com.helger.commons.type.ObjectType |
OT_SYSTEM_MIGRATION_RESULT |
DEFAULT_AUTO_SAVE_ENABLED, m_aRWLock| Constructor and Description |
|---|
SystemMigrationManager(String sFilename) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMigrationResult(SystemMigrationResult aMigrationResult) |
void |
addMigrationResultError(String sMigrationID,
String sErrorMsg)
Mark the specified migration as failed.
|
void |
addMigrationResultSuccess(String sMigrationID)
Mark the specified migration as success.
|
protected com.helger.xml.microdom.IMicroDocument |
createWriteData()
Create the XML document that should be saved to the file.
|
com.helger.commons.collection.ext.ICommonsList<SystemMigrationResult> |
getAllFailedMigrationResults(String sMigrationID) |
com.helger.commons.collection.ext.ICommonsSet<String> |
getAllMigrationIDs() |
com.helger.commons.collection.ext.ICommonsList<SystemMigrationResult> |
getAllMigrationResults(String sMigrationID) |
com.helger.commons.collection.ext.ICommonsList<SystemMigrationResult> |
getAllMigrationResultsFlattened() |
protected com.helger.commons.state.EChange |
onRead(com.helger.xml.microdom.IMicroDocument aDoc)
Fill the internal structures with from the passed XML document.
|
void |
performMigrationIfNecessary(String sMigrationID,
Runnable aMigrationAction)
Perform a migration if it was not performed yet.
|
void |
performMigrationIfNecessary(String sMigrationID,
Supplier<com.helger.commons.state.SuccessWithValue<String>> aMigrationAction)
Perform a migration if it was not performed yet.
|
String |
toString() |
boolean |
wasMigrationExecutedSuccessfully(String sMigrationID) |
beforeWriteToFile, getDAOIO, getFilenameProvider, getInitCount, getLastFilename, getLastInitDateTime, getLastReadDateTime, getLastWriteDateTime, getReadCount, getSafeFile, getWriteCount, getXMLWriterSettings, initialRead, markAsChanged, modifyWriteData, onFilenameChange, onInit, triggerExceptionHandlersRead, triggerExceptionHandlersWrite, writeToFileOnPendingChangesbeginWithoutAutoSave, endWithoutAutoSave, getExceptionHandlersRead, getExceptionHandlersWrite, hasPendingChanges, internalHasPendingChanges, internalIsAutoSaveEnabled, internalSetPendingChanges, isAutoSaveEnabled, isDebugLogging, performWithoutAutoSave, performWithoutAutoSave, performWithoutAutoSaveThrowing, performWithoutAutoSaveThrowingpublic static final com.helger.commons.type.ObjectType OT_SYSTEM_MIGRATION_RESULT
public SystemMigrationManager(@Nullable String sFilename) throws DAOException
DAOExceptionprotected com.helger.commons.state.EChange onRead(com.helger.xml.microdom.IMicroDocument aDoc)
AbstractSimpleDAOonRead in class AbstractSimpleDAOaDoc - The XML document to read from. Never null.EChange.CHANGED if reading the data changed something in
the internal structures that requires a writing.protected com.helger.xml.microdom.IMicroDocument createWriteData()
AbstractSimpleDAOcreateWriteData in class AbstractSimpleDAOnull document to write to the file.public void addMigrationResult(@Nonnull SystemMigrationResult aMigrationResult)
public void addMigrationResultSuccess(@Nonnull @Nonempty String sMigrationID)
sMigrationID - The migration ID to be added. May neither be null nor
empty.public void addMigrationResultError(@Nonnull @Nonempty String sMigrationID, @Nonnull String sErrorMsg)
sMigrationID - The migration ID to be added. May neither be null nor
empty.sErrorMsg - The error message. May not be null.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsList<SystemMigrationResult> getAllMigrationResults(@Nullable String sMigrationID)
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsList<SystemMigrationResult> getAllMigrationResultsFlattened()
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsList<SystemMigrationResult> getAllFailedMigrationResults(@Nullable String sMigrationID)
public boolean wasMigrationExecutedSuccessfully(@Nullable String sMigrationID)
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsSet<String> getAllMigrationIDs()
public void performMigrationIfNecessary(@Nonnull @Nonempty String sMigrationID, @Nonnull Runnable aMigrationAction)
sMigrationID - The migration ID to handle. May neither be null nor
empty.aMigrationAction - The action to be performed. May not be null.public void performMigrationIfNecessary(@Nonnull @Nonempty String sMigrationID, @Nonnull Supplier<com.helger.commons.state.SuccessWithValue<String>> aMigrationAction)
sMigrationID - The migration ID to handle. May neither be null nor
empty.aMigrationAction - The action to be performed. May not be null.public String toString()
toString in class AbstractSimpleDAOCopyright © 2014–2017 Philip Helger. All rights reserved.