Search in sources :

Example 1 with BuildTimeJsonSchemaResolver

use of org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver in project camel-quarkus by apache.

the class CamelProcessor method componentNameResolver.

@Record(ExecutionTime.STATIC_INIT)
@BuildStep
CamelComponentNameResolverBuildItem componentNameResolver(BuildTimeCamelCatalogBuildItem camelCatalog, CamelRecorder recorder) {
    BuildTimeCamelCatalog catalog = camelCatalog.getCatalog();
    BuildTimeJsonSchemaResolver jSonSchemaResolver = catalog.getJSonSchemaResolver();
    Set<String> componentNames = jSonSchemaResolver.getSchemaResources().stream().filter(resource -> resource.getType().equals("component")).map(SchemaResource::getName).collect(Collectors.collectingAndThen(Collectors.toUnmodifiableSet(), TreeSet::new));
    return new CamelComponentNameResolverBuildItem(recorder.createComponentNameResolver(componentNames));
}
Also used : BuildTimeCamelCatalog(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeCamelCatalog) BuildTimeJsonSchemaResolver(org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver) CamelComponentNameResolverBuildItem(org.apache.camel.quarkus.core.deployment.spi.CamelComponentNameResolverBuildItem) Record(io.quarkus.deployment.annotations.Record) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 2 with BuildTimeJsonSchemaResolver

use of org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver 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 BuildTimeCamelCatalog (org.apache.camel.quarkus.core.deployment.catalog.BuildTimeCamelCatalog)2 BuildTimeJsonSchemaResolver (org.apache.camel.quarkus.core.deployment.catalog.BuildTimeJsonSchemaResolver)2 Record (io.quarkus.deployment.annotations.Record)1 HashSet (java.util.HashSet)1 SchemaResource (org.apache.camel.quarkus.core.deployment.catalog.SchemaResource)1 BuildTimeCamelCatalogBuildItem (org.apache.camel.quarkus.core.deployment.spi.BuildTimeCamelCatalogBuildItem)1 CamelComponentNameResolverBuildItem (org.apache.camel.quarkus.core.deployment.spi.CamelComponentNameResolverBuildItem)1 AnnotationInstance (org.jboss.jandex.AnnotationInstance)1 IndexView (org.jboss.jandex.IndexView)1