io.quarkus.deployment.builditem.CombinedIndexBuildItem Java Examples

The following examples show how to use io.quarkus.deployment.builditem.CombinedIndexBuildItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Aws2CwProcessor.java    From camel-quarkus with Apache License 2.0 7 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #2
Source File: AwsSdbProcessor.java    From camel-quarkus with Apache License 2.0 7 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDB_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    resource.produce(new NativeImageResourceBuildItem("com/amazonaws/partitions/endpoints.json"));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
            Partitions.class.getCanonicalName(),
            Partition.class.getCanonicalName(),
            Endpoint.class.getCanonicalName(),
            Region.class.getCanonicalName(),
            Service.class.getCanonicalName(),
            CredentialScope.class.getCanonicalName(),
            QueryStringSigner.class.getCanonicalName(),
            AWS4Signer.class.getCanonicalName()));
}
 
Example #3
Source File: PanacheHibernateResourceProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
ValidationPhaseBuildItem.ValidationErrorBuildItem validate(ValidationPhaseBuildItem validationPhase,
        CombinedIndexBuildItem index) throws BuildException {
    // we verify that no ID fields are defined (via @Id) when extending PanacheEntity
    for (AnnotationInstance annotationInstance : index.getIndex().getAnnotations(DOTNAME_ID)) {
        ClassInfo info = JandexUtil.getEnclosingClass(annotationInstance);
        if (JandexUtil.isSubclassOf(index.getIndex(), info, DOTNAME_PANACHE_ENTITY)) {
            BuildException be = new BuildException("You provide a JPA identifier via @Id inside '" + info.name() +
                    "' but one is already provided by PanacheEntity, " +
                    "your class should extend PanacheEntityBase instead, or use the id provided by PanacheEntity",
                    Collections.emptyList());
            return new ValidationPhaseBuildItem.ValidationErrorBuildItem(be);
        }
    }
    return null;
}
 
Example #4
Source File: SmallRyeGraphQLProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
void buildExecutionService(
        BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer,
        BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchyProducer,
        SmallRyeGraphQLRecorder recorder,
        BeanContainerBuildItem beanContainer,
        CombinedIndexBuildItem combinedIndex) {

    IndexView index = combinedIndex.getIndex();
    Schema schema = SchemaBuilder.build(index);

    recorder.createExecutionService(beanContainer.getValue(), schema);

    // Make sure the complex object from the application can work in native mode
    for (String c : getClassesToRegisterForReflection(schema)) {
        DotName name = DotName.createSimple(c);
        org.jboss.jandex.Type type = org.jboss.jandex.Type.create(name, org.jboss.jandex.Type.Kind.CLASS);
        reflectiveHierarchyProducer.produce(new ReflectiveHierarchyBuildItem(type, index));
    }

    // Make sure the GraphQL Java classes needed for introspection can work in native mode
    reflectiveClassProducer.produce(new ReflectiveClassBuildItem(true, true, getGraphQLJavaClasses()));
}
 
Example #5
Source File: Aws2KmsProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #6
Source File: ResteasyBuiltinsProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void setUpDenyAllJaxRs(CombinedIndexBuildItem index,
        JaxRsSecurityConfig config,
        ResteasyDeploymentBuildItem resteasyDeployment,
        BuildProducer<AdditionalSecuredClassesBuildIem> additionalSecuredClasses) {
    if (config.denyJaxRs) {
        final List<ClassInfo> classes = new ArrayList<>();

        List<String> resourceClasses = resteasyDeployment.getDeployment().getScannedResourceClasses();
        for (String className : resourceClasses) {
            ClassInfo classInfo = index.getIndex().getClassByName(DotName.createSimple(className));
            if (!hasSecurityAnnotation(classInfo)) {
                classes.add(classInfo);
            }
        }

        additionalSecuredClasses.produce(new AdditionalSecuredClassesBuildIem(classes));
    }
}
 
Example #7
Source File: CacheProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
@Record(RUNTIME_INIT)
void recordCachesBuild(CombinedIndexBuildItem combinedIndex, BeanContainerBuildItem beanContainer, CacheConfig config,
        CaffeineCacheBuildRecorder caffeineRecorder,
        List<AdditionalCacheNameBuildItem> additionalCacheNames,
        Optional<ManagedExecutorInitializedBuildItem> managedExecutorInitialized) {
    Set<String> cacheNames = getCacheNames(combinedIndex.getIndex());
    for (AdditionalCacheNameBuildItem additionalCacheName : additionalCacheNames) {
        cacheNames.add(additionalCacheName.getName());
    }
    switch (config.type) {
        case CacheDeploymentConstants.CAFFEINE_CACHE_TYPE:
            Set<CaffeineCacheInfo> cacheInfos = CaffeineCacheInfoBuilder.build(cacheNames, config);
            caffeineRecorder.buildCaches(managedExecutorInitialized.isPresent(), beanContainer.getValue(), cacheInfos);
            break;
        default:
            throw new DeploymentException("Unknown cache type: " + config.type);
    }
}
 
