Search in sources :

Example 56 with WatchKey

use of java.nio.file.WatchKey in project jPOS by jpos.

the class Q2 method waitForChanges.

private boolean waitForChanges(WatchService service) throws InterruptedException {
    WatchKey key = service.poll(SCAN_INTERVAL, TimeUnit.MILLISECONDS);
    if (key != null) {
        LogEvent evt = getLog().createInfo();
        for (WatchEvent<?> ev : key.pollEvents()) {
            if (ev.kind() == StandardWatchEventKinds.ENTRY_CREATE) {
                evt.addMessage(String.format("created %s/%s", deployDir.getName(), ev.context()));
            } else if (ev.kind() == StandardWatchEventKinds.ENTRY_DELETE) {
                evt.addMessage(String.format("removed %s/%s", deployDir.getName(), ev.context()));
            } else if (ev.kind() == StandardWatchEventKinds.ENTRY_MODIFY) {
                evt.addMessage(String.format("modified %s/%s", deployDir.getName(), ev.context()));
            }
        }
        Logger.log(evt);
        if (!key.reset()) {
            getLog().warn(String.format("deploy directory '%s' no longer valid", deployDir.getAbsolutePath()));
            // deploy directory no longer valid
            return false;
        }
        try {
            Environment.reload();
        } catch (IOException e) {
            getLog().warn(e);
        }
    }
    return true;
}
Also used : LogEvent(org.jpos.util.LogEvent) WatchKey(java.nio.file.WatchKey)

Example 57 with WatchKey

use of java.nio.file.WatchKey in project pravega by pravega.

the class FileModificationEventWatcher method retrieveWatchKeyFrom.

private WatchKey retrieveWatchKeyFrom(WatchService watchService) throws InterruptedException {
    WatchKey result = watchService.take();
    log.info("Retrieved and removed watch key for watching file at path: {}", this.watchedFilePath);
    // Each file modification/create usually results in the WatcherService reporting the WatchEvent twice,
    // as the file is updated twice: once for the content and once for the file modification time.
    // These events occur in quick succession. We wait for 200 ms., here so that the events get
    // de-duplicated - in other words only single event is processed.
    // 
    // See https://stackoverflow.com/questions/16777869/java-7-watchservice-ignoring-multiple-occurrences-
    // of-the-same-event for a discussion on this topic.
    // 
    // If the two events are not raised within this duration, the callback will be invoked twice, which we
    // assume is not a problem for applications of this object. In case the applications do care about
    // being notified only once for each modification, they should use the FileModificationPollingMonitor
    // instead.
    Thread.sleep(200);
    return result;
}
Also used : WatchKey(java.nio.file.WatchKey)

Example 58 with WatchKey

use of java.nio.file.WatchKey in project meecrowave by apache.

the class JBake method main.

