io.quarkus.deployment.annotations.BuildStep Java Examples

The following examples show how to use io.quarkus.deployment.annotations.BuildStep. 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: AwsSdbProcessor.java    From camel-quarkus with Apache License 2.0 7 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDB_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<NativeImageResourceBuildItem> resource) {

    resource.produce(new NativeImageResourceBuildItem("com/amazonaws/partitions/endpoints.json"));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
            Partitions.class.getCanonicalName(),
            Partition.class.getCanonicalName(),
            Endpoint.class.getCanonicalName(),
            Region.class.getCanonicalName(),
            Service.class.getCanonicalName(),
            CredentialScope.class.getCanonicalName(),
            QueryStringSigner.class.getCanonicalName(),
            AWS4Signer.class.getCanonicalName()));
}
 
Example #2
Source File: HotDeploymentProcessor.java    From camel-k-runtime with 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 #3
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 #4
Source File: CamelProcessor.java    From camel-quarkus with 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 #5
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 #6
Source File: Aws2MskProcessor.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<NativeImageResourceBuildItem> resource) {

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

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

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

    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
            String.class.getCanonicalName()));
}
 
Example #7
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 #8
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 #9
Source File: JiraProcessor.java    From camel-quarkus with 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 #10
Source File: TikaProcessor.java    From camel-quarkus with 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 #11
Source File: GooglePubsubProcessor.java    From camel-quarkus with 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 #12
Source File: JsonValidatorProcessor.java    From camel-quarkus with 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 File: FhirR5Processor.java    From camel-quarkus with 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 #14
Source File: CaffeineLRUCacheProcessor.java    From camel-quarkus with 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 #15
Source File: MicroProfileMetricsProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
CamelBeanBuildItem metricRegistry(CamelMicroProfileMetricsRecorder recorder) {
    return new CamelBeanBuildItem(
            MicroProfileMetricsConstants.METRIC_REGISTRY_NAME,
            MetricRegistry.class.getName(),
            recorder.createApplicationRegistry());
}
 
Example #16
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 #17
Source File: FhirDstu2Processor.java    From camel-quarkus with 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 #18
Source File: AwsEKSProcessor.java    From camel-quarkus with 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 #19
Source File: CamelBootstrapProcessor.java    From camel-quarkus with 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 #20
Source File: PlatformHttpProcessor.java    From camel-quarkus with 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 #21
Source File: DeploymentProcessor.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@BuildStep
CamelServicePatternBuildItem servicePatterns() {
    return new CamelServicePatternBuildItem(
        CamelServicePatternBuildItem.CamelServiceDestination.DISCOVERY,
        true,
        StepParser.SERVICE_LOCATION + "/*");
}
 
Example #22
Source File: XalanNativeImageProcessor.java    From camel-quarkus with 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 #23
Source File: CouchdbProcessor.java    From camel-quarkus with 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 #24
Source File: CamelProcessor.java    From camel-quarkus with 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 #25
Source File: SalesforceProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
FeatureBuildItem feature() {
    return new FeatureBuildItem(FEATURE);
}
 
Example #26
Source File: AttachmentsProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
FeatureBuildItem feature() {
    return new FeatureBuildItem(FEATURE);
}
 
Example #27
Source File: DebeziumMysqlProcessor.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("io.debezium", "debezium-connector-mysql"));
}
 
Example #28
Source File: MicroprofileFaultToleranceProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
FeatureBuildItem feature() {
    return new FeatureBuildItem(FEATURE);
}
 
Example #29
Source File: ConsulProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
    return new ExtensionSslNativeSupportBuildItem(FEATURE);
}
 
Example #30
Source File: BuildProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Record(value = ExecutionTime.RUNTIME_INIT, optional = true)
@BuildStep
RuntimeCamelContextCustomizerBuildItem reactiveExecutorCustomizer(ReactiveExecutorRecorder recorder, VertxBuildItem vertx) {
    return new RuntimeCamelContextCustomizerBuildItem(recorder.createReactiveExecutorCustomizer(vertx.getVertx()));
}