Example #8
Source File: Aws2AthenaProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #9
Source File: VaultProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void build(
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<FeatureBuildItem> feature,
        CombinedIndexBuildItem combinedIndexBuildItem,
        SslNativeConfigBuildItem sslNativeConfig,
        BuildProducer<ExtensionSslNativeSupportBuildItem> sslNativeSupport) {

    feature.produce(new FeatureBuildItem(Feature.VAULT));

    final String[] modelClasses = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(DotName.createSimple(VaultModel.class.getName()))
            .stream()
            .map(c -> c.name().toString())
            .toArray(String[]::new);
    reflectiveClasses.produce(ReflectiveClassBuildItem.weakClass(modelClasses));
    reflectiveClasses.produce(
            new ReflectiveClassBuildItem(false, false, Base64StringDeserializer.class, Base64StringSerializer.class));

    sslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(Feature.VAULT));
}
 
Example #10
Source File: ResteasyCommonProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
private boolean restJsonSupportNeeded(CombinedIndexBuildItem indexBuildItem, DotName mediaTypeAnnotation) {
    for (AnnotationInstance annotationInstance : indexBuildItem.getIndex().getAnnotations(mediaTypeAnnotation)) {
        final AnnotationValue annotationValue = annotationInstance.value();
        if (annotationValue == null) {
            continue;
        }

        List<String> mediaTypes = Collections.emptyList();
        if (annotationValue.kind() == Kind.ARRAY) {
            mediaTypes = Arrays.asList(annotationValue.asStringArray());
        } else if (annotationValue.kind() == Kind.STRING) {
            mediaTypes = Collections.singletonList(annotationValue.asString());
        }
        return mediaTypes.contains(MediaType.APPLICATION_JSON)
                || mediaTypes.contains(MediaType.APPLICATION_JSON_PATCH_JSON);
    }

    return false;
}
 
Example #11
Source File: Aws2MqProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #12
Source File: ResteasyCommonProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void registerJsonContextResolvers(CombinedIndexBuildItem combinedIndexBuildItem,
        Capabilities capabilities,
        BuildProducer<ResteasyJaxrsProviderBuildItem> jaxrsProvider,
        BuildProducer<AdditionalBeanBuildItem> additionalBean,
        BuildProducer<UnremovableBeanBuildItem> unremovable) {

    if (capabilities.isPresent(Capability.REST_JACKSON)) {
        registerJsonContextResolver(OBJECT_MAPPER, QUARKUS_OBJECT_MAPPER_CONTEXT_RESOLVER, combinedIndexBuildItem,
                jaxrsProvider, additionalBean, unremovable);
    }

    if (capabilities.isPresent(Capability.REST_JSONB)) {
        registerJsonContextResolver(JSONB, QUARKUS_JSONB_CONTEXT_RESOLVER, combinedIndexBuildItem, jaxrsProvider,
                additionalBean, unremovable);
    }
}
 
Example #13
Source File: SpringDataJPAProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void build(CombinedIndexBuildItem index,
        BuildProducer<GeneratedClassBuildItem> generatedClasses,
        BuildProducer<GeneratedBeanBuildItem> generatedBeans,
        BuildProducer<AdditionalBeanBuildItem> additionalBeans, BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {

    detectAndLogSpecificSpringPropertiesIfExist();

    IndexView indexIndex = index.getIndex();
    List<ClassInfo> interfacesExtendingCrudRepository = getAllInterfacesExtending(DotNames.SUPPORTED_REPOSITORIES,
            indexIndex);

    removeNoRepositoryBeanClasses(interfacesExtendingCrudRepository);
    implementCrudRepositories(generatedBeans, generatedClasses, additionalBeans, reflectiveClasses,
            interfacesExtendingCrudRepository, indexIndex);
}
 
Example #14
Source File: Aws2EcsProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #15
Source File: Aws2SesProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #16
Source File: Aws2TranslateProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #17
Source File: GoogleDriveProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<UnbannedReflectiveBuildItem> unbannedClass, CombinedIndexBuildItem combinedIndex) {
    IndexView index = combinedIndex.getIndex();

    // Google drive component configuration class reflection
    Collection<AnnotationInstance> uriParams = index
            .getAnnotations(DotName.createSimple("org.apache.camel.spi.UriParams"));

    String[] googleDriveConfigClasses = uriParams.stream()
            .map(annotation -> annotation.target())
            .filter(annotationTarget -> annotationTarget.kind().equals(AnnotationTarget.Kind.CLASS))
            .map(annotationTarget -> annotationTarget.asClass().name().toString())
            .filter(className -> className.startsWith("org.apache.camel.component.google.drive"))
            .toArray(String[]::new);

    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, googleDriveConfigClasses));
    unbannedClass.produce(new UnbannedReflectiveBuildItem(googleDriveConfigClasses));
}
 
