Package org.apache.commons.io.monitor

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


                monitors = null; // no need to start anything because there is no content
                return;
            }

            final FileAlterationMonitor monitor = new FileAlterationMonitor(interval);
            final FileAlterationListener listener = new FileAlterationListenerAdaptor() {
                @Override
                public void onFileCreate(final File file) {
                    getLog().info("File " + file.getAbsolutePath() + " created.");
                    needsUpdate.set(true);
                }

                @Override
                public void onFileChange(final File file) {
                    getLog().info("File " + file.getAbsolutePath() + " updated.");
                    needsUpdate.set(true);
                }

                @Override
                public void onFileDelete(final File file) {
                    getLog().info("File " + file.getAbsolutePath() + " deleted.");
                    needsUpdate.set(true);
                }
            };

            observer.addListener(listener);
            monitor.addObserver(observer);

            monitors.add(monitor);
        }

        { // resources monitors
            if (synchronizations != null) {
                for (final Synchronization s : synchronizations) {
                    final FileAlterationMonitor monitor = new FileAlterationMonitor(interval);
                    final FileAlterationListener listener = new FileAlterationListenerAdaptor() {
                        @Override
                        public void onFileCreate(final File file) {
                            getLog().info("File " + file.getAbsolutePath() + " created.");
                            synchronize(s);
                            needsUpdate.set(true);
View Full Code Here

TOP

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

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.