yangys
8 天以前 f4c6e0e1308bccb943ca1cddfdf7f643b6b6a1aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.springblade.mdm.machineback.filewatch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.nio.file.Path;
import java.util.Set;
@Service
public class DynamicDirectoryWatcher {
    private final FileWatcherService fileWatcherService;
 
    @Autowired
    public DynamicDirectoryWatcher(FileWatcherService fileWatcherService) {
        this.fileWatcherService = fileWatcherService;
    }
 
    public void addDirectory(Path directory, FileWatcherService.FileChangeListener listener) throws Exception {
        fileWatcherService.watchDirectory(directory, listener);
    }
 
    public void removeDirectory(Path directory) throws Exception {
        fileWatcherService.stopWatching(directory);
    }
 
    public Set<Path> getWatchedDirectories() {
        return null;
        //return fileWatcherService.getWatchedDirectories();
    }
}