Skip to content

Commit

Permalink
Fix #1615 to add xslt-saxon native support (#5133)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfeng authored Jul 31, 2023
1 parent b70e0e5 commit 02e639e
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docs/modules/ROOT/examples/components/xslt-saxon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 9 additions & 5 deletions docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -29,6 +29,10 @@ Please refer to the above link for usage and configuration details.
[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>
Expand Down
1 change: 0 additions & 1 deletion extensions-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
*/
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.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 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 {

Expand All @@ -34,13 +39,15 @@ 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
@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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
1 change: 0 additions & 1 deletion integration-tests-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
<module>xml-grouped</module>
<module>xmlsecurity</module>
<module>xpath</module>
<module>xslt-saxon</module>
<module>zendesk</module>
</modules>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
@@ -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 {

}
1 change: 1 addition & 0 deletions tooling/scripts/test-categories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ group-11:
- univocity-parsers
- velocity
- xml-grouped
- xslt-saxon
group-12:
- aws2-grouped
- csimple
Expand Down

0 comments on commit 02e639e

Please sign in to comment.