Example usage for org.apache.commons.jci.monitor FilesystemAlterationMonitor addListener

List of usage examples for org.apache.commons.jci.monitor FilesystemAlterationMonitor addListener

Introduction

In this page you can find the example usage for org.apache.commons.jci.monitor FilesystemAlterationMonitor addListener.

Prototype

public void addListener(final File pRoot, final FilesystemAlterationListener pListener) 

Source Link

Usage

From source file:nz.net.catalyst.mobile.dds.WurflCapabilityServiceImpl.java

/**
 * create listeners and monitors for wurfl and its patches
 *///from w ww.  j a v a 2  s.c  o  m
protected synchronized void startWatchingFiles() {
    famList.clear();

    FilesystemAlterationMonitor fam = new FilesystemAlterationMonitor();
    FileChangeListener wurflListener = new WurflFileListener();
    fam.addListener(wurflFile, wurflListener);
    fam.start();
    famList.add(fam);
    logger.debug("watching " + wurflFile.getAbsolutePath());

    for (File patchFile : wurflPatchFiles) {
        fam = new FilesystemAlterationMonitor();
        FileChangeListener wurflPatchListener = new WurflFileListener();
        fam.addListener(patchFile, wurflPatchListener);
        fam.start();
        famList.add(fam);
        logger.debug("watching " + patchFile.getAbsolutePath());
    }

}

From source file:org.openecard.addon.FileRegistry.java

private void startFileMonitor(String addonPath) throws WSMarshallerException {
    File f = new File(addonPath);
    logger.debug("Starting file alteration monitor on path: {}", f.getPath());
    FilesystemAlterationMonitor fam = new FilesystemAlterationMonitor();
    fam.addListener(f, new PluginDirectoryAlterationListener(this));
    fam.start();// w w w  .java2 s  .com
}