Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

2341-watch-service-relative-path #2432

Merged

Conversation

svilenvul
Copy link
Contributor

See #2341


Fixes bug introduced by #1597 reverted with #1754.

The implementation of FolderObserver#processWatchEvent() does not get the file name correctly.
This led to duplicated directory names (see the logs in #1597).

AbstractWatchServiceTest is modified to run on different OS.

Signed-off-by: Svilen Valkanov svilen.valkanov@musala.com
svilenvul )

@svilenvul svilenvul force-pushed the 2341-watch-service-relative-path branch 3 times, most recently from 6daa817 to c0679ec Compare November 10, 2016 13:21
@svilenvul
Copy link
Contributor Author

I have no idea why the ip-validation fails. The author and the committer of the last commit seems to be both set to Svilen Valkanov (not svilenvul).

@kaikreuzer
Copy link
Contributor

@svilenvul Never mind failing IP checks - we can always manually check the CLAs, this isn't a blocker.

@maggu2810
Copy link
Contributor

The author and the committer of the last commit seems to be both set to Svilen Valkanov (not svilenvul).

You are right, it seems to be correct and well formatted.

author Svilen Valkanov <svilen.valkanov@musala.com> 1478782608 +0200
committer Svilen Valkanov <svilen.valkanov@musala.com> 1478784068 +0200

Also the manual validation succeeds, so I see no blocker here as well.

dstivanov and others added 2 commits November 11, 2016 15:29
…hived#1597)

* The watch service is now providing the relative path to the file when a watch event is processed. The directory modifications can be now optionally watched. Added more tests to ensure that the watch service is adequately working (some tests are platform dependent). The list of handled test events is now synchronized as several threads are accessing it. FolderObserver and ConfigDispatcher are adapted to the changes in the AbstractWatchService.

Signed-off-by: Dimitar Ivanov <dstivanov@gmail.com>
…rchived#1754.

The implementation of FolderObserver#processWatchEvent() does not get the
file name correctly.
This led to duplicated directory names (see the logs in eclipse-archived#1597).

AbstractWatchServiceTest is modified to run on different OS.

Signed-off-by: Svilen Valkanov <svilen.valkanov@musala.com>
@svilenvul
Copy link
Contributor Author

The first commit from @dstivanov has been already reviewed once in #1597.

In the second commit I have only adapted the tests to run on different OS and fixed the small bug in FolderObserver that was the reason to revert the first commit. Now all the tests ( for AbstractWatchService, FolderObserver and ConfigDispatcher) are green.

Could you please take a brief look at the PR ?

Copy link
Contributor

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kaikreuzer kaikreuzer merged commit 4a489f8 into eclipse-archived:master Nov 29, 2016
Copy link
Contributor

@maggu2810 maggu2810 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all it looks goot. Just some minor comments about style.

protected void registerDirectory(Path subDir) throws IOException {
subDir.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
protected WatchKey registerDirectory(Path subDir) throws IOException {
WatchKey registrationKey = subDir.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* in the watch service.
*/
public AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map<WatchKey, Path> registeredKeys) {
this.watchService = watchService;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to call:

this(watchService, watchedDir, registeredKeys, true);

if (subDir != null && MapUtils.isNotEmpty(folderFileExtMap)) {
String folderName = subDir.getFileName().toString();
if (folderFileExtMap.containsKey(folderName)) {
subDir.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
WatchKey registrationKey = subDir.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

svilenvul pushed a commit to MusalaSoft/smarthome that referenced this pull request Nov 29, 2016
Adapting the code of AutomationWatchService to use relative path.
This change was necessary after eclipse-archived#2432 was merged.

Signed-off-by: Svilen Valkanov <svilen.valkanov@musala.com>
maggu2810 pushed a commit that referenced this pull request Nov 29, 2016
Adapting the code of AutomationWatchService to use relative path.
This change was necessary after #2432 was merged.

Signed-off-by: Svilen Valkanov <svilen.valkanov@musala.com>
kaikreuzer pushed a commit that referenced this pull request Nov 29, 2016
Realted to: #2432
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants