You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/11/14 18:09:34 UTC
[camel-quarkus] branch master updated: xslt extension not building
in native mode #419
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 1348a08 xslt extension not building in native mode #419
1348a08 is described below
commit 1348a08fc4c389a5ebaf79da0ee61e4333931ab2
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Nov 13 14:27:46 2019 +0100
xslt extension not building in native mode #419
---
docs/modules/ROOT/pages/extensions/xslt.adoc | 39 +++++++++
extensions/xslt/deployment/pom.xml | 5 ++
.../{XsltProcessor.java => XsltFeature.java} | 6 +-
...essor.java => XsltGeneratedClassBuildItem.java} | 16 ++--
.../xslt/deployment/XsltNativeImageProcessor.java | 71 ++++++++++++++++
.../component/xslt/deployment/XsltProcessor.java | 94 ++++++++++++++++++++--
extensions/xslt/runtime/pom.xml | 5 ++
.../quarkus/component/xslt/CamelXsltConfig.java} | 27 ++++---
.../component/xslt/CamelXsltErrorListener.java} | 27 +++++--
.../quarkus/component/xslt/CamelXsltRecorder.java | 72 +++++++++++++++++
.../xslt/graal/TemplatesImplSubstitution.java} | 21 ++---
.../main/resources/META-INF/quarkus-extension.yaml | 3 +-
integration-tests/xslt/pom.xml | 35 +++++++-
.../xslt/src/main/resources/application.properties | 26 ++++++
14 files changed, 399 insertions(+), 48 deletions(-)
diff --git a/docs/modules/ROOT/pages/extensions/xslt.adoc b/docs/modules/ROOT/pages/extensions/xslt.adoc
new file mode 100644
index 0000000..405e9a2
--- /dev/null
+++ b/docs/modules/ROOT/pages/extensions/xslt.adoc
@@ -0,0 +1,39 @@
+[[xslt]]
+= XSLT Extension
+
+*Since Camel Quarkus 0.4.0*
+
+The XSLT extension allows you to process a message using an XSLT template.
+
+Maven users will need to add the following dependency to their `pom.xml` for this extension.
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-xslt</artifactId>
+</dependency>
+------------------------------------------------------------
+
+== Usage
+
+The extension provides support for the Camel https://camel.apache.org/components/latest/xslt-component.html[XSLT Component].
+
+=== Configuration
+
+To optimize XSLT processing, the extension need to know a location(s) of the XSLT templates at build time. The location(s) can be listed with the property `quarkus.camel.xslt.sources`, you can separate multiple locations with comma.
+
+[source,properties]
+----
+quarkus.camel.xslt.sources = transform.xsl, file:/path/to/my/file.xsl
+----
+
+[NOTE]
+====
+class-path locations will be embedded int the generated native image.
+====
+
+[WARNING]
+====
+the extension does not yet support Java 11.
+====
\ No newline at end of file
diff --git a/extensions/xslt/deployment/pom.xml b/extensions/xslt/deployment/pom.xml
index a061aed..b15760e 100644
--- a/extensions/xslt/deployment/pom.xml
+++ b/extensions/xslt/deployment/pom.xml
@@ -52,6 +52,11 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xslt</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.oracle.substratevm</groupId>
+ <artifactId>svm</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltFeature.java
similarity index 93%
copy from extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
copy to extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltFeature.java
index 5b33726..b24daae 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltFeature.java
@@ -19,13 +19,11 @@ package org.apache.camel.quarkus.component.xslt.deployment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-class XsltProcessor {
-
- private static final String FEATURE = "camel-xslt";
+class XsltFeature {
+ public static final String FEATURE = "camel-xslt";
@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
-
}
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltGeneratedClassBuildItem.java
similarity index 73%
copy from extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
copy to extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltGeneratedClassBuildItem.java
index 5b33726..e38a92b 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltGeneratedClassBuildItem.java
@@ -16,16 +16,16 @@
*/
package org.apache.camel.quarkus.component.xslt.deployment;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.builder.item.MultiBuildItem;
-class XsltProcessor {
+public final class XsltGeneratedClassBuildItem extends MultiBuildItem {
+ private final String className;
- private static final String FEATURE = "camel-xslt";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
+ public XsltGeneratedClassBuildItem(String className) {
+ this.className = className;
}
+ public String getClassName() {
+ return className;
+ }
}
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java
new file mode 100644
index 0000000..14d71ff
--- /dev/null
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java
@@ -0,0 +1,71 @@
+/*
+ * 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.deployment;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+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;
+import org.apache.camel.quarkus.component.xslt.CamelXsltConfig;
+import org.apache.camel.support.ResourceHelper;
+
+class XsltNativeImageProcessor {
+ public static final String CLASSPATH_SCHEME = "classpath:";
+
+ @BuildStep
+ List<ReflectiveClassBuildItem> reflectiveClasses(List<XsltGeneratedClassBuildItem> generatedClasses) {
+ List<ReflectiveClassBuildItem> items = new ArrayList<>(generatedClasses.size() + 1);
+
+ items.add(new ReflectiveClassBuildItem(true, false, "org.apache.camel.component.xslt.XsltBuilder"));
+
+ for (XsltGeneratedClassBuildItem generatedClass : generatedClasses) {
+ items.add(new ReflectiveClassBuildItem(true, false, generatedClass.getClassName()));
+ }
+
+ return items;
+ }
+
+ @BuildStep
+ List<NativeImageResourceBundleBuildItem> resourceBundles() {
+ return Arrays.asList(
+ new NativeImageResourceBundleBuildItem("com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages"));
+ }
+
+ @BuildStep
+ List<NativeImageResourceBuildItem> xsltResources(CamelXsltConfig config) {
+ List<NativeImageResourceBuildItem> items = new ArrayList<>(config.sources.size());
+
+ for (String source : config.sources) {
+ String scheme = ResourceHelper.getScheme(source);
+
+ if (Objects.isNull(scheme) || Objects.equals(scheme, CLASSPATH_SCHEME)) {
+ if (Objects.equals(scheme, CLASSPATH_SCHEME)) {
+ source = source.substring(CLASSPATH_SCHEME.length() + 1);
+ }
+
+ items.add(new NativeImageResourceBuildItem(source));
+ }
+ }
+
+ return items;
+ }
+}
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
index 5b33726..c293a9c 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
@@ -16,16 +16,100 @@
*/
package org.apache.camel.quarkus.component.xslt.deployment;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Comparator;
+
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.camel.component.xslt.XsltComponent;
+import org.apache.camel.component.xslt.XsltUriResolver;
+import org.apache.camel.quarkus.component.xslt.CamelXsltConfig;
+import org.apache.camel.quarkus.component.xslt.CamelXsltErrorListener;
+import org.apache.camel.quarkus.component.xslt.CamelXsltRecorder;
+import org.apache.camel.quarkus.core.CamelServiceFilter;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.quarkus.core.deployment.CamelBeanBuildItem;
+import org.apache.camel.quarkus.core.deployment.CamelServiceFilterBuildItem;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.StringHelper;
+import org.apache.commons.lang3.StringUtils;
+
+import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.GeneratedClassBuildItem;
class XsltProcessor {
+ /*
+ * The xslt component is programmatically configured by the extension thus
+ * we can safely prevent camel to instantiate a default instance.
+ */
+ @BuildStep
+ CamelServiceFilterBuildItem serviceFilter() {
+ return new CamelServiceFilterBuildItem(CamelServiceFilter.forComponent("xslt"));
+ }
- private static final String FEATURE = "camel-xslt";
-
+ @Record(ExecutionTime.STATIC_INIT)
@BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
+ CamelBeanBuildItem xsltComponent(CamelXsltRecorder recorder, CamelXsltConfig config) {
+ return new CamelBeanBuildItem(
+ "xslt",
+ XsltComponent.class.getName(),
+ recorder.createXsltComponent(config));
}
+ @BuildStep
+ void xsltResources(
+ CamelXsltConfig config,
+ BuildProducer<XsltGeneratedClassBuildItem> generatedNames,
+ BuildProducer<GeneratedClassBuildItem> generatedClasses) throws Exception {
+
+ Path destination = Files.createTempDirectory(XsltFeature.FEATURE);
+
+ try {
+ for (String source : config.sources) {
+ final String name = FileUtil.stripExt(source, true);
+
+ try {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ tf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ tf.setAttribute("generate-translet", true);
+ tf.setAttribute("translet-name", StringHelper.capitalize(name, true));
+ tf.setAttribute("package-name", config.packageName);
+ tf.setAttribute("destination-directory", destination.toString());
+ tf.setErrorListener(new CamelXsltErrorListener());
+ tf.newTemplates(new XsltUriResolver(new FastCamelContext(), source).resolve(source, null));
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ Files.walk(destination)
+ .sorted(Comparator.reverseOrder())
+ .filter(Files::isRegularFile)
+ .filter(path -> path.toString().endsWith(".class"))
+ .forEach(path -> {
+ try {
+ final Path rel = destination.relativize(path);
+ final String fqcn = StringUtils.removeEnd(rel.toString(), ".class").replace('/', '.');
+ final byte[] data = Files.readAllBytes(path);
+
+ generatedClasses.produce(new GeneratedClassBuildItem(false, fqcn, data));
+ generatedNames.produce(new XsltGeneratedClassBuildItem(fqcn));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ } finally {
+ Files.walk(destination)
+ .sorted(Comparator.reverseOrder())
+ .map(Path::toFile)
+ .forEach(File::delete);
+ }
+ }
}
diff --git a/extensions/xslt/runtime/pom.xml b/extensions/xslt/runtime/pom.xml
index a697e6b..3bde546 100644
--- a/extensions/xslt/runtime/pom.xml
+++ b/extensions/xslt/runtime/pom.xml
@@ -56,6 +56,11 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-xslt</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.oracle.substratevm</groupId>
+ <artifactId>svm</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltConfig.java
similarity index 56%
copy from extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
copy to extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltConfig.java
index 5b33726..6a2cc7a 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltConfig.java
@@ -14,18 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.xslt.deployment;
+package org.apache.camel.quarkus.component.xslt;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+import java.util.List;
-class XsltProcessor {
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
- private static final String FEATURE = "camel-xslt";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
- }
+@ConfigRoot(name = "camel.xslt", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
+public class CamelXsltConfig {
+ /**
+ * A comma separated list of templates to compile.
+ */
+ @ConfigItem
+ public List<String> sources;
+ /**
+ * The package name for the generated classes.
+ */
+ @ConfigItem(defaultValue = "org.apache.camel.quarkus.component.xslt.generated")
+ public String packageName;
}
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltErrorListener.java
similarity index 51%
copy from extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
copy to extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltErrorListener.java
index 5b33726..2440508 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltErrorListener.java
@@ -14,18 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.xslt.deployment;
+package org.apache.camel.quarkus.component.xslt;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.TransformerException;
-class XsltProcessor {
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
- private static final String FEATURE = "camel-xslt";
+public class CamelXsltErrorListener implements ErrorListener {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CamelXsltErrorListener.class);
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
+ @Override
+ public void warning(TransformerException e) throws TransformerException {
+ LOGGER.warn(e.getMessage(), e);
}
+ @Override
+ public void error(TransformerException e) throws TransformerException {
+ LOGGER.error(e.getMessage(), e);
+ }
+
+ @Override
+ public void fatalError(TransformerException e) throws TransformerException {
+ LOGGER.error(e.getMessage(), e);
+ }
}
diff --git a/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltRecorder.java b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltRecorder.java
new file mode 100644
index 0000000..d5f5ccf
--- /dev/null
+++ b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltRecorder.java
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.camel.component.xslt.XsltComponent;
+import org.apache.camel.component.xslt.XsltEndpoint;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.StringHelper;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+
+@Recorder
+public class CamelXsltRecorder {
+ public RuntimeValue<XsltComponent> createXsltComponent(CamelXsltConfig config) {
+ return new RuntimeValue<>(new QuarkusXsltComponent(config));
+ }
+
+ static class QuarkusXsltComponent extends XsltComponent {
+ private final CamelXsltConfig config;
+
+ public QuarkusXsltComponent(CamelXsltConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ protected void configureEndpoint(
+ XsltEndpoint endpoint,
+ String remaining,
+ Map<String, Object> parameters) throws Exception {
+
+ final String fileName = FileUtil.stripExt(remaining, true);
+ final String className = StringHelper.capitalize(fileName, true);
+
+ TransformerFactory tf = TransformerFactory.newInstance();
+ try {
+ tf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ } catch (TransformerException e) {
+ log.warn("Unsupported feature " + javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING);
+ }
+
+ tf.setAttribute("use-classpath", true);
+ tf.setAttribute("translet-name", className);
+ tf.setAttribute("package-name", this.config.packageName);
+ tf.setErrorListener(new CamelXsltErrorListener());
+
+ endpoint.setTransformerFactory(tf);
+
+ super.configureEndpoint(endpoint, remaining, parameters);
+ }
+ }
+
+}
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/graal/TemplatesImplSubstitution.java
similarity index 58%
copy from extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
copy to extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/graal/TemplatesImplSubstitution.java
index 5b33726..471c3d4 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/graal/TemplatesImplSubstitution.java
@@ -14,18 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.xslt.deployment;
+package org.apache.camel.quarkus.component.xslt.graal;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
-class XsltProcessor {
+@TargetClass(className = "com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl")
+final class TemplatesImplSubstitution {
- private static final String FEATURE = "camel-xslt";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
+ @TargetClass(className = "com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl", innerClass = "TransletClassLoader")
+ static final class TransletClassLoader {
+ @Substitute
+ Class defineClass(final byte[] b) {
+ throw new UnsupportedOperationException();
+ }
}
-
}
diff --git a/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 0de4d2d..76d6750 100644
--- a/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ b/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,4 +24,5 @@ metadata:
- "xml"
guide: "https://quarkus.io/guides/camel"
categories:
- - "integration"
\ No newline at end of file
+ - "integration"
+ status: "preview"
\ No newline at end of file
diff --git a/integration-tests/xslt/pom.xml b/integration-tests/xslt/pom.xml
index 2ca76c7..092a89a 100644
--- a/integration-tests/xslt/pom.xml
+++ b/integration-tests/xslt/pom.xml
@@ -41,6 +41,14 @@
<artifactId>camel-quarkus-direct</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-log</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jackson</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
@@ -75,12 +83,35 @@
</build>
<profiles>
+ <!--
+ It appears there is an issue in JDK 11 that prevent the compiler
+ to generate the right package + className and the result is always
+ based on default values instead of those given by the attributes
+ -->
+ <profile>
+ <id>jdk-greater-than-8</id>
+ <activation>
+ <jdk>[9,</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
- <id>xslt-native</id>
+ <id>native</id>
<activation>
<property>
- <name>xslt-native</name>
+ <name>native</name>
</property>
+ <jdk>1.8</jdk>
</activation>
<build>
<plugins>
diff --git a/integration-tests/xslt/src/main/resources/application.properties b/integration-tests/xslt/src/main/resources/application.properties
new file mode 100644
index 0000000..4fe1935
--- /dev/null
+++ b/integration-tests/xslt/src/main/resources/application.properties
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.log.file.enable = false
+quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = INFO
+
+#
+# Quarkus - Camel
+#
+quarkus.camel.xslt.sources = transform.xsl
\ No newline at end of file