eu.emi.dsr.core
Class FileListener

java.lang.Object
  extended by eu.emi.dsr.core.FileListener
All Implemented Interfaces:
Runnable

public class FileListener
extends Object
implements Runnable

Borrowed from unicore service environment's (use) core package

Author:
schuller

Constructor Summary
FileListener(File target, Runnable action)
           
 
Method Summary
 void addTarget(File target)
          add a file to be watched
Note: files are stored in a Set, so it is no problem if the same file is added repeatedly
 boolean removeTarget(File target)
           
 void run()
          check if one of the target files has been touched and invoke the action if it has
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileListener

public FileListener(File target,
                    Runnable action)
             throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

addTarget

public void addTarget(File target)
add a file to be watched
Note: files are stored in a Set, so it is no problem if the same file is added repeatedly

Parameters:
target - - the file to watch

removeTarget

public boolean removeTarget(File target)

run

public void run()
check if one of the target files has been touched and invoke the action if it has

Specified by:
run in interface Runnable


Copyright © 2012. All Rights Reserved.