Example #18
Source File: Aws2SqsProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #19
Source File: Aws2S3Processor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #20
Source File: Aws2MskProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #21
Source File: HibernateOrmPanacheRestProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void findRepositoryResources(CombinedIndexBuildItem index,
        BuildProducer<RestDataResourceBuildItem> resourcesProducer,
        BuildProducer<UnremovableBeanBuildItem> unremovableBeansProducer) {
    for (ClassInfo classInfo : index.getIndex().getKnownDirectImplementors(PANACHE_REPOSITORY_RESOURCE_INTERFACE)) {
        validateResource(index.getIndex(), classInfo);
        List<Type> generics = getGenericTypes(classInfo);
        String repositoryClassName = generics.get(0).toString();
        String entityClassName = generics.get(1).toString();
        String idClassName = generics.get(2).toString();
        RestDataResourceInfo resourceInfo = HibernateOrmRestDataResourceInfo
                .withRepositoryAccess(classInfo, idClassName, entityClassName, repositoryClassName);
        resourcesProducer.produce(new RestDataResourceBuildItem(resourceInfo));
        unremovableBeansProducer.produce(
                new UnremovableBeanBuildItem(new UnremovableBeanBuildItem.BeanClassNameExclusion(repositoryClassName)));
    }
}
 
Example #22
Source File: DeploymentProcessor.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@BuildStep
void registerServices(
        BuildProducer<ServiceProviderBuildItem> serviceProvider,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        CombinedIndexBuildItem combinedIndexBuildItem) {

    final IndexView view = combinedIndexBuildItem.getIndex();
    final String serviceType = "org.apache.camel.k.Runtime$Listener";

    getAllKnownImplementors(view, serviceType).forEach(i -> {
        serviceProvider.produce(
            new ServiceProviderBuildItem(
                serviceType,
                i.name().toString())
        );
    });
}
 
Example #23
Source File: Aws2IamProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

    List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
            .stream()
            .map(c -> c.name().toString()).collect(Collectors.toList());

    reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
            knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #24
Source File: KogitoAssetsProcessor.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
private ApplicationGenerator createApplicationGenerator(AppPaths appPaths, CombinedIndexBuildItem combinedIndexBuildItem) throws IOException {

        boolean usePersistence = combinedIndexBuildItem.getIndex()
                .getClassByName(createDotName(persistenceFactoryClass)) != null;
        boolean useMonitoring = combinedIndexBuildItem.getIndex()
                .getClassByName(createDotName(metricsClass)) != null;
        boolean useTracing = !combinedIndexBuildItem.getIndex()
                .getAllKnownSubclasses(createDotName(tracingClass)).isEmpty();

        GeneratorContext context = buildContext(appPaths, combinedIndexBuildItem.getIndex());

        ApplicationGenerator appGen = new ApplicationGenerator(appPackageName, new File(appPaths.getFirstProjectPath().toFile(), "target"))
                .withDependencyInjection(new CDIDependencyInjectionAnnotator())
                .withPersistence(usePersistence)
                .withMonitoring(useMonitoring)
                .withGeneratorContext(context);

        addProcessGenerator(appPaths, usePersistence, appGen);
        addRuleGenerator(appPaths, appGen, useMonitoring);
        addDecisionGenerator(appPaths, appGen, useMonitoring, useTracing);

        return appGen;
    }
 
Example #25
Source File: CamelProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(onlyIf = { CamelConfigFlags.RoutesDiscoveryEnabled.class })
public List<CamelRoutesBuilderClassBuildItem> discoverRoutesBuilderClassNames(
        CombinedIndexBuildItem combinedIndex,
        CamelConfig config) {

    final IndexView index = combinedIndex.getIndex();

    Set<ClassInfo> allKnownImplementors = new HashSet<>();
    allKnownImplementors.addAll(index.getAllKnownImplementors(ROUTES_BUILDER_TYPE));
    allKnownImplementors.addAll(index.getAllKnownSubclasses(ROUTE_BUILDER_TYPE));
    allKnownImplementors.addAll(index.getAllKnownSubclasses(ADVICE_WITH_ROUTE_BUILDER_TYPE));

    return allKnownImplementors
            .stream()
            // public and non-abstract
            .filter(ci -> ((ci.flags() & (Modifier.ABSTRACT | Modifier.PUBLIC)) == Modifier.PUBLIC))
            .map(ClassInfo::name)
            .filter(new PathFilter.Builder()
                    .exclude(config.routesDiscovery.excludePatterns)
                    .include(config.routesDiscovery.includePatterns)
                    .build().asDotNamePredicate())
            .map(CamelRoutesBuilderClassBuildItem::new)
            .collect(Collectors.toList());
}
 
Example #26
Source File: GrpcServerProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void discoverBindableServices(BuildProducer<BindableServiceBuildItem> bindables,
        CombinedIndexBuildItem combinedIndexBuildItem) {
    Collection<ClassInfo> bindableServices = combinedIndexBuildItem.getIndex()
            .getAllKnownImplementors(GrpcDotNames.BINDABLE_SERVICE);
    for (ClassInfo service : bindableServices) {
        if (!Modifier.isAbstract(service.flags()) && service.classAnnotation(DotNames.SINGLETON) != null) {
            bindables.produce(new BindableServiceBuildItem(service.name()));
        }
    }
}
 
Example #27
Source File: JsonbProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<NativeImageResourceBundleBuildItem> resourceBundle,
        BuildProducer<ServiceProviderBuildItem> serviceProvider,
        BuildProducer<AdditionalBeanBuildItem> additionalBeans,
        CombinedIndexBuildItem combinedIndexBuildItem) {
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false,
            JsonBindingProvider.class.getName()));

    resourceBundle.produce(new NativeImageResourceBundleBuildItem("yasson-messages"));

    serviceProvider.produce(new ServiceProviderBuildItem(JsonbComponentInstanceCreator.class.getName(),
            QuarkusJsonbComponentInstanceCreator.class.getName()));

    // this needs to be registered manually since the runtime module is not indexed by Jandex
    additionalBeans.produce(new AdditionalBeanBuildItem(JsonbProducer.class));

    IndexView index = combinedIndexBuildItem.getIndex();

    // handle the various @JsonSerialize cases
    for (AnnotationInstance serializeInstance : index.getAnnotations(JSONB_TYPE_SERIALIZER)) {
        registerInstance(reflectiveClass, serializeInstance);
    }

    // handle the various @JsonDeserialize cases
    for (AnnotationInstance deserializeInstance : index.getAnnotations(JSONB_TYPE_DESERIALIZER)) {
        registerInstance(reflectiveClass, deserializeInstance);
    }
}
 
Example #28
Source File: DeploymentProcessor.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerStreamCachingClasses(
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        CombinedIndexBuildItem combinedIndexBuildItem) {

    final IndexView view = combinedIndexBuildItem.getIndex();

    getAllKnownImplementors(view, StreamCachingStrategy.class).forEach(i-> {
        reflectiveClass.produce(
            new ReflectiveClassBuildItem(
                true,
                true,
                i.name().toString())
        );
    });
    getAllKnownImplementors(view, StreamCachingStrategy.Statistics.class).forEach(i-> {
        reflectiveClass.produce(
            new ReflectiveClassBuildItem(
                true,
                true,
                i.name().toString())
        );
    });
    getAllKnownImplementors(view, StreamCachingStrategy.SpoolRule.class).forEach(i-> {
        reflectiveClass.produce(
            new ReflectiveClassBuildItem(
                true,
                true,
                i.name().toString())
        );
    });

    reflectiveClass.produce(
        new ReflectiveClassBuildItem(
            true,
            true,
            StreamCachingStrategy.SpoolRule.class)
    );
}
 
Example #29
Source File: SupportGoogleHTTPClientProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndex) {
    IndexView index = combinedIndex.getIndex();

    // Google client API class reflection for JSON serialization / deserialization
    String[] googleApis = index.getAllKnownSubclasses(DotName.createSimple("com.google.api.client.util.GenericData"))
            .stream()
            .map(classInfo -> classInfo.name().toString())
            .toArray(String[]::new);

    reflectiveClass.produce(new ReflectiveClassBuildItem(false, true, googleApis));
}
 
Example #30
Source File: HttpClientProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerForReflection(
        CombinedIndexBuildItem index,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {

    IndexView view = index.getIndex();

    for (ClassInfo info : view.getAllKnownSubclasses(HTTP_REQUEST_BASE_NAME)) {
        reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, info.name().toString()));
    }
}