com.compomics.util.io
Class FolderMonitor

java.lang.Object
  extended by com.compomics.util.io.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
static int FTP_TO_SPECIFIED_DESTINATION
           
static int GATHER_FILES_FOR_PICKUP
           
static String HOST
           
static String LIMIT
           
static String PASSWORD
           
static String PICKUP
           
static String TEXTMODE
           
static String USER
           
 
Constructor Summary
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.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.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
 boolean isRunning()
          This method can be consutled to find put 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 signalStop()
          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 Detail

HOST

public static final String HOST
See Also:
Constant Field Values

USER

public static final String USER
See Also:
Constant Field Values

PASSWORD

public static final String PASSWORD
See Also:
Constant Field Values

TEXTMODE

public static final String TEXTMODE
See Also:
Constant Field Values

PICKUP

public static final String PICKUP
See Also:
Constant Field Values

LIMIT

public static final String LIMIT
See Also:
Constant Field Values

FTP_TO_SPECIFIED_DESTINATION

public static final int FTP_TO_SPECIFIED_DESTINATION
See Also:
Constant Field Values

GATHER_FILES_FOR_PICKUP

public static final int GATHER_FILES_FOR_PICKUP
See Also:
Constant Field Values
Constructor Detail

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.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.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 Detail

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:
Thread.run()

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 consutled to find put 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


Copyright © 2011. All Rights Reserved.