Class FileRetentionThread

java.lang.Object
java.lang.Thread
com.nt.udc.ndk.util.FileRetentionThread
All Implemented Interfaces:
Runnable

public class FileRetentionThread extends Thread
FileRetetentionThread is responsible for moving/deleting older files from DC output directory to archive directory after retention period. This thread will be used only if File Retention is enabled in Node GUI. This thread starts running when node starts and ends when node ends. This thread checks at every hour starting for the older files in the output folder. If files found, it moves/deletes them based on the file retention action configured in the Node GUI.
  • Constructor Details

    • FileRetentionThread

      public FileRetentionThread(int retentionDays, String fileRetentionAction, String archiveFolder, String fileExtension, String dcOutputFolder, LoggerIfc logger, String prefix) throws NodeStartException
      constructor with prefix parameter.
      Parameters:
      retentionDays - number of days the files to retain in the output folder
      fileRetentionAction - what to do on the older files after retention days
      archiveFolder - the folder to which the files will be moved if archive action is selected
      fileExtension - the file extension used filtering completed files.
      dcOutputFolder - the folder from which the files need to be moved/deleted
      logger - exception will be logged in this logger
      prefix - the prefix of completed files.
      Throws:
      NodeStartException - will be throws if archive folder doesn't exists and not creatable.
    • FileRetentionThread

      public FileRetentionThread(int retentionDays, String fileRetentionAction, String archiveFolder, String fileExtension, String dcOutputFolder, LoggerIfc logger) throws NodeStartException
      The constructor used initialize the parameters required for File Retention thread.
      Parameters:
      retentionDays - number of days the files to retain in the output folder
      fileRetentionAction - what to do on the older files after retention days
      archiveFolder - the folder to which the files will be moved if archive action is selected
      fileExtension - the file extension used filtering completed files.
      dcOutputFolder - the folder from which the files need to be moved/deleted
      logger - exception will be logged in this logger
      Throws:
      NodeStartException - will be throws if archive folder doesn't exists and not creatable.
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • shutdown

      public void shutdown()
    • doRetentionAction

      protected void doRetentionAction() throws Exception
      This method scans the directory containing the completed files and deletes/moves them.
      Throws:
      Exception - if an error occurs during scan of directory.