Commit d540c500 authored by Unico Hommes's avatar Unico Hommes

CMS-9708

- make both FileSystemObserver implementations usable outside own package
- move test config class to main source area so it can be used outside webfiles for running tests
parent 267d03a4
......@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
* File system observer that polls for changes. After a set of observed changes has been reported, the polling
* thread sleeps a fixed amount of time.
*/
class FileSystemPoller implements FileSystemObserver, FileAlterationListener {
public class FileSystemPoller implements FileSystemObserver, FileAlterationListener {
private static final Logger log = LoggerFactory.getLogger(FileSystemPoller.class);
......@@ -43,7 +43,7 @@ class FileSystemPoller implements FileSystemObserver, FileAlterationListener {
private final FileAlterationMonitor monitor;
private FileSystemListener listenerForCurrentChange;
FileSystemPoller(final FileFilter fileNameFilter, final long pollingDelayMillis) throws Exception {
public FileSystemPoller(final FileFilter fileNameFilter, final long pollingDelayMillis) throws Exception {
this.fileNameFilter = fileNameFilter;
listeners = new HashMap<>();
monitor = new FileAlterationMonitor(pollingDelayMillis);
......
......@@ -45,7 +45,7 @@ import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
/**
* File system observer that uses a {@link java.nio.file.WatchService} to get notified about changes.
*/
class FileSystemWatcher implements FileSystemObserver, Runnable {
public class FileSystemWatcher implements FileSystemObserver, Runnable {
private static final Logger log = LoggerFactory.getLogger(SubDirectoriesWatcher.class);
......@@ -68,7 +68,7 @@ class FileSystemWatcher implements FileSystemObserver, Runnable {
*/
final Map<WatchKey, Path> watchedPaths;
FileSystemWatcher(final GlobFileNameMatcher watchedFiles) throws IOException {
public FileSystemWatcher(final GlobFileNameMatcher watchedFiles) throws IOException {
this.watchedFiles = watchedFiles;
this.changesProcessors = new HashMap<>();
......
......@@ -16,10 +16,9 @@
package org.onehippo.cms7.services.webfiles.watch;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.onehippo.cms7.services.webfiles.watch.WebFilesWatcherConfig;
public class WebFilesWatcherJavaConfig implements WebFilesWatcherConfig {
private final List<String> watchedModules;
......@@ -43,21 +42,15 @@ public class WebFilesWatcherJavaConfig implements WebFilesWatcherConfig {
}
public void includeFiles(final String... globPatterns) {
for (String pattern : globPatterns) {
includedFiles.add(pattern);
}
Collections.addAll(includedFiles, globPatterns);
}
public void excludeDirs(final String... globPatterns) {
for (String pattern : globPatterns) {
excludedDirs.add(pattern);
}
Collections.addAll(excludedDirs, globPatterns);
}
void useWatchServiceOnOsNames(final String... osNames) {
for (String osName : osNames) {
useWatchServiceOnOsNames.add(osName);
}
Collections.addAll(useWatchServiceOnOsNames, osNames);
}
void setWatchDelayMillis(final long delayMillis) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment