camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject camel git commit: CAMEL-10335: Improve Saxon customization
Date Fri, 10 Feb 2017 11:22:26 GMT
Repository: camel
Updated Branches:
  refs/heads/master dc0dee169 -> 029471ce6


CAMEL-10335: Improve Saxon customization


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/029471ce
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/029471ce
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/029471ce

Branch: refs/heads/master
Commit: 029471ce606ed7eae180abded541fc1e41d73bd8
Parents: dc0dee1
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Fri Feb 10 07:54:05 2017 +0100
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Fri Feb 10 12:22:17 2017 +0100

----------------------------------------------------------------------
 camel-core/src/main/docs/xslt-component.adoc    | 12 ++--
 .../camel/component/xslt/XsltComponent.java     | 62 ++++++++++++++++++++
 .../camel/component/xslt/XsltEndpoint.java      | 50 ++++++++++++----
 .../apache/camel/component/xslt/XsltHelper.java | 32 ++++++++++
 .../src/main/docs/xquery-component.adoc         |  9 ++-
 .../camel/component/xquery/XQueryBuilder.java   | 19 +++++-
 .../camel/component/xquery/XQueryComponent.java | 30 ++++++++++
 .../camel/component/xquery/XQueryEndpoint.java  | 14 +++++
 .../XQueryComponentConfigurationTest.java       | 40 +++++++++++++
 .../xquery/XQueryEndpointConfigurationTest.java | 59 +++++++++++++++++++
 .../SaxonXsltComponentConfigurationTest.java    | 41 +++++++++++++
 .../SaxonXsltEndpointConfigurationTest.java     | 59 +++++++++++++++++++
 .../xquery/XQueryComponentConfigurationTest.xml | 47 +++++++++++++++
 .../xquery/XQueryEndpointConfigurationTest.xml  | 44 ++++++++++++++
 .../SaxonXsltComponentConfigurationTest.xml     | 48 +++++++++++++++
 .../xslt/SaxonXsltEndpointConfigurationTest.xml | 44 ++++++++++++++
 .../springboot/XsltComponentConfiguration.java  | 44 +++++++++++++-
 .../XQueryComponentConfiguration.java           | 28 +++++++++
 18 files changed, 662 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/camel-core/src/main/docs/xslt-component.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/xslt-component.adoc b/camel-core/src/main/docs/xslt-component.adoc
index d664ae9..989bc17 100644
--- a/camel-core/src/main/docs/xslt-component.adoc
+++ b/camel-core/src/main/docs/xslt-component.adoc
@@ -67,7 +67,7 @@ directly in the camel-core.
 ### Options
 
 // component options: START
-The XSLT component supports 5 options which are listed below.
+The XSLT component supports 8 options which are listed below.
 
 
 
@@ -78,15 +78,18 @@ The XSLT component supports 5 options which are listed below.
 | xmlConverter | advanced |  | XmlConverter | To use a custom implementation of org.apache.camel.converter.jaxp.XmlConverter
 | uriResolverFactory | advanced |  | XsltUriResolverFactory | To use a custom javax.xml.transform.URIResolver which depends on a dynamic endpoint resource URI or which is a subclass of XsltUriResolver. Do not use in combination with uriResolver. See also link setUriResolver(URIResolver).
 | uriResolver | advanced |  | URIResolver | To use a custom javax.xml.transform.URIResolver. Do not use in combination with uriResolverFactory. See also link setUriResolverFactory(XsltUriResolverFactory).
-| contentCache | producer | true | boolean | 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.
+| contentCache | producer | false | boolean | 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.
 | saxon | producer | false | boolean | 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.
+| saxonExtensionFunctions | producer |  | List | 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.
+| saxonConfiguration | producer | true | Object | To use a custom Saxon configuration
+| saxonConfigurationProperties | advanced |  | Map | To set custom Saxon configuration properties
 |=======================================================================
 {% endraw %}
 // component options: END
 
 
 // endpoint options: START
