*/
private void downloadDeletedTempFileInTransaction(RemoteFile remoteFile, File localFile) throws StorageException {
logger.log(Level.INFO, "File {0} not found, checking if it is being deleted ...", remoteFile.getName());
Set<TransactionTO> transactions = retrieveRemoteTransactions().keySet();
TempRemoteFile tempRemoteFile = null;
// Find file: If the file is being deleted and the name matches, download temporary file instead.
for (TransactionTO transaction : transactions) {
for (ActionTO action : transaction.getActions()) {
if (action.getType().equals(ActionTO.TYPE_DELETE) && action.getRemoteFile().equals(remoteFile)) {
tempRemoteFile = action.getTempRemoteFile();
break;
}
}
}
// Download file, or throw exception
if (tempRemoteFile != null) {
logger.log(Level.INFO, "-> File {0} in process of being deleted; downloading corresponding temp. file {1} ...",
new Object[] { remoteFile.getName(), tempRemoteFile.getName() });
underlyingTransferManager.download(tempRemoteFile, localFile);
}
else {
logger.log(Level.WARNING, "-> File {0} does not exist and is not in any transaction. Throwing exception.", remoteFile.getName());