src/main/java/saps/common/core/storage/swift/SwiftPermanentStorage.java
/**
   * This function tries to archive a task trying each folder in order (inputdownloading ->
   * preprocessing -> processing).
   *
   * @param task task to be archived
   * @return boolean representation, success (true) or failure (false) in to archive the three
   *     folders.
   */
This function tries to archive a task trying each folder in order (inputdownloading ->
preprocessing -> processing).

@param task task to be archived
@return boolean representation, success (true) or failure (false) in to archive the three
folders.
This function tries to archive a task trying each folder in order ( inputdownloading - > preprocessing - > processing ) . @param task task to be archived @return boolean representation success ( true ) or failure ( false ) in to archive the three folders .
@Override
  public boolean archive(SapsImage task) {
    String taskId = task.getTaskId();
    LOGGER.info(
        "Attempting to archive task ["
            + taskId
            + "] with a maximum of "
            + MAX_ARCHIVE_TRIES
            + " archiving attempts for each folder (inputdownloading, preprocessing, processing)");
    String swiftExports =
        (task.getState() == ImageTaskState.FAILED && this.debugMode)
            ? debugTasksDirName
            : tasksDirName;
    String inputdownloadingLocalDir =
        String.format(
            SAPS_TASK_STAGE_DIR_PATTERN, nfsTempStoragePath, taskId, INPUTDOWNLOADING_DIR);
    String inputdownloadingSwiftDir =
        String.format(SWIFT_TASK_STAGE_DIR_PATTERN, swiftExports, taskId, INPUTDOWNLOADING_DIR);
    String preprocessingLocalDir =
        String.format(SAPS_TASK_STAGE_DIR_PATTERN, nfsTempStoragePath, taskId, PREPROCESSING_DIR);
    String preprocessingSwiftDir =
        String.format(SWIFT_TASK_STAGE_DIR_PATTERN, swiftExports, taskId, PREPROCESSING_DIR);
    String processingLocalDir =
        String.format(SAPS_TASK_STAGE_DIR_PATTERN, nfsTempStoragePath, taskId, PROCESSING_DIR);
    String processingSwiftDir =
        String.format(SWIFT_TASK_STAGE_DIR_PATTERN, swiftExports, taskId, PROCESSING_DIR);
    boolean inputdownloadingSentSuccess =
        archive(taskId, inputdownloadingLocalDir, inputdownloadingSwiftDir);
    boolean preprocessingSentSuccess =
        inputdownloadingSentSuccess
            && archive(taskId, preprocessingLocalDir, preprocessingSwiftDir);
    boolean processingSentSuccess =
        preprocessingSentSuccess && archive(taskId, processingLocalDir, processingSwiftDir);
    LOGGER.info(
        "Archive process result of task ["
            + taskId
            + ":\nInputdownloading phase: "
            + (inputdownloadingSentSuccess ? "Success" : "Failure")
            + "\n"
            + "Preprocessing phase: "
            + (preprocessingSentSuccess ? "Success" : "Failure")
            + "\n"
            + "Processing phase: "
            + (processingSentSuccess ? "Success" : "Failure"));
    return inputdownloadingSentSuccess && preprocessingSentSuccess && processingSentSuccess;
  }
@ Override public boolean archive ( SapsImage task ) { String taskId = task . getTaskId ( ) ; LOGGER . info ( "Attempting to archive task [" + taskId + "] with a maximum of " + MAX_ARCHIVE_TRIES + " archiving attempts for each folder (inputdownloading, preprocessing, processing)" ) ; String swiftExports = ( task . getState ( ) == ImageTaskState . FAILED && this . debugMode ) ? debugTasksDirName : tasksDirName ; String inputdownloadingLocalDir = String . format ( SAPS_TASK_STAGE_DIR_PATTERN , nfsTempStoragePath , taskId , INPUTDOWNLOADING_DIR ) ; String inputdownloadingSwiftDir = String . format ( SWIFT_TASK_STAGE_DIR_PATTERN , swiftExports , taskId , INPUTDOWNLOADING_DIR ) ; String preprocessingLocalDir = String . format ( SAPS_TASK_STAGE_DIR_PATTERN , nfsTempStoragePath , taskId , PREPROCESSING_DIR ) ; String preprocessingSwiftDir = String . format ( SWIFT_TASK_STAGE_DIR_PATTERN , swiftExports , taskId , PREPROCESSING_DIR ) ; String processingLocalDir = String . format ( SAPS_TASK_STAGE_DIR_PATTERN , nfsTempStoragePath , taskId , PROCESSING_DIR ) ; String processingSwiftDir = String . format ( SWIFT_TASK_STAGE_DIR_PATTERN , swiftExports , taskId , PROCESSING_DIR ) ; boolean inputdownloadingSentSuccess = archive ( taskId , inputdownloadingLocalDir , inputdownloadingSwiftDir ) ; boolean preprocessingSentSuccess = inputdownloadingSentSuccess && archive ( taskId , preprocessingLocalDir , preprocessingSwiftDir ) ; boolean processingSentSuccess = preprocessingSentSuccess && archive ( taskId , processingLocalDir , processingSwiftDir ) ; LOGGER . info ( "Archive process result of task [" + taskId + ":\nInputdownloading phase: " + ( inputdownloadingSentSuccess ? "Success" : "Failure" ) + "\n" + "Preprocessing phase: " + ( preprocessingSentSuccess ? "Success" : "Failure" ) + "\n" + "Processing phase: " + ( processingSentSuccess ? "Success" : "Failure" ) ) ; return inputdownloadingSentSuccess && preprocessingSentSuccess && processingSentSuccess ; }
This function tries to archive a task trying each folder in order (inputdownloading ->
 preprocessing -> processing).
This function tries to archive a task trying each folder in order ( inputdownloading - > preprocessing - > processing ) .
// FIXME Create a private method to return the swift directory