Search in sources :

Example 1 with BuildTimeCamelCatalogBuildItem

use of org.apache.camel.quarkus.core.deployment.spi.BuildTimeCamelCatalogBuildItem in project camel-quarkus by apache.

the class CamelUnremovableBeansProcessor method unremovableCamelBeans.

@BuildStep
UnremovableBeanBuildItem unremovableCamelBeans(BuildTimeCamelCatalogBuildItem camelCatalogBuildItem) {
    BuildTimeCamelCatalog catalog = camelCatalogBuildItem.getCatalog();
    Set<DotName> unremovableClasses = catalog.getAllOptions().stream().filter(option -> option.getType().equals("object")).filter(option -> !option.getJavaType().startsWith("java.lang")).map(BaseOptionModel::getJavaType).map(DotName::createSimple).collect(Collectors.toSet());
    if (LOGGER.isDebugEnabled()) {
        unremovableClasses.stream().forEach(unremovableClass -> LOGGER.debug("Registering camel unremovable bean class: {}", unremovableClass));
    }
    return UnremovableBeanBuildItem.beanTypes(unremovableClasses);
}
Also used : IndexView(org.jboss.jandex.IndexView) SchemaResource(org.apache.camel.quarkus.core.deployment.catalog.SchemaResource) Logger(org.slf4j.Logger) UnremovableBeanBuildItem(io.quarkus.arc.deployment.UnremovableBeanBuildItem) Collection(java.util.Collection) DotName(org.jboss.jandex.DotName) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) ClassInfo(org.jboss.jandex.ClassInfo) BuildTimeCamelCatalog(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeCamelCatalog) Collectors(java.util.stream.Collectors) CombinedIndexBuildItem(io.quarkus.deployment.builditem.CombinedIndexBuildItem) HashSet(java.util.HashSet) BuildStep(io.quarkus.deployment.annotations.BuildStep) List(java.util.List) Stream(java.util.stream.Stream) BuildTimeCamelCatalogBuildItem(org.apache.camel.quarkus.core.deployment.spi.BuildTimeCamelCatalogBuildItem) Dataformat(org.apache.camel.spi.annotations.Dataformat) InterceptStrategy(org.apache.camel.spi.InterceptStrategy) AnnotationInstance(org.jboss.jandex.AnnotationInstance) Component(org.apache.camel.spi.annotations.Component) Language(org.apache.camel.spi.annotations.Language) BuildTimeJsonSchemaResolver(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver) BaseOptionModel(org.apache.camel.tooling.model.BaseOptionModel) BuildTimeCamelCatalog(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeCamelCatalog) BaseOptionModel(org.apache.camel.tooling.model.BaseOptionModel) DotName(org.jboss.jandex.DotName) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 2 with BuildTimeCamelCatalogBuildItem

use of org.apache.camel.quarkus.core.deployment.spi.BuildTimeCamelCatalogBuildItem in project camel-quarkus by apache.

the class CamelUnremovableBeansProcessor method buildTimeCamelCatalog.

@BuildStep
BuildTimeCamelCatalogBuildItem buildTimeCamelCatalog(CombinedIndexBuildItem combinedIndex) {
    Set<SchemaResource> resources = new HashSet<>();
    IndexView index = combinedIndex.getIndex();
    List<AnnotationInstance> annotations = Stream.of(CATALOG_SCHEMA_TYPES).map(index::getAnnotations).flatMap(Collection::stream).collect(Collectors.toList());
    for (AnnotationInstance instance : annotations) {
        SchemaResource resource = new SchemaResource();
        resource.setName(instance.value().asString());
        resource.setType(instance.name().withoutPackagePrefix().toLowerCase());
        resource.setClassName(instance.target().asClass().name());
        resources.add(resource);
    }
    BuildTimeJsonSchemaResolver resolver = new BuildTimeJsonSchemaResolver(resources);
    BuildTimeCamelCatalog catalog = new BuildTimeCamelCatalog(resolver);
    return new BuildTimeCamelCatalogBuildItem(catalog);
}
Also used : BuildTimeCamelCatalog(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeCamelCatalog) BuildTimeJsonSchemaResolver(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver) IndexView(org.jboss.jandex.IndexView) BuildTimeCamelCatalogBuildItem(org.apache.camel.quarkus.core.deployment.spi.BuildTimeCamelCatalogBuildItem) SchemaResource(org.apache.camel.quarkus.core.deployment.catalog.SchemaResource) AnnotationInstance(org.jboss.jandex.AnnotationInstance) HashSet(java.util.HashSet) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)2 HashSet (java.util.HashSet)2 BuildTimeCamelCatalog (org.apache.camel.quarkus.core.deployment.catalog.BuildTimeCamelCatalog)2 BuildTimeJsonSchemaResolver (org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver)2 SchemaResource (org.apache.camel.quarkus.core.deployment.catalog.SchemaResource)2 BuildTimeCamelCatalogBuildItem (org.apache.camel.quarkus.core.deployment.spi.BuildTimeCamelCatalogBuildItem)2 AnnotationInstance (org.jboss.jandex.AnnotationInstance)2 IndexView (org.jboss.jandex.IndexView)2 UnremovableBeanBuildItem (io.quarkus.arc.deployment.UnremovableBeanBuildItem)1 CombinedIndexBuildItem (io.quarkus.deployment.builditem.CombinedIndexBuildItem)1 Collection (java.util.Collection)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 InterceptStrategy (org.apache.camel.spi.InterceptStrategy)1 Component (org.apache.camel.spi.annotations.Component)1 Dataformat (org.apache.camel.spi.annotations.Dataformat)1 Language (org.apache.camel.spi.annotations.Language)1 BaseOptionModel (org.apache.camel.tooling.model.BaseOptionModel)1