Java Code Examples for io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem

The following examples show how to use io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem. These examples are extracted from open source projects. 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 Project: camel-k-runtime   Source File: DeploymentProcessor.java    License: 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 2
Source Project: camel-quarkus   Source File: XmlSupportProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@BuildStep
void reflective(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
    reflectiveClass.produce(
            new ReflectiveClassBuildItem(
                    false,
                    false,
                    "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
                    "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
                    "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
                    "com.sun.org.apache.xerces.internal.parsers.SAXParser",
                    "com.sun.xml.internal.stream.XMLInputFactoryImpl",
                    "com.sun.xml.internal.stream.XMLOutputFactoryImpl"));

    reflectiveClass.produce(
            new ReflectiveClassBuildItem(
                    false,
                    false,
                    "org.apache.camel.converter.jaxp.XmlConverter"));

    // javax.xml.namespace.QName is needed as it is used as part of the processor
    // definitions in the DSL and parsers like Jackson (used in camel-k YAML DSL)
    // fails if this class is cannot be instantiated reflectively.
    reflectiveClass.produce(
            new ReflectiveClassBuildItem(true, false, "javax.xml.namespace.QName"));
}
 
Example 3
Source Project: camel-quarkus   Source File: Aws2CwProcessor.java    License: 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 4
Source Project: camel-quarkus   Source File: FhirProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@BuildStep()
ReflectiveClassBuildItem fhirEndpointConfiguration() {
    return new ReflectiveClassBuildItem(true, true,
            FhirCreateEndpointConfiguration.class,
            FhirCapabilitiesEndpointConfiguration.class,
            FhirDeleteEndpointConfiguration.class,
            FhirHistoryEndpointConfiguration.class,
            FhirLoadPageEndpointConfiguration.class,
            FhirMetaEndpointConfiguration.class,
            FhirOperationEndpointConfiguration.class,
            FhirPatchEndpointConfiguration.class,
            FhirReadEndpointConfiguration.class,
            FhirSearchEndpointConfiguration.class,
            FhirTransactionEndpointConfiguration.class,
            FhirUpdateEndpointConfiguration.class,
            FhirValidateEndpointConfiguration.class,
            FhirConfiguration.class);
}
 
Example 5
Source Project: camel-quarkus   Source File: GoogleMailProcessor.java    License: 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 mail component configuration class reflection
    Collection<AnnotationInstance> uriParams = index
            .getAnnotations(DotName.createSimple("org.apache.camel.spi.UriParams"));

    String[] googleMailConfigClasses = 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.mail"))
            .toArray(String[]::new);

    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, googleMailConfigClasses));
    unbannedClass.produce(new UnbannedReflectiveBuildItem(googleMailConfigClasses));
}
 
Example 6
Source Project: camel-quarkus   Source File: Aws2Ec2Processor.java    License: 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 7
Source Project: camel-quarkus   Source File: Aws2KmsProcessor.java    License: 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 8
Source Project: camel-quarkus   Source File: GoogleCalendarProcessor.java    License: 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 calendar 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.calendar"))
            .toArray(String[]::new);

    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, googleDriveConfigClasses));
    unbannedClass.produce(new UnbannedReflectiveBuildItem(googleDriveConfigClasses));
}
 
Example 9
Source Project: camel-quarkus   Source File: Aws2AthenaProcessor.java    License: 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 10
Source Project: camel-quarkus   Source File: Aws2MqProcessor.java    License: 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 11
Source Project: camel-quarkus   Source File: JtaProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@BuildStep
void transactedPolicy(
        BuildProducer<AdditionalBeanBuildItem> additionalBeans,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        Capabilities capabilities) {
    if (capabilities.isCapabilityPresent(Capabilities.TRANSACTIONS)) {
        AdditionalBeanBuildItem.Builder builder = AdditionalBeanBuildItem.builder();
        builder.addBeanClass(RequiredJtaTransactionPolicy.class);
        builder.addBeanClass(RequiresNewJtaTransactionPolicy.class);
        builder.addBeanClass(MandatoryJtaTransactionPolicy.class);
        builder.addBeanClass(NeverJtaTransactionPolicy.class);
        builder.addBeanClass(NotSupportedJtaTransactionPolicy.class);
        builder.addBeanClass(SupportsJtaTransactionPolicy.class);

        additionalBeans.produce(builder.build());

        reflectiveClass.produce(new ReflectiveClassBuildItem(false, false,
                IllegalStateException.class.getName()));
    }
}
 
Example 12
Source Project: camel-quarkus   Source File: Aws2EcsProcessor.java    License: 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 13
Source Project: camel-quarkus   Source File: AwsSdbProcessor.java    License: Apache License 2.0 6 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 14
Source Project: camel-quarkus   Source File: Aws2SesProcessor.java    License: 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 Project: camel-quarkus   Source File: Aws2EksProcessor.java    License: 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 Project: camel-quarkus   Source File: Aws2TranslateProcessor.java    License: 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 Project: camel-quarkus   Source File: ActiveMQProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@BuildStep
ReflectiveClassBuildItem registerForReflection() {
    return new ReflectiveClassBuildItem(true, false,
            "org.apache.activemq.pool.PooledConnectionFactory",
            "org.apache.commons.pool2.impl.DefaultEvictionPolicy",
            "org.apache.activemq.openwire.v2.MarshallerFactory",
            "org.apache.activemq.openwire.v3.MarshallerFactory",
            "org.apache.activemq.openwire.v4.MarshallerFactory",
            "org.apache.activemq.openwire.v5.MarshallerFactory",
            "org.apache.activemq.openwire.v6.MarshallerFactory",
            "org.apache.activemq.openwire.v7.MarshallerFactory",
            "org.apache.activemq.openwire.v8.MarshallerFactory",
            "org.apache.activemq.openwire.v9.MarshallerFactory",
            "org.apache.activemq.openwire.v10.MarshallerFactory",
            "org.apache.activemq.openwire.v11.MarshallerFactory",
            "org.apache.activemq.openwire.v12.MarshallerFactory");
}
 
