use of org.syncany.plugins.transfer.files.RemoteFile in project syncany by syncany.
the class PathAwareFeatureTransferManager method delete.
@Override
public boolean delete(final RemoteFile remoteFile) throws StorageException {
RemoteFile pathAwareRemoteFile = createPathAwareRemoteFile(remoteFile);
boolean fileDeleted = underlyingTransferManager.delete(pathAwareRemoteFile);
boolean folderDeleted = removeFolder(pathAwareRemoteFile);
return fileDeleted && folderDeleted;
}
use of org.syncany.plugins.transfer.files.RemoteFile in project syncany by syncany.
the class RemoteTransaction method deleteTempRemoteFiles.
/**
* This method deletes the temporary remote files that were the result of deleted files.
*
* Actually deleting remote files is done after finishing the transaction, because
* it cannot be rolled back! If this fails, the temporary files will eventually
* be cleaned up by Cleanup and download will not download these, because
* they are not in any transaction file.
*/
private void deleteTempRemoteFiles() throws StorageException {
boolean success = true;
for (ActionTO action : transactionTO.getActions()) {
if (action.getStatus().equals(ActionStatus.STARTED)) {
// If we are resuming, this action has not been comopleted.
if (action.getType().equals(ActionType.DELETE)) {
RemoteFile tempRemoteFile = action.getTempRemoteFile();
logger.log(Level.INFO, "- Deleting temp. file {0} ...", new Object[] { tempRemoteFile });
try {
transferManager.delete(tempRemoteFile);
} catch (Exception e) {
logger.log(Level.INFO, "Failed to delete: " + tempRemoteFile, " because of: " + e);
success = false;
}
action.setStatus(ActionStatus.DONE);
}
}
}
if (success) {
logger.log(Level.INFO, "END of TX.delTemp(): Sucessfully deleted final files.");
} else {
logger.log(Level.INFO, "END of TX.delTemp(): Did not succesfully delete all files!");
}
}
use of org.syncany.plugins.transfer.files.RemoteFile in project syncany by syncany.
the class AbstractTransferManagerTest method cleanTestLocation.
private void cleanTestLocation(TransferManager transferManager) throws StorageException {
Map<String, RemoteFile> normalFiles = transferManager.list(RemoteFile.class);
Map<String, DatabaseRemoteFile> databaseFiles = transferManager.list(DatabaseRemoteFile.class);
Map<String, MultichunkRemoteFile> multiChunkFiles = transferManager.list(MultichunkRemoteFile.class);
for (RemoteFile remoteFile : normalFiles.values()) {
transferManager.delete(remoteFile);
}
for (RemoteFile remoteFile : databaseFiles.values()) {
transferManager.delete(remoteFile);
}
for (RemoteFile remoteFile : multiChunkFiles.values()) {
transferManager.delete(remoteFile);
}
}
Aggregations