public StandaloneScanner()

in winegrower-core/src/main/java/org/apache/winegrower/scanner/StandaloneScanner.java [68:114]


    public StandaloneScanner(final Ripener.Configuration configuration, final File frameworkJar) {
        this.configuration = configuration;
        this.frameworkJar = frameworkJar;
        this.loader = Thread.currentThread().getContextClassLoader();
        this.urls = findUrls();

        try { // fatjar plugin
            providedManifests = list(this.loader.getResources("WINEGROWER-INF/manifests.properties")).stream()
                .flatMap(url -> {
                    final Properties properties = new Properties();
                    try (final InputStream stream = url.openStream()) {
                        properties.load(stream);
                    } catch (final IOException e) {
                        throw new IllegalArgumentException(e);
                    }
                    return properties.stringPropertyNames().stream()
                            .collect(toMap(identity(), key -> {
                                final String property = properties.getProperty(key);
                                final Manifest manifest = new Manifest();
                                try (final ByteArrayInputStream mfStream = new ByteArrayInputStream(property.getBytes(StandardCharsets.UTF_8))) {
                                    manifest.read(mfStream);
                                } catch (final IOException e) {
                                    throw new IllegalArgumentException(e);
                                }
                                return manifest;
                            })).entrySet().stream();
                })
                .collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
            providedIndex = list(this.loader.getResources("WINEGROWER-INF/index.properties")).stream()
                    .flatMap(url -> {
                        final Properties properties = new Properties();
                        try (final InputStream stream = url.openStream()) {
                            properties.load(stream);
                        } catch (final IOException e) {
                            throw new IllegalArgumentException(e);
                        }
                        return properties.stringPropertyNames().stream()
                                .collect(toMap(identity(), key -> {
                                    final String property = properties.getProperty(key);
                                    return asList(property.split(","));
                                })).entrySet().stream();
                    })
                    .collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
        } catch (final IOException e) {
            throw new IllegalArgumentException(e);
        }
    }