io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem Java Examples

The following examples show how to use io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem. 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: SentinelNativeImageProcessor.java    From Sentinel with Apache License 2.0 6 votes vote down vote up
@BuildStep(onlyIf = NativeBuild.class)
List<RuntimeInitializedClassBuildItem> runtimeInitializedClasses() {
    return Arrays.asList(
            new RuntimeInitializedClassBuildItem("com.alibaba.fastjson.serializer.JodaCodec"),
            new RuntimeInitializedClassBuildItem("com.alibaba.fastjson.serializer.GuavaCodec"),
            new RuntimeInitializedClassBuildItem("com.alibaba.fastjson.support.moneta.MonetaCodec"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.Env"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.init.InitExecutor"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.cluster.ClusterStateManager"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.slots.block.degrade.DegradeRuleManager"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.node.metric.MetricTimerListener"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.node.metric.MetricWriter"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.util.TimeUtil"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.eagleeye.StatLogController"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.slots.logger.EagleEyeLogUtil"),
            new RuntimeInitializedClassBuildItem("com.alibaba.csp.sentinel.eagleeye.EagleEye"));
}
 
Example #2
Source File: LoggingResourceProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void miscSetup(
        Consumer<RuntimeInitializedClassBuildItem> runtimeInit,
        Consumer<NativeImageSystemPropertyBuildItem> systemProp,
        Consumer<ServiceProviderBuildItem> provider) {
    runtimeInit.accept(new RuntimeInitializedClassBuildItem("org.jboss.logmanager.formatters.TrueColorHolder"));
    systemProp
            .accept(new NativeImageSystemPropertyBuildItem("java.util.logging.manager", "org.jboss.logmanager.LogManager"));
    provider.accept(
            new ServiceProviderBuildItem(EmbeddedConfigurator.class.getName(), InitialConfigurator.class.getName()));
}
 
Example #3
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 #4
Source File: NettyProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem runtimeInitBcryptUtil() {
    // this holds a direct allocated byte buffer that needs to be initialised at run time
    return new RuntimeInitializedClassBuildItem(EmptyByteBufStub.class.getName());
}
 
Example #5
Source File: ConfigBuildSteps.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem runtimeInitializedClass() {
    return new RuntimeInitializedClassBuildItem(InetRunTime.class.getName());
}
 
Example #6
Source File: ThreadPoolSetup.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem registerClasses() {
    // make sure that the config provider gets initialized only at run time
    return new RuntimeInitializedClassBuildItem(ExecutorRecorder.class.getName());
}
 
Example #7
Source File: NarayanaJtaProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
@Record(RUNTIME_INIT)
public void build(NarayanaJtaRecorder recorder,
        BuildProducer<AdditionalBeanBuildItem> additionalBeans,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<RuntimeInitializedClassBuildItem> runtimeInit,
        BuildProducer<FeatureBuildItem> feature,
        TransactionManagerConfiguration transactions) {
    feature.produce(new FeatureBuildItem(Feature.NARAYANA_JTA));
    additionalBeans.produce(new AdditionalBeanBuildItem(NarayanaJtaProducers.class));
    additionalBeans.produce(new AdditionalBeanBuildItem(CDIDelegatingTransactionManager.class));
    runtimeInit.produce(new RuntimeInitializedClassBuildItem(
            "com.arjuna.ats.internal.jta.resources.arjunacore.CommitMarkableResourceRecord"));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, JTAEnvironmentBean.class.getName(),
            UserTransactionImple.class.getName(),
            CheckedActionFactoryImple.class.getName(),
            TransactionManagerImple.class.getName(),
            TransactionSynchronizationRegistryImple.class.getName(),
            ObjectStoreEnvironmentBean.class.getName(),
            ShadowNoFileLockStore.class.getName()));

    AdditionalBeanBuildItem.Builder builder = AdditionalBeanBuildItem.builder();
    builder.addBeanClass(TransactionalInterceptorSupports.class);
    builder.addBeanClass(TransactionalInterceptorNever.class);
    builder.addBeanClass(TransactionalInterceptorRequired.class);
    builder.addBeanClass(TransactionalInterceptorRequiresNew.class);
    builder.addBeanClass(TransactionalInterceptorMandatory.class);
    builder.addBeanClass(TransactionalInterceptorNotSupported.class);
    additionalBeans.produce(builder.build());

    //we want to force Arjuna to init at static init time
    Properties defaultProperties = PropertiesFactory.getDefaultProperties();
    //we don't want to store the system properties here
    //we re-apply them at runtime
    for (Object i : System.getProperties().keySet()) {
        defaultProperties.remove(i);
    }
    recorder.setDefaultProperties(defaultProperties);
    // This must be done before setNodeName as the code in setNodeName will create a TSM based on the value of this property
    recorder.disableTransactionStatusManager();
    recorder.setNodeName(transactions);
    recorder.setDefaultTimeout(transactions);
}
 
