public class DBVersionControl extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
APPLIED_VERSION_CONSISTENCY_HANDLER_FIELD |
static String |
DB_CONVERTER_PACKAGE_NAME |
protected org.slf4j.Logger |
logger |
static String |
VERSION_FIELD |
static String |
VERSION_FILE_NAME |
static String |
VERSION_FILE_WARNING |
| Constructor and Description |
|---|
DBVersionControl(String entryType,
FileProvider entryFileProvider,
Package converterPackage,
File databaseDirectory) |
DBVersionControl(String entryType,
FileProvider entryFileProvider,
Package converterPackage,
File databaseDirectory,
Writable databaseWriteAccess) |
| Modifier and Type | Method and Description |
|---|---|
int |
detectAndUpgradeCurrentDBVersion()
Method detects the current db version and returns the version number as integer.
|
int |
detectCurrentDBVersion(File databaseDirectory)
Method detects the current db version of the given database.
|
Set<String> |
detectExecutedVersionConsistencyHandler()
Method detects the already executed version consistency handler which are registered within the db version file.
|
String |
formatEntryToHumanReadableString(com.google.gson.JsonObject jsonEntry) |
Package |
getConverterPackage() |
List<DBVersionConverter> |
getConverterPipeline() |
File |
getDatabaseDirectory() |
List<DBVersionConverter> |
getDBConverterPipeline(int currentVersion,
int targetVersion)
Method returns a db entry converter pipeline which supports the db entry version conversion from the current to the target version.
|
FileProvider |
getEntryFileProvider() |
int |
getLatestDBVersion() |
List<ConsistencyHandler> |
loadDBVersionConsistencyHandlers(FileSynchronizedRegistry registry)
Loads a consistency handler list which is used for consistency reconstruction after a db upgrade.
|
void |
registerConsistencyHandlerExecution(ConsistencyHandler versionConsistencyHandler)
Method upgrades the applied db version consistency handler list of the version file.
|
void |
storeEntry(String entryAsString,
File entryFile) |
void |
upgradeCurrentDBVersion()
Method upgrades the current db version to the latest db version.
|
void |
upgradeDB(int currentVersion,
int targetVersion) |
com.google.gson.JsonObject |
upgradeDBEntry(com.google.gson.JsonObject entry,
DBVersionConverter converter,
Map<File,com.google.gson.JsonObject> dbSnapshot,
Map<String,Map<File,DatabaseEntryDescriptor>> globalDbSnapshots) |
void |
validateAndUpgradeDBVersion() |
public static final String VERSION_FILE_NAME
public static final String VERSION_FIELD
public static final String DB_CONVERTER_PACKAGE_NAME
public static final String APPLIED_VERSION_CONSISTENCY_HANDLER_FIELD
public static final String VERSION_FILE_WARNING
protected final org.slf4j.Logger logger
public DBVersionControl(String entryType, FileProvider entryFileProvider, Package converterPackage, File databaseDirectory, Writable databaseWriteAccess) throws InstantiationException
InstantiationExceptionpublic DBVersionControl(String entryType, FileProvider entryFileProvider, Package converterPackage, File databaseDirectory) throws InstantiationException
InstantiationExceptionpublic void validateAndUpgradeDBVersion()
throws CouldNotPerformException
CouldNotPerformExceptionpublic void upgradeDB(int currentVersion,
int targetVersion)
throws CouldNotPerformException
CouldNotPerformExceptionpublic com.google.gson.JsonObject upgradeDBEntry(com.google.gson.JsonObject entry,
DBVersionConverter converter,
Map<File,com.google.gson.JsonObject> dbSnapshot,
Map<String,Map<File,DatabaseEntryDescriptor>> globalDbSnapshots)
throws CouldNotPerformException
CouldNotPerformExceptionpublic String formatEntryToHumanReadableString(com.google.gson.JsonObject jsonEntry) throws CouldNotPerformException
jsonEntry - CouldNotPerformExceptionpublic void storeEntry(String entryAsString, File entryFile) throws CouldNotPerformException
CouldNotPerformExceptionpublic int getLatestDBVersion()
public int detectCurrentDBVersion(File databaseDirectory) throws CouldNotPerformException
databaseDirectory - CouldNotPerformExceptionpublic int detectAndUpgradeCurrentDBVersion()
throws CouldNotPerformException
CouldNotPerformExceptionpublic void upgradeCurrentDBVersion()
throws CouldNotPerformException
CouldNotPerformExceptionpublic List<DBVersionConverter> getDBConverterPipeline(int currentVersion, int targetVersion) throws CouldNotPerformException
currentVersion - targetVersion - CouldNotPerformExceptionpublic List<ConsistencyHandler> loadDBVersionConsistencyHandlers(FileSynchronizedRegistry registry) throws CouldNotPerformException
registry - CouldNotPerformExceptionpublic void registerConsistencyHandlerExecution(ConsistencyHandler versionConsistencyHandler) throws CouldNotPerformException
versionConsistencyHandler - CouldNotPerformExceptionpublic Set<String> detectExecutedVersionConsistencyHandler() throws CouldNotPerformException
CouldNotPerformExceptionpublic Package getConverterPackage()
public List<DBVersionConverter> getConverterPipeline()
public FileProvider getEntryFileProvider()
public File getDatabaseDirectory()
Copyright © 2015–2018 openbase.org. All rights reserved.