You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2019/11/15 03:03:07 UTC

[camel] branch master updated: CAMEL-14176: fix compile error

This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 5abaa6d  CAMEL-14176: fix compile error
5abaa6d is described below

commit 5abaa6d419ba4ec64004111aca21a592d4928b4b
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Fri Nov 15 04:02:36 2019 +0100

    CAMEL-14176: fix compile error
    
    This fixes the compiler error in `camel-xj`. The endpoint needed to be
    extended from Saxon XSLT component's endpoint to have the `setAllowStAX`
    method available.
---
 components/camel-xj/pom.xml                        |   2 +-
 .../camel-xj/src/main/docs/xj-component.adoc       |  18 ++-
 .../org/apache/camel/component/xj/XJEndpoint.java  |   9 +-
 .../endpoint/dsl/XJEndpointBuilderFactory.java     | 139 +++++++++------------
 .../xj/springboot/XJComponentConfiguration.java    |  94 ++++++--------
 5 files changed, 111 insertions(+), 151 deletions(-)

diff --git a/components/camel-xj/pom.xml b/components/camel-xj/pom.xml
index 864bd02..fe89a21 100644
--- a/components/camel-xj/pom.xml
+++ b/components/camel-xj/pom.xml
@@ -37,7 +37,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-xslt</artifactId>
+            <artifactId>camel-xslt-saxon</artifactId>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
diff --git a/components/camel-xj/src/main/docs/xj-component.adoc b/components/camel-xj/src/main/docs/xj-component.adoc
index 1ad032f..434aa02 100644
--- a/components/camel-xj/src/main/docs/xj-component.adoc
+++ b/components/camel-xj/src/main/docs/xj-component.adoc
@@ -46,20 +46,19 @@ In contrary to the xslt component, the *templateName* parameter is optional. If
 == Component options
 
 // component options: START
-The XJ component supports 10 options, which are listed below.
+The XJ component supports 9 options, which are listed below.
 
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *saxonExtensionFunctions* (advanced) | Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add camel-saxon to the classpath. The function is looked up in the registry, where you can comma to separate multiple values to lookup. |  | String
+| *saxonConfiguration* (advanced) | To use a custom Saxon configuration |  | Configuration
+| *saxonConfiguration Properties* (advanced) | To set custom Saxon configuration properties |  | Map
 | *uriResolverFactory* (advanced) | To use a custom UriResolver which depends on a dynamic endpoint resource URI. Should not be used together with the option 'uriResolver'. |  | XsltUriResolverFactory
 | *uriResolver* (advanced) | To use a custom UriResolver. Should not be used together with the option 'uriResolverFactory'. |  | URIResolver
 | *contentCache* (producer) | Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reload the stylesheet file on each message processing. This is good for development. A cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. | true | boolean
-| *saxon* (producer) | Whether to use Saxon as the transformerFactoryClass. If enabled then the class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to the classpath. | false | boolean
-| *saxonExtensionFunctions* (advanced) | Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add camel-saxon to the classpath. The function is looked up in the registry, where you can comma to separate multiple values to lookup. |  | String
-| *saxonConfiguration* (advanced) | To use a custom Saxon configuration |  | Object
-| *saxonConfiguration Properties* (advanced) | To set custom Saxon configuration properties |  | Map
 | *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
