io.quarkus.deployment.annotations.BuildProducer Java Examples

The following examples show how to use io.quarkus.deployment.annotations.BuildProducer. 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: XmlSupportProcessor.java    From camel-quarkus with 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 #2
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 #3
Source File: CamelProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void userServicePatterns(
        CamelConfig camelConfig,
        BuildProducer<CamelServicePatternBuildItem> services) {

    camelConfig.service.discovery.includePatterns.ifPresent(list -> services.produce(new CamelServicePatternBuildItem(
            CamelServiceDestination.DISCOVERY,
            true,
            list)));

    camelConfig.service.discovery.excludePatterns.ifPresent(list -> services.produce(new CamelServicePatternBuildItem(
            CamelServiceDestination.DISCOVERY,
            false,
            list)));

    camelConfig.service.registry.includePatterns.ifPresent(list -> services.produce(new CamelServicePatternBuildItem(
            CamelServiceDestination.REGISTRY,
            true,
            list)));

    camelConfig.service.registry.excludePatterns.ifPresent(list -> services.produce(new CamelServicePatternBuildItem(
            CamelServiceDestination.REGISTRY,
            false,
            list)));
}
 
Example #4
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 #5
Source File: GoogleSheetsProcessor.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 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 #6
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 #7
Source File: Aws2SnsProcessor.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 #8
Source File: Aws2EksProcessor.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: 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 #10
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 #11
Source File: JtaProcessor.java    From camel-quarkus with 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 File: Aws2DdbProcessor.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 #13
Source File: MicroProfileHealthProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void disableCamelMicroProfileHealthChecks(BuildProducer<AnnotationsTransformerBuildItem> transformers,
        CamelMicroProfileHealthConfig config) {
    if (!config.enabled) {
        // Veto the Camel MicroProfile checks to disable them
        transformers.produce(new AnnotationsTransformerBuildItem(context -> {
            if (context.isClass()) {
                AnnotationTarget target = context.getTarget();
                if (isCamelMicroProfileHealthCheck(target.asClass())) {
                    AnnotationInstance annotationInstance = AnnotationInstance.create(VETOED_DOTNAME, target,
                            new AnnotationValue[0]);
                    context.transform().add(annotationInstance).done();
                }
            }
        }));
    }
}
 
Example #14
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 #15
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 #16
Source File: ServletProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
static ServletBuildItem newServlet(String key, ServletConfig servletConfig,
        BuildProducer<AdditionalBeanBuildItem> additionalBean) {
    final String servletName = servletConfig.getEffectiveServletName(key);
    final Optional<List<String>> urlPatterns = servletConfig.urlPatterns;
    if (!urlPatterns.isPresent() || urlPatterns.get().isEmpty()) {
        throw new IllegalStateException(
                String.format("Missing quarkus.camel.servlet%s.url-patterns",
                        ServletConfig.DEFAULT_SERVLET_NAME.equals(servletName) ? "" : "." + servletName));
    }

    final Builder builder = ServletBuildItem.builder(servletName, servletConfig.servletClass);
    additionalBean.produce(new AdditionalBeanBuildItem(servletConfig.servletClass));
    for (String pattern : urlPatterns.get()) {
        builder.addMapping(pattern);
    }

    return builder.build();
}
 
Example #17
Source File: ServletProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void build(BuildProducer<ServletBuildItem> servlet, BuildProducer<AdditionalBeanBuildItem> additionalBean) {
    boolean servletCreated = false;
    if (camelServletConfig.defaultServlet.isValid()) {
        servlet.produce(
                newServlet(ServletConfig.DEFAULT_SERVLET_NAME, camelServletConfig.defaultServlet, additionalBean));
        servletCreated = true;
    }

    for (Entry<String, ServletConfig> e : camelServletConfig.namedServlets.entrySet()) {
        if (ServletConfig.DEFAULT_SERVLET_NAME.equals(e.getKey())) {
            throw new IllegalStateException(
                    String.format("Use quarkus.camel.servlet.url-patterns instead of quarkus.camel.servlet.%s.url-patterns",
                            ServletConfig.DEFAULT_SERVLET_NAME));
        }
        servlet.produce(newServlet(e.getKey(), e.getValue(), additionalBean));
        servletCreated = true;
    }

    if (!servletCreated) {
        throw new IllegalStateException(
                "Map at least one servlet to a path using quarkus.camel.servlet.url-patterns or quarkus.camel.servlet.[your-servlet-name].url-patterns");
    }

}
 
