+ fileForStorableBackup.getFile().getName();
/*
* need some files maintenance
*/
LOGGER.fatal(message);
throw new HeapException(message, EnumFileState.STATE_UNSTABLE);
} else if (backupFlagExists && !backupExists) {
final String message = "data flag " + stateOkFlagFile.getName()
+ " exists but missing data file "
+ fileForStorable.getFile().getName();
/*
* need some files maintenance
*/
LOGGER.fatal(message);
throw new HeapException(message, EnumFileState.STATE_UNSTABLE);
} else if (globalFlagExists) {
/*
* global flag exists
*/
if (dataFlagExists && backupFlagExists) {
/*
* data and backup file in stable state
*/
LOGGER.info(FILES_IN_STABLE_STATE);
} else {
/*
* flag file inconsistency, data and backup flag file must
* exists if global flag file exist
*/
/*
* may be first time case when there is no file present
*/
inconsistencyCheck(backupExists, dataExists);
}
restored = false;
} else {
try {
/*
* global flag do not exists
*/
if (dataFlagExists && backupFlagExists) {
/*
* backup file may not be up to date, create it from
* data file
*/
HELPER_FILE_UTIL.copyFile(fileForStorable.getFile(),
fileForStorableBackup.getFile());
LOGGER.warn(BACKUP_FILE_NOT_IN_STABLE_STATE_RESTORED);
restored = true;
} else if (!dataFlagExists && backupFlagExists) {
/*
* data file not in stable state
*/
/*
* since backup file in stable state, create data file
* from backup file
*/
HELPER_FILE_UTIL.copyFile(
fileForStorableBackup.getFile(),
fileForStorable.getFile());
LOGGER.warn(DATA_FILE_NOT_IN_STABLE_STATE_RESTORED);
restored = true;
dataLost = true;
} else if (dataFlagExists && !backupFlagExists) {
/*
* backup file not in stable state, create it from data
* file
*/
HELPER_FILE_UTIL.copyFile(fileForStorable.getFile(),
fileForStorableBackup.getFile());
LOGGER.warn(BACKUP_FILE_NOT_IN_STABLE_STATE_RESTORED);
restored = true;
} else {
/*
* flag file inconsistency, one of data and backup flag
* file must exists if global flag file not exist
*/
/*
* may be first time case when there is no file present
*/
inconsistencyCheck(backupExists, dataExists);
restored = false;
}
} catch (FileIOException exception) {
throw new HeapException(exception);
}
}
} else {
restored = false;
}