in winegrower-core/src/main/java/org/apache/winegrower/Ripener.java [243:304]
public void fromProperties(final Properties properties) {
ofNullable(properties.getProperty("winegrower.ripener.configuration.workdir"))
.map(String::valueOf)
.map(File::new)
.ifPresent(this::setWorkDir);
ofNullable(properties.getProperty("winegrower.ripener.configuration.lazyInstall"))
.map(String::valueOf)
.map(Boolean::parseBoolean)
.ifPresent(this::setLazyInstall);
ofNullable(properties.getProperty("winegrower.ripener.configuration.prioritizedBundles"))
.map(String::valueOf)
.filter(it -> !it.isEmpty())
.map(it -> asList(it.split(",")))
.ifPresent(this::setPrioritizedBundles);
ofNullable(properties.getProperty("winegrower.ripener.configuration.ignoredBundles"))
.map(String::valueOf)
.filter(it -> !it.isEmpty())
.map(it -> asList(it.split(",")))
.ifPresent(this::setIgnoredBundles);
ofNullable(properties.getProperty("winegrower.ripener.configuration.scanningIncludes"))
.map(String::valueOf)
.filter(it -> !it.isEmpty())
.map(it -> asList(it.split(",")))
.ifPresent(this::setScanningIncludes);
ofNullable(properties.getProperty("winegrower.ripener.configuration.scanningExcludes"))
.map(String::valueOf)
.filter(it -> !it.isEmpty())
.map(it -> asList(it.split(",")))
.ifPresent(this::setScanningExcludes);
ofNullable(properties.getProperty("winegrower.ripener.configuration.manifestContributors"))
.map(String::valueOf)
.filter(it -> !it.isEmpty())
.map(it -> asList(it.split(",")))
.ifPresent(contributors -> setManifestContributors(contributors.stream().map(clazz -> {
try {
return Thread.currentThread().getContextClassLoader().loadClass(clazz).getConstructor().newInstance();
} catch (final InstantiationException | NoSuchMethodException | IllegalAccessException
| ClassNotFoundException e) {
throw new IllegalArgumentException(e);
} catch (final InvocationTargetException e) {
throw new IllegalArgumentException(e.getTargetException());
}
}).map(ManifestContributor.class::cast).collect(toList())));
ofNullable(properties.getProperty("winegrower.ripener.configuration.jarFilter"))
.map(String::valueOf)
.filter(it -> !it.isEmpty())
.ifPresent(filter -> {
try {
setJarFilter((Predicate<String>) Thread.currentThread().getContextClassLoader().loadClass(filter)
.getConstructor().newInstance());
} catch (final InstantiationException | NoSuchMethodException | IllegalAccessException | ClassNotFoundException e) {
throw new IllegalArgumentException(e);
} catch (final InvocationTargetException e) {
throw new IllegalArgumentException(e.getTargetException());
}
});
ofNullable(properties.getProperty("winegrower.ripener.configuration.defaultConfigurationAdminPids"))
.ifPresent(it -> setDefaultConfigurationAdminPids(Stream.of(it.split(","))
.map(String::trim)
.filter(v -> !v.isEmpty())
.collect(toList())));
}