Example #8
Source File: LiquibaseProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep(onlyIf = NativeBuild.class)
@Record(STATIC_INIT)
void nativeImageConfiguration(
        LiquibaseRecorder recorder,
        LiquibaseBuildTimeConfig liquibaseBuildConfig,
        List<JdbcDataSourceBuildItem> jdbcDataSourceBuildItems,
        BuildProducer<ReflectiveClassBuildItem> reflective,
        BuildProducer<NativeImageResourceBuildItem> resource,
        BuildProducer<GeneratedResourceBuildItem> generatedResource,
        BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitialized,
        BuildProducer<NativeImageResourceBundleBuildItem> resourceBundle) {

    runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("liquibase.diff.compare.CompareControl"));

    reflective.produce(new ReflectiveClassBuildItem(false, true, false,
            "liquibase.change.AbstractSQLChange",
            "liquibase.database.jvm.JdbcConnection"));

    reflective.produce(new ReflectiveClassBuildItem(true, true, true,
            "liquibase.change.ColumnConfig",
            "liquibase.change.AddColumnConfig"));

    reflective.produce(new ReflectiveClassBuildItem(false, false, true,
            "liquibase.change.ConstraintsConfig"));

    addReflection(reflective, true, liquibase.change.Change.class);

    // add all implementation of these classes to the reflection process
    addReflection(reflective, false,
            liquibase.configuration.ConfigurationContainer.class,
            liquibase.parser.LiquibaseParser.class,
            liquibase.structure.DatabaseObject.class,
            liquibase.sql.visitor.SqlVisitor.class);

    // load the liquibase services
    Map<String, List<String>> serviceClassesImplementationRegistry = new HashMap<>();

    Stream.of(liquibase.diff.compare.DatabaseObjectComparator.class,
            liquibase.parser.NamespaceDetails.class,
            liquibase.precondition.Precondition.class,
            liquibase.database.Database.class,
            liquibase.parser.ChangeLogParser.class,
            liquibase.change.Change.class,
            liquibase.snapshot.SnapshotGenerator.class,
            liquibase.changelog.ChangeLogHistoryService.class,
            liquibase.datatype.LiquibaseDataType.class,
            liquibase.executor.Executor.class,
            liquibase.lockservice.LockService.class,
            liquibase.sqlgenerator.SqlGenerator.class,
            liquibase.command.LiquibaseCommand.class,
            liquibase.structure.DatabaseObject.class,
            liquibase.diff.output.changelog.ChangeGenerator.class,
            liquibase.diff.DiffGenerator.class)
            .forEach(t -> addService(reflective, t, true, serviceClassesImplementationRegistry));

    addService(reflective, liquibase.license.LicenseService.class, false, serviceClassesImplementationRegistry);

    recorder.setServicesImplementations(serviceClassesImplementationRegistry);

    Collection<String> dataSourceNames = jdbcDataSourceBuildItems.stream()
            .map(i -> i.getName())
            .collect(Collectors.toSet());

    resource.produce(
            new NativeImageResourceBuildItem(getChangeLogs(dataSourceNames, liquibaseBuildConfig).toArray(new String[0])));

    // liquibase XSD
    resource.produce(new NativeImageResourceBuildItem(
            "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd",
            "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd",
            "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.7.xsd",
            "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd",
            "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd",
            "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd",
            "www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd",
            "liquibase.build.properties"));

    // liquibase resource bundles
    resourceBundle.produce(new NativeImageResourceBundleBuildItem("liquibase/i18n/liquibase-core"));
}
 
Example #9
Source File: XrayBuildStep.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep(onlyIf = NativeBuild.class)
public void process(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinition,
        BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitialized,
        BuildProducer<NativeImageResourceBuildItem> resource) {
    runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("com.amazonaws.xray.AWSXRay"));
    runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("com.amazonaws.xray.AWSXRayRecorder"));
    runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("com.amazonaws.xray.interceptors.TracingInterceptor"));
    runtimeInitialized.produce(
            new RuntimeInitializedClassBuildItem("com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy"));
    reflectiveClass.produce(new ReflectiveClassBuildItem(
            true, true, true,
            "com.amazonaws.xray.handlers.config.AWSServiceHandlerManifest",
            "com.amazonaws.xray.AWSXRay",
            "com.amazonaws.xray.strategy.sampling.manifest.SamplingRuleManifest",
            "com.amazonaws.xray.strategy.sampling.rule.SamplingRule",
            "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir",
            "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir$MaxFunction",
            "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir$LessThan10",
            "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir$AtLeast10",
            "com.amazonaws.auth.AWS4Signer",
            "com.amazonaws.xray.handlers.config.AWSOperationHandlerManifest",
            "com.amazonaws.xray.handlers.config.AWSOperationHandler",
            "com.amazonaws.xray.handlers.config.AWSOperationHandlerRequestDescriptor",
            "com.amazonaws.xray.handlers.config.AWSOperationHandlerResponseDescriptor",
            "com.amazonaws.xray.entities.ThrowableDescription",
            "com.amazonaws.xray.entities.SubsegmentImpl",
            "com.amazonaws.xray.entities.EntityImpl",
            "com.amazonaws.xray.entities.TraceID",
            "com.amazonaws.xray.entities.Cause",
            "com.amazonaws.xray.entities.SegmentImpl",
            "com.fasterxml.jackson.databind.ser.std.ToStringSerializer"));

    resource.produce(new NativeImageResourceBuildItem(
            "com/amazonaws/xray/interceptors/DefaultOperationParameterWhitelist.json",
            "com/amazonaws/xray/strategy/sampling/DefaultSamplingRules.json",
            "com/amazonaws/xray/sdk.properties"));

    //Register Apache client 
    proxyDefinition.produce(
            new NativeImageProxyDefinitionBuildItem("org.apache.http.conn.HttpClientConnectionManager",
                    "org.apache.http.pool.ConnPoolControl",
                    "com.amazonaws.http.conn.Wrapped"));
}
 
