List conf()

in camel-k-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/devmode/HotDeploymentProcessor.java [71:113]


    List<HotDeploymentWatchedFileBuildItem> conf() {
        final Config config = ConfigProvider.getConfig();
        final Optional<String> conf = config.getOptionalValue(Constants.PROPERTY_CAMEL_K_CONF, String.class);
        final Optional<String> confd = config.getOptionalValue(Constants.PROPERTY_CAMEL_K_CONF_D, String.class);

        List<HotDeploymentWatchedFileBuildItem> items = new ArrayList<>();

        if (conf.isPresent()) {
            LOGGER.info("Register conf for hot deployment: {}", conf.get());
            items.add(new HotDeploymentWatchedFileBuildItem(conf.get()));
        }

        if (confd.isPresent()) {
            FileVisitor<Path> visitor = new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    Objects.requireNonNull(file);
                    Objects.requireNonNull(attrs);

                    String path = file.toFile().getAbsolutePath();
                    String ext = FilenameUtils.getExtension(path);

                    if (Objects.equals("properties", ext)) {
                        LOGGER.info("Register conf for hot deployment: {}", path);
                        items.add(new HotDeploymentWatchedFileBuildItem(path));
                    }

                    return FileVisitResult.CONTINUE;
                }
            };

            Path root = Paths.get(confd.get());
            if (Files.exists(root)) {
                try {
                    Files.walkFileTree(root, visitor);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        return items;
    }