Java Code Examples for io.quarkus.deployment.annotations.BuildStep

The following examples show how to use io.quarkus.deployment.annotations.BuildStep. 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-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 2
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 3
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 4
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 5
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 6
Source Project: camel-quarkus   Source File: CamelProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
CamelFactoryFinderResolverBuildItem factoryFinderResolver(
        RecorderContext recorderContext,
        CamelRecorder recorder,
        List<CamelServiceBuildItem> camelServices) {

    RuntimeValue<Builder> builder = recorder.factoryFinderResolverBuilder();

    camelServices.forEach(service -> {
        recorder.factoryFinderResolverEntry(
                builder,
                service.path.toString(),
                recorderContext.classProxy(service.type));
    });

    return new CamelFactoryFinderResolverBuildItem(recorder.factoryFinderResolver(builder));
}
 
Example 7
Source Project: camel-k-runtime   Source File: HotDeploymentProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@BuildStep
List<HotDeploymentWatchedFileBuildItem> routes() {
    final Config config = ConfigProvider.getConfig();
    final Optional<String> value = config.getOptionalValue(Constants.PROPERTY_CAMEL_K_ROUTES, String.class);

    List<HotDeploymentWatchedFileBuildItem> items = new ArrayList<>();

    if (value.isPresent()) {
        for (String source : value.get().split(",", -1)) {
            String path = StringHelper.after(source, ":");
            if (path == null) {
                path = source;
            }

            Path p = Paths.get(path);
            if (Files.exists(p)) {
                LOGGER.info("Register source for hot deployment: {}", p.toAbsolutePath());
                items.add(new HotDeploymentWatchedFileBuildItem(p.toAbsolutePath().toString()));
            }
        }
    }

    return items;
}
 
Example 8
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 9
Source Project: camel-quarkus   Source File: AwsEKSProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_EKS_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 10
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
CamelBeanBuildItem metricRegistry(CamelMicroProfileMetricsRecorder recorder) {
    return new CamelBeanBuildItem(
            MicroProfileMetricsConstants.METRIC_REGISTRY_NAME,
            MetricRegistry.class.getName(),
            recorder.createApplicationRegistry());
}
 
Example 11
Source Project: camel-quarkus   Source File: CaffeineLRUCacheProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
NativeImageResourceBuildItem lruCacheFactory() {
    // The process of discovering the LRUCacheFactory does not use any Camel' built in mechanic
    // but it based on loading a resource from the classpath, like:
    //
    //     ClassLoader classLoader = LRUCacheFactory.class.getClassLoader();
    //     URL url = classLoader.getResource("META-INF/services/org/apache/camel/lru-cache-factory");
    //
    // Full code here:
    //     https://github.com/apache/camel/blob/8bf781197c7138be5f8293e149a4a46a612cc40c/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java#L73-L100
    //
    // For such reason we need to include the lru-cache-factory file in the native image
    return new NativeImageResourceBuildItem("META-INF/services/org/apache/camel/lru-cache-factory");
}
 
Example 12
Source Project: camel-quarkus   Source File: JsonValidatorProcessor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Keywords used in schema ("required", "type"...) need matching classes ("RequiredValidator", "TypeValidator"...).
 * So, let's register all the known JsonValidator implementations for reflective access in native mode.
 */
@BuildStep
void registerReflectiveClasses(CombinedIndexBuildItem combinedIndex,
        BuildProducer<ReflectiveClassBuildItem> reflectiveProducer) {
    combinedIndex.getIndex().getAllKnownImplementors(VALIDATOR_INTERFACE).stream()
            .forEach(c -> reflectiveProducer.produce(new ReflectiveClassBuildItem(false, false, c.name().toString())));
}
 
Example 13
Source Project: camel-quarkus   Source File: TikaProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
CamelRuntimeBeanBuildItem tikaComponent(BeanContainerBuildItem beanContainer, TikaRecorder recorder) {
    return new CamelRuntimeBeanBuildItem(
            "tika",
            TikaComponent.class.getName(),
            recorder.createTikaComponent(beanContainer.getValue()));
}
 
Example 14
Source Project: camel-quarkus   Source File: GooglePubsubProcessor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Remove this once this extension starts supporting the native mode.
 */
@BuildStep(onlyIf = NativeBuild.class)
@Record(value = ExecutionTime.RUNTIME_INIT)
void warnJvmInNative(JvmOnlyRecorder recorder) {
    JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
    recorder.warnJvmInNative(FEATURE); // warn at runtime
}
 
Example 15
Source Project: camel-quarkus   Source File: JiraProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
NativeImageResourceBuildItem nativeImageResources() {
    // Add Joda timezone resources into the native image as it is required by com.atlassian.jira.rest.client.internal.json.JsonParseUtil
    List<String> timezones = new ArrayList<>();
    for (String timezone : DateTimeZone.getAvailableIDs()) {
        String[] zoneParts = timezone.split("/");
        if (zoneParts.length == 2) {
            timezones.add(String.format("org/joda/time/tz/data/%s/%s", zoneParts[0], zoneParts[1]));
        }
    }
    return new NativeImageResourceBuildItem(timezones);
}
 
Example 16
Source Project: camel-quarkus   Source File: CamelBootstrapProcessor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Starts the given {@link CamelRuntimeBuildItem}.
 *
 * @param recorder             the recorder.
 * @param runtime              a reference to the {@link CamelRuntimeBuildItem}.
 * @param commandLineArguments a reference to the raw command line arguments as they were passed to the application.
 * @param shutdown             a reference to a {@link ShutdownContext} used tor register the Camel's related shutdown
 *                             tasks.
 */