Example #18
Source File: GoogleMailProcessor.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 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 #19
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 #20
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 #21
Source File: AwsCommonsProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(loadsApplicationClasses = true)
void client(BeanRegistrationPhaseBuildItem beanRegistrationPhase,
        BuildProducer<ServiceProviderBuildItem> serviceProvider,
        BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinition) {
    checkClasspath(APACHE_HTTP_SERVICE, "apache-client");

    serviceProvider.produce(new ServiceProviderBuildItem(SdkHttpService.class.getName(), APACHE_HTTP_SERVICE));

}
 
Example #22
Source File: ActiveMQProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerServiceProviders(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<NativeImageResourceBuildItem> nativeImage) {

    String[] servicePaths = new String[] {
            ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/masterslave",
            ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/multicast",
            ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/simple",
            ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/static",
            ACTIVEMQ_SERVICE_BASE + "transport/failover",
            ACTIVEMQ_SERVICE_BASE + "transport/fanout",
            ACTIVEMQ_SERVICE_BASE + "transport/mock",
            ACTIVEMQ_SERVICE_BASE + "transport/multicast",
            ACTIVEMQ_SERVICE_BASE + "transport/nio",
            ACTIVEMQ_SERVICE_BASE + "transport/nio+ssl",
            ACTIVEMQ_SERVICE_BASE + "transport/ssl",
            ACTIVEMQ_SERVICE_BASE + "transport/tcp",
            ACTIVEMQ_SERVICE_BASE + "transport/udp",
            ACTIVEMQ_SERVICE_BASE + "wireformat/default",
    };

    for (String path : servicePaths) {
        reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, getServiceClass(path)));
    }

    nativeImage.produce(new NativeImageResourceBuildItem(servicePaths));
}
 
Example #23
Source File: GraphQLProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void nativeImageResources(BuildProducer<NativeImageResourceBuildItem> nativeImage, CamelGraphQLConfig config) {
    if (!config.queryFiles.isPresent()) {
        return;
    }

    config.queryFiles.get()
            .stream()
            .map(scriptFile -> new NativeImageResourceBuildItem(scriptFile.replace("classpath:", "")))
            .forEach(nativeImage::produce);
}
 
Example #24
Source File: AwsKinesisProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_KINESIS_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 #25
Source File: AwsSwfProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SWF_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 #26
Source File: PolicyProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void bannedReflectiveClasses(
        CombinedIndexBuildItem combinedIndex,
        List<ReflectiveClassBuildItem> reflectiveClasses,
        List<UnbannedReflectiveBuildItem> unbannedReflectives,
        BuildProducer<GeneratedResourceBuildItem> dummy // to force the execution of this method
) {
    final DotName uriParamsDotName = DotName.createSimple("org.apache.camel.spi.UriParams");

    final Set<String> bannedClassNames = combinedIndex.getIndex()
            .getAnnotations(uriParamsDotName)
            .stream()
            .filter(ai -> ai.target().kind() == Kind.CLASS)
            .map(ai -> ai.target().asClass().name().toString())
            .collect(Collectors.toSet());

    final Set<String> unbannedClassNames = unbannedReflectives.stream()
            .map(UnbannedReflectiveBuildItem::getClassNames)
            .flatMap(Collection::stream)
            .collect(Collectors.toSet());

    Set<String> violations = reflectiveClasses.stream()
            .map(ReflectiveClassBuildItem::getClassNames)
            .flatMap(Collection::stream)
            .filter(cl -> !unbannedClassNames.contains(cl))
            .filter(bannedClassNames::contains)
            .collect(Collectors.toSet());

    if (!violations.isEmpty()) {
        throw new IllegalStateException(
                "The following classes should either be whitelisted via an UnbannedReflectiveBuildItem or they should not be registered for reflection via ReflectiveClassBuildItem: "
                        + violations);
    }
}
 
Example #27
Source File: GithubProcessor.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();
    index.getKnownDirectImplementors(DotName.createSimple(Serializable.class.getName()))
            .stream()
            .filter(classInfo -> classInfo.name().prefix().toString().equals("org.eclipse.egit.github.core"))
            .map(className -> new ReflectiveClassBuildItem(false, true, className.name().toString()))
            .forEach(reflectiveClass::produce);
}
 
Example #28
Source File: ConsulClientSupportProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void clientProxies(CombinedIndexBuildItem index, BuildProducer<NativeImageProxyDefinitionBuildItem> proxies) {
    index.getIndex().getAllKnownSubclasses(DotName.createSimple("com.orbitz.consul.BaseClient"))
            .stream()
            .map(ClassInfo::name)
            .map(DotName::toString)
            .map(name -> name + "$Api")
            .map(NativeImageProxyDefinitionBuildItem::new)
            .forEach(proxies::produce);
}
 
Example #29
Source File: AwsEc2Processor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_EC2_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 #30
Source File: AwsS3Processor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_S3_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(),
            AWSS3V4Signer.class.getCanonicalName()));
}