Example 18
Source Project: camel-quarkus   Source File: GoogleDriveProcessor.java    License: 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 19
Source Project: camel-quarkus   Source File: Aws2S3Processor.java    License: 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 Project: camel-quarkus   Source File: Aws2MskProcessor.java    License: 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 Project: camel-quarkus   Source File: GoogleSheetsProcessor.java    License: 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 sheets component configuration class reflection
    Collection<AnnotationInstance> uriParams = index
            .getAnnotations(DotName.createSimple("org.apache.camel.spi.UriParams"));

    String[] googleMailConfigClasses = 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.sheets"))
            .toArray(String[]::new);

    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, googleMailConfigClasses));
    unbannedClass.produce(new UnbannedReflectiveBuildItem(googleMailConfigClasses));
}
 
Example 22
Source Project: camel-quarkus   Source File: Aws2IamProcessor.java    License: 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 23
Source Project: camel-quarkus   Source File: Aws2SnsProcessor.java    License: 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 Project: camel-quarkus   Source File: HttpClientProcessor.java    License: 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()));
    }
}
 
Example 25
Source Project: camel-quarkus   Source File: CamelNativeImageProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
void reflection(CamelConfig config, ApplicationArchivesBuildItem archives,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {

    final ReflectionConfig reflectionConfig = config.native_.reflection;
    if (!reflectionConfig.includePatterns.isPresent()) {
        LOGGER.debug("No classes registered for reflection via quarkus.camel.native.reflection.include-patterns");
        return;
    }

    LOGGER.debug("Scanning resources for native inclusion from include-patterns {}",
            reflectionConfig.includePatterns.get());

    final PathFilter.Builder builder = new PathFilter.Builder();
    reflectionConfig.includePatterns.map(Collection::stream).orElseGet(Stream::empty)
            .map(className -> className.replace('.', '/'))
            .forEach(builder::include);
    reflectionConfig.excludePatterns.map(Collection::stream).orElseGet(Stream::empty)
            .map(className -> className.replace('.', '/'))
            .forEach(builder::exclude);
    final PathFilter pathFilter = builder.build();

    for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
        LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getPaths());

        for (Path rootPath : archive.getRootDirs()) {
            String[] selectedClassNames = pathFilter.scanClassNames(rootPath, CamelSupport.safeWalk(rootPath),
                    Files::isRegularFile);
            if (selectedClassNames.length > 0) {
                reflectiveClasses.produce(new ReflectiveClassBuildItem(true, true, selectedClassNames));
            }
        }
    }
}
 
Example 26
Source Project: camel-quarkus   Source File: CouchdbProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
List<ReflectiveClassBuildItem> registerReflectiveClasses() {
    List<ReflectiveClassBuildItem> items = new ArrayList<ReflectiveClassBuildItem>();
    items.add(new ReflectiveClassBuildItem(false, true, "org.lightcouch.Response"));
    items.add(new ReflectiveClassBuildItem(false, true, "org.lightcouch.CouchDbInfo"));
    items.add(new ReflectiveClassBuildItem(false, true, "org.lightcouch.ChangesResult$Row"));
    items.add(new ReflectiveClassBuildItem(false, true, "org.lightcouch.ChangesResult$Row$Rev"));
    return items;
}
 
Example 27
Source Project: camel-quarkus   Source File: AwsKmsProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_KMS_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()));
}
 
Example 28
Source Project: camel-quarkus   Source File: AwsSNSProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SNS_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(),
            AWS4Signer.class.getCanonicalName()));
}
 
Example 29
Source Project: camel-quarkus   Source File: TelegramProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
ReflectiveClassBuildItem reflectiveMethodsAndFields(CombinedIndexBuildItem combinedIndex) {
    String[] models = combinedIndex.getIndex().getKnownClasses().stream()
            .filter(ci -> ci.name().prefix().equals(TELEGRAM_MODEL_PACKAGE))
            .map(ci -> ci.name().toString())
            .sorted()
            .toArray(String[]::new);

    return new ReflectiveClassBuildItem(true, true, models);
}
 
Example 30
Source Project: camel-quarkus   Source File: XsltNativeImageProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
List<ReflectiveClassBuildItem> generatedReflectiveClasses(List<XsltGeneratedClassBuildItem> generatedClasses) {
    return generatedClasses.stream()
            .map(XsltGeneratedClassBuildItem::getClassName)
            .map(className -> new ReflectiveClassBuildItem(true, false, className))
            .collect(Collectors.toList());
}