@BuildStep(onlyIf = { CamelConfigFlags.BootstrapEnabled.class })
@Record(value = ExecutionTime.RUNTIME_INIT)
@Produce(CamelBootstrapCompletedBuildItem.class)
void boot(
        CamelBootstrapRecorder recorder,
        CamelRuntimeBuildItem runtime,
        RawCommandLineArgumentsBuildItem commandLineArguments,
        ShutdownContextBuildItem shutdown) {

    recorder.addShutdownTask(shutdown, runtime.runtime());
    if (runtime.isAutoStartup()) {
        recorder.start(runtime.runtime(), commandLineArguments);
    }
}
 
Example 17
Source Project: camel-k-runtime   Source File: DeploymentProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
CamelServicePatternBuildItem servicePatterns() {
    return new CamelServicePatternBuildItem(
        CamelServicePatternBuildItem.CamelServiceDestination.DISCOVERY,
        true,
        StepParser.SERVICE_LOCATION + "/*");
}
 
Example 18
Source Project: camel-quarkus   Source File: XalanNativeImageProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
ReflectiveClassBuildItem reflectiveClasses() {
    return new ReflectiveClassBuildItem(
            true,
            false,
            "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory",
            "org.apache.xalan.xsltc.dom.ObjectFactory",
            "org.apache.xalan.xsltc.dom.XSLTCDTMManager",
            "org.apache.xalan.xsltc.trax.ObjectFactory",
            "org.apache.xalan.xsltc.trax.TransformerFactoryImpl",
            "org.apache.xml.serializer.OutputPropertiesFactory",
            "org.apache.xml.serializer.CharInfo",
            "org.apache.xml.serializer.XMLEntities");
}
 
Example 19
Source Project: camel-quarkus   Source File: CamelProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void disableXmlReifiers(CamelRecorder recorder, Capabilities capabilities) {
    if (!capabilities.isCapabilityPresent(CamelCapabilities.XML)) {
        LOGGER.debug("Camel XML capability not detected, disable XML reifiers");
        recorder.disableXmlReifiers();
    }
}
 
Example 20
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 21
Source Project: camel-quarkus   Source File: PlatformHttpProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
CamelRuntimeBeanBuildItem platformHttpEngineBean(PlatformHttpEngineBuildItem engine) {
    return new CamelRuntimeBeanBuildItem(
            PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME,
            QuarkusPlatformHttpEngine.class.getName(),
            engine.getInstance());
}
 
Example 22
Source Project: camel-quarkus   Source File: FhirDstu2Processor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep(onlyIf = FhirFlags.Dstu2Enabled.class)
@Record(ExecutionTime.STATIC_INIT)
void recordContext(FhirContextRecorder fhirContextRecorder, BeanContainerBuildItem beanContainer,
        Dstu2PropertiesBuildItem propertiesBuildItem) {
    fhirContextRecorder.createDstu2FhirContext(beanContainer.getValue(),
            getResourceDefinitions(propertiesBuildItem.getProperties()));
}
 
Example 23
Source Project: camel-quarkus   Source File: AwsKinesisProcessor.java    License: 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 24
Source Project: camel-quarkus   Source File: FhirR5Processor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep(onlyIf = FhirFlags.R5Enabled.class)
@Record(ExecutionTime.STATIC_INIT)
void recordContext(FhirContextRecorder fhirContextRecorder, BeanContainerBuildItem beanContainer,
        R5PropertiesBuildItem propertiesBuildItem) {
    fhirContextRecorder.createR5FhirContext(beanContainer.getValue(),
            getResourceDefinitions(propertiesBuildItem.getProperties()));
}
 
Example 25
@BuildStep
FeatureBuildItem feature() {
    return new FeatureBuildItem(FEATURE);
}
 
Example 26
Source Project: camel-quarkus   Source File: GoogleSheetsProcessor.java    License: Apache License 2.0 4 votes vote down vote up
@BuildStep
void applicationArchiveMarkers(BuildProducer<AdditionalApplicationArchiveMarkerBuildItem> applicationArchiveMarker) {
    applicationArchiveMarker.produce(new AdditionalApplicationArchiveMarkerBuildItem("com/google/api/services/sheets"));
}
 
Example 27
Source Project: camel-quarkus   Source File: JtaProcessor.java    License: Apache License 2.0 4 votes vote down vote up
@BuildStep //TODO remove this BuildStep when https://github.com/quarkusio/quarkus/issues/10180 gets resolved
void registerNarayanaReflectiveClass(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
    reflectiveClass.produce(
            new ReflectiveClassBuildItem(false, false, SocketProcessId.class.getName()));
}
 
Example 28
Source Project: camel-quarkus   Source File: Olingo4Processor.java    License: Apache License 2.0 4 votes vote down vote up
@BuildStep
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
    return new ExtensionSslNativeSupportBuildItem(FEATURE);
}
 
Example 29
Source Project: camel-quarkus   Source File: DebeziumSqlserverProcessor.java    License: Apache License 2.0 4 votes vote down vote up
@BuildStep
FeatureBuildItem feature() {
    return new FeatureBuildItem(FEATURE);
}
 
Example 30
Source Project: camel-quarkus   Source File: AhcWsProcessor.java    License: Apache License 2.0 4 votes vote down vote up
@BuildStep
FeatureBuildItem feature() {
    return new FeatureBuildItem(FEATURE);
}