Search in sources :

Example 1 with ServiceProviderBuildItem

use of io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem in project camel-quarkus by apache.

the class JacksonDataformatXmlSupportProcessor method serviceProviders.

@BuildStep
void serviceProviders(BuildProducer<ServiceProviderBuildItem> serviceProviders) {
    Stream.concat(Stream.of(JsonFactory.class, ObjectCodec.class, VerifierFactoryLoader.class, DatatypeLibraryFactory.class, XMLEventFactory.class, XMLInputFactory.class, XMLOutputFactory.class).map(Class::getName), Stream.of(XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_DTD, XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_RELAXNG, XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_W3C, XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_TREX).map(schemaId -> XMLValidationSchemaFactory.class.getName() + "." + schemaId)).forEach(serviceName -> {
        try {
            final Set<String> names = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(), SERVICES_PREFIX + serviceName);
            serviceProviders.produce(new ServiceProviderBuildItem(serviceName, new ArrayList<>(names)));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    });
}
Also used : DatatypeLibraryFactory(com.ctc.wstx.shaded.msv.relaxng_datatype.DatatypeLibraryFactory) XMLOutputFactory(javax.xml.stream.XMLOutputFactory) ServiceProviderBuildItem(io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem) VerifierFactoryLoader(com.ctc.wstx.shaded.msv.org_isorelax.verifier.VerifierFactoryLoader) XMLEventFactory(javax.xml.stream.XMLEventFactory) JsonFactory(com.fasterxml.jackson.core.JsonFactory) ArrayList(java.util.ArrayList) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec) IOException(java.io.IOException) XMLValidationSchemaFactory(org.codehaus.stax2.validation.XMLValidationSchemaFactory) XMLInputFactory(javax.xml.stream.XMLInputFactory) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 2 with ServiceProviderBuildItem

use of io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem in project camel-quarkus by apache.

the class AtlasmapProcessor method registerNativeImageResources.

