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

The following examples show how to use io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem. 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: Aws2CwProcessor.java    From camel-quarkus with Apache License 2.0 7 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 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 #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: 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 #5
Source File: HibernateOrmProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void handleNativeImageImportSql(BuildProducer<NativeImageResourceBuildItem> resources,
        List<PersistenceUnitDescriptorBuildItem> descriptors,
        JpaEntitiesBuildItem jpaEntities, List<NonJpaModelBuildItem> nonJpaModels,
        LaunchModeBuildItem launchMode) {
    if (!hasEntities(jpaEntities, nonJpaModels)) {
        return;
    }

    for (PersistenceUnitDescriptorBuildItem i : descriptors) {
        //add resources
        if (i.getDescriptor().getProperties().containsKey("javax.persistence.sql-load-script-source")) {
            resources.produce(new NativeImageResourceBuildItem(
                    (String) i.getDescriptor().getProperties().get("javax.persistence.sql-load-script-source")));
        } else {
            getSqlLoadScript(launchMode.getLaunchMode()).ifPresent(script -> {
                resources.produce(new NativeImageResourceBuildItem(script));
            });
        }
    }
}
 
Example #6
Source File: KafkaStreamsProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
void build(BuildProducer<FeatureBuildItem> feature,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
        BuildProducer<JniRuntimeAccessBuildItem> jniRuntimeAccessibleClasses,
        BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized,
        BuildProducer<NativeImageResourceBuildItem> nativeLibs,
        LaunchModeBuildItem launchMode,
        NativeConfig config) throws IOException {

    feature.produce(new FeatureBuildItem(Feature.KAFKA_STREAMS));

    registerClassesThatAreLoadedThroughReflection(reflectiveClasses, launchMode);
    registerClassesThatAreAccessedViaJni(jniRuntimeAccessibleClasses);
    addSupportForRocksDbLib(nativeLibs, config);
    enableLoadOfNativeLibs(reinitialized);
}
 
Example #7
Source File: UndertowBuildStep.java    From quarkus with Apache License 2.0 6 votes vote down vote up
/**
 * Register the undertow-handlers.conf file
 */
@BuildStep
public void registerUndertowHandlersConf(BuildProducer<ServletExtensionBuildItem> producer,
        ApplicationArchivesBuildItem applicationArchivesBuildItem,
        BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFile,
        BuildProducer<NativeImageResourceBuildItem> nativeImageResourceBuildItemBuildProducer) {
    //we always watch the file, so if it gets added we restart
    watchedFile.produce(
            new HotDeploymentWatchedFileBuildItem(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF));

    //check for the file in the handlers dir
    Path handlerPath = applicationArchivesBuildItem.getRootArchive()
            .getChildPath(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF);
    if (handlerPath != null) {
        producer.produce(new ServletExtensionBuildItem(new UndertowHandlersConfServletExtension()));
        nativeImageResourceBuildItemBuildProducer.produce(
                new NativeImageResourceBuildItem(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF));
    }
}
 
Example #8
Source File: Aws2Ec2Processor.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: QuteProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
private void scan(Path root, Path directory, String basePath, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths,
        BuildProducer<TemplatePathBuildItem> templatePaths,
        BuildProducer<NativeImageResourceBuildItem> nativeImageResources)
        throws IOException {
    try (Stream<Path> files = Files.list(directory)) {
        Iterator<Path> iter = files.iterator();
        while (iter.hasNext()) {
            Path filePath = iter.next();
            if (Files.isRegularFile(filePath)) {
                LOGGER.debugf("Found template: %s", filePath);
                String templatePath = root.relativize(filePath).toString();
                if (File.separatorChar != '/') {
                    templatePath = templatePath.replace(File.separatorChar, '/');
                }
                produceTemplateBuildItems(templatePaths, watchedPaths, nativeImageResources, basePath, templatePath,
                        filePath);
            } else if (Files.isDirectory(filePath)) {
                LOGGER.debugf("Scan directory: %s", filePath);
                scan(root, filePath, basePath, watchedPaths, templatePaths, nativeImageResources);
            }
        }
    }
}
 
Example #10
Source File: FlywayProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Record(STATIC_INIT)
@BuildStep
void build(BuildProducer<FeatureBuildItem> featureProducer,
        BuildProducer<NativeImageResourceBuildItem> resourceProducer,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer,
        FlywayRecorder recorder,
        RecorderContext context,
        CombinedIndexBuildItem combinedIndexBuildItem,
        List<JdbcDataSourceBuildItem> jdbcDataSourceBuildItems) throws IOException, URISyntaxException {

    featureProducer.produce(new FeatureBuildItem(Feature.FLYWAY));

    Collection<String> dataSourceNames = getDataSourceNames(jdbcDataSourceBuildItems);

    List<String> applicationMigrations = discoverApplicationMigrations(getMigrationLocations(dataSourceNames));
    recorder.setApplicationMigrationFiles(applicationMigrations);

    Set<Class<?>> javaMigrationClasses = new HashSet<>();
    addJavaMigrations(combinedIndexBuildItem.getIndex().getAllKnownImplementors(JAVA_MIGRATION), context,
            reflectiveClassProducer, javaMigrationClasses);
    recorder.setApplicationMigrationClasses(javaMigrationClasses);

    resourceProducer.produce(new NativeImageResourceBuildItem(applicationMigrations.toArray(new String[0])));
}
 
