Java Code Examples for io.quarkus.deployment.annotations.BuildProducer#produce()

The following examples show how to use io.quarkus.deployment.annotations.BuildProducer#produce() . 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: SupportMongoDBProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void registerCamelMongoClientProducer(
        List<MongoClientBuildItem> mongoClients,
        BuildProducer<CamelRuntimeBeanBuildItem> runtimeBeans) {

    for (MongoClientBuildItem mongoClient : mongoClients) {
        // If there is a default mongo client instance, then bind it to the camel registry
        // with the default mongo client name used by the camel-mongodb component
        if (MongoClientBeanUtil.isDefault(mongoClient.getName())) {
            runtimeBeans.produce(
                    new CamelRuntimeBeanBuildItem(
                            "camelMongoClient",
                            "com.mongodb.client.MongoClient",
                            mongoClient.getClient()));
        }
    }
}
 
Example 2
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 3
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 4
Source File: FhirR4Processor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(onlyIf = FhirFlags.R4Enabled.class)
void enableReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, R4PropertiesBuildItem buildItem) {
    Set<String> classes = new HashSet<>();
    classes.add(org.hl7.fhir.r4.model.DomainResource.class.getCanonicalName());
    classes.add(org.hl7.fhir.r4.model.Resource.class.getCanonicalName());
    classes.add(org.hl7.fhir.r4.model.BaseResource.class.getCanonicalName());
    classes.add(org.hl7.fhir.r4.model.Base.class.getCanonicalName());
    classes.addAll(getModelClasses(buildItem.getProperties()));
    classes.addAll(getInnerClasses(org.hl7.fhir.r4.model.Enumerations.class.getCanonicalName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(true, true, true, org.hl7.fhir.r4.model.Meta.class.getCanonicalName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, true,
            org.hl7.fhir.r4.model.MetadataResource.class.getCanonicalName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, classes.toArray(new String[0])));
}
 
Example 5
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 6
Source File: BraintreeProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<UnbannedReflectiveBuildItem> unbannedClass, CombinedIndexBuildItem combinedIndex) {
    IndexView index = combinedIndex.getIndex();
    Collection<AnnotationInstance> uriParams = index
            .getAnnotations(DotName.createSimple("org.apache.camel.spi.UriParams"));

    String[] braintreeConfigClasses = 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.braintree"))
            .collect(Collectors.toList())
            .toArray(new String[0]);

    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, braintreeConfigClasses));
    unbannedClass.produce(new UnbannedReflectiveBuildItem(braintreeConfigClasses));

    reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
            "com.braintreegateway.Address",
            "com.braintreegateway.BraintreeGateway",
            "com.braintreegateway.Customer",
            "com.braintreegateway.DisputeEvidence",
            "com.braintreegateway.DocumentUpload",
            "com.braintreegateway.MerchantAccount",
            "com.braintreegateway.PaymentMethod",
            "com.braintreegateway.Transaction"));
}
 
Example 7
Source File: SalesforceProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
    for (Class<?> type : SALESFORCE_REFLECTIVE_CLASSES) {
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, type));
    }
}
 
Example 8
Source File: AwsTranslateProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_TRANSLATE_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 9
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 10
Source File: AwsSNSProcessor.java    From camel-quarkus with 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 11
Source File: SupportAhcProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClass) {
    for (String className : RUNTIME_INITIALIZED_CLASSES) {
        runtimeInitializedClass
                .produce(new RuntimeInitializedClassBuildItem(className));
    }
}
 
Example 12
Source File: AwsLambdaProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_LAMBDA_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 13
Source File: AwsIamProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_IAM_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 14
Source File: ConsulClientSupportProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void ignoredOnReflectiveHierarchyRegistration(BuildProducer<ReflectiveHierarchyIgnoreWarningBuildItem> ignored) {
    ignored.produce(new ReflectiveHierarchyIgnoreWarningBuildItem(DOT_NAME_IMMUTABLE_LIST));
    ignored.produce(new ReflectiveHierarchyIgnoreWarningBuildItem(DOT_NAME_IMMUTABLE_MAP));
}
 
