All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkiverse.cxf.woodstox.deployment.QuarkusCxfWoodstoxProcessor Maven / Gradle / Ivy

There is a newer version: 3.17.3
Show newest version
package io.quarkiverse.cxf.woodstox.deployment;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Set;
import java.util.stream.Stream;

import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;

import org.codehaus.stax2.validation.XMLValidationSchemaFactory;

import com.ctc.wstx.shaded.msv.relaxng_datatype.DatatypeLibraryFactory;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.util.ServiceUtil;

public class QuarkusCxfWoodstoxProcessor {

    @BuildStep
    void registerServices(BuildProducer serviceProvider) {
        Stream.concat(
                Stream.of(
                        XMLEventFactory.class,
                        XMLInputFactory.class,
                        XMLOutputFactory.class,
                        DatatypeLibraryFactory.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 names = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(),
                                ServiceProviderBuildItem.SPI_ROOT + serviceName);
                        serviceProvider.produce(new ServiceProviderBuildItem(serviceName, new ArrayList<>(names)));
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                });
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy