Fix #1615 to add xslt-saxon native support (#5133)
diff --git a/docs/modules/ROOT/examples/components/xslt-saxon.yml b/docs/modules/ROOT/examples/components/xslt-saxon.yml
index 4863730..30d4286 100644
--- a/docs/modules/ROOT/examples/components/xslt-saxon.yml
+++ b/docs/modules/ROOT/examples/components/xslt-saxon.yml
@@ -2,11 +2,11 @@
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
cqArtifactId: camel-quarkus-xslt-saxon
cqArtifactIdBase: xslt-saxon
-cqNativeSupported: false
-cqStatus: Preview
+cqNativeSupported: true
+cqStatus: Stable
cqDeprecated: false
cqJvmSince: 1.1.0
-cqNativeSince: n/a
+cqNativeSince: 3.0.0
cqCamelPartName: xslt-saxon
cqCamelPartTitle: XSLT Saxon
cqCamelPartDescription: Transform XML payloads using an XSLT template using Saxon.
diff --git a/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc b/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
index 2a07754..73b9d70 100644
--- a/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
@@ -4,17 +4,17 @@
= XSLT Saxon
:linkattrs:
:cq-artifact-id: camel-quarkus-xslt-saxon
-:cq-native-supported: false
-:cq-status: Preview
-:cq-status-deprecation: Preview
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
:cq-description: Transform XML payloads using an XSLT template using Saxon.
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 3.0.0
ifeval::[{doc-show-badges} == true]
[.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##3.0.0##
endif::[]
Transform XML payloads using an XSLT template using Saxon.
@@ -29,6 +29,10 @@
[id="extensions-xslt-saxon-maven-coordinates"]
== Maven coordinates
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-xslt-saxon[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]
+
+Or add the coordinates to your existing project:
+
[source,xml]
----
<dependency>
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index ec56a2f..278a4f9 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -102,7 +102,6 @@
<module>workday</module>
<module>xj</module>
<module>xmpp</module>
- <module>xslt-saxon</module>
<module>zookeeper</module>
<module>zookeeper-master</module>
</modules>
diff --git a/extensions-jvm/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java b/extensions-jvm/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
deleted file mode 100644
index 26a253d..0000000
--- a/extensions-jvm/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.component.xslt.saxon.deployment;
-
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
-
-class XsltSaxonProcessor {
-
- private static final Logger LOG = Logger.getLogger(XsltSaxonProcessor.class);
- private static final String FEATURE = "camel-xslt-saxon";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
- }
-
- /**
- * Remove this once this extension starts supporting the native mode.
- */
- @BuildStep(onlyIf = NativeBuild.class)
- @Record(value = ExecutionTime.RUNTIME_INIT)
- void warnJvmInNative(JvmOnlyRecorder recorder) {
- JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
- recorder.warnJvmInNative(FEATURE); // warn at runtime
- }
-}
diff --git a/extensions/pom.xml b/extensions/pom.xml
index c8262d6..eb51ecc 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -248,6 +248,7 @@
<module>xmlsecurity</module>
<module>xpath</module>
<module>xslt</module>
+ <module>xslt-saxon</module>
<module>zendesk</module>
<module>zip-deflater</module>
<module>zipfile</module>
diff --git a/extensions-jvm/xslt-saxon/deployment/pom.xml b/extensions/xslt-saxon/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/xslt-saxon/deployment/pom.xml
rename to extensions/xslt-saxon/deployment/pom.xml
diff --git a/extensions/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java b/extensions/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
new file mode 100644
index 0000000..dbb0372
--- /dev/null
+++ b/extensions/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.xslt.saxon.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.functions.StringJoin;
+import net.sf.saxon.functions.String_1;
+import net.sf.saxon.functions.Tokenize_1;
+import org.apache.camel.component.xslt.saxon.XsltSaxonBuilder;
+import org.jboss.logging.Logger;
+import org.xmlresolver.loaders.XmlLoader;
+
+class XsltSaxonProcessor {
+
+ private static final Logger LOG = Logger.getLogger(XsltSaxonProcessor.class);
+ private static final String FEATURE = "camel-xslt-saxon";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
+ BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClasses) {
+ reflectiveClasses.produce(ReflectiveClassBuildItem
+ .builder(Configuration.class, String_1.class, Tokenize_1.class, StringJoin.class).build());
+ reflectiveClasses.produce(ReflectiveClassBuildItem.builder(XmlLoader.class).build());
+ reflectiveClasses.produce(ReflectiveClassBuildItem.builder(XsltSaxonBuilder.class).build());
+
+ runtimeInitializedClasses
+ .produce(new RuntimeInitializedClassBuildItem("org.apache.hc.client5.http.impl.auth.NTLMEngineImpl"));
+ }
+}
diff --git a/extensions-jvm/xslt-saxon/pom.xml b/extensions/xslt-saxon/pom.xml
similarity index 95%
rename from extensions-jvm/xslt-saxon/pom.xml
rename to extensions/xslt-saxon/pom.xml
index f466460..d405cc2 100644
--- a/extensions-jvm/xslt-saxon/pom.xml
+++ b/extensions/xslt-saxon/pom.xml
@@ -21,7 +21,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-extensions-jvm</artifactId>
+ <artifactId>camel-quarkus-extensions</artifactId>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/extensions-jvm/xslt-saxon/runtime/pom.xml b/extensions/xslt-saxon/runtime/pom.xml
similarity index 94%
rename from extensions-jvm/xslt-saxon/runtime/pom.xml
rename to extensions/xslt-saxon/runtime/pom.xml
index 1153b0e..a708e60 100644
--- a/extensions-jvm/xslt-saxon/runtime/pom.xml
+++ b/extensions/xslt-saxon/runtime/pom.xml
@@ -32,6 +32,7 @@
<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>3.0.0</camel.quarkus.nativeSince>
</properties>
<dependencies>
@@ -43,6 +44,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-xslt-saxon</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.brotli</groupId>
+ <artifactId>dec</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions-jvm/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 100%
rename from extensions-jvm/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml
index f512624..7e8c124 100644
--- a/integration-tests-jvm/pom.xml
+++ b/integration-tests-jvm/pom.xml
@@ -102,7 +102,6 @@
<module>xj</module>
<module>xml-grouped</module>
<module>xmpp</module>
- <module>xslt-saxon</module>
<module>zookeeper</module>
<module>zookeeper-master</module>
</modules>
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index b9fb947..b4f8dba 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -235,6 +235,7 @@
<module>xml-grouped</module>
<module>xmlsecurity</module>
<module>xpath</module>
+ <module>xslt-saxon</module>
<module>zendesk</module>
</modules>
diff --git a/integration-tests-jvm/xslt-saxon/pom.xml b/integration-tests/xslt-saxon/pom.xml
similarity index 77%
rename from integration-tests-jvm/xslt-saxon/pom.xml
rename to integration-tests/xslt-saxon/pom.xml
index 1aa30e2..47ac724 100644
--- a/integration-tests-jvm/xslt-saxon/pom.xml
+++ b/integration-tests/xslt-saxon/pom.xml
@@ -78,6 +78,33 @@
</dependency>
</dependencies>
</profile>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/integration-tests-jvm/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java b/integration-tests/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
similarity index 100%
rename from integration-tests-jvm/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
rename to integration-tests/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
diff --git a/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonIT.java b/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonIT.java
new file mode 100644
index 0000000..0947e5a
--- /dev/null
+++ b/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.xslt.saxon.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class XsltSaxonIT extends XsltSaxonTest {
+
+}
diff --git a/integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java b/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
similarity index 100%
rename from integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
rename to integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 60147a9..d5762c0 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -183,6 +183,7 @@
- univocity-parsers
- velocity
- xml-grouped
+ - xslt-saxon
group-12:
- aws2-grouped
- csimple