Search in sources :

Example 11 with ActionTO

use of org.syncany.plugins.transfer.to.ActionTO in project syncany by syncany.

the class RemoteTransaction method gatherTransactionStats.

/**
 * This method gathers the total number of files and size that is to be uploaded.
 *
 * This is used in displays to the user.
 */
private TransactionStats gatherTransactionStats() {
    TransactionStats stats = new TransactionStats();
    for (ActionTO action : transactionTO.getActions()) {
        if (action.getType().equals(ActionType.UPLOAD)) {
            if (action.getStatus().equals(ActionStatus.UNSTARTED)) {
                stats.totalUploadFileCount++;
                stats.totalUploadSize += action.getLocalTempLocation().length();
            }
        }
    }
    return stats;
}
Also used : ActionTO(org.syncany.plugins.transfer.to.ActionTO)

Example 12 with ActionTO

use of org.syncany.plugins.transfer.to.ActionTO in project syncany by syncany.

the class RemoteTransaction method upload.

/**
 * Adds a file to this transaction. Generates a temporary file to store it.
 */
public void upload(File localFile, RemoteFile remoteFile) throws StorageException {
    TempRemoteFile temporaryRemoteFile = new TempRemoteFile(remoteFile);
    logger.log(Level.INFO, "- Adding file to TX for UPLOAD: " + localFile + " -> Temp. remote file: " + temporaryRemoteFile + ", final location: " + remoteFile);
    ActionTO action = new ActionTO();
    action.setType(ActionType.UPLOAD);
    action.setLocalTempLocation(localFile);
    action.setRemoteLocation(remoteFile);
    action.setRemoteTempLocation(temporaryRemoteFile);
    transactionTO.addAction(action);
}
Also used : TempRemoteFile(org.syncany.plugins.transfer.files.TempRemoteFile) ActionTO(org.syncany.plugins.transfer.to.ActionTO)

Aggregations

ActionTO (org.syncany.plugins.transfer.to.ActionTO)12 TempRemoteFile (org.syncany.plugins.transfer.files.TempRemoteFile)7 TransactionRemoteFile (org.syncany.plugins.transfer.files.TransactionRemoteFile)7 TransactionTO (org.syncany.plugins.transfer.to.TransactionTO)5 RemoteFile (org.syncany.plugins.transfer.files.RemoteFile)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 HashSet (java.util.HashSet)1 UpUploadFileInTransactionSyncExternalEvent (org.syncany.operations.daemon.messages.UpUploadFileInTransactionSyncExternalEvent)1 BlockingTransfersException (org.syncany.operations.up.BlockingTransfersException)1 RemoteTransaction (org.syncany.plugins.transfer.RemoteTransaction)1 StorageException (org.syncany.plugins.transfer.StorageException)1 StorageFileNotFoundException (org.syncany.plugins.transfer.StorageFileNotFoundException)1 StorageMoveException (org.syncany.plugins.transfer.StorageMoveException)1 DatabaseRemoteFile (org.syncany.plugins.transfer.files.DatabaseRemoteFile)1 MultichunkRemoteFile (org.syncany.plugins.transfer.files.MultichunkRemoteFile)1