001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 *
012 * $Id$
013 */
014
015package org.nuxeo.runtime.deploy;
016
017// FIXME: interface has changed and this example is no more appropriate.
018/**
019 * An example of listener implementation:
020 *
021 * <pre>
022 * public class MyListener implements FileChangeListener {
023 *     long lastNotif = 0;
024 *
025 *     public void fileChanged(File file, long since, long now) {
026 *         if (now == lastNotifFlush)
027 *             return;
028 *         if (isIntersetedInFile(file)) {
029 *             lastNotif = now;
030 *             flushCache(); // flush internal cache because file on disk changed
031 *         }
032 *     }
033 * }
034 * </pre>
035 *
036 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
037 */
038public interface FileChangeListener {
039
040    /**
041     * Notifies that the given file changed.
042     *
043     * @param entry
044     * @param now the time stamp when the change was detected. This value can be used as a notification ID by listeners
045     *            to avoid multiple processing for notification that will send multiple events
046     */
047    void fileChanged(FileChangeNotifier.FileEntry entry, long now);
048
049}