Example 15
Source File: KogitoAssetsProcessor.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@BuildStep(loadsApplicationClasses = true)
public void generateModel(ArchiveRootBuildItem root,
                          BuildProducer<GeneratedBeanBuildItem> generatedBeans,
                          CombinedIndexBuildItem combinedIndexBuildItem,
                          LaunchModeBuildItem launchMode,
                          LiveReloadBuildItem liveReload,
                          BuildProducer<NativeImageResourceBuildItem> resource,
                          BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
                          CurateOutcomeBuildItem curateOutcomeBuildItem) throws IOException, BootstrapDependencyProcessingException {

    if (liveReload.isLiveReload()) {
        return;
    }

    AppPaths appPaths = new AppPaths( root.getPaths() );

    ApplicationGenerator appGen = createApplicationGenerator(appPaths, combinedIndexBuildItem);
    Collection<GeneratedFile> generatedFiles = appGen.generate();

    Collection<GeneratedFile> javaFiles = generatedFiles.stream().filter( f -> f.relativePath().endsWith( ".java" ) ).collect( Collectors.toCollection( ArrayList::new ));
    writeGeneratedFiles(appPaths, generatedFiles);

    if (!javaFiles.isEmpty()) {

        Indexer kogitoIndexer = new Indexer();
        Set<DotName> kogitoIndex = new HashSet<>();

        MemoryFileSystem trgMfs = new MemoryFileSystem();
        CompilationResult result = compile( appPaths, trgMfs, curateOutcomeBuildItem.getEffectiveModel(), javaFiles, launchMode.getLaunchMode() );
        register(appPaths, trgMfs, generatedBeans,
                (className, data) -> generateBeanBuildItem( combinedIndexBuildItem, kogitoIndexer, kogitoIndex, className, data ),
                launchMode.getLaunchMode(), result);


        Index index = kogitoIndexer.complete();

        generatePersistenceInfo(appPaths, generatedBeans, CompositeIndex.create(combinedIndexBuildItem.getIndex(), index),
                launchMode, resource, curateOutcomeBuildItem);


        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.event.AbstractDataEvent"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.AbstractProcessDataEvent"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.ProcessInstanceDataEvent"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.VariableInstanceDataEvent"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.impl.ProcessInstanceEventBody"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.impl.NodeInstanceEventBody"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.impl.ProcessErrorEventBody"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.impl.VariableInstanceEventBody"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.UserTaskInstanceDataEvent"));
        reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, "org.kie.kogito.services.event.impl.UserTaskInstanceEventBody"));

        Collection<ClassInfo> dataEvents = index
                .getAllKnownSubclasses(createDotName("org.kie.kogito.event.AbstractDataEvent"));

        dataEvents.forEach(c -> reflectiveClass.produce(
                new ReflectiveClassBuildItem(true, true, c.name().toString())));

        writeGeneratedFiles(appPaths, getJsonSchemaFiles(index, trgMfs));
    }
}
 
Example 16
Source File: AvroProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void additionalBeanClasses(BuildProducer<AdditionalBeanBuildItem> additionalBeanProducer) {
    additionalBeanProducer.produce(new AdditionalBeanBuildItem(AvroDataFormatProducer.class));
}
 
Example 17
Source File: InfluxdbProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void clientProxies(BuildProducer<NativeImageProxyDefinitionBuildItem> proxies) {
    proxies.produce(new NativeImageProxyDefinitionBuildItem("org.influxdb.impl.InfluxDBService"));
}
 
Example 18
Source File: DebeziumSupportProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) {
    indexDependency.produce(new IndexDependencyBuildItem("org.apache.kafka", "connect-json"));
    indexDependency.produce(new IndexDependencyBuildItem("io.debezium", "debezium-embedded"));
}
 
Example 19
Source File: GoogleCalendarProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void applicationArchiveMarkers(BuildProducer<AdditionalApplicationArchiveMarkerBuildItem> applicationArchiveMarker) {
    applicationArchiveMarker.produce(new AdditionalApplicationArchiveMarkerBuildItem("com/google/api/services/calendar"));
}
 
Example 20
Source File: FhirDstu3Processor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep(onlyIf = FhirFlags.Dstu3Enabled.class)
Dstu3PropertiesBuildItem properties(BuildProducer<NativeImageResourceBuildItem> resource) {
    resource.produce(new NativeImageResourceBuildItem(FHIR_VERSION_PROPERTIES));
    return new Dstu3PropertiesBuildItem(FHIR_VERSION_PROPERTIES);
}