Class FolderMonitor

java.lang.Object
com.compomics.util.io.file.FolderMonitor
All Implemented Interfaces:
Runnable

public class FolderMonitor extends Object implements Runnable
This class will monitor a specified folder for activity.
Author:
Lennart Martens
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty default constructor
    FolderMonitor(File aFolder, long aDelay, int aOperation, HashMap aParams)
    This constructor allows the creation of a FolderMonitor that will take care of performing a specified action, with the specified parameters, whenever a new file is found.
    FolderMonitor(File aFolder, long aDelay, int aOperation, HashMap aParams, org.apache.logging.log4j.Logger aLogger)
    This constructor allows the creation of a FolderMonitor that will take care of performing a specified action, with the specified parameters, whenever a new file is found.
    FolderMonitor(File aFolder, long aDelay, String aFilter, int aOperation, HashMap aParams)
    This constructor allows the creation of a FolderMonitor for the specified filtered files that will take care of performing a specified action, with the specified parameters, whenever a new file is found.
    FolderMonitor(File aFolder, long aDelay, String aFilter, int aOperation, HashMap aParams, org.apache.logging.log4j.Logger aLogger)
    This constructor allows the creation of a FolderMonitor for the specified filtered files that will take care of performing a specified action, with the specified parameters, whenever a new file is found.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This method can be consulted to find out whether the monitor is running.
    static void
    main(String[] args)
    Main method starting the foldermonitor that looks for changes to a monitored folder.
    void
    run()
    When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.
    void
    This method can be used to signal the monitor to halt its monitoring.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • FolderMonitor

      public FolderMonitor()
      Empty default constructor
    • FolderMonitor

      public FolderMonitor(File aFolder, long aDelay, int aOperation, HashMap aParams)
      This constructor allows the creation of a FolderMonitor that will take care of performing a specified action, with the specified parameters, whenever a new file is found.
      Parameters:
      aFolder - File istance with the folder to check.
      aDelay - long with the minimal delay in milliseconds between each folder check.
      aOperation - int with the code for the operation to perform (use only constants defined on this class).
      aParams - HashMap with the necessary parameters for the operation.
    • FolderMonitor

      public FolderMonitor(File aFolder, long aDelay, int aOperation, HashMap aParams, org.apache.logging.log4j.Logger aLogger)
      This constructor allows the creation of a FolderMonitor that will take care of performing a specified action, with the specified parameters, whenever a new file is found. It also specifies a logger, to which messages detailing the activity can be logged.
      Parameters:
      aFolder - File istance with the folder to check.
      aDelay - long with the minimal delay in milliseconds between each folder check.
      aOperation - int with the code for the operation to perform (use only constants defined on this class).
      aParams - HashMap with the necessary parameters for the operation.
      aLogger - Logger for messages from this class.
    • FolderMonitor

      public FolderMonitor(File aFolder, long aDelay, String aFilter, int aOperation, HashMap aParams)
      This constructor allows the creation of a FolderMonitor for the specified filtered files that will take care of performing a specified action, with the specified parameters, whenever a new file is found.
      Parameters:
      aFolder - File instance with the folder to check.
      aDelay - long with the minimal delay in milliseconds between each folder check.
      aFilter - String to filter the files in the folder through.
      aOperation - int with the code for the operation to perform (use only constants defined on this class).
      aParams - HashMap with the necessary parameters for the operation.
    • FolderMonitor

      public FolderMonitor(File aFolder, long aDelay, String aFilter, int aOperation, HashMap aParams, org.apache.logging.log4j.Logger aLogger)
      This constructor allows the creation of a FolderMonitor for the specified filtered files that will take care of performing a specified action, with the specified parameters, whenever a new file is found. It also specifies a logger, to which messages detailing the activity can be logged.
      Parameters:
      aFolder - File instance with the folder to check.
      aDelay - long with the minimal delay in milliseconds between each folder check.
      aFilter - String to filter the files in the folder through.
      aOperation - int with the code for the operation to perform (use only constants defined on this class).
      aParams - HashMap with the necessary parameters for the operation.
      aLogger - Logger for messages from this class.
  • Method Details

    • run

      public void run()
      When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

      The general contract of the method run is that it may take any action whatsoever.

      Specified by:
      run in interface Runnable
      See Also:
    • signalStop

      public void signalStop()
      This method can be used to signal the monitor to halt its monitoring.
    • isRunning

      public boolean isRunning()
      This method can be consulted to find out whether the monitor is running.
      Returns:
      boolean that indicates whether the monitor is running.
    • main

      public static void main(String[] args)
      Main method starting the foldermonitor that looks for changes to a monitored folder.
      Parameters:
      args - start-up arguments