/**
  * DOC amaumont JobServerCleaner constructor comment.
  *
  * @param frequencyCleaningAction in seconds
  * @param maxDurationBeforeCleaningOldExecutionsLogs in seconds
  * @param maxOldExecutionsLogs
  * @param maxDurationBeforeCleaningOldJobs in seconds
  * @param maxOldJobs
  */
 public SchedulerDataCleaner() {
   super(
       SchedulerDataCleaner.class.getSimpleName(),
       SchedulerConfiguration.getInstance().getFrequencyCleaningAction());
   SchedulerConfiguration schedulerConfiguration = SchedulerConfiguration.getInstance();
   this.maxDurationBeforeCleaningOldExecutionsLogs =
       schedulerConfiguration.getMaxDurationBeforeCleaningOldExecutionsLogs();
   this.maxOldExecutionsLogs = schedulerConfiguration.getMaxOldExecutionsLogs();
   this.maxDurationBeforeCleaningOldJobs =
       schedulerConfiguration.getMaxDurationBeforeCleaningOldJobs();
   this.maxOldJobs = schedulerConfiguration.getMaxOldJobs();
 }
  protected void clean() {
    FileDirCleaner fileDirCleaner = null;

    SchedulerConfiguration schedulerConfiguration = SchedulerConfiguration.getInstance();
    String archiveJobsPath = schedulerConfiguration.getArchivesJobsRootPath();
    String executionLogsPath = schedulerConfiguration.getJobExecutionLogsRootPath();

    boolean doAction = true;

    int deletedArchives = 0;
    if (maxOldJobs > 0 || maxDurationBeforeCleaningOldJobs > 0) {
      fileDirCleaner =
          new FileDirCleaner(
              doAction,
              SCAN_STRATEGY.FILES_RECURSIVELY,
              maxOldJobs,
              maxDurationBeforeCleaningOldJobs);
      deletedArchives = fileDirCleaner.clean(archiveJobsPath, "\\d+_task_\\d+\\.zip", "task_\\d+");
    }

    // fileDirCleaner = new FileDirCleaner(maxOldJobs, maxDurationBeforeCleaningOldJobs, true,
    // false);
    // int deletedExecutionLogs = fileDirCleaner.clean(archiveJobsPath, null, null);

    int deletedResumingLogs = 0;
    if (maxOldExecutionsLogs > 0 || maxDurationBeforeCleaningOldExecutionsLogs > 0) {
      fileDirCleaner =
          new FileDirCleaner(
              doAction,
              SCAN_STRATEGY.DIRECTORIES,
              maxOldExecutionsLogs,
              maxDurationBeforeCleaningOldExecutionsLogs);
      deletedResumingLogs = fileDirCleaner.clean(executionLogsPath, null, "\\d{14}_\\w{5}");
    }

    StringBuilder sb = new StringBuilder("TempDataCleaner");
    int lengthRef = sb.length();
    if (deletedArchives > 0) {
      sb.append(", " + deletedArchives + " archive jobs cleaned");
    }
    // if (deletedExecutionLogs > 0) {
    // sb.append(", " + deletedExecutionLogs + " executions logs cleaned");
    // }
    if (deletedResumingLogs > 0) {
      sb.append(", " + deletedResumingLogs + " resuming logs cleaned");
    }
    if (sb.length() > lengthRef) {
      log.info(sb.toString());
    }
  }