Package org.syncany.operations.down.actions

Examples of org.syncany.operations.down.actions.FileSystemAction


 
  private String[] toArray(List<FileSystemAction> actions) {
    String[] actionStrArr = new String[actions.size()];
   
    for (int i=0; i<actions.size(); i++) {
      FileSystemAction action = actions.get(i);
     
      actionStrArr[i] =
          action.getClass().getSimpleName()
        + ","
        + actions.get(i).getFile2().getPath()
        + ","
        + actions.get(i).getType();
     
View Full Code Here


   
    if (winningFileToVersionComparison.equals()) {
      logger.log(Level.INFO, "     -> (1) Equals: Nothing to do, winning version equals winning file: "+winningLastVersion+" AND "+winningLastFile)
    }
    else if (winningFileToVersionComparison.getFileChanges().contains(FileChange.DELETED)) {         
      FileSystemAction action = new NewFileSystemAction(config, winningLastVersion, winnersDatabase);
      outFileSystemActions.add(action);
     
      logger.log(Level.INFO, "     -> (2) Deleted: Local file does NOT exist, but it should, winning version not known: "+winningLastVersion+" AND "+winningLastFile);
      logger.log(Level.INFO, "     -> "+action);
     
      changeSet.getNewFiles().add(winningLastVersion.getPath());
    }
    else if (winningFileToVersionComparison.getFileChanges().contains(FileChange.NEW)) {
      logger.log(Level.INFO, "     -> (3) New: winning version was deleted, but local exists: "+winningLastVersion+" AND "+winningLastFile);         
      throw new Exception("What happend here?");
    }
    else if (winningFileToVersionComparison.getFileChanges().contains(FileChange.CHANGED_LINK_TARGET)) {         
      FileSystemAction action = new NewSymlinkFileSystemAction(config, winningLastVersion, winnersDatabase);
      outFileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (4) Changed link target: winning file has a different link target: "+winningLastVersion+" AND "+winningLastFile);
      logger.log(Level.INFO, "     -> "+action);
     
      changeSet.getNewFiles().add(winningLastVersion.getPath());
    }
    else if (!contentChanged && (winningFileToVersionComparison.getFileChanges().contains(FileChange.CHANGED_LAST_MOD_DATE)
        || winningFileToVersionComparison.getFileChanges().contains(FileChange.CHANGED_ATTRIBUTES))) { 
     
      FileSystemAction action = new SetAttributesFileSystemAction(config, winningLastVersion, winnersDatabase);
      outFileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (5) Changed file attributes: winning file has different file attributes: "+winningLastVersion+" AND "+winningLastFile);
      logger.log(Level.INFO, "     -> "+action);
     
      changeSet.getNewFiles().add(winningLastVersion.getPath());
    }
    else if (winningFileToVersionComparison.getFileChanges().contains(FileChange.CHANGED_PATH)) {
      logger.log(Level.INFO, "     -> (6) Changed path: winning file has a different path: "+winningLastVersion+" AND "+winningLastFile);         
      throw new Exception("What happend here?");
    }
    else { // Content changed
      FileSystemAction action = new NewFileSystemAction(config, winningLastVersion, winnersDatabase);
      outFileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (7) Content changed: Winning file differs from winning version: "+winningLastVersion+" AND "+winningLastFile);
      logger.log(Level.INFO, "     -> "+action);
     
View Full Code Here

   
    if (winningVersionToLocalVersionComparison.equals()) { // Local file = local version = winning version!
      logger.log(Level.INFO, "     -> (8) Equals: Nothing to do, local file equals local version equals winning version: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
    }
    else if (winningVersionToLocalVersionComparison.getFileChanges().contains(FileChange.DELETED)) {
      FileSystemAction action = new ChangeFileSystemAction(config, localLastVersion, winningLastVersion, winnersDatabase);
      fileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (9) Content changed: Local file does not exist, but it should: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
      logger.log(Level.INFO, "     -> "+action);
     
      changeSet.getChangedFiles().add(winningLastVersion.getPath());
    }
    else if (winningVersionToLocalVersionComparison.getFileChanges().contains(FileChange.NEW)) {
      FileSystemAction action = new DeleteFileSystemAction(config, localLastVersion, winningLastVersion, winnersDatabase);
      fileSystemActions.add(action);
     
      logger.log(Level.INFO, "     -> (10) Local file is exists, but should not: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);         
      logger.log(Level.INFO, "     -> "+action)
     
      changeSet.getDeletedFiles().add(winningLastVersion.getPath());
    }
    else if (winningVersionToLocalVersionComparison.getFileChanges().contains(FileChange.CHANGED_LINK_TARGET)) {         
      FileSystemAction action = new NewSymlinkFileSystemAction(config, winningLastVersion, winnersDatabase);
      fileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (11) Changed link target: local file has a different link target: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
      logger.log(Level.INFO, "     -> "+action);
     
      changeSet.getNewFiles().add(winningLastVersion.getPath());
    }
    else if (!contentChanged && (winningVersionToLocalVersionComparison.getFileChanges().contains(FileChange.CHANGED_LAST_MOD_DATE)
        || winningVersionToLocalVersionComparison.getFileChanges().contains(FileChange.CHANGED_ATTRIBUTES)
        || winningVersionToLocalVersionComparison.getFileChanges().contains(FileChange.CHANGED_PATH))) { 
     
      FileSystemAction action = new RenameFileSystemAction(config, localLastVersion, winningLastVersion, winnersDatabase);
      fileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (12) Rename / Changed file attributes: Local file has different file attributes: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
      logger.log(Level.INFO, "     -> "+action);
     
      changeSet.getChangedFiles().add(winningLastVersion.getPath());
    }
    else { // Content changed
      FileSystemAction action = new ChangeFileSystemAction(config, localLastVersion, winningLastVersion, winnersDatabase);
      fileSystemActions.add(action);

      logger.log(Level.INFO, "     -> (13) Content changed: Local file differs from winning version: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
      logger.log(Level.INFO, "     -> "+action)
     
View Full Code Here

    if (localFileToVersionComparison.getFileChanges().contains(FileChange.DELETED)) { 
      boolean winningLastVersionDeleted = winningLastVersion.getStatus() == FileStatus.DELETED;
     
      if (!winningLastVersionDeleted) {
        FileSystemAction action = new ChangeFileSystemAction(config, localLastVersion, winningLastVersion, winnersDatabase);
        fileSystemActions.add(action);
   
        logger.log(Level.INFO, "     -> (14) Content changed: Local file does NOT exist, and winning version changed: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
        logger.log(Level.INFO, "     -> "+action)
       
        changeSet.getChangedFiles().add(winningLastVersion.getPath());
      }
      else {
        logger.log(Level.INFO, "     -> (15) Doing nothing: Local file does NOT exist, and winning version is marked DELETED: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);       
      }
    }
    else {
      FileSystemAction action = new ChangeFileSystemAction(config, localLastVersion, winningLastVersion, winnersDatabase);
      fileSystemActions.add(action);
 
      logger.log(Level.INFO, "     -> (16) Content changed: Local file differs from last version: local file = "+localLastFile+", local version = "+localLastVersion+", winning version = "+winningLastVersion);
      logger.log(Level.INFO, "     -> "+action)
     
View Full Code Here

    List<FileSystemAction> fixedActions = new ArrayList<FileSystemAction>(actions);
   
    int i = 0;
   
    while (i < fixedActions.size()) {
      FileSystemAction currentAction = fixedActions.get(i);
     
      if (currentAction instanceof DeleteFileSystemAction && currentAction.getType() == FileType.FOLDER) {
        break;
      }
     
      //System.out.println("testing "+currentAction);
      if ((currentAction instanceof NewFileSystemAction || currentAction instanceof RenameFileSystemAction)
          && (currentAction.getType() == FileType.FILE || currentAction.getType() == FileType.SYMLINK)) {
         
        int conflictingDeleteActionIndex = getPathConflictingWithDeleteActionIndex(currentAction, fixedActions);
       
        if (conflictingDeleteActionIndex >= 0) {
          logger.log(Level.INFO, "     --> match, conflict ["+i+"]: "+currentAction);
View Full Code Here

    actions.addAll(fixedActions);
  }
     
  private int getPathConflictingWithDeleteActionIndex(FileSystemAction currentAction, List<FileSystemAction> deleteFolderActions) {
    for (int i=0; i<deleteFolderActions.size(); i++) {
      FileSystemAction action = deleteFolderActions.get(i);

      if (action instanceof DeleteFileSystemAction && action.getType() == FileType.FOLDER) {     
        if (action.getFile2().getPath().equals(currentAction.getFile2().getPath())) {
          return i;
        }
      }
    }
   
View Full Code Here

TOP

Related Classes of org.syncany.operations.down.actions.FileSystemAction

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.