use of io.quarkus.arc.processor.BeanInfo in project quarkus by quarkusio.
the class ArcDevProcessor method registerRoutes.
@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep(onlyIf = IsDevelopment.class)
void registerRoutes(ArcConfig arcConfig, ArcDevRecorder recorder, BuildProducer<RouteBuildItem> routes, BuildProducer<NotFoundPageDisplayableEndpointBuildItem> displayableEndpoints, NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, ValidationPhaseBuildItem validationPhase, BuildProducer<ValidationErrorBuildItem> errors) {
List<BeanInfo> removed = new ArrayList<>();
Collection<InterceptorInfo> removedInterceptors = validationPhase.getContext().get(BuildExtension.Key.REMOVED_INTERCEPTORS);
if (removedInterceptors != null) {
removed.addAll(removedInterceptors);
}
Collection<DecoratorInfo> removedDecorators = validationPhase.getContext().get(BuildExtension.Key.REMOVED_DECORATORS);
if (removedDecorators != null) {
removed.addAll(removedDecorators);
}
List<String[]> removedInterceptorsDecorators;
if (removed.isEmpty()) {
removedInterceptorsDecorators = Collections.emptyList();
} else {
removedInterceptorsDecorators = new ArrayList<>();
for (BeanInfo r : removed) {
removedInterceptorsDecorators.add(new String[] { r.isInterceptor() ? InjectableBean.Kind.INTERCEPTOR.toString() : InjectableBean.Kind.DECORATOR.toString(), r.getImplClazz().name().toString() });
}
}
String basePath = "arc";
String beansPath = basePath + "/beans";
String removedBeansPath = basePath + "/removed-beans";
String observersPath = basePath + "/observers";
routes.produce(nonApplicationRootPathBuildItem.routeBuilder().route(basePath).displayOnNotFoundPage("CDI Overview").handler(recorder.createSummaryHandler(getConfigProperties(arcConfig), nonApplicationRootPathBuildItem.getNonApplicationRootPath(), removedInterceptorsDecorators.size())).build());
routes.produce(nonApplicationRootPathBuildItem.routeBuilder().route(beansPath).displayOnNotFoundPage("Active CDI Beans").handler(recorder.createBeansHandler()).build());
routes.produce(nonApplicationRootPathBuildItem.routeBuilder().route(removedBeansPath).displayOnNotFoundPage("Removed CDI Beans").handler(recorder.createRemovedBeansHandler(removedInterceptorsDecorators)).build());
routes.produce(nonApplicationRootPathBuildItem.routeBuilder().route(observersPath).displayOnNotFoundPage("Active CDI Observers").handler(recorder.createObserversHandler()).build());
}
Aggregations