@@ -85,27 +84,26 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (19 parameters):
+=== Query Parameters (18 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *transformDirection* (producer) | *Required* Sets the transform direction. |  | TransformDirection
-| *allowStAX* (producer) | Whether to allow using StAX as the javax.xml.transform.Source. You can enable this if the XSLT library supports StAX such as the Saxon library (camel-saxon). The Xalan library (default in JVM) does not support StAXSource. | false | boolean
+| *allowStAX* (producer) | Whether to allow using StAX as the javax.xml.transform.Source. You can enable this if the XSLT library supports StAX such as the Saxon library (camel-saxon). The Xalan library (default in JVM) does not support StAXSource. | true | boolean
+| *saxonConfiguration* (advanced) | To use a custom Saxon configuration |  | Configuration
+| *saxonExtensionFunctions* (advanced) | Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add camel-saxon to the classpath. The function is looked up in the registry, where you can comma to separate multiple values to lookup. |  | String
 | *contentCache* (producer) | Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reload the stylesheet file on each message processing. This is good for development. A cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. | true | boolean
 | *deleteOutputFile* (producer) | If you have output=file then this option dictates whether or not the output file should be deleted when the Exchange is done processing. For example suppose the output file is a temporary file, then it can be a good idea to delete it after use. | false | boolean
 | *failOnNullBody* (producer) | Whether or not to throw an exception if the input body is null. | true | boolean
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
 | *output* (producer) | Option to specify which output type to use. Possible values are: string, bytes, DOM, file. The first three options are all in memory based, where as file is streamed directly to a java.io.File. For file you must specify the filename in the IN header with the key Exchange.XSLT_FILE_NAME which is also CamelXsltFileName. Also any paths leading to the filename must be created beforehand, otherwise an exception is thrown at runtime. | string | XsltOutput
-| *saxon* (producer) | Whether to use Saxon as the transformerFactoryClass. If enabled then the class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to the classpath. | false | boolean
 | *transformerCacheSize* (producer) | The number of javax.xml.transform.Transformer object that are cached for reuse to avoid calls to Template.newTransformer(). | 0 | int
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *entityResolver* (advanced) | To use a custom org.xml.sax.EntityResolver with javax.xml.transform.sax.SAXSource. |  | EntityResolver
 | *errorListener* (advanced) | Allows to configure to use a custom javax.xml.transform.ErrorListener. Beware when doing this then the default error listener which captures any errors or fatal errors and store information on the Exchange as properties is not in use. So only use this option for special use-cases. |  | ErrorListener
 | *resultHandlerFactory* (advanced) | Allows you to use a custom org.apache.camel.builder.xml.ResultHandlerFactory which is capable of using custom org.apache.camel.builder.xml.ResultHandler types. |  | ResultHandlerFactory
-| *saxonConfiguration* (advanced) | To use a custom Saxon configuration |  | Object
-| *saxonExtensionFunctions* (advanced) | Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add camel-saxon to the classpath. The function is looked up in the registry, where you can comma to separate multiple values to lookup. |  | String
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *transformerFactory* (advanced) | To use a custom XSLT transformer factory |  | TransformerFactory
 | *transformerFactoryClass* (advanced) | To use a custom XSLT transformer factory, specified as a FQN class name |  | String
diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
index 6c4a6f0..e63af41 100644
--- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
+++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
@@ -21,7 +21,8 @@ import org.apache.camel.Component;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.component.xslt.XsltBuilder;
-import org.apache.camel.component.xslt.XsltEndpoint;
+import org.apache.camel.component.xslt.saxon.XsltSaxonBuilder;
+import org.apache.camel.component.xslt.saxon.XsltSaxonEndpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
@@ -32,7 +33,7 @@ import org.apache.camel.util.ObjectHelper;
  */
 @ManagedResource(description = "Managed XJEndpoint")
 @UriEndpoint(firstVersion = "3.0.0", scheme = "xj", title = "XJ", syntax = "xj:resourceUri", producerOnly = true, label = "transformation")
-public class XJEndpoint extends XsltEndpoint {
+public class XJEndpoint extends XsltSaxonEndpoint {
 
     private final JsonFactory jsonFactory = new JsonFactory();
 
@@ -68,8 +69,8 @@ public class XJEndpoint extends XsltEndpoint {
     }
 
     @Override
-    protected XsltBuilder createXsltBuilder() throws Exception {
-        final XsltBuilder xsltBuilder = super.createXsltBuilder();
+    protected XsltSaxonBuilder createXsltBuilder() throws Exception {
+        final XsltSaxonBuilder xsltBuilder = super.createXsltBuilder();
         xsltBuilder.setAllowStAX(true); // we rely on stax so always to true.
 
         configureInput(xsltBuilder);
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/XJEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/XJEndpointBuilderFactory.java
index a17d87a..dd42d49 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/XJEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/XJEndpointBuilderFactory.java
@@ -248,32 +248,6 @@ public interface XJEndpointBuilderFactory {
             return this;
         }
         /**
-         * Whether to use Saxon as the transformerFactoryClass. If enabled then
-         * the class net.sf.saxon.TransformerFactoryImpl. You would need to add
-         * Saxon to the classpath.
-         * 
-         * The option is a: <code>boolean</code> type.
-         * 
-         * Group: producer
-         */
-        default XJEndpointBuilder saxon(boolean saxon) {
-            doSetProperty("saxon", saxon);
-            return this;
-        }
-        /**
-         * Whether to use Saxon as the transformerFactoryClass. If enabled then
-         * the class net.sf.saxon.TransformerFactoryImpl. You would need to add
-         * Saxon to the classpath.
-         * 
-         * The option will be converted to a <code>boolean</code> type.
-         * 
-         * Group: producer
-         */
-        default XJEndpointBuilder saxon(String saxon) {
-            doSetProperty("saxon", saxon);
-            return this;
-        }
-        /**
          * The number of javax.xml.transform.Transformer object that are cached
          * for reuse to avoid calls to Template.newTransformer().
          * 
@@ -310,6 +284,63 @@ public interface XJEndpointBuilderFactory {
             return (XJEndpointBuilder) this;
         }
         /**
+         * To use a custom Saxon configuration.
+         * 
+         * The option is a: <code>net.sf.saxon.Configuration</code> type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedXJEndpointBuilder saxonConfiguration(
+                Object saxonConfiguration) {
+            doSetProperty("saxonConfiguration", saxonConfiguration);
+            return this;
+        }
+        /**
+         * To use a custom Saxon configuration.
+         * 
+         * The option will be converted to a
+         * <code>net.sf.saxon.Configuration</code> type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedXJEndpointBuilder saxonConfiguration(
+                String saxonConfiguration) {
+            doSetProperty("saxonConfiguration", saxonConfiguration);
+            return this;
+        }
+        /**
+         * Allows you to use a custom
+         * net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add
+         * camel-saxon to the classpath. The function is looked up in the
+         * registry, where you can comma to separate multiple values to lookup.
+         * 
+         * The option is a: <code>java.util.List&lt;java.lang.Object&gt;</code>
+         * type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedXJEndpointBuilder saxonExtensionFunctions(
+                List<Object> saxonExtensionFunctions) {
+            doSetProperty("saxonExtensionFunctions", saxonExtensionFunctions);
+            return this;
+        }
+        /**
+         * Allows you to use a custom
+         * net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add
+         * camel-saxon to the classpath. The function is looked up in the
+         * registry, where you can comma to separate multiple values to lookup.
+         * 
+         * The option will be converted to a
+         * <code>java.util.List&lt;java.lang.Object&gt;</code> type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedXJEndpointBuilder saxonExtensionFunctions(
+                String saxonExtensionFunctions) {
+            doSetProperty("saxonExtensionFunctions", saxonExtensionFunctions);
+            return this;
+        }
+        /**
          * Whether the endpoint should use basic property binding (Camel 2.x) or
          * the newer property binding with additional capabilities.
          * 
@@ -424,62 +455,6 @@ public interface XJEndpointBuilderFactory {
             return this;
         }
         /**
-         * To use a custom Saxon configuration.
-         * 
-         * The option is a: <code>java.lang.Object</code> type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedXJEndpointBuilder saxonConfiguration(
-                Object saxonConfiguration) {
-            doSetProperty("saxonConfiguration", saxonConfiguration);
-            return this;
-        }
-        /**
-         * To use a custom Saxon configuration.
-         * 
-         * The option will be converted to a <code>java.lang.Object</code> type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedXJEndpointBuilder saxonConfiguration(
-                String saxonConfiguration) {
-            doSetProperty("saxonConfiguration", saxonConfiguration);
-            return this;
-        }
-        /**
-         * Allows you to use a custom
-         * net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add
-         * camel-saxon to the classpath. The function is looked up in the
-         * registry, where you can comma to separate multiple values to lookup.
-         * 
-         * The option is a: <code>java.util.List&lt;java.lang.Object&gt;</code>
-         * type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedXJEndpointBuilder saxonExtensionFunctions(
-                List<Object> saxonExtensionFunctions) {
-            doSetProperty("saxonExtensionFunctions", saxonExtensionFunctions);
-            return this;
-        }
-        /**
-         * Allows you to use a custom
-         * net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add
-         * camel-saxon to the classpath. The function is looked up in the
-         * registry, where you can comma to separate multiple values to lookup.
-         * 
-         * The option will be converted to a
-         * <code>java.util.List&lt;java.lang.Object&gt;</code> type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedXJEndpointBuilder saxonExtensionFunctions(
-                String saxonExtensionFunctions) {
-            doSetProperty("saxonExtensionFunctions", saxonExtensionFunctions);
-            return this;
-        }
-        /**
          * Sets whether synchronous processing should be strictly used, or Camel
          * is allowed to use asynchronous processing (if supported).
          * 
diff --git a/platforms/spring-boot/components-starter/camel-xj-starter/src/main/java/org/apache/camel/component/xj/springboot/XJComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-xj-starter/src/main/java/org/apache/camel/component/xj/springboot/XJComponentConfiguration.java
index 8073bf1..100b52a 100644
--- a/platforms/spring-boot/components-starter/camel-xj-starter/src/main/java/org/apache/camel/component/xj/springboot/XJComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xj-starter/src/main/java/org/apache/camel/component/xj/springboot/XJComponentConfiguration.java
@@ -38,6 +38,22 @@ public class XJComponentConfiguration
      */
     private Boolean enabled;
     /**
+     * Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition.
+     * You would need to add camel-saxon to the classpath. The function is
+     * looked up in the registry, where you can comma to separate multiple
+     * values to lookup.
+     */
+    private String saxonExtensionFunctions;
+    /**
+     * To use a custom Saxon configuration. The option is a
+     * net.sf.saxon.Configuration type.
+     */
+    private String saxonConfiguration;
+    /**
+     * To set custom Saxon configuration properties
+     */
+    private Map<String, Object> saxonConfigurationProperties;
+    /**
      * To use a custom UriResolver which depends on a dynamic endpoint resource
      * URI. Should not be used together with the option 'uriResolver'. The
      * option is a org.apache.camel.component.xslt.XsltUriResolverFactory type.
@@ -58,28 +74,6 @@ public class XJComponentConfiguration
      */
     private Boolean contentCache = true;
     /**
-     * Whether to use Saxon as the transformerFactoryClass. If enabled then the
-     * class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to
-     * the classpath.
-     */
-    private Boolean saxon = false;
-    /**
-     * Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition.
-     * You would need to add camel-saxon to the classpath. The function is
-     * looked up in the registry, where you can comma to separate multiple
-     * values to lookup.
-     */
-    private String saxonExtensionFunctions;
-    /**
-     * To use a custom Saxon configuration. The option is a java.lang.Object
-     * type.
-     */
-    private String saxonConfiguration;
-    /**
-     * To set custom Saxon configuration properties
-     */
-    private Map<String, Object> saxonConfigurationProperties;
-    /**
      * Whether the component should use basic property binding (Camel 2.x) or
      * the newer property binding with additional capabilities
      */
@@ -105,38 +99,6 @@ public class XJComponentConfiguration
      */
     private Boolean bridgeErrorHandler = false;
 
-    public String getUriResolverFactory() {
-        return uriResolverFactory;
-    }
-
-    public void setUriResolverFactory(String uriResolverFactory) {
-        this.uriResolverFactory = uriResolverFactory;
-    }
-
-    public String getUriResolver() {
-        return uriResolver;
-    }
-
-    public void setUriResolver(String uriResolver) {
-        this.uriResolver = uriResolver;
-    }
-
-    public Boolean getContentCache() {
-        return contentCache;
-    }
-
-    public void setContentCache(Boolean contentCache) {
-        this.contentCache = contentCache;
-    }
-
-    public Boolean getSaxon() {
-        return saxon;
-    }
-
-    public void setSaxon(Boolean saxon) {
-        this.saxon = saxon;
-    }
-
     public String getSaxonExtensionFunctions() {
         return saxonExtensionFunctions;
     }
@@ -162,6 +124,30 @@ public class XJComponentConfiguration
         this.saxonConfigurationProperties = saxonConfigurationProperties;
     }
 
+    public String getUriResolverFactory() {
+        return uriResolverFactory;
+    }
+
+    public void setUriResolverFactory(String uriResolverFactory) {
+        this.uriResolverFactory = uriResolverFactory;
+    }
+
+    public String getUriResolver() {
+        return uriResolver;
+    }
+
+    public void setUriResolver(String uriResolver) {
+        this.uriResolver = uriResolver;
+    }
+
+    public Boolean getContentCache() {
+        return contentCache;
+    }
+
+    public void setContentCache(Boolean contentCache) {
+        this.contentCache = contentCache;
+    }
+
     public Boolean getBasicPropertyBinding() {
         return basicPropertyBinding;
     }