commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: svn commit: r1021892 - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/monitor/ test/java/org/apache/commons/io/monitor/
Date Tue, 12 Oct 2010 23:53:35 GMT
That was my point.  The break in binary compatibility makes moot the
previous discussion about the appropriateness of [io] moving to 2.0.

On 10/12/10, Gary Gregory <GGregory@seagullsoftware.com> wrote:
> I do not think that we need to worry about binary compatibility because the
> classes are @since 2.0.
>
> Gary
>
> On Oct 12, 2010, at 14:38, "Matt Benson" <gudnabrsam@gmail.com> wrote:
>
>> On the bright side, having given in to the wishes of those who wanted this
>> naming change makes the question of whether there is sufficient reason for
>> a major version bump, as the API is no longer binary-compatible, right?
>>
>> On Oct 12, 2010, at 2:27 PM, niallp@apache.org wrote:
>>
>>> Author: niallp
>>> Date: Tue Oct 12 19:27:40 2010
>>> New Revision: 1021892
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1021892&view=rev
>>> Log:
>>> IO-132 Rename FilesystemEntry/Listener/Observer to
>>> FilesEntry/Listener/Observer
>>>
>>> Added:
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileEntry.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemEntry.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListener.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListener.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListenerAdaptor.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListenerAdaptor.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileMonitor.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemMonitor.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileObserver.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemObserver.java
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFilesystemListener.java
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileMonitorTestCase.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileSystemMonitorTestCase.java
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileObserverTestCase.java
>>>     - copied, changed from r1021885,
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FilesystemObserverTestCase.java
>>> Removed:
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemEntry.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListener.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListenerAdaptor.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemMonitor.java
>>>
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemObserver.java
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFilesystemListener.java
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileSystemMonitorTestCase.java
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FilesystemObserverTestCase.java
>>> Modified:
>>>
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileEntry.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemEntry.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileEntry.java?p2=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileEntry.java&p1=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemEntry.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemEntry.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileEntry.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -20,8 +20,8 @@ import java.io.File;
>>> import java.io.Serializable;
>>>
>>> /**
>>> - * {@link FilesystemEntry} represents the state of a file or directory,
>>> capturing
>>> - * the following {@link File} attributes at a point in time:
>>> + * {@link FileEntry} represents the state of a file or directory,
>>> capturing
>>> + * the following {@link File} attributes at a point in time.
>>> * <ul>
>>> *   <li>File Name (see {@link File#getName()})</li>
>>> *   <li>Exists - whether the file exists or not (see {@link
>>> File#exists()})</li>
>>> @@ -33,16 +33,16 @@ import java.io.Serializable;
>>> * <p>
>>> * <h3>Custom Implementations</h3>
>>> * If the state of additional {@link File} attributes is required then
>>> create a custom
>>> - * {@link FilesystemEntry} with properties for those attributes.
>>> Override the
>>> + * {@link FileEntry} with properties for those attributes. Override the
>>> * {@link #newChildInstance(File)} to return a new instance of the
>>> appropriate type.
>>> * You may also want to override the {@link #refresh(File)} method.
>>> - * @see FilesystemObserver
>>> + * @see FileObserver
>>> * @since Commons IO 2.0
>>> */
>>> -public class FilesystemEntry implements Serializable {
>>> +public class FileEntry implements Serializable {
>>>
>>> -    private final FilesystemEntry parent;
>>> -    private FilesystemEntry[] children;
>>> +    private final FileEntry parent;
>>> +    private FileEntry[] children;
>>>    private final File file;
>>>    private String name;
>>>    private boolean exists;
>>> @@ -55,8 +55,8 @@ public class FilesystemEntry implements
>>>     *
>>>     * @param file The file being monitored
>>>     */
>>> -    public FilesystemEntry(File file) {
>>> -        this((FilesystemEntry)null, file);
>>> +    public FileEntry(File file) {
>>> +        this((FileEntry)null, file);
>>>    }
>>>
>>>    /**
>>> @@ -65,7 +65,7 @@ public class FilesystemEntry implements
>>>     * @param parent The parent
>>>     * @param file The file being monitored
>>>     */
>>> -    public FilesystemEntry(FilesystemEntry parent, File file) {
>>> +    public FileEntry(FileEntry parent, File file) {
>>>        if (file == null) {
>>>            throw new IllegalArgumentException("File is missing");
>>>        }
>>> @@ -119,8 +119,8 @@ public class FilesystemEntry implements
>>>     * @param file The child file
>>>     * @return a new child instance
>>>     */
>>> -    public FilesystemEntry newChildInstance(File file) {
>>> -        return new FilesystemEntry(this, file);
>>> +    public FileEntry newChildInstance(File file) {
>>> +        return new FileEntry(this, file);
>>>    }
>>>
>>>    /**
>>> @@ -128,7 +128,7 @@ public class FilesystemEntry implements
>>>     *
>>>     * @return the parent entry
>>>     */
>>> -    public FilesystemEntry getParent() {
>>> +    public FileEntry getParent() {
>>>        return parent;
>>>    }
>>>
>>> @@ -148,8 +148,8 @@ public class FilesystemEntry implements
>>>     * array if the file is not a directory or the
>>>     * directory is empty
>>>     */
>>> -    public FilesystemEntry[] getChildren() {
>>> -        return children != null ? children :
>>> FilesystemObserver.EMPTY_ENTRIES;
>>> +    public FileEntry[] getChildren() {
>>> +        return children != null ? children : FileObserver.EMPTY_ENTRIES;
>>>    }
>>>
>>>    /**
>>> @@ -157,7 +157,7 @@ public class FilesystemEntry implements
>>>     *
>>>     * @param children This directory's files, may be null
>>>     */
>>> -    public void setChildren(FilesystemEntry[] children) {
>>> +    public void setChildren(FileEntry[] children) {
>>>        this.children = children;
>>>    }
>>>
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListener.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListener.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListener.java?p2=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListener.java&p1=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListener.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListener.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListener.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -20,20 +20,20 @@ import java.io.File;
>>> /**
>>> * A listener that receives events of file system modifications.
>>> * <p>
>>> - * Register {@link FilesystemListener}s with a {@link
>>> FilesystemObserver}.
>>> + * Register {@link FileListener}s with a {@link FileObserver}.
>>> *
>>> - * @see FilesystemObserver
>>> + * @see FileObserver
>>> * @version $Id$
>>> * @since Commons IO 2.0
>>> */
>>> -public interface FilesystemListener {
>>> +public interface FileListener {
>>>
>>>    /**
>>>     * File system observer started checking event.
>>>     *
>>>     * @param observer The file system observer
>>>     */
>>> -    void onStart(final FilesystemObserver observer);
>>> +    void onStart(final FileObserver observer);
>>>
>>>    /**
>>>     * Directory created Event.
>>> @@ -82,5 +82,5 @@ public interface FilesystemListener {
>>>     *
>>>     * @param observer The file system observer
>>>     */
>>> -    void onStop(final FilesystemObserver observer);
>>> +    void onStop(final FileObserver observer);
>>> }
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListenerAdaptor.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListenerAdaptor.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListenerAdaptor.java?p2=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListenerAdaptor.java&p1=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListenerAdaptor.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemListenerAdaptor.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileListenerAdaptor.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -19,20 +19,20 @@ package org.apache.commons.io.monitor;
>>> import java.io.File;
>>>
>>> /**
>>> - * Convenience {@link FilesystemListener} implementation that does
>>> nothing.
>>> + * Convenience {@link FileListener} implementation that does nothing.
>>> *
>>> - * @see FilesystemObserver
>>> + * @see FileObserver
>>> * @version $Id$
>>> * @since Commons IO 2.0
>>> */
>>> -public class FilesystemListenerAdaptor implements FilesystemListener {
>>> +public class FileListenerAdaptor implements FileListener {
>>>
>>>    /**
>>>     * File system observer started checking event.
>>>     *
>>>     * @param observer The file system observer
>>>     */
>>> -    public void onStart(final FilesystemObserver observer) {
>>> +    public void onStart(final FileObserver observer) {
>>>    }
>>>
>>>    /**
>>> @@ -88,7 +88,7 @@ public class FilesystemListenerAdaptor i
>>>     *
>>>     * @param observer The file system observer
>>>     */
>>> -    public void onStop(final FilesystemObserver observer) {
>>> +    public void onStop(final FileObserver observer) {
>>>    }
>>>
>>> }
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileMonitor.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemMonitor.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileMonitor.java?p2=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileMonitor.java&p1=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemMonitor.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemMonitor.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileMonitor.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -21,23 +21,23 @@ import java.util.concurrent.CopyOnWriteA
>>>
>>> /**
>>> * A runnable that spawns a monitoring thread triggering any
>>> - * registered {@link FilesystemObserver} at a specified interval.
>>> + * registered {@link FileObserver} at a specified interval.
>>> *
>>> - * @see FilesystemObserver
>>> + * @see FileObserver
>>> * @version $Id$
>>> * @since Commons IO 2.0
>>> */
>>> -public final class FilesystemMonitor implements Runnable {
>>> +public final class FileMonitor implements Runnable {
>>>
>>>    private final long interval;
>>> -    private final List<FilesystemObserver> observers = new
>>> CopyOnWriteArrayList<FilesystemObserver>();
>>> +    private final List<FileObserver> observers = new
>>> CopyOnWriteArrayList<FileObserver>();
>>>    private Thread thread = null;
>>>    private volatile boolean running = false;
>>>
>>>    /**
>>>     * Construct a monitor with a default interval of 10 seconds.
>>>     */
>>> -    public FilesystemMonitor() {
>>> +    public FileMonitor() {
>>>        this(10000);
>>>    }
>>>
>>> @@ -47,7 +47,7 @@ public final class FilesystemMonitor imp
>>>     * @param interval The amount of time in miliseconds to wait between
>>>     * checks of the file system
>>>     */
>>> -    public FilesystemMonitor(long interval) {
>>> +    public FileMonitor(long interval) {
>>>        this.interval = interval;
>>>    }
>>>
>>> @@ -58,10 +58,10 @@ public final class FilesystemMonitor imp
>>>     * checks of the file system
>>>     * @param observers The set of observers to add to the monitor.
>>>     */
>>> -    public FilesystemMonitor(long interval, FilesystemObserver...
>>> observers) {
>>> +    public FileMonitor(long interval, FileObserver... observers) {
>>>        this(interval);
>>>        if (observers != null) {
>>> -            for (FilesystemObserver observer : observers) {
>>> +            for (FileObserver observer : observers) {
>>>                addObserver(observer);
>>>            }
>>>        }
>>> @@ -72,7 +72,7 @@ public final class FilesystemMonitor imp
>>>     *
>>>     * @param observer The file system observer to add
>>>     */
>>> -    public void addObserver(final FilesystemObserver observer) {
>>> +    public void addObserver(final FileObserver observer) {
>>>        if (observer != null) {
>>>            observers.add(observer);
>>>        }
>>> @@ -83,7 +83,7 @@ public final class FilesystemMonitor imp
>>>     *
>>>     * @param observer The file system observer to remove
>>>     */
>>> -    public void removeObserver(final FilesystemObserver observer) {
>>> +    public void removeObserver(final FileObserver observer) {
>>>        if (observer != null) {
>>>            while (observers.remove(observer)) {
>>>            }
>>> @@ -91,12 +91,12 @@ public final class FilesystemMonitor imp
>>>    }
>>>
>>>    /**
>>> -     * Returns the set of {@link FilesystemObserver} registered with
>>> +     * Returns the set of {@link FileObserver} registered with
>>>     * this monitor.
>>>     *
>>> -     * @return The set of {@link FilesystemObserver}
>>> +     * @return The set of {@link FileObserver}
>>>     */
>>> -    public Iterable<FilesystemObserver> getObservers() {
>>> +    public Iterable<FileObserver> getObservers() {
>>>        return observers;
>>>    }
>>>
>>> @@ -106,7 +106,7 @@ public final class FilesystemMonitor imp
>>>     * @throws Exception if an error occurs initializing the observer
>>>     */
>>>    public void start() throws Exception {
>>> -        for (FilesystemObserver observer : observers) {
>>> +        for (FileObserver observer : observers) {
>>>            observer.initialize();
>>>        }
>>>        running = true;
>>> @@ -126,7 +126,7 @@ public final class FilesystemMonitor imp
>>>        } catch (InterruptedException e) {
>>>            Thread.currentThread().interrupt();
>>>        }
>>> -        for (FilesystemObserver observer : observers) {
>>> +        for (FileObserver observer : observers) {
>>>            observer.destroy();
>>>        }
>>>    }
>>> @@ -136,7 +136,7 @@ public final class FilesystemMonitor imp
>>>     */
>>>    public void run() {
>>>        while (running) {
>>> -            for (FilesystemObserver observer : observers) {
>>> +            for (FileObserver observer : observers) {
>>>                observer.checkAndNotify();
>>>            }
>>>            if (!running) {
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileObserver.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemObserver.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileObserver.java?p2=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileObserver.java&p1=commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemObserver.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FilesystemObserver.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileObserver.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -28,25 +28,25 @@ import org.apache.commons.io.IOCase;
>>> import org.apache.commons.io.comparator.NameFileComparator;
>>>
>>> /**
>>> - * FilesystemObserver represents the state of files below a root
>>> directory,
>>> + * FileObserver represents the state of files below a root directory,
>>> * checking the filesystem and notifying listeners of create, change or
>>> * delete events.
>>> * <p>
>>> * To use this implementation:
>>> * <ul>
>>> - *   <li>Create {@link FilesystemListener} implementation(s) that
>>> process
>>> + *   <li>Create {@link FileListener} implementation(s) that process
>>> *      the file/directory create, change and delete events</li>
>>> - *   <li>Register the listener(s) with a {@link FilesystemObserver} for
>>> + *   <li>Register the listener(s) with a {@link FileObserver} for
>>> *       the appropriate directory.</li>
>>> - *   <li>Either register the observer(s) with a {@link
>>> FilesystemMonitor} or
>>> + *   <li>Either register the observer(s) with a {@link FileMonitor} or
>>> *       run manually.</li>
>>> * </ul>
>>> *
>>> * <h2>Basic Usage</h2>
>>> - * Create a {@link FilesystemObserver} for the directory and register
>>> the listeners:
>>> + * Create a {@link FileObserver} for the directory and register the
>>> listeners:
>>> * <pre>
>>> *      File directory = new File(new File("."), "src");
>>> - *      FilesystemObserver observer = new FilesystemObserver(directory);
>>> + *      FileObserver observer = new FileObserver(directory);
>>> *      observer.addListener(...);
>>> *      observer.addListener(...);
>>> * </pre>
>>> @@ -64,11 +64,11 @@ import org.apache.commons.io.comparator.
>>> *      // finished
>>> *      observer.finish();
>>> * </pre>
>>> - * Alternatively, register the oberver(s) with a {@link
>>> FilesystemMonitor},
>>> + * Alternatively, register the oberver(s) with a {@link FileMonitor},
>>> * which creates a new thread, invoking the observer at the specified
>>> interval:
>>> * <pre>
>>> *      long interval = ...
>>> - *      FilesystemMonitor monitor = new FilesystemMonitor(interval);
>>> + *      FileMonitor monitor = new FileMonitor(interval);
>>> *      monitor.addObserver(observer);
>>> *      monitor.start();
>>> *      ...
>>> @@ -87,7 +87,7 @@ import org.apache.commons.io.comparator.
>>> * implementations for this purpose.
>>> * <p>
>>> * For example, to only observe 1) visible directories and 2) files with a
>>> ".java" suffix
>>> - * in a root directory called "src" you could set up a {@link
>>> FilesystemObserver} in the following
>>> + * in a root directory called "src" you could set up a {@link
>>> FileObserver} in the following
>>> * way:
>>> * <pre>
>>> *      // Create a FileFilter
>>> @@ -100,7 +100,7 @@ import org.apache.commons.io.comparator.
>>> *      IOFileFilter filter = FileFilterUtils.orFileFilter(dirFilter,
>>> fileFilter);
>>> *
>>> *      // Create the File system observer and register File Listeners
>>> - *      FilesystemObserver observer = new FilesystemObserver(new
>>> File("src"), filter);
>>> + *      FileObserver observer = new FileObserver(new File("src"),
>>> filter);
>>> *      observer.addListener(...);
>>> *      observer.addListener(...);
>>> *
>>> @@ -121,26 +121,26 @@ import org.apache.commons.io.comparator.
>>> * manner ({@link NameFileComparator#NAME_INSENSITIVE_COMPARATOR} could be
>>> used
>>> * to do that).
>>> *
>>> - * <h2>FilesystemEntry</h2>
>>> - * {@link FilesystemEntry} represents the state of a file or directory,
>>> capturing
>>> + * <h2>FileEntry</h2>
>>> + * {@link FileEntry} represents the state of a file or directory,
>>> capturing
>>> * {@link File} attributes at a point in time. Custom implementations of
>>> - * {@link FilesystemEntry} can be used to capture additional properties
>>> that the
>>> - * basic implementation does not support. The {@link
>>> FilesystemEntry#refresh(File)}
>>> + * {@link FileEntry} can be used to capture additional properties that
>>> the
>>> + * basic implementation does not support. The {@link
>>> FileEntry#refresh(File)}
>>> * method is used to determine if a file or directory has changed since
>>> the last
>>> * check and stores the current state of the {@link File}'s properties.
>>> *
>>> - * @see FilesystemListener
>>> - * @see FilesystemMonitor
>>> + * @see FileListener
>>> + * @see FileMonitor
>>> * @version $Id$
>>> * @since Commons IO 2.0
>>> */
>>> -public class FilesystemObserver implements Serializable {
>>> +public class FileObserver implements Serializable {
>>>
>>>    private static final File[] EMPTY_FILES = new File[0];
>>> -    static final FilesystemEntry[] EMPTY_ENTRIES = new
>>> FilesystemEntry[0];
>>> +    static final FileEntry[] EMPTY_ENTRIES = new FileEntry[0];
>>>
>>> -    private final List<FilesystemListener> listeners = new
>>> CopyOnWriteArrayList<FilesystemListener>();
>>> -    private final FilesystemEntry rootEntry;
>>> +    private final List<FileListener> listeners = new
>>> CopyOnWriteArrayList<FileListener>();
>>> +    private final FileEntry rootEntry;
>>>    private final FileFilter fileFilter;
>>>    private final Comparator<File> comparator;
>>>
>>> @@ -149,7 +149,7 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @param directoryName the name of the directory to observe
>>>     */
>>> -    public FilesystemObserver(String directoryName) {
>>> +    public FileObserver(String directoryName) {
>>>        this(new File(directoryName));
>>>    }
>>>
>>> @@ -159,7 +159,7 @@ public class FilesystemObserver implemen
>>>     * @param directoryName the name of the directory to observe
>>>     * @param fileFilter The file filter or null if none
>>>     */
>>> -    public FilesystemObserver(String directoryName, FileFilter
>>> fileFilter) {
>>> +    public FileObserver(String directoryName, FileFilter fileFilter) {
>>>        this(new File(directoryName), fileFilter);
>>>    }
>>>
>>> @@ -171,7 +171,7 @@ public class FilesystemObserver implemen
>>>     * @param fileFilter The file filter or null if none
>>>     * @param caseSensitivity  what case sensitivity to use comparing file
>>> names, null means system sensitive
>>>     */
>>> -    public FilesystemObserver(String directoryName, FileFilter
>>> fileFilter, IOCase caseSensitivity) {
>>> +    public FileObserver(String directoryName, FileFilter fileFilter,
>>> IOCase caseSensitivity) {
>>>        this(new File(directoryName), fileFilter, caseSensitivity);
>>>    }
>>>
>>> @@ -180,7 +180,7 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @param directory the directory to observe
>>>     */
>>> -    public FilesystemObserver(File directory) {
>>> +    public FileObserver(File directory) {
>>>        this(directory, (FileFilter)null);
>>>    }
>>>
>>> @@ -190,7 +190,7 @@ public class FilesystemObserver implemen
>>>     * @param directory the directory to observe
>>>     * @param fileFilter The file filter or null if none
>>>     */
>>> -    public FilesystemObserver(File directory, FileFilter fileFilter) {
>>> +    public FileObserver(File directory, FileFilter fileFilter) {
>>>        this(directory, fileFilter, (IOCase)null);
>>>    }
>>>
>>> @@ -202,8 +202,8 @@ public class FilesystemObserver implemen
>>>     * @param fileFilter The file filter or null if none
>>>     * @param caseSensitivity  what case sensitivity to use comparing file
>>> names, null means system sensitive
>>>     */
>>> -    public FilesystemObserver(File directory, FileFilter fileFilter,
>>> IOCase caseSensitivity) {
>>> -        this(new FilesystemEntry(directory), fileFilter,
>>> caseSensitivity);
>>> +    public FileObserver(File directory, FileFilter fileFilter, IOCase
>>> caseSensitivity) {
>>> +        this(new FileEntry(directory), fileFilter, caseSensitivity);
>>>    }
>>>
>>>    /**
>>> @@ -214,7 +214,7 @@ public class FilesystemObserver implemen
>>>     * @param fileFilter The file filter or null if none
>>>     * @param caseSensitivity  what case sensitivity to use comparing file
>>> names, null means system sensitive
>>>     */
>>> -    protected FilesystemObserver(FilesystemEntry rootEntry, FileFilter
>>> fileFilter, IOCase caseSensitivity) {
>>> +    protected FileObserver(FileEntry rootEntry, FileFilter fileFilter,
>>> IOCase caseSensitivity) {
>>>        if (rootEntry == null) {
>>>            throw new IllegalArgumentException("Root entry is missing");
>>>        }
>>> @@ -237,7 +237,7 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @return the entry for the root directory
>>>     */
>>> -    public FilesystemEntry getRootEntry() {
>>> +    public FileEntry getRootEntry() {
>>>        return rootEntry;
>>>    }
>>>
>>> @@ -273,7 +273,7 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @param listener The file system listener
>>>     */
>>> -    public void addListener(final FilesystemListener listener) {
>>> +    public void addListener(final FileListener listener) {
>>>        if (listener != null) {
>>>            listeners.add(listener);
>>>        }
>>> @@ -284,7 +284,7 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @param listener The file system listener
>>>     */
>>> -    public void removeListener(final FilesystemListener listener) {
>>> +    public void removeListener(final FileListener listener) {
>>>        if (listener != null) {
>>>            while (listeners.remove(listener)) {
>>>            }
>>> @@ -296,7 +296,7 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @return The file system listeners
>>>     */
>>> -    public Iterable<FilesystemListener> getListeners() {
>>> +    public Iterable<FileListener> getListeners() {
>>>        return listeners;
>>>    }
>>>
>>> @@ -308,7 +308,7 @@ public class FilesystemObserver implemen
>>>    public void initialize() throws Exception {
>>>        rootEntry.refresh(rootEntry.getFile());
>>>        File[] files = listFiles(rootEntry.getFile());
>>> -        FilesystemEntry[] children = files.length > 0 ? new
>>> FilesystemEntry[files.length] : EMPTY_ENTRIES;
>>> +        FileEntry[] children = files.length > 0 ? new
>>> FileEntry[files.length] : EMPTY_ENTRIES;
>>>        for (int i = 0; i < files.length; i++) {
>>>            children[i] = createFileEntry(rootEntry, files[i]);
>>>        }
>>> @@ -329,7 +329,7 @@ public class FilesystemObserver implemen
>>>    public void checkAndNotify() {
>>>
>>>        /* fire onStart() */
>>> -        for (FilesystemListener listener : listeners) {
>>> +        for (FileListener listener : listeners) {
>>>            listener.onStart(this);
>>>        }
>>>
>>> @@ -344,7 +344,7 @@ public class FilesystemObserver implemen
>>>        }
>>>
>>>        /* fire onStop() */
>>> -        for (FilesystemListener listener : listeners) {
>>> +        for (FileListener listener : listeners) {
>>>            listener.onStop(this);
>>>        }
>>>    }
>>> @@ -356,10 +356,10 @@ public class FilesystemObserver implemen
>>>     * @param previous The original list of files
>>>     * @param files  The current list of files
>>>     */
>>> -    private void checkAndNotify(FilesystemEntry parent,
>>> FilesystemEntry[] previous, File[] files) {
>>> +    private void checkAndNotify(FileEntry parent, FileEntry[] previous,
>>> File[] files) {
>>>        int c = 0;
>>> -        FilesystemEntry[] current = files.length > 0 ? new
>>> FilesystemEntry[files.length] : EMPTY_ENTRIES;
>>> -        for (FilesystemEntry entry : previous) {
>>> +        FileEntry[] current = files.length > 0 ? new
>>> FileEntry[files.length] : EMPTY_ENTRIES;
>>> +        for (FileEntry entry : previous) {
>>>            while (c < files.length && comparator.compare(entry.getFile(),
>>> files[c]) > 0) {
>>>                current[c] = createFileEntry(parent, files[c]);
>>>                doCreate(current[c]);
>>> @@ -389,11 +389,11 @@ public class FilesystemObserver implemen
>>>     * @param file The file to create an entry for
>>>     * @return A new file entry
>>>     */
>>> -    private FilesystemEntry createFileEntry(FilesystemEntry parent, File
>>> file) {
>>> -        FilesystemEntry entry = parent.newChildInstance(file);
>>> +    private FileEntry createFileEntry(FileEntry parent, File file) {
>>> +        FileEntry entry = parent.newChildInstance(file);
>>>        entry.refresh(file);
>>>        File[] files = listFiles(file);
>>> -        FilesystemEntry[] children = files.length > 0 ? new
>>> FilesystemEntry[files.length] : EMPTY_ENTRIES;
>>> +        FileEntry[] children = files.length > 0 ? new
>>> FileEntry[files.length] : EMPTY_ENTRIES;
>>>        for (int i = 0; i < files.length; i++) {
>>>            children[i] = createFileEntry(entry, files[i]);
>>>        }
>>> @@ -406,16 +406,16 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @param entry The file entry
>>>     */
>>> -    private void doCreate(FilesystemEntry entry) {
>>> -        for (FilesystemListener listener : listeners) {
>>> +    private void doCreate(FileEntry entry) {
>>> +        for (FileListener listener : listeners) {
>>>            if (entry.isDirectory()) {
>>>                listener.onDirectoryCreate(entry.getFile());
>>>            } else {
>>>                listener.onFileCreate(entry.getFile());
>>>            }
>>>        }
>>> -        FilesystemEntry[] children = entry.getChildren();
>>> -        for (FilesystemEntry aChildren : children) {
>>> +        FileEntry[] children = entry.getChildren();
>>> +        for (FileEntry aChildren : children) {
>>>            doCreate(aChildren);
>>>        }
>>>    }
>>> @@ -426,9 +426,9 @@ public class FilesystemObserver implemen
>>>     * @param entry The previous file system entry
>>>     * @param file The current file
>>>     */
>>> -    private void doMatch(FilesystemEntry entry, File file) {
>>> +    private void doMatch(FileEntry entry, File file) {
>>>        if (entry.refresh(file)) {
>>> -            for (FilesystemListener listener : listeners) {
>>> +            for (FileListener listener : listeners) {
>>>                if (entry.isDirectory()) {
>>>                    listener.onDirectoryChange(file);
>>>                } else {
>>> @@ -443,8 +443,8 @@ public class FilesystemObserver implemen
>>>     *
>>>     * @param entry The file entry
>>>     */
>>> -    private void doDelete(FilesystemEntry entry) {
>>> -        for (FilesystemListener listener : listeners) {
>>> +    private void doDelete(FileEntry entry) {
>>> +        for (FileListener listener : listeners) {
>>>            if (entry.isDirectory()) {
>>>                listener.onDirectoryDelete(entry.getFile());
>>>            } else {
>>>
>>> Modified:
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java?rev=1021892&r1=1021891&r2=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -27,15 +27,15 @@ import org.apache.commons.io.filefilter.
>>> import org.apache.commons.io.filefilter.IOFileFilter;
>>>
>>> /**
>>> - * {@link FilesystemObserver} Test Case.
>>> + * {@link FileObserver} Test Case.
>>> */
>>> public abstract class AbstractMonitorTestCase extends TestCase {
>>>
>>> -    /** Filesystem observer */
>>> -    protected FilesystemObserver observer;
>>> +    /** File observer */
>>> +    protected FileObserver observer;
>>>
>>>    /** Listener which collects file changes */
>>> -    protected CollectionFilesystemListener listener;
>>> +    protected CollectionFileListener listener;
>>>
>>>    /** Test diretory name */
>>>    protected String testDirName = null;
>>> @@ -78,13 +78,13 @@ public abstract class AbstractMonitorTes
>>>    }
>>>
>>>    /**
>>> -     * Create a {@link FilesystemObserver}.
>>> +     * Create a {@link FileObserver}.
>>>     *
>>>     * @param file The directory to observe
>>>     * @param fileFilter The file filter to apply
>>>     */
>>>    protected void createObserver(File file, FileFilter fileFilter) {
>>> -        observer = new FilesystemObserver(file, fileFilter);
>>> +        observer = new FileObserver(file, fileFilter);
>>>        observer.addListener(listener);
>>>        try {
>>>            observer.initialize();
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFilesystemListener.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java?p2=commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java&p1=commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFilesystemListener.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFilesystemListener.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -22,10 +22,10 @@ import java.util.ArrayList;
>>> import java.util.Collection;
>>>
>>> /**
>>> - * {@link FilesystemListener} implementation that adds created, changed
>>> and deleted
>>> + * {@link FileListener} implementation that adds created, changed and
>>> deleted
>>> * files/directories to a set of {@link Collection}s.
>>> */
>>> -public class CollectionFilesystemListener implements FilesystemListener,
>>> Serializable {
>>> +public class CollectionFileListener implements FileListener,
>>> Serializable {
>>>
>>>    private final boolean clearOnStart;
>>>    private final Collection<File> createdFiles = new ArrayList<File>();
>>> @@ -40,7 +40,7 @@ public class CollectionFilesystemListene
>>>     *
>>>     * @param clearOnStart true if clear() should be called by onStart().
>>>     */
>>> -    public CollectionFilesystemListener(boolean clearOnStart) {
>>> +    public CollectionFileListener(boolean clearOnStart) {
>>>        this.clearOnStart = clearOnStart;
>>>    }
>>>
>>> @@ -49,7 +49,7 @@ public class CollectionFilesystemListene
>>>     *
>>>     * @param observer The file system observer
>>>     */
>>> -    public void onStart(final FilesystemObserver observer) {
>>> +    public void onStart(final FileObserver observer) {
>>>        if (clearOnStart) {
>>>            clear();
>>>        }
>>> @@ -180,7 +180,7 @@ public class CollectionFilesystemListene
>>>     *
>>>     * @param observer The file system observer
>>>     */
>>> -    public void onStop(final FilesystemObserver observer) {
>>> +    public void onStop(final FileObserver observer) {
>>>    }
>>>
>>> }
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileMonitorTestCase.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileSystemMonitorTestCase.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileMonitorTestCase.java?p2=commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileMonitorTestCase.java&p1=commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileSystemMonitorTestCase.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileSystemMonitorTestCase.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileMonitorTestCase.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -20,23 +20,23 @@ import java.io.File;
>>> import java.util.Collection;
>>>
>>> /**
>>> - * {@link FilesystemMonitor} Test Case.
>>> + * {@link FileMonitor} Test Case.
>>> */
>>> -public class FileSystemMonitorTestCase extends AbstractMonitorTestCase {
>>> +public class FileMonitorTestCase extends AbstractMonitorTestCase {
>>>
>>>    /**
>>>     * Construct a new test case.
>>>     *
>>>     * @param name The name of the test
>>>     */
>>> -    public FileSystemMonitorTestCase(String name) {
>>> +    public FileMonitorTestCase(String name) {
>>>        super(name);
>>>        testDirName = "test-monitor";
>>>    }
>>>
>>>    @Override
>>>    protected void setUp() throws Exception {
>>> -        listener = new CollectionFilesystemListener(false);
>>> +        listener = new CollectionFileListener(false);
>>>        super.setUp();
>>>    }
>>>
>>> @@ -46,7 +46,7 @@ public class FileSystemMonitorTestCase e
>>>    public void testMonitor() {
>>>        try {
>>>            long interval = 100;
>>> -            FilesystemMonitor monitor = new FilesystemMonitor(interval,
>>> observer);
>>> +            FileMonitor monitor = new FileMonitor(interval, observer);
>>>            monitor.start();
>>>
>>>            // Create a File
>>>
>>> Copied:
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileObserverTestCase.java
>>> (from r1021885,
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FilesystemObserverTestCase.java)
>>> URL:
>>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileObserverTestCase.java?p2=commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileObserverTestCase.java&p1=commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FilesystemObserverTestCase.java&r1=1021885&r2=1021892&rev=1021892&view=diff
>>> ==============================================================================
>>> ---
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FilesystemObserverTestCase.java
>>> (original)
>>> +++
>>> commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileObserverTestCase.java
>>> Tue Oct 12 19:27:40 2010
>>> @@ -23,23 +23,23 @@ import org.apache.commons.io.FileUtils;
>>> import org.apache.commons.io.filefilter.FileFilterUtils;
>>>
>>> /**
>>> - * {@link FilesystemObserver} Test Case.
>>> + * {@link FileObserver} Test Case.
>>> */
>>> -public class FilesystemObserverTestCase extends AbstractMonitorTestCase
>>> {
>>> +public class FileObserverTestCase extends AbstractMonitorTestCase {
>>>
>>>    /**
>>>     * Construct a new test case.
>>>     *
>>>     * @param name The name of the test
>>>     */
>>> -    public FilesystemObserverTestCase(String name) {
>>> +    public FileObserverTestCase(String name) {
>>>        super(name);
>>>        testDirName = "test-observer";
>>>    }
>>>
>>>    @Override
>>>    protected void setUp() throws Exception {
>>> -        listener = new CollectionFilesystemListener(true);
>>> +        listener = new CollectionFileListener(true);
>>>        super.setUp();
>>>    }
>>>
>>> @@ -346,7 +346,7 @@ public class FilesystemObserverTestCase
>>>    }
>>>
>>>    /**
>>> -     * Call {@link FilesystemObserver#checkAndNotify()}.
>>> +     * Call {@link FileObserver#checkAndNotify()}.
>>>     *
>>>     * @throws Exception if an error occurs
>>>     */
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message