Example #10
Source File: JSchProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem runtimeInitialized() {
    return new RuntimeInitializedClassBuildItem(PortWatcherRunTime.class.getName());
}
 
Example #11
Source File: GelfLogHandlerProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem nativeBuild() {
    return new RuntimeInitializedClassBuildItem(
            "biz.paluch.logging.gelf.jboss7.JBoss7GelfLogHandler");
}
 
Example #12
Source File: RestDataProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem el() {
    return new RuntimeInitializedClassBuildItem(EL.class.getCanonicalName());
}
 
Example #13
Source File: QuarkusSecurityCommonProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem runtimeInitBcryptUtil() {
    // this holds a SecureRandom static var that needs to be initialised at run time
    return new RuntimeInitializedClassBuildItem(BcryptUtil.class.getName());
}
 
Example #14
Source File: TikaProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
public void registerRuntimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> resource) {
    //org.apache.tika.parser.pdf.PDFParser (https://issues.apache.org/jira/browse/PDFBOX-4548)
    resource.produce(new RuntimeInitializedClassBuildItem("org.apache.pdfbox.pdmodel.font.PDType1Font"));
}
 
Example #15
Source File: VertxHttpProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem configureNativeCompilation() {
    return new RuntimeInitializedClassBuildItem("io.vertx.ext.web.handler.sockjs.impl.XhrTransport");
}
 
Example #16
Source File: AhcWsProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem runtimeInitializedClasses() {
    return new RuntimeInitializedClassBuildItem("org.asynchttpclient.netty.ws.NettyWebSocket");
}
 
Example #17
Source File: MsSQLProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
public RuntimeInitializedClassBuildItem runtimeInitializedClass() {
    return new RuntimeInitializedClassBuildItem("com.microsoft.sqlserver.jdbc.KerbAuthentication");
}
 
Example #18
Source File: MariaDBJDBCReflections.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void runtimeInit(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitialized) {
    //MastersSlavesListener starts threads in DynamicSizedSchedulerImpl which is disallowed during build time in GraalVM
    runtimeInitialized
            .produce(new RuntimeInitializedClassBuildItem("org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener"));
}
 
Example #19
Source File: JGitProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
List<RuntimeInitializedClassBuildItem> runtimeInitializedClasses() {
    return Arrays.asList(
            new RuntimeInitializedClassBuildItem("org.eclipse.jgit.transport.HttpAuthMethod$Digest"),
            new RuntimeInitializedClassBuildItem("org.eclipse.jgit.lib.GpgSigner"));
}
 
Example #20
Source File: KogitoAssetsProcessor.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@BuildStep
public RuntimeInitializedClassBuildItem runtimeInitializedClass() {
    return new RuntimeInitializedClassBuildItem(ClassFieldAccessorFactory.class.getName());
}
 
Example #21
Source File: SupportGoogleHTTPClientProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem runtimeInitializedClasses() {
    return new RuntimeInitializedClassBuildItem("com.google.api.client.auth.oauth.OAuthParameters");
}
 
Example #22
Source File: PdfProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void configureRuntimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClass) {
    for (String className : RUNTIME_INITIALIZED_CLASSES) {
        runtimeInitializedClass.produce(new RuntimeInitializedClassBuildItem(className));
    }
}
 
Example #23
Source File: JaxbProcessor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem fastInfosetStreamWriterOutput() {
    return new RuntimeInitializedClassBuildItem(FastInfosetStreamWriterOutput.class.getCanonicalName());
}
 
Example #24
Source File: AwsS3Processor.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
RuntimeInitializedClassBuildItem cryptoConfiguration() {
    return new RuntimeInitializedClassBuildItem(CryptoConfiguration.class.getCanonicalName());
}
 
Example #25
Source File: BoxProcessor.java    From camel-quarkus with Apache License 2.0 3 votes vote down vote up
@BuildStep
void configure(BuildProducer<RuntimeInitializedClassBuildItem> runtimeClasses) {
    // Avoid use of sun.security.provider.NativePRNG at image runtime
    runtimeClasses.produce(new RuntimeInitializedClassBuildItem(BoxDeveloperEditionAPIConnection.class.getCanonicalName()));
    runtimeClasses.produce(new RuntimeInitializedClassBuildItem(BoxAPIRequest.class.getCanonicalName()));
}