Class FileTreeRepositories


  • public class FileTreeRepositories
    extends java.lang.Object
    Provides factory methods for generating instances of FileTreeRepository.
    • Method Detail

      • get

        public static <T> FileTreeRepository<T> get​(FileTreeDataViews.Converter<T> converter,
                                                    boolean followLinks)
                                             throws java.lang.InterruptedException,
                                                    java.io.IOException
        Create a file tree repository.
        Type Parameters:
        T - the value type of the cache entries
        Parameters:
        converter - converts a path to the cached value type T
        followLinks - toggles whether or not to follow symbolic links. When true, any symbolic links that point to a regular file will trigger an event when the target file is modified. For any symbolic links that point to a directory, the children of the target directory will be included (up to the max depth parameter specified by FileTreeRepository.register(java.nio.file.Path, int)) and will trigger an event when any of the included children are modified. When false, symbolic links are not followed and only events for the symbolic link itself are reported.
        Returns:
        a file tree repository.
        Throws:
        java.lang.InterruptedException - if the path watcher can't be started.
        java.io.IOException - if an instance of WatchService cannot be created.
      • get

        public static <T> FileTreeRepository<T> get​(FileTreeDataViews.Converter<T> converter,
                                                    Filter<TypedPath> filter,
                                                    boolean followLinks)
                                             throws java.lang.InterruptedException,
                                                    java.io.IOException
        Create a file tree repository.
        Type Parameters:
        T - the value type of the cache entries
        Parameters:
        converter - converts a path to the cached value type T
        followLinks - toggles whether or not to follow symbolic links. When true, any symbolic links that point to a regular file will trigger an event when the target file is modified. For any symbolic links that point to a directory, the children of the target directory will be included (up to the max depth parameter specified by FileTreeRepository.register(java.nio.file.Path, int)) and will trigger an event when any of the included children are modified. When false, symbolic links are not followed and only events for the symbolic link itself are reported.
        Returns:
        a file tree repository.
        Throws:
        java.lang.InterruptedException - if the path watcher can't be started.
        java.io.IOException - if an instance of WatchService cannot be created.
      • get

        public static <T> FileTreeRepository<T> get​(FileTreeDataViews.Converter<T> converter,
                                                    boolean followLinks,
                                                    boolean rescanOnDirectoryUpdates,
                                                    Logger logger)
                                             throws java.lang.InterruptedException,
                                                    java.io.IOException
        Create a file tree repository.
        Type Parameters:
        T - the value type of the cache entries
        Parameters:
        converter - converts a path to the cached value type T
        followLinks - toggles whether or not to follow symbolic links. When true, any symbolic links that point to a regular file will trigger an event when the target file is modified. For any symbolic links that point to a directory, the children of the target directory will be included (up to the max depth parameter specified by FileTreeRepository.register(java.nio.file.Path, int)) and will trigger an event when any of the included children are modified. When false, symbolic links are not followed and only events for the symbolic link itself are reported.
        rescanOnDirectoryUpdates - toggles whether or not we rescan a directory's subtree when an update is detected for that directory. This can be very expensive since it will perform iops proportional to the number of files in the subtree. It generally should not be necessary since we are also watching the subtree for events.
        logger - logs debug events
        Returns:
        a file tree repository.
        Throws:
        java.lang.InterruptedException - if the path watcher can't be started.
        java.io.IOException - if an instance of WatchService cannot be created.
      • get

        public static <T> FileTreeRepository<T> get​(FileTreeDataViews.Converter<T> converter,
                                                    Filter<TypedPath> filter,
                                                    boolean followLinks,
                                                    boolean rescanOnDirectoryUpdates,
                                                    Logger logger)
                                             throws java.lang.InterruptedException,
                                                    java.io.IOException
        Create a file tree repository.
        Type Parameters:
        T - the value type of the cache entries
        Parameters:
        converter - converts a path to the cached value type T
        filter - only cache paths accepted by this filter
        followLinks - toggles whether or not to follow symbolic links. When true, any symbolic links that point to a regular file will trigger an event when the target file is modified. For any symbolic links that point to a directory, the children of the target directory will be included (up to the max depth parameter specified by FileTreeRepository.register(java.nio.file.Path, int)) and will trigger an event when any of the included children are modified. When false, symbolic links are not followed and only events for the symbolic link itself are reported.
        rescanOnDirectoryUpdates - toggles whether or not we rescan a directory's subtree when an update is detected for that directory. This can be very expensive since it will perform iops proportional to the number of files in the subtree. It generally should not be necessary since we are also watching the subtree for events.
        logger - logs debug events
        Returns:
        a file tree repository.
        Throws:
        java.lang.InterruptedException - if the path watcher can't be started.
        java.io.IOException - if an instance of WatchService cannot be created.