Java Code Examples for io.quarkus.deployment.annotations.ExecutionTime#STATIC_INIT
The following examples show how to use
io.quarkus.deployment.annotations.ExecutionTime#STATIC_INIT .
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: SmallRyeOpenApiProcessor.java From quarkus with Apache License 2.0 | 6 votes |
@BuildStep @Record(ExecutionTime.STATIC_INIT) RouteBuildItem handler(LaunchModeBuildItem launch, BuildProducer<NotFoundPageDisplayableEndpointBuildItem> displayableEndpoints, OpenApiRecorder recorder, ShutdownContextBuildItem shutdownContext) { /* * <em>Ugly Hack</em> * In dev mode, we pass a classloader to load the up to date OpenAPI document. * This hack is required because using the TCCL would get an outdated version - the initial one. * This is because the worker thread on which the handler is called captures the TCCL at creation time * and does not allow updating it. * * This classloader must ONLY be used to load the OpenAPI document. * * In non dev mode, the TCCL is used. */ if (launch.getLaunchMode() == LaunchMode.DEVELOPMENT) { recorder.setupClDevMode(shutdownContext); displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(openapi.path)); } return new RouteBuildItem(openapi.path, new OpenApiHandler(), HandlerType.BLOCKING); }
Example 2
Source File: PanacheMongoResourceProcessor.java From quarkus with Apache License 2.0 | 6 votes |
@BuildStep @Record(ExecutionTime.STATIC_INIT) void buildReplacementMap(List<PropertyMappingClassBuildStep> propertyMappingClasses, CombinedIndexBuildItem index, PanacheMongoRecorder recorder) { Map<String, Map<String, String>> replacementMap = new ConcurrentHashMap<>(); for (PropertyMappingClassBuildStep classToMap : propertyMappingClasses) { DotName dotName = DotName.createSimple(classToMap.getClassName()); ClassInfo classInfo = index.getIndex().getClassByName(dotName); if (classInfo != null) { // only compute field replacement for types inside the index Map<String, String> classReplacementMap = replacementMap.computeIfAbsent(classToMap.getClassName(), className -> computeReplacement(classInfo)); if (classToMap.getAliasClassName() != null) { // also register the replacement map for the projection classes replacementMap.put(classToMap.getAliasClassName(), classReplacementMap); } } } recorder.setReplacementCache(replacementMap); }
Example 3
Source File: FhirR5Processor.java From camel-quarkus with Apache License 2.0 | 5 votes |
@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 4
Source File: SupportBuildStep.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep CamelBeanBuildItem logComponent(SupportRecorder recorder) { return new CamelBeanBuildItem( "log", LogComponent.class.getName(), recorder.logComponent()); }
Example 5
Source File: TikaProcessor.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep @Record(ExecutionTime.STATIC_INIT) void initializeTikaParser(BeanContainerBuildItem beanContainer, TikaRecorder recorder, BuildProducer<ServiceProviderBuildItem> serviceProvider, TikaConfiguration configuration) throws Exception { Map<String, List<TikaParserParameter>> parsers = getSupportedParserConfig(configuration.tikaConfigPath, configuration.parsers, configuration.parserOptions, configuration.parser); String tikaXmlConfiguration = generateTikaXmlConfiguration(parsers); serviceProvider.produce(new ServiceProviderBuildItem(Parser.class.getName(), new ArrayList<>(parsers.keySet()))); serviceProvider .produce(new ServiceProviderBuildItem(Detector.class.getName(), getProviderNames(Detector.class.getName()))); serviceProvider.produce(new ServiceProviderBuildItem(EncodingDetector.class.getName(), getProviderNames(EncodingDetector.class.getName()))); recorder.initTikaParser(beanContainer.getValue(), configuration, tikaXmlConfiguration); }
Example 6
Source File: CommandLineArgumentsProcessor.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep @Record(ExecutionTime.STATIC_INIT) BeanContainerListenerBuildItem commandLineArgs(RawCommandLineArgumentsBuildItem rawCommandLineArgumentsBuildItem, ArcRecorder arcRecorder) { //todo: this should be filtered return new BeanContainerListenerBuildItem(arcRecorder.initCommandLineArgs(rawCommandLineArgumentsBuildItem)); }
Example 7
Source File: MicroProfileHealthProcessor.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep CamelBeanBuildItem metricRegistry(CamelMicroProfileHealthRecorder recorder, CamelMicroProfileHealthConfig config) { return new CamelBeanBuildItem( "HealthCheckRegistry", HealthCheckRegistry.class.getName(), recorder.createHealthCheckRegistry(config)); }
Example 8
Source File: QuteProcessor.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep CamelRuntimeBeanBuildItem quteComponent(CamelQuteRecorder recorder, BeanContainerBuildItem beanContainer) { // set the "real" Qute engine to the Camel Qute component return new CamelRuntimeBeanBuildItem( "qute", QuteComponent.class.getName(), recorder.createQuteComponent(beanContainer.getValue())); }
Example 9
Source File: DozerProcessor.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep void configureDozerTypeConverterRegistry(CamelContextBuildItem camelContextBuildItem, CamelDozerConfig camelDozerConfig, CamelDozerRecorder camelDozerRecorder) { if (camelDozerConfig.typeConverterEnabled) { camelDozerRecorder.initializeDozerTypeConverter(camelContextBuildItem.getCamelContext()); } }
Example 10
Source File: BlockingOperationControlBuildStep.java From quarkus with Apache License 2.0 | 5 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep public void blockingOP(List<IOThreadDetectorBuildItem> threadDetectors, BlockingOperationRecorder recorder) { recorder .control(threadDetectors.stream().map(IOThreadDetectorBuildItem::getDetector).collect(Collectors.toList())); }
Example 11
Source File: WebSocketJSR356Processor.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep public void createWebsocketEndpoints(List<ServletContextAttributeBuildItem> servletContext, CamelWebSocketJSR356Recorder recorder, CamelWebSocketJSR356Config config) { ServletContextAttributeBuildItem wsDeploymentInfoAttribute = servletContext .stream() .filter(context -> context.getKey().equals(WebSocketDeploymentInfo.ATTRIBUTE_NAME)) .findFirst() .orElseThrow(() -> new IllegalStateException( "Servlet context attribute: " + WebSocketDeploymentInfo.ATTRIBUTE_NAME + " not found")); recorder.configureWebsocketEndpoints((WebSocketDeploymentInfo) wsDeploymentInfoAttribute.getValue(), config); }
Example 12
Source File: KafkaStreamsProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep @Record(ExecutionTime.STATIC_INIT) BeanContainerListenerBuildItem processBuildTimeConfig(KafkaStreamsRecorder recorder, LaunchModeBuildItem launchMode) { Properties kafkaStreamsProperties = buildKafkaStreamsProperties(launchMode.getLaunchMode()); return new BeanContainerListenerBuildItem(recorder.configure(kafkaStreamsProperties)); }
Example 13
Source File: CamelMainProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Overridable @BuildStep @Record(value = ExecutionTime.STATIC_INIT, optional = true) public CamelRoutesLoaderBuildItems.Registry routesLoader(CamelRecorder recorder) { return new CamelRoutesLoaderBuildItems.Registry(recorder.newDefaultRegistryRoutesLoader()); }
Example 14
Source File: CamelProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Overridable @BuildStep @Record(value = ExecutionTime.STATIC_INIT, optional = true) public CamelModelToXMLDumperBuildItem createModelToXMLDumper(CamelRecorder recorder) { return new CamelModelToXMLDumperBuildItem(recorder.newDisabledModelToXMLDumper()); }
Example 15
Source File: SentinelNativeImageProcessor.java From Sentinel with Apache License 2.0 | 4 votes |
@BuildStep(onlyIf = NativeBuild.class) @Record(ExecutionTime.STATIC_INIT) void record(SentinelRecorder recorder) { recorder.init(); }
Example 16
Source File: BraintreeProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep CamelBeanBuildItem configureBraintreeComponent(BraintreeRecorder recorder) { return new CamelBeanBuildItem("braintree", BraintreeComponent.class.getName(), recorder.configureBraintreeComponent()); }
Example 17
Source File: WebSocketJSR356Processor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep public CamelBeanBuildItem createWebSocketComponent(CamelWebSocketJSR356Recorder recorder) { return new CamelBeanBuildItem("websocket-jsr356", JSR356WebSocketComponent.class.getName(), recorder.createJsr356Component()); }
Example 18
Source File: SmallRyeHealthProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep @Record(ExecutionTime.STATIC_INIT) @SuppressWarnings("unchecked") void build(SmallRyeHealthRecorder recorder, RecorderContext recorderContext, BuildProducer<FeatureBuildItem> feature, BuildProducer<AdditionalBeanBuildItem> additionalBean, BuildProducer<BeanDefiningAnnotationBuildItem> beanDefiningAnnotation, BuildProducer<NotFoundPageDisplayableEndpointBuildItem> displayableEndpoints, LaunchModeBuildItem launchModeBuildItem) throws IOException { feature.produce(new FeatureBuildItem(Feature.SMALLRYE_HEALTH)); // add health endpoints to not found page if (launchModeBuildItem.getLaunchMode().isDevOrTest()) { displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(health.rootPath)); displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(health.rootPath + health.livenessPath)); displayableEndpoints .produce(new NotFoundPageDisplayableEndpointBuildItem(health.rootPath + health.readinessPath)); displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(health.rootPath + health.groupPath)); } // Discover the beans annotated with @Health, @Liveness, @Readiness, @HealthGroup and @HealthGroups even if no scope is defined beanDefiningAnnotation.produce(new BeanDefiningAnnotationBuildItem(HEALTH)); beanDefiningAnnotation.produce(new BeanDefiningAnnotationBuildItem(LIVENESS)); beanDefiningAnnotation.produce(new BeanDefiningAnnotationBuildItem(READINESS)); beanDefiningAnnotation.produce(new BeanDefiningAnnotationBuildItem(HEALTH_GROUP)); beanDefiningAnnotation.produce(new BeanDefiningAnnotationBuildItem(HEALTH_GROUPS)); // Add additional beans additionalBean.produce(new AdditionalBeanBuildItem(SmallRyeHealthReporter.class)); // Make ArC discover @HealthGroup as a qualifier additionalBean.produce(new AdditionalBeanBuildItem(HealthGroup.class)); // Discover and register the HealthCheckResponseProvider Set<String> providers = ServiceUtil.classNamesNamedIn(getClass().getClassLoader(), "META-INF/services/" + HealthCheckResponseProvider.class.getName()); if (providers.isEmpty()) { throw new IllegalStateException("No HealthCheckResponseProvider implementation found."); } else if (providers.size() > 1) { throw new IllegalStateException( String.format("Multiple HealthCheckResponseProvider implementations found: %s", providers)); } recorder.registerHealthCheckResponseProvider( (Class<? extends HealthCheckResponseProvider>) recorderContext.classProxy(providers.iterator().next())); }
Example 19
Source File: CustomTypeConverterBuildStep.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep CamelTypeConverterLoaderBuildItem typeConverterLoader(CustomTypeConverterRecorder recorder) { return new CamelTypeConverterLoaderBuildItem(recorder.createTypeConverterLoader()); }
Example 20
Source File: CustomMainListenerProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep CamelMainListenerBuildItem listener(CustomMainListenerRecorder recorder) { return new CamelMainListenerBuildItem(recorder.createSupportListener()); }