Implements the PathWatcher for Mac OSX using the Apple File System Events Api.
Provides a mutable in-memory cache of files and subdirectories with basic CRUD functionality.
Tracks which directories the user wishes to monitor.
Tracks which directories the user wishes to monitor. This can be used to determine whether or not a path is part of the subtree specified by the set of paths registered by the user.
A repository for a directory.
A repository for a directory. The FileTreeView.list method will only return non-empty results for paths that are children of the root directory, specified by DirectoryView.getTypedPath.
A repository for which each java.nio.file.Path has an associated data value.
A repository for which each java.nio.file.Path has an associated data value.
the data value for each path
Provides an in memory cache of portions of the file system.
Provides an in memory cache of portions of the file system. Directories are added to the cache using the FileTreeRepository.register method. Once a Path is added the cache, its contents may be retrieved using the FileTreeRepository.list method. The cache stores the path information in Entry instances.
A default implementation is provided by FileTreeRepositories.get. The user may cache arbitrary information in the cache by customizing the Converter that is passed into the factory FileTreeRepositories.get.
The cache allows the user to register a regular file, directory or symbolic link. After registration, the cache should monitor the path (and in the case of symbolic links, the target of the link) for updates. Whenever an update is detected, the cache updates its internal representation of the file system. When that is complete, it will notify all of the registered com.swoval.files.Observers of the change. In general, the update that is sent in the callback will be visible if the user lists the relevant path. It is however, possible that if the file is being updated rapidly that the internal state of the cache may change in between the callback being invoked and the user listing the path. Once the file system activity settles down, the cache should always end up in a consistent state where it mirrors the state of the file system.
The semantics of the list method are very similar to the linux ls
tool. Listing a directory
returns all of the subdirectories and files contained in the directory and the empty list if the
directory is empty. Listing a file, however, will return the entry for the file if it exists and
the empty list otherwise.
the type of data stored in the Entry instances for the cache
Functional interface for a function that takes one argument.
Provides a PathWatcher that is backed by a java.nio.file.WatchService.
Container class that wraps multiple FileTreeViews.Observer and runs the callbacks for each whenever the PathWatcher detects an event.
Container class that wraps multiple FileTreeViews.Observer and runs the callbacks for each whenever the PathWatcher detects an event.
the data type for the PathWatcher to which the observers correspond
Watches directories for file changes.
Watches directories for file changes. The api permits recursive watching of directories unlike the java.nio.file.WatchService. Some of the behavior may vary by platform due to fundamental differences in the underlying file event apis. For example, Linux doesn't support recursive directory monitoring via inotify, so it's possible in rare cases to miss file events for newly created files in newly created directories. On OSX, it is difficult to disambiguate file creation and modify events, so the Event.Kind is best effort, but should not be relied upon to accurately reflect the state of the file.
Augments the java.nio.file.WatchService with a RegisterableWatchService.register method.
Augments the java.nio.file.WatchService with a RegisterableWatchService.register method. This is because https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html.register does not work on custom watch services.
Monitors symlink targets.
Monitors symlink targets. The SymlinkWatcher maintains a mapping of symlink targets to symlink. When the symlink target is modified, the watcher will detect the update and invoke a provided com.swoval.functional.Consumer for the symlink.
A mix-in for an object that represents a file system path.
A mix-in for an object that represents a file system path. Provides (possibly) fast accessors for the type of the file.
Provides a mutable in-memory cache of files and subdirectories with basic CRUD functionality. The CachedDirectory can be fully recursive as the subdirectories are themselves stored as recursive (when the CachedDirectory is initialized without the recursive toggle, the subdirectories are stored as Entry instances. The primary use case is the implementation of FileTreeRepository and NioPathWatcher. Directly handling CachedDirectory instances is discouraged because it is inherently mutable so it's better to let the FileTreeRepository manage it and query the cache rather than CachedDirectory directly.
The CachedDirectory should cache all of the files and subdirectories up the maximum depth. A maximum depth of zero means that the CachedDirectory should cache the subdirectories, but not traverse them. A depth
< 0
means that it should not cache any files or subdirectories within the directory. In the event that a loop is created by symlinks, the CachedDirectory will include the symlink that completes the loop, but will not descend further (inducing a loop).the cache value type.