From ecc1fef27349f69f919136a7cf5e2c95273f5129 Mon Sep 17 00:00:00 2001 From: Ali Sheikhi Date: Thu, 8 Feb 2024 16:53:17 +0100 Subject: [PATCH] DD-1492 dd-manage-deposits improvemnets fixes for DD-1419 - Part 2 directory search depth limit --- .../managedeposit/core/service/IngestPathMonitor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/nl/knaw/dans/managedeposit/core/service/IngestPathMonitor.java b/src/main/java/nl/knaw/dans/managedeposit/core/service/IngestPathMonitor.java index 179b49e..ea2aa5e 100644 --- a/src/main/java/nl/knaw/dans/managedeposit/core/service/IngestPathMonitor.java +++ b/src/main/java/nl/knaw/dans/managedeposit/core/service/IngestPathMonitor.java @@ -47,13 +47,13 @@ public IngestPathMonitor(List depositBoxesPaths, DepositStatusUpdater depo } private void startMonitors() throws Exception { - IOFileFilter directories = FileFilterUtils.and(FileFilterUtils.directoryFileFilter(), HiddenFileFilter.VISIBLE); - IOFileFilter files = FileFilterUtils.and(FileFilterUtils.fileFileFilter(), FileFilterUtils.nameFileFilter("deposit.properties", IOCase.INSENSITIVE)); - IOFileFilter filter = FileFilterUtils.or(directories, files); - - log.info("Starting 'IngestPathMonitor', file filter: deposit.properties"); + log.info("Starting 'IngestPathMonitor', file filter: deposit.properties, directory depth: only first child of the base folder"); for (Path folder : toMonitorPaths) { + IOFileFilter directories = FileFilterUtils.and(FileFilterUtils.directoryFileFilter(), new DepthFileFilter(folder, 1)); + IOFileFilter files = FileFilterUtils.and(FileFilterUtils.fileFileFilter(), FileFilterUtils.nameFileFilter("deposit.properties", IOCase.INSENSITIVE)); + IOFileFilter filter = FileFilterUtils.or(directories, files); + FileAlterationObserver observer = new FileAlterationObserver(folder.toFile(), filter); observer.addListener(this);