Skip to content

Commit

Permalink
JAXP extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga authored and gsmet committed Sep 17, 2020
1 parent ebfeffc commit c325302
Show file tree
Hide file tree
Showing 16 changed files with 464 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,15 @@ jobs:
test-modules: >
kubernetes-client
- category: Misc4
timeout: 50
timeout: 55
test-modules: >
smallrye-graphql
picocli-native
gradle
micrometer-mp-metrics
micrometer-prometheus
logging-json
jaxp
- category: Spring
timeout: 50
test-modules: >
Expand Down
10 changes: 10 additions & 0 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@
<artifactId>quarkus-jaxb-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxp-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jackson</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/jaxb/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxp-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxb</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ class JaxbProcessor {
private static final List<Class<?>> JAXB_REFLECTIVE_CLASSES = Arrays.asList(
XmlAccessOrder.class);

private static final List<String> JAXB_SERIALIZERS = Arrays.asList(
"html",
"text",
"xml",
"unknown");

private static final DotName XML_ROOT_ELEMENT = DotName.createSimple(XmlRootElement.class.getName());
private static final DotName XML_TYPE = DotName.createSimple(XmlType.class.getName());
private static final DotName XML_REGISTRY = DotName.createSimple(XmlRegistry.class.getName());
Expand Down Expand Up @@ -193,10 +187,6 @@ void registerClasses(
BuildProducer<NativeImageSystemPropertyBuildItem> nativeImageProps,
BuildProducer<ServiceProviderBuildItem> providerItem) {

addReflectiveClass(false, false, "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
addReflectiveClass(false, false, "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl");
addReflectiveClass(false, false, "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
addReflectiveClass(false, false, "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
addReflectiveClass(true, false, "com.sun.xml.bind.v2.ContextFactory");
addReflectiveClass(true, false, "com.sun.xml.internal.bind.v2.ContextFactory");

Expand All @@ -207,11 +197,6 @@ void registerClasses(

addResourceBundle("javax.xml.bind.Messages");
addResourceBundle("javax.xml.bind.helpers.Messages");
addResourceBundle("com.sun.org.apache.xml.internal.serializer.utils.SerializerMessages");
addResourceBundle("com.sun.org.apache.xml.internal.res.XMLErrorResources");
addResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
addResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
addResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message");

nativeImageProps
.produce(new NativeImageSystemPropertyBuildItem("com.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize", "true"));
Expand All @@ -220,10 +205,6 @@ void registerClasses(
.map(Class::getName)
.forEach(className -> addReflectiveClass(true, false, className));

JAXB_SERIALIZERS.stream()
.map(s -> "com/sun/org/apache/xml/internal/serializer/output_" + s + ".properties")
.forEach(this::addResource);

providerItem
.produce(new ServiceProviderBuildItem(JAXBContext.class.getName(), "com.sun.xml.bind.v2.ContextFactory"));
}
Expand Down
4 changes: 4 additions & 0 deletions extensions/jaxb/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxp</artifactId>
</dependency>
<!-- Don't rely on the JDK impl to be present as it's not present in JDK 11+ -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
Expand Down
44 changes: 44 additions & 0 deletions extensions/jaxp/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-jaxp-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jaxp-deployment</artifactId>
<name>Quarkus - JAXP - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxp</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package io.quarkus.jaxp.deployment;

import java.util.stream.Stream;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class JaxpProcessor {

@BuildStep
void reflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false,
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
"com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl",
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
"com.sun.org.apache.xerces.internal.parsers.SAXParser",
"com.sun.org.apache.xml.internal.utils.FastStringBuffer"));

reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
"com.sun.xml.internal.stream.XMLInputFactoryImpl",
"com.sun.xml.internal.stream.XMLOutputFactoryImpl",
"com.sun.org.apache.xpath.internal.functions.FuncNot",
"com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl",
"javax.xml.namespace.QName"));
}

@BuildStep
void resourceBundles(BuildProducer<NativeImageResourceBundleBuildItem> resourceBundle) {
Stream.of(
"com.sun.org.apache.xml.internal.serializer.utils.SerializerMessages",
"com.sun.org.apache.xml.internal.res.XMLErrorResources",
"com.sun.org.apache.xerces.internal.impl.msg.SAXMessages",
"com.sun.org.apache.xerces.internal.impl.msg.XMLMessages",
"com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages",
"com.sun.org.apache.xerces.internal.impl.xpath.regex.message")
.map(NativeImageResourceBundleBuildItem::new)
.forEach(resourceBundle::produce);
}

@BuildStep
void resources(BuildProducer<NativeImageResourceBuildItem> resource) {

Stream.of(
"html",
"text",
"xml",
"unknown")
.map(s -> "com/sun/org/apache/xml/internal/serializer/output_" + s + ".properties")
.map(NativeImageResourceBuildItem::new)
.forEach(resource::produce);

}

}
21 changes: 21 additions & 0 deletions extensions/jaxp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-build-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jaxp-parent</artifactId>
<name>Quarkus - JAXP</name>
<packaging>pom</packaging>
<modules>
<module>deployment</module>
<module>runtime</module>
</modules>

</project>
43 changes: 43 additions & 0 deletions extensions/jaxp/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-jaxp-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jaxp</artifactId>
<name>Quarkus - JAXP - Runtime</name>
<description>Java API for XML Processing</description>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: "JAXP"
metadata:
keywords:
- "jaxp"
- "xml"
categories:
- "serialization"
status: "stable"
unlisted: true
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<module>arc</module>
<module>scheduler</module>
<module>quartz</module>
<module>jaxp</module>

<!-- Configuration -->
<module>config-yaml</module>
Expand Down
Loading

0 comments on commit c325302

Please sign in to comment.