-The XSLT component supports 17 endpoint options which are listed below:
+The XSLT component supports 18 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2,1,1m,1m,5",options="header"]
@@ -104,6 +107,7 @@ The XSLT component supports 17 endpoint options which are listed below:
 | entityResolver | advanced |  | EntityResolver | To use a custom org.xml.sax.EntityResolver with javax.xml.transform.sax.SAXSource.
 | errorListener | advanced |  | ErrorListener | 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.
 | resultHandlerFactory | advanced |  | ResultHandlerFactory | 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.
+| saxonConfiguration | advanced |  | Object | To use a custom Saxon configuration
 | saxonExtensionFunctions | advanced |  | String | 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.
 | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
 | transformerFactory | advanced |  | TransformerFactory | To use a custom XSLT transformer factory
@@ -424,4 +428,4 @@ ________________________________________________________________________________
 * link:configuring-camel.html[Configuring Camel]
 * link:component.html[Component]
 * link:endpoint.html[Endpoint]
-* link:getting-started.html[Getting Started]
\ No newline at end of file
+* link:getting-started.html[Getting Started]

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
index fa9f4f8..846c1fd 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.xslt;
 
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import javax.xml.transform.URIResolver;
 
@@ -24,6 +26,8 @@ import org.apache.camel.builder.xml.XsltUriResolver;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ResourceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,6 +46,12 @@ public class XsltComponent extends UriEndpointComponent {
     @Metadata(label = "advanced", description = "To use a custom UriResolver which depends on a dynamic endpoint resource URI. Should not be used together with the option 'uriResolver'.")
     private XsltUriResolverFactory uriResolverFactory;
     @Metadata(defaultValue = "true")
+    @UriParam(label = "advanced")
+    private Object saxonConfiguration;
+    @Metadata(label = "advanced")
+    private Map<String, Object> saxonConfigurationProperties = new HashMap<>();
+    @UriParam(label = "advanced", javaType = "java.lang.String")
+    private List<Object> saxonExtensionFunctions;
     private boolean contentCache = true;
     private boolean saxon;
 
@@ -112,11 +122,63 @@ public class XsltComponent extends UriEndpointComponent {
         this.saxon = saxon;
     }
 
+    public List<Object> getSaxonExtensionFunctions() {
+        return saxonExtensionFunctions;
+    }
+
+    /**
+     * 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.
+     */
+    public void setSaxonExtensionFunctions(List<Object> extensionFunctions) {
+        this.saxonExtensionFunctions = extensionFunctions;
+    }
+
+    /**
+     * 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.
+     */
+    public void setSaxonExtensionFunctions(String extensionFunctions) {
+        this.saxonExtensionFunctions = EndpointHelper.resolveReferenceListParameter(
+            getCamelContext(),
+            extensionFunctions,
+            Object.class
+        );
+    }
+
+    public Object getSaxonConfiguration() {
+        return saxonConfiguration;
+    }
+
+    /**
+     * To use a custom Saxon configuration
+     */
+    public void setSaxonConfiguration(Object saxonConfiguration) {
+        this.saxonConfiguration = saxonConfiguration;
+    }
+
+    public Map<String, Object> getSaxonConfigurationProperties() {
+        return saxonConfigurationProperties;
+    }
+
+    /**
+     * To set custom Saxon configuration properties
+     */
+    public void setSaxonConfigurationProperties(Map<String, Object> configurationProperties) {
+        this.saxonConfigurationProperties = configurationProperties;
+    }
+
+    @Override
     protected Endpoint createEndpoint(String uri, final String remaining, Map<String, Object> parameters) throws Exception {
         XsltEndpoint endpoint = new XsltEndpoint(uri, this);
         endpoint.setConverter(getXmlConverter());
         endpoint.setContentCache(isContentCache());
         endpoint.setSaxon(isSaxon());
+        endpoint.setSaxonConfiguration(saxonConfiguration);
+        endpoint.setSaxonConfigurationProperties(saxonConfigurationProperties);
+        endpoint.setSaxonExtensionFunctions(saxonExtensionFunctions);
 
         String resourceUri = remaining;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
index bd189a5..1ab1bd9 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
@@ -25,8 +25,10 @@ import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
+
 import org.xml.sax.EntityResolver;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.Exchange;
 import org.apache.camel.api.management.ManagedAttribute;
@@ -36,6 +38,8 @@ import org.apache.camel.builder.xml.ResultHandlerFactory;
 import org.apache.camel.builder.xml.XsltBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.impl.ProcessorEndpoint;
+import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.spi.Injector;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
@@ -56,7 +60,6 @@ public class XsltEndpoint extends ProcessorEndpoint {
 
     private static final Logger LOG = LoggerFactory.getLogger(XsltEndpoint.class);
 
-
     private volatile boolean cacheCleared;
     private volatile XsltBuilder xslt;
     private Map<String, Object> parameters;
@@ -73,6 +76,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
     private TransformerFactory transformerFactory;
     @UriParam
     private boolean saxon;
+    @UriParam(label = "advanced")
+    private Object saxonConfiguration;
+    @Metadata(label = "advanced")
+    private Map<String, Object> saxonConfigurationProperties = new HashMap<>();
     @UriParam(label = "advanced", javaType = "java.lang.String")
     private List<Object> saxonExtensionFunctions;
     @UriParam(label = "advanced")
@@ -231,6 +238,28 @@ public class XsltEndpoint extends ProcessorEndpoint {
         );
     }
 
+    public Object getSaxonConfiguration() {
+        return saxonConfiguration;
+    }
+
+    /**
+     * To use a custom Saxon configuration
+     */
+    public void setSaxonConfiguration(Object saxonConfiguration) {
+        this.saxonConfiguration = saxonConfiguration;
+    }
+
+    public Map<String, Object> getSaxonConfigurationProperties() {
+        return saxonConfigurationProperties;
+    }
+
+    /**
+     * To set custom Saxon configuration properties
+     */
+    public void setSaxonConfigurationProperties(Map<String, Object> configurationProperties) {
+        this.saxonConfigurationProperties = configurationProperties;
+    }
+
     public ResultHandlerFactory getResultHandlerFactory() {
         return resultHandlerFactory;
     }
@@ -389,9 +418,13 @@ public class XsltEndpoint extends ProcessorEndpoint {
     protected void doStart() throws Exception {
         super.doStart();
 
+        final CamelContext ctx = getCamelContext();
+        final ClassResolver resolver = ctx.getClassResolver();
+        final Injector injector = ctx.getInjector();
+
         LOG.debug("{} using schema resource: {}", this, resourceUri);
 
-        this.xslt = getCamelContext().getInjector().newInstance(XsltBuilder.class);
+        this.xslt = injector.newInstance(XsltBuilder.class);
         if (converter != null) {
             xslt.setConverter(converter);
         }
@@ -405,17 +438,14 @@ public class XsltEndpoint extends ProcessorEndpoint {
         TransformerFactory factory = transformerFactory;
         if (factory == null && transformerFactoryClass != null) {
             // provide the class loader of this component to work in OSGi environments
-            Class<?> factoryClass = getCamelContext().getClassResolver().resolveMandatoryClass(transformerFactoryClass, XsltComponent.class.getClassLoader());
+            Class<TransformerFactory> factoryClass = resolver.resolveMandatoryClass(transformerFactoryClass, TransformerFactory.class, XsltComponent.class.getClassLoader());
             LOG.debug("Using TransformerFactoryClass {}", factoryClass);
-            factory = (TransformerFactory) getCamelContext().getInjector().newInstance(factoryClass);
+            factory = injector.newInstance(factoryClass);
 
             if (useSaxon) {
-                XsltHelper.registerSaxonExtensionFunctions(
-                    getCamelContext(),
-                    factoryClass,
-                    factory,
-                    saxonExtensionFunctions
-                );
+                XsltHelper.registerSaxonConfiguration(ctx, factoryClass, factory, saxonConfiguration);
+                XsltHelper.registerSaxonConfigurationProperties(ctx, factoryClass, factory, saxonConfigurationProperties);
+                XsltHelper.registerSaxonExtensionFunctions(ctx, factoryClass, factory, saxonExtensionFunctions);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/camel-core/src/main/java/org/apache/camel/component/xslt/XsltHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltHelper.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltHelper.java
index 529fd68..61af8d2 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltHelper.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.xslt;
 
 import java.lang.reflect.Method;
 import java.util.List;
+import java.util.Map;
 import javax.xml.XMLConstants;
 import javax.xml.transform.TransformerFactory;
 
@@ -34,6 +35,37 @@ final class XsltHelper {
     private XsltHelper() {
     }
 
+    public static void registerSaxonConfiguration(
+            CamelContext camelContext, Class<?> factoryClass, TransformerFactory factory, Object saxonConfiguration) throws Exception {
+
+        if (saxonConfiguration != null) {
+            Class<?> configurationClass = camelContext.getClassResolver().resolveClass(SAXON_CONFIGURATION_CLASS_NAME);
+            if (configurationClass != null) {
+                Method method = factoryClass.getMethod("setConfiguration", configurationClass);
+                if (method != null) {
+                    method.invoke(factory, configurationClass.cast(saxonConfiguration));
+                }
+            }
+        }
+    }
+
+    public static void registerSaxonConfigurationProperties(
+            CamelContext camelContext, Class<?> factoryClass, TransformerFactory factory, Map<String, Object> saxonConfigurationProperties) throws Exception {
+
+        if (saxonConfigurationProperties != null && !saxonConfigurationProperties.isEmpty()) {
+            Method method = factoryClass.getMethod("getConfiguration");
+            if (method != null) {
+                Object configuration = method.invoke(factory, null);
+                if (configuration != null) {
+                    method = configuration.getClass().getMethod("setConfigurationProperty", String.class, Object.class);
+                    for (Map.Entry<String, Object> entry : saxonConfigurationProperties.entrySet()) {
+                        method.invoke(configuration, entry.getKey(), entry.getValue());
+                    }
+                }
+            }
+        }
+    }
+
     public static void registerSaxonExtensionFunctions(
             CamelContext camelContext, Class<?> factoryClass, TransformerFactory factory, List<Object> saxonExtensionFunctions) throws Exception {
 

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/main/docs/xquery-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/main/docs/xquery-component.adoc b/components/camel-saxon/src/main/docs/xquery-component.adoc
index b512d7f..c3a23d9 100644
--- a/components/camel-saxon/src/main/docs/xquery-component.adoc
+++ b/components/camel-saxon/src/main/docs/xquery-component.adoc
@@ -15,7 +15,7 @@ link:recipient-list.html[Recipient List].
 
 
 // component options: START
-The XQuery component supports 1 options which are listed below.
+The XQuery component supports 3 options which are listed below.
 
 
 
@@ -24,6 +24,8 @@ The XQuery component supports 1 options which are listed below.
 |=======================================================================
 | Name | Group | Default | Java Type | Description
 | moduleURIResolver | advanced |  | ModuleURIResolver | To use the custom ModuleURIResolver
+| configuration | advanced |  | Configuration | To use a custom Saxon configuration
+| configurationProperties | advanced |  | Map | To set custom Saxon configuration properties
 |=======================================================================
 {% endraw %}
 // component options: END
@@ -32,7 +34,7 @@ The XQuery component supports 1 options which are listed below.
 
 
 // endpoint options: START
-The XQuery component supports 31 endpoint options which are listed below:
+The XQuery component supports 32 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2,1,1m,1m,5",options="header"]
@@ -51,6 +53,7 @@ The XQuery component supports 31 endpoint options which are listed below:
 | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
 | pollStrategy | consumer (advanced) |  | PollingConsumerPollStrategy | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.
 | configuration | advanced |  | Configuration | To use a custom Saxon configuration
+| configurationProperties | advanced |  | Map | To set custom Saxon configuration properties
 | moduleURIResolver | advanced |  | ModuleURIResolver | To use the custom ModuleURIResolver
 | parameters | advanced |  | Map | Additional parameters
 | properties | advanced |  | Properties | Properties to configure the serialization parameters
@@ -258,4 +261,4 @@ link:download.html[the download page for the latest versions]).
   <artifactId>camel-saxon</artifactId>
   <version>x.x.x</version>
 </dependency>
---------------------------------------
\ No newline at end of file
+--------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
index a4c61d9..98be79b 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
@@ -24,13 +24,13 @@ import java.io.Reader;
 import java.io.StringWriter;
 import java.net.URL;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
-
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMResult;
@@ -54,7 +54,6 @@ import net.sf.saxon.query.XQueryExpression;
 import net.sf.saxon.trans.XPathException;
 import net.sf.saxon.value.ObjectValue;
 import net.sf.saxon.value.Whitespace;
-
 import org.apache.camel.BytesSource;
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
@@ -83,6 +82,7 @@ import org.slf4j.LoggerFactory;
 public abstract class XQueryBuilder implements Expression, Predicate, NamespaceAware, Processor {
     private static final Logger LOG = LoggerFactory.getLogger(XQueryBuilder.class);
     private Configuration configuration;
+    private Map<String, Object> configurationProperties = new HashMap<String, Object>();
     private XQueryExpression expression;
     private StaticQueryContext staticQueryContext;
     private Map<String, Object> parameters = new HashMap<String, Object>();
@@ -385,6 +385,16 @@ public abstract class XQueryBuilder implements Expression, Predicate, NamespaceA
         initialized.set(false);
     }
 
+    public Map<String, Object> getConfigurationProperties() {
+        return configurationProperties;
+    }
+
+    public void setConfigurationProperties(Map<String, Object> configurationProperties) {
+        this.configurationProperties = Collections.unmodifiableMap(new HashMap<>(configurationProperties));
+        // change configuration, we must re initialize
+        initialized.set(false);
+    }
+
     public StaticQueryContext getStaticQueryContext() {
         return staticQueryContext;
     }
@@ -668,6 +678,11 @@ public abstract class XQueryBuilder implements Expression, Predicate, NamespaceA
                 LOG.debug("Using existing Configuration {}", configuration);
             }
 
+            if (configurationProperties != null && !configurationProperties.isEmpty()) {
+                for (Map.Entry<String, Object> entry : configurationProperties.entrySet()) {
+                    configuration.setConfigurationProperty(entry.getKey(), entry.getValue());
+                }
+            }
             staticQueryContext = getConfiguration().newStaticQueryContext();
             if (moduleURIResolver != null) {
                 staticQueryContext.setModuleURIResolver(moduleURIResolver);

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
index 01d8b4a..8e78c7e 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
@@ -17,8 +17,10 @@
 package org.apache.camel.component.xquery;
 
 import java.net.URL;
+import java.util.HashMap;
 import java.util.Map;
 
+import net.sf.saxon.Configuration;
 import net.sf.saxon.lib.ModuleURIResolver;
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
@@ -33,6 +35,10 @@ public class XQueryComponent extends UriEndpointComponent {
 
     @Metadata(label = "advanced")
     private ModuleURIResolver moduleURIResolver = new XQueryModuleURIResolver(this);
+    @Metadata(label = "advanced")
+    private Configuration configuration;
+    @Metadata(label = "advanced")
+    private Map<String, Object> configurationProperties = new HashMap<>();
 
     public XQueryComponent() {
         super(XQueryEndpoint.class);
@@ -40,6 +46,8 @@ public class XQueryComponent extends UriEndpointComponent {
 
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         XQueryEndpoint answer = new XQueryEndpoint(uri, this);
+        answer.setConfiguration(configuration);
+        answer.setConfigurationProperties(getConfigurationProperties());
         setProperties(answer, parameters);
 
         answer.setResourceUri(remaining);
@@ -62,4 +70,26 @@ public class XQueryComponent extends UriEndpointComponent {
     public void setModuleURIResolver(ModuleURIResolver moduleURIResolver) {
         this.moduleURIResolver = moduleURIResolver;
     }
+
+    public Configuration getConfiguration() {
+        return configuration;
+    }
+
+    /**
+     * To use a custom Saxon configuration
+     */
+    public void setConfiguration(Configuration configuration) {
+        this.configuration = configuration;
+    }
+
+    public Map<String, Object> getConfigurationProperties() {
+        return configurationProperties;
+    }
+
+    /**
+     * To set custom Saxon configuration properties
+     */
+    public void setConfigurationProperties(Map<String, Object> configurationProperties) {
+        this.configurationProperties = configurationProperties;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
index 9003357..46615db 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
@@ -50,6 +50,8 @@ public class XQueryEndpoint extends ProcessorEndpoint {
     @UriParam(label = "advanced")
     private Configuration configuration;
     @UriParam(label = "advanced")
+    private Map<String, Object> configurationProperties = new HashMap<>();
+    @UriParam(label = "advanced")
     private StaticQueryContext staticQueryContext;
     @UriParam(label = "advanced")
     private Map<String, Object> parameters = new HashMap<String, Object>();
@@ -96,6 +98,17 @@ public class XQueryEndpoint extends ProcessorEndpoint {
         this.configuration = configuration;
     }
 
+    public Map<String, Object> getConfigurationProperties() {
+        return configurationProperties;
+    }
+
+    /**
+     * To set custom Saxon configuration properties
+     */
+    public void setConfigurationProperties(Map<String, Object> configurationProperties) {
+        this.configurationProperties = configurationProperties;
+    }
+
     public StaticQueryContext getStaticQueryContext() {
         return staticQueryContext;
     }
@@ -215,6 +228,7 @@ public class XQueryEndpoint extends ProcessorEndpoint {
 
         this.xquery = XQueryBuilder.xquery(url);
         this.xquery.setConfiguration(getConfiguration());
+        this.xquery.setConfigurationProperties(getConfigurationProperties());
         this.xquery.setStaticQueryContext(getStaticQueryContext());
         this.xquery.setParameters(getParameters());
         this.xquery.setNamespaces(namespacePrefixes);

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.java
new file mode 100644
index 0000000..b6d4a6a
--- /dev/null
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.component.xquery;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class XQueryComponentConfigurationTest extends CamelSpringTestSupport {
+
+    @Test
+    public void testConfiguration() throws Exception {
+        XQueryComponent component = context.getComponent("xquery", XQueryComponent.class);
+        XQueryEndpoint endpoint = context.getEndpoint("xquery:org/apache/camel/component/xquery/transform.xquery", XQueryEndpoint.class);
+
+        assertNotNull(component.getConfiguration());
+        assertNotNull(component.getConfigurationProperties());
+        assertEquals(component.getConfiguration(), endpoint.getConfiguration());
+        assertEquals(component.getConfigurationProperties(), endpoint.getConfigurationProperties());
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/xquery/XQueryComponentConfigurationTest.xml");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.java
new file mode 100644
index 0000000..d0d4c5d
--- /dev/null
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.component.xquery;
+
+import java.util.Map;
+
+import net.sf.saxon.Configuration;
+import org.apache.camel.Endpoint;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class XQueryEndpointConfigurationTest extends CamelSpringTestSupport {
+    @Test
+    public void testConfiguration() throws Exception {
+        Configuration configuration = context.getRegistry().lookupByNameAndType("saxon-configuration", Configuration.class);
+        Map<String, Object> properties = context.getRegistry().lookupByNameAndType("saxon-properties", Map.class);
+        XQueryComponent component = context.getComponent("xquery", XQueryComponent.class);
+        XQueryEndpoint endpoint = null;
+
+        assertNotNull(configuration);
+        assertNotNull(properties);
+
+        for (Endpoint ep : context.getEndpoints()) {
+            if (ep instanceof XQueryEndpoint) {
+                endpoint = (XQueryEndpoint)ep;
+                break;
+            }
+        }
+
+        assertNotNull(component);
+        assertNotNull(endpoint);
+        assertNull(component.getConfiguration());
+        assertTrue(component.getConfigurationProperties().isEmpty());
+        assertNotNull(endpoint.getConfiguration());
+        assertNotNull(endpoint.getConfigurationProperties());
+        assertEquals(configuration, endpoint.getConfiguration());
+        assertEquals(properties, endpoint.getConfigurationProperties());
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.xml");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.java
new file mode 100644
index 0000000..c4fb30d
--- /dev/null
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.java
@@ -0,0 +1,41 @@
+/**
+ * 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.component.xslt;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SaxonXsltComponentConfigurationTest extends CamelSpringTestSupport {
+    @Test
+    public void testConfiguration() throws Exception {
+        XsltComponent component = context.getComponent("xslt", XsltComponent.class);
+        XsltEndpoint endpoint = context.getEndpoint("xslt:org/apache/camel/component/xslt/transform.xsl", XsltEndpoint.class);
+
+        assertNotNull(component.getSaxonConfiguration());
+        assertNotNull(component.getSaxonConfigurationProperties());
+        assertFalse(component.getSaxonConfigurationProperties().isEmpty());
+        assertEquals(component.getSaxonConfiguration(), endpoint.getSaxonConfiguration());
+        assertEquals(component.getSaxonConfigurationProperties(), endpoint.getSaxonConfigurationProperties());
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.xml");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.java
new file mode 100644
index 0000000..036b589
--- /dev/null
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.component.xslt;
+
+import java.util.Map;
+
+import net.sf.saxon.Configuration;
+import org.apache.camel.Endpoint;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SaxonXsltEndpointConfigurationTest extends CamelSpringTestSupport {
+    @Test
+    public void testConfiguration() throws Exception {
+        Configuration configuration = context.getRegistry().lookupByNameAndType("saxon-configuration", Configuration.class);
+        Map<String, Object> properties = context.getRegistry().lookupByNameAndType("saxon-properties", Map.class);
+        XsltComponent component = context.getComponent("xslt", XsltComponent.class);
+        XsltEndpoint endpoint = null;
+
+        assertNotNull(configuration);
+        assertNotNull(properties);
+
+        for (Endpoint ep : context.getEndpoints()) {
+            if (ep instanceof XsltEndpoint) {
+                endpoint = (XsltEndpoint)ep;
+                break;
+            }
+        }
+
+        assertNotNull(component);
+        assertNotNull(endpoint);
+        assertNull(component.getSaxonConfiguration());
+        assertTrue(component.getSaxonConfigurationProperties().isEmpty());
+        assertNotNull(endpoint.getSaxonConfiguration());
+        assertNotNull(endpoint.getSaxonConfigurationProperties());
+        assertEquals(configuration, endpoint.getSaxonConfiguration());
+        assertEquals(properties, endpoint.getSaxonConfigurationProperties());
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.xml");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.xml
new file mode 100644
index 0000000..83a204c
--- /dev/null
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryComponentConfigurationTest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+      ">
+
+  <bean id="xquery" class="org.apache.camel.component.xquery.XQueryComponent">
+    <property name="configuration">
+      <bean class="net.sf.saxon.Configuration"/>
+    </property>
+    <property name="configurationProperties">
+      <map>
+        <entry key="http://saxon.sf.net/feature/allow-external-functions" value="false" value-type="java.lang.Boolean"/>
+      </map>
+    </property>
+  </bean>
+
+  <!-- START SNIPPET: example -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="xquery:org/apache/camel/component/xquery/transform.xquery"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.xml
new file mode 100644
index 0000000..3245afb
--- /dev/null
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/component/xquery/XQueryEndpointConfigurationTest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+      ">
+
+  <bean id="saxon-configuration" class="net.sf.saxon.Configuration"/>
+
+  <util:map id="saxon-properties" key-type="java.lang.String" value-type="java.lang.Object">
+    <entry key="http://saxon.sf.net/feature/allow-external-functions" value="false" value-type="java.lang.Boolean"/>
+  </util:map>
+
+  <!-- START SNIPPET: example -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="xquery:org/apache/camel/component/xquery/transform.xquery?configuration=#saxon-configuration&amp;configurationProperties=#saxon-properties"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.xml
new file mode 100644
index 0000000..4643d74
--- /dev/null
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltComponentConfigurationTest.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+      ">
+
+  <bean id="xslt" class="org.apache.camel.component.xslt.XsltComponent">
+    <property name="saxon" value="true"/>
+    <property name="saxonConfiguration">
+      <bean class="net.sf.saxon.Configuration"/>
+    </property>
+    <property name="saxonConfigurationProperties">
+      <map>
+        <entry key="http://saxon.sf.net/feature/allow-external-functions" value="false" value-type="java.lang.Boolean"/>
+      </map>
+    </property>
+  </bean>
+
+  <!-- START SNIPPET: example -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="xslt:org/apache/camel/component/xslt/transform.xsl"/>
+      <multicast>
+        <to uri="mock:result"/>
+      </multicast>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.xml
new file mode 100644
index 0000000..ca6f980
--- /dev/null
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/component/xslt/SaxonXsltEndpointConfigurationTest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+      ">
+
+  <bean id="saxon-configuration" class="net.sf.saxon.Configuration"/>
+
+  <util:map id="saxon-properties" key-type="java.lang.String" value-type="java.lang.Object">
+    <entry key="http://saxon.sf.net/feature/allow-external-functions" value="false" value-type="java.lang.Boolean"/>
+  </util:map>
+
+  <!-- START SNIPPET: example -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="xslt:org/apache/camel/component/xslt/transform.xsl?saxon=true&amp;saxonConfiguration=#saxon-configuration&amp;saxonConfigurationProperties=#saxon-properties"/>
+      <multicast>
+        <to uri="mock:result"/>
+      </multicast>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java
index 87665c8..9b024d3 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.xslt.springboot;
 
+import java.util.List;
+import java.util.Map;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
@@ -57,13 +59,28 @@ public class XsltComponentConfiguration {
      * forced to reload at runtime via JMX using the clearCachedStylesheet
      * operation.
      */
-    private Boolean contentCache = true;
+    private Boolean contentCache = false;
     /**
      * 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 List<Object> saxonExtensionFunctions;
+    /**
+     * To use a custom Saxon configuration
+     */
+    private Object saxonConfiguration;
+    /**
+     * To set custom Saxon configuration properties
+     */
+    private Map<String, Object> saxonConfigurationProperties;
 
     public XmlConverterNestedConfiguration getXmlConverter() {
         return xmlConverter;
@@ -105,6 +122,31 @@ public class XsltComponentConfiguration {
         this.saxon = saxon;
     }
 
+    public List<Object> getSaxonExtensionFunctions() {
+        return saxonExtensionFunctions;
+    }
+
+    public void setSaxonExtensionFunctions(List<Object> saxonExtensionFunctions) {
+        this.saxonExtensionFunctions = saxonExtensionFunctions;
+    }
+
+    public Object getSaxonConfiguration() {
+        return saxonConfiguration;
+    }
+
+    public void setSaxonConfiguration(Object saxonConfiguration) {
+        this.saxonConfiguration = saxonConfiguration;
+    }
+
+    public Map<String, Object> getSaxonConfigurationProperties() {
+        return saxonConfigurationProperties;
+    }
+
+    public void setSaxonConfigurationProperties(
+            Map<String, Object> saxonConfigurationProperties) {
+        this.saxonConfigurationProperties = saxonConfigurationProperties;
+    }
+
     public static class XmlConverterNestedConfiguration {
         public static final Class CAMEL_NESTED_CLASS = org.apache.camel.converter.jaxp.XmlConverter.class;
         private DocumentBuilderFactory documentBuilderFactory;

http://git-wip-us.apache.org/repos/asf/camel/blob/029471ce/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentConfiguration.java
index 2c99e0b..ed4a251 100644
--- a/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentConfiguration.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.xquery.springboot;
 
+import java.util.Map;
+import net.sf.saxon.Configuration;
 import net.sf.saxon.lib.ModuleURIResolver;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.NestedConfigurationProperty;
@@ -33,6 +35,15 @@ public class XQueryComponentConfiguration {
      */
     @NestedConfigurationProperty
     private ModuleURIResolver moduleURIResolver;
+    /**
+     * To use a custom Saxon configuration
+     */
+    @NestedConfigurationProperty
+    private Configuration configuration;
+    /**
+     * To set custom Saxon configuration properties
+     */
+    private Map<String, Object> configurationProperties;
 
     public ModuleURIResolver getModuleURIResolver() {
         return moduleURIResolver;
@@ -41,4 +52,21 @@ public class XQueryComponentConfiguration {
     public void setModuleURIResolver(ModuleURIResolver moduleURIResolver) {
         this.moduleURIResolver = moduleURIResolver;
     }
+
+    public Configuration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(Configuration configuration) {
+        this.configuration = configuration;
+    }
+
+    public Map<String, Object> getConfigurationProperties() {
+        return configurationProperties;
+    }
+
+    public void setConfigurationProperties(
+            Map<String, Object> configurationProperties) {
+        this.configurationProperties = configurationProperties;
+    }
 }
\ No newline at end of file


Mime
View raw message