// if you want to switch off PDF generation use as arguments: src/main/jbake target/site-tmp true false
public static void main(final String[] args) throws Exception {
    // try to have parallelStream better than default
    System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "64");
    final File source = args == null || args.length < 1 ? new File("src/main/jbake") : new File(args[0]);
    final File pdfSource = new File(source, "content");
    final File destination = args == null || args.length < 2 ? new File("target/site-tmp") : new File(args[1]);
    // by default we dev
    final boolean startHttp = args == null || args.length < 2 || Boolean.parseBoolean(args[2]);
    // by default...too slow sorry
    final boolean skipPdf = args != null && args.length > 3 && !Boolean.parseBoolean(args[3]);
    // grabs central
    final boolean updateDownloads = args != null && args.length > 4 && Boolean.parseBoolean(args[4]);
    // generation of dynamic content
    new Configuration().run();
    new CliConfiguration().run();
    new ArquillianConfiguration().run();
    new MavenConfiguration().run();
    new OAuth2Configuration().run();
    new LetsEncryptConfiguration().run();
    new GradleConfiguration().run();
    new ProxyConfiguration().run();
    if (updateDownloads) {
        final ByteArrayOutputStream tableContent = new ByteArrayOutputStream();
        try (final PrintStream stream = new PrintStream(tableContent)) {
            Downloads.doMain(stream);
        }
        try (final Writer writer = new FileWriter(new File(source, "content/download.adoc"))) {
            writer.write("= Downloads\n" + ":jbake-generated: true\n" + ":jbake-date: 2017-07-24\n" + ":jbake-type: page\n" + ":jbake-status: published\n" + ":jbake-meecrowavepdf:\n" + ":jbake-meecrowavecolor: body-blue\n" + ":icons: font\n" + "\n" + "License under Apache License v2 (ALv2).\n" + "\n" + "[.table.table-bordered,options=\"header\"]\n" + "|===\n" + "|Name|Version|Date|Size|Type|Links\n");
            writer.write(new String(tableContent.toByteArray(), StandardCharsets.UTF_8));
            writer.write("\n|===\n");
        }
    }
    final Runnable build = () -> {
        System.out.println("Building Meecrowave website in " + destination);
        final Orient orient = Orient.instance();
        try {
            final Oven oven = new Oven(new JBakeConfigurationFactory().createDefaultJbakeConfiguration(source, destination, new CompositeConfiguration() {

                {
                    final CompositeConfiguration config = new CompositeConfiguration();
                    config.addConfiguration(new MapConfiguration(new HashMap<String, Object>() {

                        {
                            put("asciidoctor.attributes", new ArrayList<String>() {

                                {
                                    add("source-highlighter=highlightjs");
                                    add("highlightjs-theme=idea");
                                    add("context_rootpath=/meecrowave");
                                    add("icons=font");
                                }
                            });
                        }
                    }));
                    config.addConfiguration(DefaultJBakeConfiguration.class.cast(new ConfigUtil().loadConfig(source)).getCompositeConfiguration());
                    addConfiguration(config);
                }
            }, true));
            System.out.println("  > baking");
            oven.bake();
            if (!skipPdf) {
                System.out.println("  > pdfifying");
                PDFify.generatePdf(pdfSource, destination);
            }
            System.out.println("  > done :)");
        } catch (final Exception e) {
            e.printStackTrace();
        } finally {
            orient.shutdown();
        }
    };
    build.run();
    if (startHttp) {
        final Path watched = source.toPath();
        final WatchService watchService = watched.getFileSystem().newWatchService();
        watched.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
        final AtomicBoolean run = new AtomicBoolean(true);
        final AtomicLong render = new AtomicLong(-1);
        final Thread renderingThread = new Thread() {

            {
                setName("jbake-renderer");
            }

            @Override
            public void run() {
                long last = System.currentTimeMillis();
                while (run.get()) {
                    if (render.get() > last) {
                        last = System.currentTimeMillis();
                        try {
                            build.run();
                        } catch (final Throwable oops) {
                            oops.printStackTrace();
                        }
                    }
                    try {
                        sleep(TimeUnit.SECONDS.toMillis(1));
                    } catch (final InterruptedException e) {
                        Thread.currentThread().interrupt();
                        break;
                    }
                }
                System.out.println("Exiting renderer");
            }
        };
        final Thread watcherThread = new Thread() {

            {
                setName("jbake-file-watcher");
            }

            @Override
            public void run() {
                while (run.get()) {
                    try {
                        final WatchKey key = watchService.poll(1, TimeUnit.SECONDS);
                        if (key == null) {
                            continue;
                        }
                        for (final WatchEvent<?> event : key.pollEvents()) {
                            final WatchEvent.Kind<?> kind = event.kind();
                            if (kind != ENTRY_CREATE && kind != ENTRY_DELETE && kind != ENTRY_MODIFY) {
                                // unlikely but better to protect ourself
                                continue;
                            }
                            final Path updatedPath = Path.class.cast(event.context());
                            if (kind == ENTRY_DELETE || updatedPath.toFile().isFile()) {
                                final String path = updatedPath.toString();
                                if (!path.contains("___jb") && !path.endsWith("~")) {
                                    render.set(System.currentTimeMillis());
                                }
                            }
                        }
                        key.reset();
                    } catch (final InterruptedException e) {
                        Thread.currentThread().interrupt();
                        run.compareAndSet(true, false);
                    } catch (final ClosedWatchServiceException cwse) {
                        if (!run.get()) {
                            throw new IllegalStateException(cwse);
                        }
                    }
                }
                System.out.println("Exiting file watcher");
            }
        };
        renderingThread.start();
        watcherThread.start();
        final Runnable onQuit = () -> {
            run.compareAndSet(true, false);
            Stream.of(watcherThread, renderingThread).forEach(thread -> {
                try {
                    thread.join();
                } catch (final InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            });
            try {
                watchService.close();
            } catch (final IOException ioe) {
            // not important
            }
        };
        try (final Meecrowave container = new Meecrowave(new Meecrowave.Builder() {

            {
                setWebResourceCached(false);
                property("proxy-skip", "true");
            }
        }) {

            {
                start();
                getTomcat().getServer().setParentClassLoader(Thread.currentThread().getContextClassLoader());
                deployWebapp("/meecrowave", destination);
            }
        }) {
            System.out.println("Started on http://localhost:" + container.getConfiguration().getHttpPort() + "/meecrowave");
            final Scanner console = new Scanner(System.in);
            String cmd;
            while (((cmd = console.nextLine())) != null) {
                if ("quit".equals(cmd)) {
                    break;
                } else if ("r".equals(cmd) || "rebuild".equals(cmd) || "build".equals(cmd) || "b".equals(cmd)) {
                    render.set(System.currentTimeMillis());
                } else {
                    System.err.println("Ignoring " + cmd + ", please use 'build' or 'quit'");
                }
            }
        }
        onQuit.run();
    }
}
Also used : ByteArrayOutputStream(java.io.ByteArrayOutputStream) DefaultJBakeConfiguration(org.jbake.app.configuration.DefaultJBakeConfiguration) OAuth2Configuration(org.apache.meecrowave.doc.generator.OAuth2Configuration) ProxyServletSetup(org.apache.meecrowave.proxy.servlet.meecrowave.ProxyServletSetup) Scanner(java.util.Scanner) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Orient(com.orientechnologies.orient.core.Orient) HashMap(java.util.HashMap) ConfigUtil(org.jbake.app.configuration.ConfigUtil) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) ProxyConfiguration(org.apache.meecrowave.doc.generator.ProxyConfiguration) ENTRY_CREATE(java.nio.file.StandardWatchEventKinds.ENTRY_CREATE) ArrayList(java.util.ArrayList) WatchKey(java.nio.file.WatchKey) MapConfiguration(org.apache.commons.configuration.MapConfiguration) GradleConfiguration(org.apache.meecrowave.doc.generator.GradleConfiguration) JBakeConfigurationFactory(org.jbake.app.configuration.JBakeConfigurationFactory) Path(java.nio.file.Path) PrintStream(java.io.PrintStream) ENTRY_MODIFY(java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY) WatchEvent(java.nio.file.WatchEvent) FileWriter(java.io.FileWriter) LetsEncryptConfiguration(org.apache.meecrowave.doc.generator.LetsEncryptConfiguration) IOException(java.io.IOException) Downloads(org.apache.meecrowave.doc.generator.Downloads) CliConfiguration(org.apache.meecrowave.doc.generator.CliConfiguration) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) TimeUnit(java.util.concurrent.TimeUnit) MavenConfiguration(org.apache.meecrowave.doc.generator.MavenConfiguration) AtomicLong(java.util.concurrent.atomic.AtomicLong) WatchService(java.nio.file.WatchService) ClosedWatchServiceException(java.nio.file.ClosedWatchServiceException) Stream(java.util.stream.Stream) Oven(org.jbake.app.Oven) ENTRY_DELETE(java.nio.file.StandardWatchEventKinds.ENTRY_DELETE) Writer(java.io.Writer) Meecrowave(org.apache.meecrowave.Meecrowave) ArquillianConfiguration(org.apache.meecrowave.doc.generator.ArquillianConfiguration) Configuration(org.apache.meecrowave.doc.generator.Configuration) Scanner(java.util.Scanner) DefaultJBakeConfiguration(org.jbake.app.configuration.DefaultJBakeConfiguration) OAuth2Configuration(org.apache.meecrowave.doc.generator.OAuth2Configuration) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) ProxyConfiguration(org.apache.meecrowave.doc.generator.ProxyConfiguration) MapConfiguration(org.apache.commons.configuration.MapConfiguration) GradleConfiguration(org.apache.meecrowave.doc.generator.GradleConfiguration) LetsEncryptConfiguration(org.apache.meecrowave.doc.generator.LetsEncryptConfiguration) CliConfiguration(org.apache.meecrowave.doc.generator.CliConfiguration) MavenConfiguration(org.apache.meecrowave.doc.generator.MavenConfiguration) ArquillianConfiguration(org.apache.meecrowave.doc.generator.ArquillianConfiguration) Configuration(org.apache.meecrowave.doc.generator.Configuration) FileWriter(java.io.FileWriter) MapConfiguration(org.apache.commons.configuration.MapConfiguration) ArrayList(java.util.ArrayList) ClosedWatchServiceException(java.nio.file.ClosedWatchServiceException) DefaultJBakeConfiguration(org.jbake.app.configuration.DefaultJBakeConfiguration) Oven(org.jbake.app.Oven) ArquillianConfiguration(org.apache.meecrowave.doc.generator.ArquillianConfiguration) OAuth2Configuration(org.apache.meecrowave.doc.generator.OAuth2Configuration) WatchEvent(java.nio.file.WatchEvent) CliConfiguration(org.apache.meecrowave.doc.generator.CliConfiguration) Meecrowave(org.apache.meecrowave.Meecrowave) Path(java.nio.file.Path) MavenConfiguration(org.apache.meecrowave.doc.generator.MavenConfiguration) PrintStream(java.io.PrintStream) Orient(com.orientechnologies.orient.core.Orient) JBakeConfigurationFactory(org.jbake.app.configuration.JBakeConfigurationFactory) ConfigUtil(org.jbake.app.configuration.ConfigUtil) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) WatchKey(java.nio.file.WatchKey) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) IOException(java.io.IOException) ClosedWatchServiceException(java.nio.file.ClosedWatchServiceException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicLong(java.util.concurrent.atomic.AtomicLong) ProxyConfiguration(org.apache.meecrowave.doc.generator.ProxyConfiguration) LetsEncryptConfiguration(org.apache.meecrowave.doc.generator.LetsEncryptConfiguration) GradleConfiguration(org.apache.meecrowave.doc.generator.GradleConfiguration) File(java.io.File) WatchService(java.nio.file.WatchService) FileWriter(java.io.FileWriter) Writer(java.io.Writer)

Example 59 with WatchKey

use of java.nio.file.WatchKey in project atlasmap by atlasmap.

the class E2ETest method test.

@Test
public void test() throws Exception {
    driver.get("http://127.0.0.1:" + port);
    WebDriverWait waitForLoad = new WebDriverWait(driver, Duration.ofSeconds(30));
    waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//article[@aria-label='Properties']")));
    WebElement atlasmapMenuBtn = driver.findElement(By.xpath("//button[@data-testid='atlasmap-menu-button']"));
    atlasmapMenuBtn.click();
    waitForLoad.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@data-testid='import-mappings-button']")));
    WebElement importBtn = driver.findElement(By.xpath("//a[@data-testid='import-mappings-button']"));
    importBtn.click();
    WebElement fileInput = driver.findElement(By.xpath("//div[@id='data-toolbar']//input[@type='file']"));
    String cwd = System.getProperty("user.dir");
    fileInput.sendKeys(cwd + "/src/test/resources/json-schema-source-to-xml-schema-target.adm");
    WebElement confirmBtn = driver.findElement(By.xpath("//button[@data-testid='confirmation-dialog-confirm-button']"));
    confirmBtn.click();
    waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//article[@aria-label='JSONSchemaSource']")));
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e1) {
    }
    // Check custom action param
    WebElement orderBtn = driver.findElement(By.xpath("//button[@id='sources-field-atlas:json:JSONSchemaSource:source:/order-toggle']"));
    orderBtn.click();
    By addressToggle = By.xpath("//button[@id='sources-field-atlas:json:JSONSchemaSource:source:/order/address-toggle']");
    waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(addressToggle));
    WebElement addrBtn = driver.findElement(addressToggle);
    addrBtn.click();
    By addrDivPath = By.xpath("//button[@id='sources-field-atlas:json:JSONSchemaSource:source:/order/address-toggle']/../..");
    waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(addrDivPath));
    WebElement addrDiv = driver.findElement(addrDivPath);
    By cityDivPath = By.xpath(".//button[@data-testid='grip-city-button']/../../../..");
    waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(cityDivPath));
    WebElement cityDiv = addrDiv.findElement(cityDivPath);
    Actions action = new Actions(driver);
    action.moveToElement(cityDiv).perform();
    waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@data-testid='show-mapping-details-button']")));
    WebElement showDetailsBtn = cityDiv.findElement(By.xpath(".//button[@data-testid='show-mapping-details-button']"));
    showDetailsBtn.click();
    WebElement detailsCity = waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@role='dialog']//div[@aria-labelledby='mapping-field-city']")));
    assertNotNull(detailsCity);
    WebElement customActionParamInput = driver.findElement(By.id("user-field-action-io.atlasmap.service.my.MyFieldActionsModel-transformation-0"));
    assertEquals("testparam", customActionParamInput.getAttribute("value"));
    // Check custom source class mapping
    WebElement customClassDoc = driver.findElement(By.xpath("//article[@aria-label='MyFieldActionsModel']"));
    WebElement paramDiv = customClassDoc.findElement(By.xpath(".//button[@data-testid='grip-param-button']/../../../.."));
    action = new Actions(driver);
    action.moveToElement(paramDiv).perform();
    waitForLoad.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@data-testid='show-mapping-details-button']")));
    showDetailsBtn = paramDiv.findElement(By.xpath(".//button[@data-testid='show-mapping-details-button']"));
    showDetailsBtn.click();
    WebElement detailsPhotoUrl = waitForLoad.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@data-testid='column-mapping-details-area']" + "//div[@data-testid='mapping-field-photoUrl']")));
    assertNotNull(detailsPhotoUrl);
    atlasmapMenuBtn = driver.findElement(By.xpath("//button[@data-testid='atlasmap-menu-button']"));
    atlasmapMenuBtn.click();
    waitForLoad.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@data-testid='export-mappings-button']")));
    WebElement exportBtn = driver.findElement(By.xpath("//a[@data-testid='export-mappings-button']"));
    exportBtn.click();
    WebElement dialogDiv = driver.findElement(By.xpath("//div[@data-testid='export-catalog-dialog']/.."));
    WebElement exportInput = dialogDiv.findElement(By.id("filename"));
    String exportAdmFileName = UUID.randomUUID().toString() + "-exported.adm";
    exportInput.clear();
    exportInput.sendKeys(exportAdmFileName);
    confirmBtn = dialogDiv.findElement(By.xpath(".//button[@data-testid='confirmation-dialog-confirm-button']"));
    WatchService watcher = FileSystems.getDefault().newWatchService();
    Executors.newSingleThreadExecutor().execute(() -> {
        long start = System.currentTimeMillis();
        while ((System.currentTimeMillis() - start) < 300000) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                break;
            }
        }
        try {
            watcher.close();
        } catch (Exception e) {
            fail("Failed to close file watcher");
        }
    });
    Path dirPath = Paths.get(DLDIR);
    dirPath.register(watcher, StandardWatchEventKinds.ENTRY_CREATE);
    confirmBtn.click();
    WatchKey key = watcher.take();
    while (key.isValid()) {
        List<WatchEvent<?>> events = key.pollEvents();
        if (events.isEmpty()) {
            Thread.sleep(1000);
            continue;
        }
        for (WatchEvent<?> event : events) {
            if (!StandardWatchEventKinds.ENTRY_CREATE.name().equals(event.kind().name())) {
                continue;
            }
            ;
            Path eventPath = (Path) event.context();
            LOG.info("File '{}' is created", eventPath.getFileName().toString());
            if (!exportAdmFileName.equals(eventPath.getFileName().toString())) {
                continue;
            }
            ADMArchiveHandler handler = new ADMArchiveHandler(getClass().getClassLoader());
            handler.setLibraryDirectory(Paths.get(DLDIR + File.separator + "lib"));
            handler.load(Paths.get(DLDIR + File.separator + exportAdmFileName));
            assertEquals("UI.0", handler.getMappingDefinition().getName());
            DataSourceMetadata sourceMeta = handler.getDataSourceMetadata(true, "JSONSchemaSource");
            assertEquals(true, sourceMeta.getIsSource());
            assertEquals("JSONSchemaSource", sourceMeta.getName());
            assertEquals("JSON", sourceMeta.getDataSourceType());
            DataSourceMetadata targetMeta = handler.getDataSourceMetadata(false, "XMLSchemaSource");
            assertEquals(false, targetMeta.getIsSource());
            assertEquals("XMLSchemaSource", targetMeta.getName());
            assertEquals("XML", targetMeta.getDataSourceType());
            return;
        }
        ;
    }
    fail("exported.adm was not created");
}
Also used : Path(java.nio.file.Path) Actions(org.openqa.selenium.interactions.Actions) WatchKey(java.nio.file.WatchKey) WebElement(org.openqa.selenium.WebElement) DataSourceMetadata(io.atlasmap.v2.DataSourceMetadata) By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WatchEvent(java.nio.file.WatchEvent) ADMArchiveHandler(io.atlasmap.core.ADMArchiveHandler) WatchService(java.nio.file.WatchService) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 60 with WatchKey

