Package com.swoval.files
Class FileTreeRepositories
- java.lang.Object
-
- com.swoval.files.FileTreeRepositories
-
public class FileTreeRepositories extends java.lang.ObjectProvides factory methods for generating instances ofFileTreeRepository.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> FileTreeRepository<T>get(FileTreeDataViews.Converter<T> converter, boolean followLinks)Create a file tree repository.static <T> FileTreeRepository<T>get(FileTreeDataViews.Converter<T> converter, boolean followLinks, boolean rescanOnDirectoryUpdates, Logger logger)Create a file tree repository.static <T> FileTreeRepository<T>get(FileTreeDataViews.Converter<T> converter, Filter<TypedPath> filter, boolean followLinks)Create a file tree repository.static <T> FileTreeRepository<T>get(FileTreeDataViews.Converter<T> converter, Filter<TypedPath> filter, boolean followLinks, boolean rescanOnDirectoryUpdates, Logger logger)Create a file tree repository.
-
-
-
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 TfollowLinks- 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 byFileTreeRepository.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 ofWatchServicecannot 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 TfollowLinks- 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 byFileTreeRepository.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 ofWatchServicecannot 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 TfollowLinks- 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 byFileTreeRepository.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 ofWatchServicecannot 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 Tfilter- only cache paths accepted by this filterfollowLinks- 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 byFileTreeRepository.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 ofWatchServicecannot be created.
-
-