Search in sources :

Example 16 with BeanInfo

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());
}
Also used : BeanInfo(io.quarkus.arc.processor.BeanInfo) DecoratorInfo(io.quarkus.arc.processor.DecoratorInfo) ArrayList(java.util.ArrayList) InterceptorInfo(io.quarkus.arc.processor.InterceptorInfo) Record(io.quarkus.deployment.annotations.Record) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

BeanInfo (io.quarkus.arc.processor.BeanInfo)16 BuildStep (io.quarkus.deployment.annotations.BuildStep)12 AnnotationInstance (org.jboss.jandex.AnnotationInstance)8 MethodInfo (org.jboss.jandex.MethodInfo)7 ClassInfo (org.jboss.jandex.ClassInfo)5 Type (org.jboss.jandex.Type)4 ArrayList (java.util.ArrayList)3 Predicate (java.util.function.Predicate)3 AnnotationStore (io.quarkus.arc.processor.AnnotationStore)2 DecoratorInfo (io.quarkus.arc.processor.DecoratorInfo)2 InjectionPointInfo (io.quarkus.arc.processor.InjectionPointInfo)2 InterceptorInfo (io.quarkus.arc.processor.InterceptorInfo)2 BuildProducer (io.quarkus.deployment.annotations.BuildProducer)2 Record (io.quarkus.deployment.annotations.Record)2 ClassOutput (io.quarkus.gizmo.ClassOutput)2 ResultHandle (io.quarkus.gizmo.ResultHandle)2 MediatorBuildItem (io.quarkus.smallrye.reactivemessaging.deployment.items.MediatorBuildItem)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 DeploymentException (javax.enterprise.inject.spi.DeploymentException)2