Example #11
Source File: NativeImageAutoFeatureStep.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
List<NativeImageResourceBuildItem> registerPackageResources(
        List<NativeImageResourceDirectoryBuildItem> nativeImageResourceDirectories)
        throws IOException, URISyntaxException {
    List<NativeImageResourceBuildItem> resources = new ArrayList<>();

    for (NativeImageResourceDirectoryBuildItem nativeImageResourceDirectory : nativeImageResourceDirectories) {
        String path = Thread.currentThread().getContextClassLoader().getResource(nativeImageResourceDirectory.getPath())
                .getPath();
        File resourceFile = Paths.get(new URL(path.substring(0, path.indexOf("!"))).toURI()).toFile();
        try (JarFile jarFile = new JarFile(resourceFile)) {
            Enumeration<JarEntry> entries = jarFile.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                String resourceName = entry.getName();
                if (!entry.isDirectory() && resourceName.startsWith(nativeImageResourceDirectory.getPath())
                        && !resourceName.endsWith(".class")) {
                    resources.add(new NativeImageResourceBuildItem(resourceName));
                }
            }
        }
    }

    return resources;
}
 
Example #12
Source File: Aws2KmsProcessor.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 #13
Source File: Aws2IamProcessor.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 #14
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 #15
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 #16
Source File: Aws2SesProcessor.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 #17
Source File: Aws2EksProcessor.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 #18
Source File: Aws2TranslateProcessor.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 #19
Source File: ElytronPropertiesProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if a PropertiesRealmConfig was specified and enabled and create a
 * {@linkplain org.wildfly.security.auth.realm.LegacyPropertiesSecurityRealm}
 * runtime value to process the user/roles properties files. This also registers the names of the user/roles properties
 * files
 * to include the build artifact.
 *
 * @param recorder - runtime security recorder
 * @param securityRealm - the producer factory for the SecurityRealmBuildItem
 * @return the AuthConfigBuildItem for the realm authentication mechanism if there was an enabled PropertiesRealmConfig,
 *         null otherwise
 * @throws Exception - on any failure
 */
@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void configureFileRealmAuthConfig(ElytronPropertiesFileRecorder recorder,
        BuildProducer<NativeImageResourceBuildItem> resources,
        BuildProducer<SecurityRealmBuildItem> securityRealm) throws Exception {
    if (propertiesConfig.file.enabled) {
        PropertiesRealmConfig realmConfig = propertiesConfig.file;
        log.debugf("Configuring from PropertiesRealmConfig, users=%s, roles=%s", realmConfig.users,
                realmConfig.roles);
        // Have the runtime recorder create the LegacyPropertiesSecurityRealm and create the build item
        RuntimeValue<SecurityRealm> realm = recorder.createRealm(realmConfig);
        securityRealm
                .produce(new SecurityRealmBuildItem(realm, realmConfig.realmName, recorder.loadRealm(realm, realmConfig)));
        // Return the realm authentication mechanism build item
    }
}
 
Example #20
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 #21
Source File: Aws2MqProcessor.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 #22
Source File: Aws2SqsProcessor.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 #23
Source File: Aws2AthenaProcessor.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 #24
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 #25
Source File: SmallRyeJwtProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 * If the configuration specified a deployment local key resource, register it in native mode
 *
 * @return NativeImageResourceBuildItem
 */
@BuildStep
NativeImageResourceBuildItem registerNativeImageResources() {
    final Config config = ConfigProvider.getConfig();
    Optional<String> publicKeyLocationOpt = config.getOptionalValue("mp.jwt.verify.publickey.location", String.class);
    if (publicKeyLocationOpt.isPresent()) {
        final String publicKeyLocation = publicKeyLocationOpt.get();
        if (publicKeyLocation.indexOf(':') < 0 || publicKeyLocation.startsWith("classpath:")) {
            log.infof("Adding %s to native image", publicKeyLocation);
            return new NativeImageResourceBuildItem(publicKeyLocation);
        }
    }
    return null;
}
 
Example #26
Source File: RestClientProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void setupProviders(BuildProducer<NativeImageResourceBuildItem> resources,
        BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinition) {

    proxyDefinition.produce(new NativeImageProxyDefinitionBuildItem("javax.ws.rs.ext.Providers"));
    resources.produce(new NativeImageResourceBuildItem(PROVIDERS_SERVICE_FILE));
}
 
Example #27
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 #28
Source File: QuteProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildItem> templatePaths,
        BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths,
        BuildProducer<NativeImageResourceBuildItem> nativeImageResources, String basePath, String filePath,
        Path originalPath) {
    if (filePath.isEmpty()) {
        return;
    }
    String fullPath = basePath + filePath;
    LOGGER.debugf("Produce template build items [filePath: %s, fullPath: %s, originalPath: %s", filePath, fullPath,
            originalPath);
    // NOTE: we cannot just drop the template because a template param can be added 
    watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(fullPath, true));
    nativeImageResources.produce(new NativeImageResourceBuildItem(fullPath));
    templatePaths.produce(new TemplatePathBuildItem(filePath, originalPath));
}
 
Example #29
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 #30
Source File: QuteProcessor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void collectTemplates(ApplicationArchivesBuildItem applicationArchivesBuildItem,
        BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths,
        BuildProducer<TemplatePathBuildItem> templatePaths,
        BuildProducer<NativeImageResourceBuildItem> nativeImageResources)
        throws IOException {
    ApplicationArchive applicationArchive = applicationArchivesBuildItem.getRootArchive();
    String basePath = "templates";
    Path templatesPath = applicationArchive.getChildPath(basePath);

    if (templatesPath != null) {
        scan(templatesPath, templatesPath, basePath + "/", watchedPaths, templatePaths, nativeImageResources);
    }
}