/**
   * Applies the given file system actions in a sensible order. To do that, the given actions are
   * first sorted using the {@link FileSystemActionComparator} and then executed individually using
   * {@link FileSystemAction#execute()}.
   */
  private void applyFileSystemActions(List<FileSystemAction> actions) throws Exception {
    // Sort
    FileSystemActionComparator actionComparator = new FileSystemActionComparator();
    actionComparator.sort(actions);

    logger.log(Level.FINER, "- Applying file system actions (sorted!) ...");

    // Apply
    for (FileSystemAction action : actions) {
      if (logger.isLoggable(Level.FINER)) {
        logger.log(Level.FINER, "   +  {0}", action);
      }

      // Execute the file system action

      // Note that exceptions are not caught here, to prevent
      // apply-failed-delete-on-up situations.

      action.execute();
    }
  }
Exemplo n.º 2
0
  private List<FileSystemAction> sortFileSystemActions(List<FileSystemAction> actions) {
    FileSystemActionComparator actionComparator = new FileSystemActionComparator();
    actionComparator.sort(actions);

    return actions;
  }