Package org.syncany.plugins.transfer.files

Examples of org.syncany.plugins.transfer.files.TempRemoteFile


   */
  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());
View Full Code Here


  /**
   * 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();
View Full Code Here

  /**
   * Adds the deletion of a file to this transaction. Generates a temporary file
   * to store it while the transaction is being finalized.
   */
  public void delete(RemoteFile remoteFile) throws StorageException {
    TempRemoteFile temporaryRemoteFile = new TempRemoteFile(remoteFile);

    logger.log(Level.INFO, "- Adding file to TX for DELETE: " + remoteFile + "-> Temp. remote file: " + temporaryRemoteFile);

    ActionTO action = new ActionTO();
    action.setType(ActionTO.TYPE_DELETE);
View Full Code Here

TOP

Related Classes of org.syncany.plugins.transfer.files.TempRemoteFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.