src/main/java/saps/common/core/storage/swift/SwiftPermanentStorage.java
/**
   * This function delete all files from task in Permanent Storage.
   *
   * @param task task with files information to be deleted
   * @return boolean representation, success (true) or failure (false) to delete files
   */
This function delete all files from task in Permanent Storage.
@param task task with files information to be deleted
@return boolean representation, success (true) or failure (false) to delete files
This function delete all files from task in Permanent Storage . @param task task with files information to be deleted @return boolean representation success ( true ) or failure ( false ) to delete files
@Override
  public boolean delete(SapsImage task) throws IOException {
    String taskId = task.getTaskId();
    LOGGER.debug("Deleting files from task [" + taskId + "] in Swift [" + containerName + "]");
    String swiftExports =
        (task.getState() == ImageTaskState.FAILED && this.debugMode)
            ? debugTasksDirName
            : tasksDirName;
    String dir = swiftExports + File.separator + taskId;
    List<String> fileNames = swiftAPIClient.listFiles(containerName, dir);
    LOGGER.info("Files List: " + fileNames);
    try {
      for (String file : fileNames) {
        LOGGER.debug("Trying to delete file " + file + " from " + containerName);
        swiftAPIClient.deleteFile(containerName, file);
      }
    } catch (Exception e) {
      throw new IOException("Error while delete file from task [" + taskId + "]", e);
    }
    return true;
  }
@ Override public boolean delete ( SapsImage task ) throws IOException { String taskId = task . getTaskId ( ) ; LOGGER . debug ( "Deleting files from task [" + taskId + "] in Swift [" + containerName + "]" ) ; String swiftExports = ( task . getState ( ) == ImageTaskState . FAILED && this . debugMode ) ? debugTasksDirName : tasksDirName ; String dir = swiftExports + File . separator + taskId ; List < String > fileNames = swiftAPIClient . listFiles ( containerName , dir ) ; LOGGER . info ( "Files List: " + fileNames ) ; try { for ( String file : fileNames ) { LOGGER . debug ( "Trying to delete file " + file + " from " + containerName ) ; swiftAPIClient . deleteFile ( containerName , file ) ; } } catch ( Exception e ) { throw new IOException ( "Error while delete file from task [" + taskId + "]" , e ) ; } return true ; }
This function delete all files from task in Permanent Storage.
This function delete all files from task in Permanent Storage .