use of org.apache.camel.quarkus.core.deployment.spi.CamelServiceBuildItem in project camel-quarkus by apache.
the class CamelSupport method services.
public static Stream<CamelServiceBuildItem> services(ApplicationArchivesBuildItem archives, PathFilter pathFilter) {
final Set<CamelServiceBuildItem> answer = new HashSet<>();
final Predicate<Path> filter = pathFilter.asPathPredicate();
for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
for (Path root : archive.getRootDirectories()) {
final Path resourcePath = root.resolve(CAMEL_SERVICE_BASE_PATH);
if (!Files.isDirectory(resourcePath)) {
continue;
}
safeWalk(resourcePath).filter(Files::isRegularFile).forEach(file -> {
// the root archive may point to a jar file or the absolute path of
// a project's build output so we need to relativize to make the
// FastFactoryFinder work as expected
Path key = root.relativize(file);
if (filter.test(key)) {
String clazz = readProperties(file).getProperty("class");
if (clazz != null) {
answer.add(new CamelServiceBuildItem(key, clazz));
}
}
});
}
}
return answer.stream();
}
use of org.apache.camel.quarkus.core.deployment.spi.CamelServiceBuildItem in project camel-quarkus by apache.
the class CamelProcessor method camelServices.
@BuildStep
void camelServices(ApplicationArchivesBuildItem applicationArchives, List<CamelServicePatternBuildItem> servicePatterns, BuildProducer<CamelServiceBuildItem> camelServices) {
final PathFilter pathFilter = servicePatterns.stream().filter(patterns -> patterns.getDestination() == CamelServiceDestination.DISCOVERY).collect(PathFilter.Builder::new, (builder, patterns) -> builder.patterns(patterns.isInclude(), patterns.getPatterns()), PathFilter.Builder::combine).build();
CamelSupport.services(applicationArchives, pathFilter).forEach(camelServices::produce);
}
Aggregations