ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel URL: https://github.com/apache/camel-quarkus/pull/226#discussion_r331403147
########## File path: extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java ########## @@ -56,4 +69,67 @@ public static boolean isPublic(ClassInfo ci) { .flatMap(CamelSupport::safeWalk) .filter(Files::isRegularFile); } + + public static Stream<String> getRouteBuilderClasses(IndexView view) { + Set<ClassInfo> allKnownImplementors = new HashSet<>(); + allKnownImplementors.addAll( + view.getAllKnownImplementors(DotName.createSimple(RoutesBuilder.class.getName()))); + allKnownImplementors.addAll( + view.getAllKnownSubclasses(DotName.createSimple(RouteBuilder.class.getName()))); + allKnownImplementors.addAll( + view.getAllKnownSubclasses(DotName.createSimple(AdviceWithRouteBuilder.class.getName()))); + + return allKnownImplementors + .stream() + .filter(CamelSupport::isConcrete) + .filter(CamelSupport::isPublic) + .map(ClassInfo::toString); + } + + public static Stream<ServiceInfo> services(ApplicationArchivesBuildItem applicationArchivesBuildItem) { + return CamelSupport.resources(applicationArchivesBuildItem, CamelSupport.CAMEL_SERVICE_BASE_PATH) + .map(CamelSupport::services) + .flatMap(Collection::stream); + } + + private static List<ServiceInfo> services(Path p) { + List<ServiceInfo> answer = new ArrayList<>(); + + String name = p.getFileName().toString(); + try (InputStream is = Files.newInputStream(p)) { + Properties props = new Properties(); + props.load(is); + for (Map.Entry<Object, Object> entry : props.entrySet()) { + String k = entry.getKey().toString(); + if (k.equals("class")) { + String clazz = entry.getValue().toString(); + Class<?> cl = Class.forName(clazz); + + answer.add(new ServiceInfo(name, cl)); + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } + + return answer; + } + + public static class ServiceInfo { Review comment: JavaDoc please. A noun phrase would be enoungh. Something like `A description/metadata/identifier? of a Camel Service (typically found in {@code META-INF/services/org/apache/camel} of a jar?)` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services