Package org.apache.commons.io.monitor

Examples of org.apache.commons.io.monitor.FileAlterationObserver


         {
            filter = FileFilterUtils.and(filter, adapter);
         }
      }
      File directory = dirResource.getUnderlyingResourceObject();
      FileAlterationObserver observer = new FileAlterationObserver(directory, filter);
      try
      {
         observer.initialize();
      }
      catch (Exception e)
      {
         log.log(Level.SEVERE, "Error while initializing File observer", e);
      }
View Full Code Here


        final File rexsterConfigurationDirectory = absolute.getParentFile();

        logger.info(String.format("Rexster is watching [%s] for change.", rexsterConfigurationFile.getAbsolutePath()));

        // follow the rexster configuration file directory and only the rexster.xml equivalent within that directory.
        return new FileAlterationObserver(rexsterConfigurationDirectory,
                FileFilterUtils.and(FileFileFilter.FILE, FileFilterUtils.nameFileFilter(rexsterConfigurationFile.getName())));
    }
View Full Code Here

    }

    private FileAlterationMonitor monitorFile(File file, FileAlterationListener listener) {
        File parentFile = file.getParentFile();
        File directory = (parentFile == null) ? new File(".") : parentFile;
        FileAlterationObserver observer = new FileAlterationObserver(directory, sameFile(file));
        observer.addListener(listener);

        return new FileAlterationMonitor(INTERVAL, observer);
    }
View Full Code Here

        }
        return null;
    }

    private void watchSourceFile(final File file) throws Exception {
        FileAlterationObserver observer = new FileAlterationObserver(file.getAbsoluteFile().getParentFile(), new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getAbsolutePath().equals(file.getAbsolutePath());
            }
        });
        observer.addListener(new FileAlterationListenerAdaptor() {
            @Override
            public void onFileChange(File file) {
                try {
                    BonzaConfig newCFG = parse(file, false);
                    if (configChanged(newCFG)) {
View Full Code Here

TOP

Related Classes of org.apache.commons.io.monitor.FileAlterationObserver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.