You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/10/21 12:37:18 UTC

[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #4018: Fix #3904 increase xslt extension test coverage

ppalaga commented on code in PR #4018:
URL: https://github.com/apache/camel-quarkus/pull/4018#discussion_r1001723760


##########
integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java:
##########
@@ -18,9 +18,17 @@
 
 import org.w3c.dom.Document;
 
+import io.quarkus.runtime.annotations.RegisterForReflection;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.xslt.saxon.XsltSaxonAggregationStrategy;
 import org.apache.camel.support.builder.Namespaces;
 
+@RegisterForReflection(classNames = {
+        "net.sf.saxon.Configuration",
+        "net.sf.saxon.functions.String_1",
+        "net.sf.saxon.functions.Tokenize_1",
+        "net.sf.saxon.functions.StringJoin",
+        "org.apache.camel.component.xslt.saxon.XsltSaxonBuilder" })

Review Comment:
   I see that camel-quarkus-xslt-saxon is JVM only. 
   
   If porting camel-quarkus-xslt-saxon to native would be too much work, then it would be worthwhile to put a comment here saying that `@RegisterForReflection` should be removed with fixing https://github.com/apache/camel-quarkus/issues/1615
   
   In https://github.com/apache/camel-quarkus/issues/1615, we should note that XmlRouteBuilder.java needs some care



##########
extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltRecorder.java:
##########
@@ -52,6 +55,23 @@ public void addRuntimeUriResolverEntry(RuntimeValue<RuntimeUriResolver.Builder>
         builder.getValue().entry(templateUri, transletClassName);
     }
 
+    static class QuarkusXsltUriResolverFactory extends DefaultXsltUriResolverFactory {
+        private final RuntimeUriResolver uriResolver;
+
+        public QuarkusXsltUriResolverFactory(RuntimeUriResolver uriResolver) {
+            this.uriResolver = uriResolver;
+        }
+
+        @Override
+        public URIResolver createUriResolver(CamelContext camelContext, String resourceUri) {
+            if (uriResolver.getTransletClassName(resourceUri) != null) {
+                return uriResolver;
+            } else {
+                return super.createUriResolver(camelContext, resourceUri);
+            }

Review Comment:
   A comment would be nice about what these two options are supposed to do. The first one is supposed to catch the cases where we compile the translet at build time, right? Which is for `classpath:` XSLT resources in both JVM and native mode?
   The `else` branch is for all other cases, right?



##########
extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/RuntimeUriResolver.java:
##########
@@ -60,11 +60,7 @@ public Source resolve(String href, String base) throws TransformerException {
      * @return     the unqualified translet name associated with the given {@code uri}

Review Comment:
   Just guessing - please correct me if needed:
   
   ```suggestion
        * @return     the unqualified translet name associated with the given {@code uri} or {@code null} if the given XSLT resource was not compiled to a translet at build time.
   ```



##########
extensions/xslt/runtime/src/main/doc/configuration.adoc:
##########
@@ -9,7 +9,22 @@ quarkus.camel.xslt.sources = transform.xsl, classpath:path/to/my/file.xsl
 
 Scheme-less URIs are interpreted as `classpath:` URIs.
 
-Only `classpath:` URIs are supported on Quarkus. `file:`, `http:` and other kinds of URIs do not work by design.
+Only `classpath:` URIs are supported on Quarkus native mode. `file:`, `http:` and other kinds of URIs can be used on JVM mode only.
+
+`xsl:include` and `xsl:messaging` are aslo supported in JVM mode only right now.

Review Comment:
   ```suggestion
   `<xsl:include>` and `<xsl:messaging>` XSLT elements are also supported in JVM mode only right now.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org