@BuildStep
void registerNativeImageResources(BuildProducer<ServiceProviderBuildItem> services, BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
    Stream.of(AtlasConverter.class.getName(), AtlasFieldAction.class.getName(), Action.class.getName()).forEach(service -> {
        try {
            Set<String> implementations = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(), ATLASMAP_SERVICE_BASE + service);
            services.produce(new ServiceProviderBuildItem(service, implementations.toArray(new String[0])));
            // register those classes for reflection too
            // we don't need to add external dependency atlas-core for the services
            String[] dtos = implementations.stream().toArray(String[]::new);
            reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, dtos));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    });
}
Also used : ServiceProviderBuildItem(io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem) IOException(java.io.IOException) ReflectiveClassBuildItem(io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 3 with ServiceProviderBuildItem

use of io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem in project camel-quarkus by apache.

the class AzureCoreSupportProcessor method nativeResources.

@BuildStep
void nativeResources(BuildProducer<ServiceProviderBuildItem> services, BuildProducer<NativeImageResourceBuildItem> nativeResources) {
    Stream.of(// TODO move this to a separate camel-quarkus-azure-core extension
    HttpClientProvider.class.getName(), // TODO: move to reactor extension
    "reactor.blockhound.integration.BlockHoundIntegration").forEach(service -> {
        try {
            Set<String> implementations = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(), "META-INF/services/" + service);
            services.produce(new ServiceProviderBuildItem(service, implementations.toArray(new String[0])));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    });
    nativeResources.produce(new NativeImageResourceBuildItem("azure-core.properties"));
}
Also used : NativeImageResourceBuildItem(io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem) ServiceProviderBuildItem(io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem) IOException(java.io.IOException) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 4 with ServiceProviderBuildItem

use of io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem in project camel-quarkus by apache.

the class SoapProcessor method serviceProviders.

@BuildStep
void serviceProviders(BuildProducer<ServiceProviderBuildItem> serviceProvider) {
    String[] soapVersions = new String[] { "1_1", "1_2" };
    for (String version : soapVersions) {
        serviceProvider.produce(new ServiceProviderBuildItem("javax.xml.soap.MessageFactory", "com.sun.xml.messaging.saaj.soap.ver" + version + ".SOAPMessageFactory" + version + "Impl"));
        serviceProvider.produce(new ServiceProviderBuildItem("javax.xml.soap.SOAPFactory", "com.sun.xml.messaging.saaj.soap.ver" + version + ".SOAPFactory" + version + "Impl"));
    }
    serviceProvider.produce(new ServiceProviderBuildItem("javax.xml.soap.SOAPConnectionFactory", "com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory"));
    serviceProvider.produce(new ServiceProviderBuildItem("javax.xml.soap.SAAJMetaFactory", "com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl"));
}
Also used : ServiceProviderBuildItem(io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 5 with ServiceProviderBuildItem

use of io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem in project camel-k-runtime by apache.

the class CoreProcessor method registerServices.

@BuildStep
List<ServiceProviderBuildItem> registerServices(CombinedIndexBuildItem combinedIndexBuildItem) {
    final IndexView view = combinedIndexBuildItem.getIndex();
    final String serviceType = "org.apache.camel.k.Runtime$Listener";
    return stream(getAllKnownImplementors(view, serviceType)).map(i -> new ServiceProviderBuildItem(serviceType, i.name().toString())).collect(Collectors.toList());
}
Also used : IndexView(org.jboss.jandex.IndexView) ReflectiveClassBuildItem(io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem) DeploymentSupport.getAllKnownImplementors(org.apache.camel.k.core.quarkus.deployment.support.DeploymentSupport.getAllKnownImplementors) DeploymentSupport.reflectiveClassBuildItem(org.apache.camel.k.core.quarkus.deployment.support.DeploymentSupport.reflectiveClassBuildItem) Constants(org.apache.camel.k.support.Constants) CamelServicePatternBuildItem(org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem) Collectors(java.util.stream.Collectors) CombinedIndexBuildItem(io.quarkus.deployment.builditem.CombinedIndexBuildItem) BuildProducer(io.quarkus.deployment.annotations.BuildProducer) BuildStep(io.quarkus.deployment.annotations.BuildStep) List(java.util.List) SourceDefinition(org.apache.camel.k.SourceDefinition) CamelServiceDestination(org.apache.camel.quarkus.core.deployment.spi.CamelServiceDestination) StreamCachingStrategy(org.apache.camel.spi.StreamCachingStrategy) ContextCustomizer(org.apache.camel.k.ContextCustomizer) ServiceProviderBuildItem(io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem) RouteBuilderLifecycleStrategy(org.apache.camel.builder.RouteBuilderLifecycleStrategy) DeploymentSupport.stream(org.apache.camel.k.core.quarkus.deployment.support.DeploymentSupport.stream) ServiceProviderBuildItem(io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem) IndexView(org.jboss.jandex.IndexView) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)8 ServiceProviderBuildItem (io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem)8 IOException (java.io.IOException)5 ReflectiveClassBuildItem (io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem)2 ArrayList (java.util.ArrayList)2 XMLEventFactory (javax.xml.stream.XMLEventFactory)2 XMLInputFactory (javax.xml.stream.XMLInputFactory)2 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)2 XMLValidationSchemaFactory (org.codehaus.stax2.validation.XMLValidationSchemaFactory)2 VerifierFactoryLoader (com.ctc.wstx.shaded.msv.org_isorelax.verifier.VerifierFactoryLoader)1 DatatypeLibraryFactory (com.ctc.wstx.shaded.msv.relaxng_datatype.DatatypeLibraryFactory)1 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 ObjectCodec (com.fasterxml.jackson.core.ObjectCodec)1 BuildProducer (io.quarkus.deployment.annotations.BuildProducer)1 CombinedIndexBuildItem (io.quarkus.deployment.builditem.CombinedIndexBuildItem)1 NativeImageResourceBuildItem (io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 RouteBuilderLifecycleStrategy (org.apache.camel.builder.RouteBuilderLifecycleStrategy)1 ContextCustomizer (org.apache.camel.k.ContextCustomizer)1