Example usage for org.apache.commons.io.monitor FileAlterationObserver checkAndNotify

List of usage examples for org.apache.commons.io.monitor FileAlterationObserver checkAndNotify

Introduction

In this page you can find the example usage for org.apache.commons.io.monitor FileAlterationObserver checkAndNotify.

Prototype

public void checkAndNotify() 

Source Link

Document

Check whether the file and its chlidren have been created, modified or deleted.

Usage

From source file:org.cytoscape.app.internal.manager.AppManager.java

private void checkForFileChanges() {
    for (FileAlterationObserver observer : fileAlterationMonitor.getObservers()) {
        observer.checkAndNotify();
    }//from ww w .j a v  a2  s.c o m
}

From source file:org.jumpmind.symmetric.file.FileTriggerTracker.java

synchronized protected void takeFullSnapshot(DirectorySnapshot snapshot) {
    // update the snapshot with every file in the directory spec
    FileAlterationObserver observer = new FileAlterationObserver(
            fileTriggerRouter.getFileTrigger().getBaseDir(),
            fileTriggerRouter.getFileTrigger().createIOFileFilter());
    observer.addListener(new SnapshotUpdater(snapshot));
    observer.checkAndNotify();
}

From source file:org.ow2.chameleon.fuchsia.discovery.filebased.monitor.DirectoryMonitor.java

public DirectoryMonitor(String directorypath, long polling, String classname) {

    this.directory = new File(directorypath);
    this.trackedClassName = classname;
    this.polling = polling;

    if (!directory.isDirectory()) {
        LOG.info("Monitored directory {} not existing - creating directory", directory.getAbsolutePath());
        if (!this.directory.mkdirs()) {
            throw new IllegalStateException("Monitored directory doesn't exist and cannot be created.");
        }//  www.ja  v a 2s. co  m
    }

    // We observes all files.
    FileAlterationObserver observer = new FileAlterationObserver(directory, TrueFileFilter.INSTANCE);
    observer.checkAndNotify();
    observer.addListener(new FileMonitor());
    monitor = new FileAlterationMonitor(polling, observer);

}