use of java.nio.file.WatchKey in project curiostack by curioswitch.

the class FileWatcher method listenForFileEvents.

private void listenForFileEvents() {
    for (; ; ) {
        final WatchKey key;
        try {
            key = watchService.take();
        } catch (ClosedWatchServiceException | InterruptedException ex) {
            return;
        }
        key.pollEvents().stream().filter(e -> e.kind() != StandardWatchEventKinds.OVERFLOW).map(e -> {
            // Only support Path
            @SuppressWarnings("unchecked") WatchEvent<Path> cast = (WatchEvent<Path>) e;
            return cast.context();
        }).forEach(path -> {
            final Path resolved = watchedDirs.get(key).resolve(path);
            Optional<Consumer<Path>> callback = registeredPaths.entrySet().stream().filter(e -> {
                try {
                    // been updated.
                    return e.getKey().toRealPath().startsWith(resolved);
                } catch (IOException ex) {
                    logger.info("Could not resolve real path.", ex);
                    return false;
                }
            }).map(Entry::getValue).findFirst();
            if (callback.isPresent()) {
                logger.info("Processing update to path: " + resolved);
                try {
                    callback.get().accept(resolved);
                } catch (Exception e) {
                    logger.warn("Unexpected exception processing update to path: {}", resolved, e);
                }
            } else {
                logger.info("Could not find callback for path: {}", resolved);
            }
        });
        boolean valid = key.reset();
        if (!valid) {
            logger.info("Key not valid, breaking.");
            break;
        }
    }
}
Also used : ImmutableMap(com.google.common.collect.ImmutableMap) WatchEvent(java.nio.file.WatchEvent) IOException(java.io.IOException) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) Executors(java.util.concurrent.Executors) UncheckedIOException(java.io.UncheckedIOException) WatchKey(java.nio.file.WatchKey) Consumer(java.util.function.Consumer) Inject(javax.inject.Inject) StandardWatchEventKinds(java.nio.file.StandardWatchEventKinds) WatchService(java.nio.file.WatchService) ClosedWatchServiceException(java.nio.file.ClosedWatchServiceException) Logger(org.apache.logging.log4j.Logger) Map(java.util.Map) Entry(java.util.Map.Entry) Optional(java.util.Optional) Path(java.nio.file.Path) LogManager(org.apache.logging.log4j.LogManager) FileSystems(java.nio.file.FileSystems) ExecutorService(java.util.concurrent.ExecutorService) Path(java.nio.file.Path) Consumer(java.util.function.Consumer) WatchKey(java.nio.file.WatchKey) ClosedWatchServiceException(java.nio.file.ClosedWatchServiceException) WatchEvent(java.nio.file.WatchEvent) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) ClosedWatchServiceException(java.nio.file.ClosedWatchServiceException)

Aggregations

WatchKey (java.nio.file.WatchKey)134 Path (java.nio.file.Path)88 WatchEvent (java.nio.file.WatchEvent)65 IOException (java.io.IOException)49 WatchService (java.nio.file.WatchService)30 File (java.io.File)27 ClosedWatchServiceException (java.nio.file.ClosedWatchServiceException)18 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 HashMap (java.util.HashMap)7 Map (java.util.Map)7 FileSystems (java.nio.file.FileSystems)6 FileVisitResult (java.nio.file.FileVisitResult)6 HashSet (java.util.HashSet)6 List (java.util.List)6 StandardWatchEventKinds (java.nio.file.StandardWatchEventKinds)5 InputStream (java.io.InputStream)4 AccessDeniedException (java.nio.file.AccessDeniedException)4 Kind (java.nio.file.WatchEvent.Kind)4 Logger (org.slf4j.Logger)4