You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/04/23 10:58:25 UTC

[camel] branch xpath created (now 08c2873)

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

davsclaus pushed a change to branch xpath
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at 08c2873  CAMEL-13113: Add @Groovy annotation as camel-script was removed

This branch includes the following new commits:

     new ba6bdd7  camel3 - a little bit of modularization around xpath
     new 0004cc8  Fixed CS
     new 4aa7ba1  camel3 - Removed unused stuff in pom.xml for camel-base
     new 7695931  CAMEL-13442: camel3 - Move xpath out of camel-core
     new 78a7537  CAMEL-13442: camel3 - Move xpath out of camel-core
     new 07bd9a5  CAMEL-13442: camel3 - Move xpath out of camel-core
     new ce55338  CAMEL-13442: camel3 - Move xpath out of camel-core
     new f261486  CAMEL-13442: camel3 - Move xpath out of camel-core
     new d57cae2  CAMEL-13442: camel3 - Move xpath out of camel-core
     new 08c2873  CAMEL-13113: Add @Groovy annotation as camel-script was removed

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/10: camel3 - a little bit of modularization around xpath

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ba6bdd79ae1e970f605db5c9324f6c915c9b75a0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 09:24:51 2019 +0200

    camel3 - a little bit of modularization around xpath
---
 .../org/apache/camel/builder/xml/XPathBuilder.java | 16 +++++++++++
 .../apache/camel/language/xpath/XPathLanguage.java | 32 +++++++++++++++++++---
 .../camel/model/language/XPathExpression.java      | 13 ++++-----
 3 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java b/core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
index 580abfd..b60de21 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
@@ -118,6 +118,7 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
     // let's assume XPath expressions result in nodesets.
     private volatile Class<?> resultType;
     private volatile QName resultQName = XPathConstants.NODESET;
+    private volatile boolean useSaxon;
     private volatile String objectModelUri;
     private volatile String factoryClassName;
     private volatile DefaultNamespaceContext namespaceContext;
@@ -373,6 +374,7 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
      * @return the current builder
      */
     public XPathBuilder saxon() {
+        this.useSaxon = true;
         this.objectModelUri = SAXON_OBJECT_MODEL_URI;
         this.factoryClassName = SAXON_FACTORY_CLASS_NAME;
         return this;
@@ -832,6 +834,20 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
         this.setFactoryClassName(SAXON_FACTORY_CLASS_NAME);
     }
 
+    /**
+     * Whether to enable Saxon on this particular XPath expression.
+     */
+    public void setUseSaxon(boolean useSaxon) {
+        this.useSaxon = useSaxon;
+        if (useSaxon) {
+            enableSaxon();
+        }
+    }
+
+    public boolean isUseSaxon() {
+        return useSaxon;
+    }
+
     public String getObjectModelUri() {
         return objectModelUri;
     }
diff --git a/core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java b/core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
index 0ec4bcd..c9b7ebd 100644
--- a/core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
+++ b/core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
@@ -35,6 +35,8 @@ public class XPathLanguage extends LanguageSupport {
     private Boolean useSaxon;
     private String objectModelUri;
     private Boolean threadSafety;
+    private Boolean logNamespaces;
+    private String headerName;
 
     public Predicate createPredicate(String expression) {
         expression = loadResource(expression);
@@ -76,10 +78,6 @@ public class XPathLanguage extends LanguageSupport {
         return useSaxon;
     }
 
-    public Boolean isUseSaxon() {
-        return useSaxon != null && useSaxon;
-    }
-
     public String getObjectModelUri() {
         return objectModelUri;
     }
@@ -96,6 +94,26 @@ public class XPathLanguage extends LanguageSupport {
         this.threadSafety = threadSafety;
     }
 
+    public Boolean getLogNamespaces() {
+        return logNamespaces;
+    }
+
+    public void setLogNamespaces(Boolean logNamespaces) {
+        this.logNamespaces = logNamespaces;
+    }
+
+    public String getHeaderName() {
+        return headerName;
+    }
+
+    public void setHeaderName(String headerName) {
+        this.headerName = headerName;
+    }
+
+    private boolean isUseSaxon() {
+        return useSaxon != null && useSaxon;
+    }
+
     protected void configureBuilder(XPathBuilder builder) {
         if (threadSafety != null) {
             builder.setThreadSafety(threadSafety);
@@ -103,6 +121,12 @@ public class XPathLanguage extends LanguageSupport {
         if (resultType != null) {
             builder.setResultQName(resultType);
         }
+        if (logNamespaces != null) {
+            builder.setLogNamespaces(logNamespaces);
+        }
+        if (headerName != null) {
+            builder.setHeaderName(headerName);
+        }
 
         if (isUseSaxon()) {
             builder.enableSaxon();
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java b/core/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
index e832601..27ec20d 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
@@ -27,7 +27,6 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.util.ObjectHelper;
 
@@ -246,7 +245,7 @@ public class XPathExpression extends NamespaceAwareExpression {
             setProperty(expression, "resultType", resultType);
         }
         if (isSaxon) {
-            ObjectHelper.cast(XPathBuilder.class, expression).enableSaxon();
+            setProperty(expression, "useSaxon", true);
         }
         if (xpathFactory != null) {
             setProperty(expression, "xPathFactory", xpathFactory);
@@ -258,10 +257,10 @@ public class XPathExpression extends NamespaceAwareExpression {
             setProperty(expression, "threadSafety", threadSafety);
         }
         if (isLogNamespaces) {
-            ObjectHelper.cast(XPathBuilder.class, expression).setLogNamespaces(true);
+            setProperty(expression, "logNamespaces", true);
         }
         if (ObjectHelper.isNotEmpty(getHeaderName())) {
-            ObjectHelper.cast(XPathBuilder.class, expression).setHeaderName(getHeaderName());
+            setProperty(expression, "headerName", getHeaderName());
         }
         // moved the super configuration to the bottom so that the namespace init picks up the newly set XPath Factory
         super.configureExpression(camelContext, expression);
@@ -279,7 +278,7 @@ public class XPathExpression extends NamespaceAwareExpression {
             setProperty(predicate, "resultType", resultType);
         }
         if (isSaxon) {
-            ObjectHelper.cast(XPathBuilder.class, predicate).enableSaxon();
+            setProperty(predicate, "useSaxon", true);
         }
         if (xpathFactory != null) {
             setProperty(predicate, "xPathFactory", xpathFactory);
@@ -291,10 +290,10 @@ public class XPathExpression extends NamespaceAwareExpression {
             setProperty(predicate, "threadSafety", threadSafety);
         }
         if (isLogNamespaces) {
-            ObjectHelper.cast(XPathBuilder.class, predicate).setLogNamespaces(true);
+            setProperty(predicate, "logNamespaces", true);
         }
         if (ObjectHelper.isNotEmpty(getHeaderName())) {
-            ObjectHelper.cast(XPathBuilder.class, predicate).setHeaderName(getHeaderName());
+            setProperty(predicate, "headerName", getHeaderName());
         }
         // moved the super configuration to the bottom so that the namespace init picks up the newly set XPath Factory
         super.configurePredicate(camelContext, predicate);


[camel] 04/10: CAMEL-13442: camel3 - Move xpath out of camel-core

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7695931c7d879cd99b651cc3c135e2170f8a5404
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 11:03:31 2019 +0200

    CAMEL-13442: camel3 - Move xpath out of camel-core
---
 MIGRATION.md                                       |   7 +
 components/camel-saxon/pom.xml                     |   1 +
 .../saxon/XPathAnnotationResultTypeTest.java       |   2 +-
 .../org/apache/camel/builder/saxon/XPathTest.java  |   2 +-
 .../xquery/XQueryPredicateFilterTest.java          |   4 +-
 .../camel/converter/saxon/SaxonConverterTest.java  |   4 +-
 .../xpath/XPathHeaderEnableSaxonJavaDslTest.java   |   4 +-
 .../xpath/XPathLanguageDefaultSettingsTest.xml     |   2 +-
 components/camel-xpath/pom.xml                     |  45 +++++
 .../language/xpath}/DefaultNamespaceContext.java   |   2 +-
 .../language/xpath/InvalidXPathException.java      |   6 +-
 .../language/xpath}/MessageVariableResolver.java   |   2 +-
 .../camel/language/xpath}/ThreadSafeNodeList.java  |  10 +-
 .../org/apache/camel/language/xpath}/XPath.java    |   3 +-
 .../xpath}/XPathAnnotationExpressionFactory.java   |   3 +-
 .../apache/camel/language/xpath}/XPathBuilder.java |  15 +-
 .../apache/camel/language/xpath/XPathLanguage.java |   1 -
 .../org/apache/camel/language/xpath/package.html   |   0
 components/pom.xml                                 |   1 +
 core/camel-core/pom.xml                            |   4 +
 .../org/apache/camel/builder/BuilderSupport.java   |  40 +++-
 .../java/org/apache/camel/builder/xml/package.html |  29 ---
 .../apache/camel/model/ExpressionNodeHelper.java   |  15 +-
 .../builder/xml/DefaultNamespaceContextTest.java   |   2 +
 .../apache/camel/builder/xml/XPathFeatureTest.java |   2 +-
 .../apache/camel/builder/xml/XPathMockTest.java    |   2 +-
 .../camel/builder/xml/XPathNamespaceTest.java      |   2 +-
 .../org/apache/camel/builder/xml/XPathTest.java    |   6 +-
 .../camel/builder/xml/XPathTransformTest.java      |   2 +-
 .../xml/XPathWithNamespacesFromDomTest.java        |   2 +
 ...BeanWithXPathInjectionUsingHeaderValueTest.java |   2 +-
 .../BeanWithXPathInjectionUsingResultTypeTest.java |   2 +-
 .../camel/component/dataset/CustomDataSetTest.java |   2 +-
 .../camel/component/mock/MockEndpointTest.java     |   2 +-
 .../org/apache/camel/component/xslt/MyXPath.java   |   2 +-
 .../apache/camel/issues/SetHeaderIssueTest.java    |   4 +-
 .../apache/camel/issues/XPathSplitStreamTest.java  |   7 +-
 .../BeanOgnMethodWithXPathInjectionTest.java       |   2 +-
 .../processor/BeanWithXPathInjectionTest.java      |   2 +-
 .../org/apache/camel/processor/ClaimCheckTest.java |   2 +-
 .../org/apache/camel/processor/MyNormalizer.java   |   2 +-
 .../camel/processor/SplitterStreamCacheTest.java   |   3 +-
 ...ithNamespaceBuilderFilterAndResultTypeTest.java |   2 +-
 .../XPathWithNamespaceBuilderFilterTest.java       |   2 +-
 .../camel/util/DumpModelAsXmlNamespaceTest.java    |   8 +-
 .../toolbox/FlexibleAggregationStrategiesTest.java |   5 +-
 parent/pom.xml                                     |  10 +
 .../karaf/features/src/main/resources/features.xml |   1 +
 .../components-starter/camel-xpath-starter/pom.xml |  53 ++++++
 .../springboot/XPathLanguageAutoConfiguration.java | 117 ++++++++++++
 .../springboot/XPathLanguageConfiguration.java     | 132 ++++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt        | 203 +++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt         |  11 ++
 .../src/main/resources/META-INF/spring.factories   |  19 ++
 .../src/main/resources/META-INF/spring.provides    |  17 ++
 platforms/spring-boot/components-starter/pom.xml   |   1 +
 56 files changed, 737 insertions(+), 96 deletions(-)

diff --git a/MIGRATION.md b/MIGRATION.md
index 6883dc8..533d903 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -53,6 +53,7 @@ We have also modularized many of the core components and moved them out of `came
 - camel-timer
 - camel-validator
 - camel-vm
+- camel-xpath
 - camel-xslt
 
 
@@ -213,6 +214,12 @@ The class `org.apache.camel.processor.loadbalancer.SimpleLoadBalancerSupport` ha
 
 The class `org.apache.camel.management.JmxSystemPropertyKeys` has been moved to `org.apache.camel.api.management.JmxSystemPropertyKeys`.
 
+The class `org.apache.camel.builder.xml.XPathBuilder` has been moved to `org.apache.camel.language.xpath.XPathBuilder` and in the `camel-xpath` JAR.
+
+The annotation `org.apache.camel.language.XPath` has been moved to `org.apache.camel.language.xpath.XPath` and in the `camel-xpath` JAR.
+
+The exception `org.apache.camel.builder.xml.InvalidXPathExpression` has been renamed to `org.apache.camel.language.xpath.InvalidXPathException` and in the `camel-xpath` JAR.
+
 #### camel-test
 
 If you are using camel-test and override the `createRegistry` method, for example to register beans from the `JndiRegisty` class, then this is no longer necessary, and instead
diff --git a/components/camel-saxon/pom.xml b/components/camel-saxon/pom.xml
index 4ec9273..9ef3b31 100644
--- a/components/camel-saxon/pom.xml
+++ b/components/camel-saxon/pom.xml
@@ -40,6 +40,7 @@
 
     <dependencies>
 
+        <!-- TODO: camel-xpath and avoid the IOConverter dependency -->
         <!-- requires camel-core -->
         <dependency>
             <groupId>org.apache.camel</groupId>
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
index bc4e7bf..b6867ef 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
@@ -20,7 +20,7 @@ import javax.xml.xpath.XPathFactory;
 
 import net.sf.saxon.lib.NamespaceConstant;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
index eb2a691..fc5f102 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.builder.saxon;
 import javax.xml.xpath.XPathFactory;
 
 import net.sf.saxon.xpath.XPathFactoryImpl;
-import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java
index f23697e..d3c3b49 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java
@@ -20,8 +20,8 @@ import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -29,7 +29,7 @@ import org.junit.Test;
 @Ignore("Fixed me later")
 public class XQueryPredicateFilterTest extends CamelTestSupport {
     
-    @EndpointInject(uri = "mock:result") 
+    @EndpointInject("mock:result")
     protected MockEndpoint resultEndpoint; 
 
     @Produce(uri = "direct:xpath") 
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java b/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
index f9d0ff4..25bf285 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
@@ -34,7 +34,7 @@ import net.sf.saxon.trans.XPathException;
 import net.sf.saxon.xpath.XPathEvaluator;
 import org.apache.camel.Exchange;
 import org.apache.camel.StringSource;
-import org.apache.camel.builder.xml.DefaultNamespaceContext;
+import org.apache.camel.language.xpath.DefaultNamespaceContext;
 import org.apache.camel.support.DefaultExchange;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Before;
@@ -43,7 +43,7 @@ import org.junit.Test;
 public class SaxonConverterTest extends CamelTestSupport {
     private static final String CONTENT = "<a xmlns=\"http://www.apache.org/test\"><b foo=\"bar\">test</b><c><d>foobar</d></c></a>";
     private static final String CONTENT_B = "<b xmlns=\"http://www.apache.org/test\" foo=\"bar\">test</b>";
-    private static final NamespaceContext NS_CONTEXT = (new DefaultNamespaceContext()).add("ns1", "http://www.apache.org/test");
+    private static final NamespaceContext NS_CONTEXT = new DefaultNamespaceContext().add("ns1", "http://www.apache.org/test");
 
     private Exchange exchange;
     private XPathEvaluator evaluator;
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathHeaderEnableSaxonJavaDslTest.java b/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathHeaderEnableSaxonJavaDslTest.java
index 1d131a7..0803fe5 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathHeaderEnableSaxonJavaDslTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathHeaderEnableSaxonJavaDslTest.java
@@ -62,9 +62,9 @@ public class XPathHeaderEnableSaxonJavaDslTest extends CamelTestSupport {
             public void configure() throws Exception {
                 from("direct:in")
                     .choice()
-                        .when(xpath("$type = 'Camel'").saxon())
+                        .when(XPathBuilder.xpath("$type = 'Camel'").saxon())
                             .to("mock:camel")
-                        .when(xpath("//name = 'Kong'").saxon())
+                        .when(XPathBuilder.xpath("//name = 'Kong'").saxon())
                             .to("mock:donkey")
                         .otherwise()
                             .to("mock:other");
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageDefaultSettingsTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageDefaultSettingsTest.xml
index 67e14ce..b8a811e 100644
--- a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageDefaultSettingsTest.xml
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageDefaultSettingsTest.xml
@@ -35,7 +35,7 @@
     <route>
       <from uri="seda:testDefaultXPathSettings"/>
       <onException useOriginalMessage="true">
-        <exception>org.apache.camel.builder.xml.InvalidXPathExpression</exception>
+        <exception>org.apache.camel.language.xpath.InvalidXPathException</exception>
         <handled>
           <constant>true</constant>
         </handled>
diff --git a/components/camel-xpath/pom.xml b/components/camel-xpath/pom.xml
new file mode 100644
index 0000000..fd54835
--- /dev/null
+++ b/components/camel-xpath/pom.xml
@@ -0,0 +1,45 @@
+<?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.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-xpath</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Camel :: XPath</name>
+    <description>Camel XPath language</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+    </dependencies>
+</project>
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/DefaultNamespaceContext.java
similarity index 99%
rename from core/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/DefaultNamespaceContext.java
index 2a8355f..11671f3 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/DefaultNamespaceContext.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.builder.xml;
+package org.apache.camel.language.xpath;
 
 import java.util.HashMap;
 import java.util.HashSet;
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/xml/InvalidXPathExpression.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/InvalidXPathException.java
similarity index 87%
rename from core/camel-core/src/main/java/org/apache/camel/builder/xml/InvalidXPathExpression.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/InvalidXPathException.java
index bd75acd..34efcf4 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/xml/InvalidXPathExpression.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/InvalidXPathException.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.builder.xml;
+package org.apache.camel.language.xpath;
 
 import javax.xml.xpath.XPathException;
 
@@ -23,12 +23,12 @@ import org.apache.camel.RuntimeExpressionException;
 /**
  * An exception thrown if am XPath expression could not be parsed or evaluated
  */
-public class InvalidXPathExpression extends RuntimeExpressionException {
+public class InvalidXPathException extends RuntimeExpressionException {
     private static final long serialVersionUID = 9171451033826915273L;
 
     private final String xpath;
 
-    public InvalidXPathExpression(String xpath, XPathException e) {
+    public InvalidXPathException(String xpath, XPathException e) {
         super("Invalid xpath: " + xpath + ". Reason: " + e, e);
         this.xpath = xpath;
     }
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/xml/MessageVariableResolver.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/MessageVariableResolver.java
similarity index 99%
rename from core/camel-core/src/main/java/org/apache/camel/builder/xml/MessageVariableResolver.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/MessageVariableResolver.java
index 8ae9914..3814e00 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/xml/MessageVariableResolver.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/MessageVariableResolver.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.builder.xml;
+package org.apache.camel.language.xpath;
 
 import java.util.HashMap;
 import java.util.Map;
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/jaxp/ThreadSafeNodeList.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/ThreadSafeNodeList.java
similarity index 90%
rename from core/camel-base/src/main/java/org/apache/camel/converter/jaxp/ThreadSafeNodeList.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/ThreadSafeNodeList.java
index 1263021..7c0c83b 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/jaxp/ThreadSafeNodeList.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/ThreadSafeNodeList.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.converter.jaxp;
+package org.apache.camel.language.xpath;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -24,14 +24,16 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 
+import org.apache.camel.support.builder.xml.XMLConverterHelper;
+
 /**
- * A simple thread-safe {@link NodeList} that is used by {@link org.apache.camel.builder.xml.XPathBuilder}
+ * A simple thread-safe {@link NodeList} that is used by XPathBuilder
  * to return thread-safe {@link NodeList} instances as its result.
  * <p/>
  * This is needed to ensure that end users do not hit any concurrency issues while working
  * with xpath expressions using built-in from the JDK or via camel-saxon.
  */
-public class ThreadSafeNodeList implements NodeList {
+class ThreadSafeNodeList implements NodeList {
 
     private final List<Node> list = new ArrayList<>();
 
@@ -56,7 +58,7 @@ public class ThreadSafeNodeList implements NodeList {
                 // import node must not occur concurrent on the same node (must be its owner)
                 // so we need to synchronize on it
                 synchronized (node.getOwnerDocument()) {
-                    Document doc = new XmlConverter().createDocument();
+                    Document doc = new XMLConverterHelper().createDocument();
                     // import node must not occur concurrent on the same node (must be its owner)
                     // so we need to synchronize on it
                     synchronized (node.getOwnerDocument()) {
diff --git a/core/camel-core/src/main/java/org/apache/camel/language/XPath.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPath.java
similarity index 95%
rename from core/camel-core/src/main/java/org/apache/camel/language/XPath.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPath.java
index 6523b9b..053d8a7 100644
--- a/core/camel-core/src/main/java/org/apache/camel/language/XPath.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPath.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.language;
+package org.apache.camel.language.xpath;
 
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
@@ -22,7 +22,6 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-import org.apache.camel.component.bean.XPathAnnotationExpressionFactory;
 import org.apache.camel.support.language.LanguageAnnotation;
 import org.apache.camel.support.language.NamespacePrefix;
 
diff --git a/core/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathAnnotationExpressionFactory.java
similarity index 97%
rename from core/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathAnnotationExpressionFactory.java
index e03efd1..221e63f 100644
--- a/core/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathAnnotationExpressionFactory.java
@@ -14,13 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.bean;
+package org.apache.camel.language.xpath;
 
 import java.lang.annotation.Annotation;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Expression;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.support.language.DefaultAnnotationExpressionFactory;
 import org.apache.camel.support.language.LanguageAnnotation;
 import org.apache.camel.support.language.NamespacePrefix;
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
similarity index 99%
rename from core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
index b60de21..d5c8a09 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.builder.xml;
+package org.apache.camel.language.xpath;
 
 import java.io.File;
 import java.io.InputStream;
@@ -55,7 +55,6 @@ import org.apache.camel.Predicate;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.RuntimeExpressionException;
 import org.apache.camel.WrappedFile;
-import org.apache.camel.converter.jaxp.ThreadSafeNodeList;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.NamespaceAware;
 import org.apache.camel.support.DefaultExchange;
@@ -864,10 +863,7 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
         this.factoryClassName = factoryClassName;
     }
 
-    // Implementation methods
-    // -------------------------------------------------------------------------
-
-    protected Object evaluate(Exchange exchange) {
+    public Object evaluate(Exchange exchange) {
         Object answer = evaluateAs(exchange, resultQName);
         if (resultType != null) {
             return ExchangeHelper.convertToType(exchange, resultType, answer);
@@ -875,6 +871,9 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
         return answer;
     }
 
+    // Implementation methods
+    // -------------------------------------------------------------------------
+
     /**
      * Evaluates the expression as the given result type
      */
@@ -887,7 +886,7 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
             try {
                 xpathExpression = createXPathExpression();
             } catch (XPathExpressionException e) {
-                throw new InvalidXPathExpression(getText(), e);
+                throw new InvalidXPathException(getText(), e);
             } catch (Exception e) {
                 throw new RuntimeExpressionException("Cannot create xpath expression", e);
             }
@@ -1045,7 +1044,7 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
             if (ObjectHelper.isNotEmpty(getHeaderName())) {
                 message = message + " with headerName " + getHeaderName();
             }
-            throw new InvalidXPathExpression(message, e);
+            throw new InvalidXPathException(message, e);
         } finally {
             // IOHelper can handle if is is null
             IOHelper.close(is);
diff --git a/core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
similarity index 98%
rename from core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
index c9b7ebd..e05e5e4 100644
--- a/core/camel-core/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathLanguage.java
@@ -21,7 +21,6 @@ import javax.xml.xpath.XPathFactory;
 
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.spi.annotations.Language;
 import org.apache.camel.support.LanguageSupport;
 
diff --git a/core/camel-core/src/main/java/org/apache/camel/language/xpath/package.html b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/package.html
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/language/xpath/package.html
rename to components/camel-xpath/src/main/java/org/apache/camel/language/xpath/package.html
diff --git a/components/pom.xml b/components/pom.xml
index f11591f..a1676a1 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -51,6 +51,7 @@
         <module>camel-timer</module>
         <module>camel-validator</module>
         <module>camel-vm</module>
+        <module>camel-xpath</module>
 
         <!-- we want to test these modules first to catch any errors early as possible -->
         <module>camel-test</module>
diff --git a/core/camel-core/pom.xml b/core/camel-core/pom.xml
index a789e94..37111d6 100644
--- a/core/camel-core/pom.xml
+++ b/core/camel-core/pom.xml
@@ -175,6 +175,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xpath</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
             <artifactId>camel-xslt</artifactId>
         </dependency>
 
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java b/core/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
index 7547a4a..2bbc804 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
@@ -19,17 +19,19 @@ package org.apache.camel.builder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Expression;
 import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.language.ExchangePropertyExpression;
 import org.apache.camel.model.language.HeaderExpression;
 import org.apache.camel.model.language.JsonPathExpression;
+import org.apache.camel.model.language.XPathExpression;
+import org.apache.camel.support.builder.xml.Namespaces;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -163,8 +165,8 @@ public abstract class BuilderSupport {
      * @param value the XPath expression
      * @return the builder
      */
-    public XPathBuilder xpath(String value) {
-        return xpath(value, null);
+    public ValueBuilder xpath(String value) {
+        return xpath(value, null, null);
     }
 
     /**
@@ -174,14 +176,42 @@ public abstract class BuilderSupport {
      * @param resultType the result type that the XPath expression will return.
      * @return the builder
      */
-    public XPathBuilder xpath(String value, Class<?> resultType) {
+    public ValueBuilder xpath(String value, Class<?> resultType) {
+        return xpath(value, resultType, null);
+    }
+
+    /**
+     * Returns a xpath expression value builder
+     *
+     * @param value      the XPath expression
+     * @param namespaces namespace mappings
+     * @return the builder
+     */
+    public ValueBuilder xpath(String value, Namespaces namespaces) {
+        return xpath(value, null, namespaces);
+    }
+
+    /**
+     * Returns a xpath expression value builder
+     *
+     * @param value      the XPath expression
+     * @param resultType the result type that the XPath expression will return.
+     * @param namespaces namespace mappings
+     * @return the builder
+     */
+    public ValueBuilder xpath(String value, Class<?> resultType, Namespaces namespaces) {
         // the value may contain property placeholders as it may be used directly from Java DSL
         try {
             value = getContext().resolvePropertyPlaceholders(value);
         } catch (Exception e) {
             throw RuntimeCamelException.wrapRuntimeCamelException(e);
         }
-        return XPathBuilder.xpath(value, resultType);
+        XPathExpression exp = new XPathExpression(value);
+        exp.setResultType(resultType);
+        if (namespaces != null) {
+            exp.setNamespaces(namespaces.getNamespaces());
+        }
+        return new ValueBuilder(exp);
     }
 
     /**
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/xml/package.html b/core/camel-core/src/main/java/org/apache/camel/builder/xml/package.html
deleted file mode 100644
index 39f30b1..0000000
--- a/core/camel-core/src/main/java/org/apache/camel/builder/xml/package.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-
-    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.
-
--->
-<html>
-<head>
-</head>
-<body>
-
-Support for XPath based <a href="http://camel.apache.org/expression.html">Expressions</a>
-and <a href="http://camel.apache.org/predicate.html">Predicates</a> as well as
-<a href="http://camel.apache.org/xslt.html">an XSLT processor</a>
-
-</body>
-</html>
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java b/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java
index f2b4572..ac18235 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java
@@ -20,7 +20,6 @@ import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.SimpleBuilder;
 import org.apache.camel.builder.ValueBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.model.language.ExpressionDefinition;
 import org.apache.camel.model.language.SimpleExpression;
 import org.apache.camel.model.language.XPathExpression;
@@ -50,13 +49,16 @@ public final class ExpressionNodeHelper {
             answer.setExpression(builder.getText());
             answer.setResultType(builder.getResultType());
             return answer;
-        } else if (expression instanceof XPathBuilder) {
+
+            // TODO: Make some kind of resulttype expression so we can use an interface to set both kinds
+
+/*        } else if (expression instanceof XPathBuilder) {
             XPathBuilder builder = (XPathBuilder) expression;
             // we keep the original expression by using the constructor that accepts an expression
             XPathExpression answer = new XPathExpression(builder);
             answer.setExpression(builder.getText());
             answer.setResultType(builder.getResultType());
-            return answer;
+            return answer;*/
         } else if (expression instanceof ValueBuilder) {
             // ValueBuilder wraps the actual expression so unwrap
             ValueBuilder builder = (ValueBuilder) expression;
@@ -85,12 +87,15 @@ public final class ExpressionNodeHelper {
             SimpleExpression answer = new SimpleExpression(builder);
             answer.setExpression(builder.getText());
             return answer;
-        } else if (predicate instanceof XPathBuilder) {
+
+            // TODO: Make some kind of resulttype expression so we can use an interface to set both kinds
+
+/*        } else if (predicate instanceof XPathBuilder) {
             XPathBuilder builder = (XPathBuilder) predicate;
             // we keep the original expression by using the constructor that accepts an expression
             XPathExpression answer = new XPathExpression(builder);
             answer.setExpression(builder.getText());
-            return answer;
+            return answer;*/
         } else if (predicate instanceof ValueBuilder) {
             // ValueBuilder wraps the actual predicate so unwrap
             ValueBuilder builder = (ValueBuilder) predicate;
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/DefaultNamespaceContextTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/DefaultNamespaceContextTest.java
index bbb3023..495318f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/DefaultNamespaceContextTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/DefaultNamespaceContextTest.java
@@ -21,6 +21,8 @@ import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.language.xpath.DefaultNamespaceContext;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.support.builder.xml.Namespaces;
 import org.junit.Test;
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
index 0dbe735..c3e19ba 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
@@ -28,7 +28,7 @@ import org.apache.camel.TypeConversionException;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.junit.Test;
 
-import static org.apache.camel.builder.xml.XPathBuilder.xpath;
+import static org.apache.camel.language.xpath.XPathBuilder.xpath;
 
 public class XPathFeatureTest extends ContextTestSupport {
     public static final String DOM_BUILDER_FACTORY_FEATURE = XmlConverter.DOCUMENT_BUILDER_FACTORY_FEATURE;
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathMockTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathMockTest.java
index 7c76e47..207a66d 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathMockTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathMockTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
 
 import static org.apache.camel.builder.PredicateBuilder.not;
-import static org.apache.camel.builder.xml.XPathBuilder.xpath;
+import static org.apache.camel.language.xpath.XPathBuilder.xpath;
 
 public class XPathMockTest extends ContextTestSupport {
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathNamespaceTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathNamespaceTest.java
index 6f587db..0e3734b 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathNamespaceTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathNamespaceTest.java
@@ -63,7 +63,7 @@ public class XPathNamespaceTest extends ContextTestSupport {
                 Namespaces ns = new Namespaces("c", "http://acme.com/cheese");
 
                 from("direct:in").choice()
-                    .when(xpath("/c:number = 55", Integer.class).namespaces(ns))
+                    .when(xpath("/c:number = 55", Integer.class, ns))
                         .to("mock:55")
                     .otherwise()
                         .to("mock:other")
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java
index 7a3dbe0..2000a3b 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java
@@ -41,11 +41,13 @@ import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
+import org.apache.camel.language.xpath.InvalidXPathException;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.support.builder.xml.Namespaces;
 import org.apache.camel.util.StringHelper;
 import org.junit.Test;
 
-import static org.apache.camel.builder.xml.XPathBuilder.xpath;
+import static org.apache.camel.language.xpath.XPathBuilder.xpath;
 
 public class XPathTest extends ContextTestSupport {
 
@@ -83,7 +85,7 @@ public class XPathTest extends ContextTestSupport {
         try {
             assertPredicate("/foo/", "<foo><bar xyz='cheese'/></foo>", true);
             fail("Should have thrown exception");
-        } catch (InvalidXPathExpression e) {
+        } catch (InvalidXPathException e) {
             assertEquals("/foo/", e.getXpath());
             assertIsInstanceOf(XPathExpressionException.class, e.getCause());
         }
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java
index 85e2b2a..2b24571 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java
@@ -23,6 +23,7 @@ import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.junit.Test;
 import org.slf4j.Logger;
 
@@ -34,7 +35,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.mockito.hamcrest.MockitoHamcrest.argThat;
 
-
 public class XPathTransformTest extends ContextTestSupport {
 
     @Override
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java
index 91fc2b2..e30b52a 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java
@@ -20,6 +20,8 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.language.xpath.DefaultNamespaceContext;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.support.builder.xml.Namespaces;
 import org.junit.Test;
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingHeaderValueTest.java b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingHeaderValueTest.java
index cfb3780..52c9be3 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingHeaderValueTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingHeaderValueTest.java
@@ -20,7 +20,7 @@ import javax.naming.Context;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Handler;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.apache.camel.support.jndi.JndiContext;
 import org.junit.Test;
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingResultTypeTest.java b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingResultTypeTest.java
index f649a85..ba431d9 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingResultTypeTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithXPathInjectionUsingResultTypeTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.bean;
 import javax.naming.Context;
 
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.apache.camel.support.jndi.JndiContext;
 import org.junit.Test;
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/dataset/CustomDataSetTest.java b/core/camel-core/src/test/java/org/apache/camel/component/dataset/CustomDataSetTest.java
index c5ff258..ed3bf8f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/dataset/CustomDataSetTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/dataset/CustomDataSetTest.java
@@ -25,7 +25,7 @@ import org.apache.camel.Predicate;
 import org.apache.camel.builder.ExpressionBuilder;
 import org.apache.camel.builder.PredicateBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.support.PredicateAssertHelper;
 import org.junit.Test;
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java b/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
index 6e7a890..8ebc2e5 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
@@ -31,8 +31,8 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.ExpressionBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.junit.Test;
 
 public class MockEndpointTest extends ContextTestSupport {
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/xslt/MyXPath.java b/core/camel-core/src/test/java/org/apache/camel/component/xslt/MyXPath.java
index 88f3b95..dfa0173 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/xslt/MyXPath.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/xslt/MyXPath.java
@@ -24,7 +24,7 @@ import java.lang.annotation.Target;
 
 import org.w3c.dom.NodeList;
 
-import org.apache.camel.component.bean.XPathAnnotationExpressionFactory;
+import org.apache.camel.language.xpath.XPathAnnotationExpressionFactory;
 import org.apache.camel.support.language.LanguageAnnotation;
 import org.apache.camel.support.language.NamespacePrefix;
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/issues/SetHeaderIssueTest.java b/core/camel-core/src/test/java/org/apache/camel/issues/SetHeaderIssueTest.java
index 5c8b9de..849bd8a 100644
--- a/core/camel-core/src/test/java/org/apache/camel/issues/SetHeaderIssueTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/issues/SetHeaderIssueTest.java
@@ -65,8 +65,8 @@ public class SetHeaderIssueTest extends ContextTestSupport {
 
                 from("direct:start").
                     unmarshal().string().
-                    setHeader("foo", xpath("/foo:person[@name='James']").namespaces(ns)).
-                    filter(xpath("/foo:person[@name='James']").namespaces(ns)).
+                    setHeader("foo", xpath("/foo:person[@name='James']", ns)).
+                    filter(xpath("/foo:person[@name='James']", ns)).
                         to("mock:result");
                 // END SNIPPET: example
             }
diff --git a/core/camel-core/src/test/java/org/apache/camel/issues/XPathSplitStreamTest.java b/core/camel-core/src/test/java/org/apache/camel/issues/XPathSplitStreamTest.java
index c491ba1..d139651 100644
--- a/core/camel-core/src/test/java/org/apache/camel/issues/XPathSplitStreamTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/issues/XPathSplitStreamTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 package org.apache.camel.issues;
+
 import org.xml.sax.InputSource;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.language.xpath.XPath;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -59,10 +62,12 @@ public class XPathSplitStreamTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                XPathBuilder personXPath = XPathBuilder.xpath("/persons/person").documentType(InputSource.class);
+
                 // START SNIPPET: e1
                 from("file://target/data/file/xpathsplit?initialDelay=0&delay=10")
                     // set documentType to org.xml.sax.InputSource then Camel will use SAX to split the file
-                    .split(xpath("/persons/person").documentType(InputSource.class)).streaming()
+                    .split(personXPath).streaming()
                     .to("mock:splitted");
                 // END SNIPPET: e1
             }
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/BeanOgnMethodWithXPathInjectionTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/BeanOgnMethodWithXPathInjectionTest.java
index 26f6690..d77da5b 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/BeanOgnMethodWithXPathInjectionTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/BeanOgnMethodWithXPathInjectionTest.java
@@ -20,7 +20,7 @@ import javax.naming.Context;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.apache.camel.support.jndi.JndiContext;
 import org.junit.Test;
 import org.slf4j.Logger;
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/BeanWithXPathInjectionTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/BeanWithXPathInjectionTest.java
index fb1e569..35be574 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/BeanWithXPathInjectionTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/BeanWithXPathInjectionTest.java
@@ -20,7 +20,7 @@ import javax.naming.Context;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.apache.camel.support.jndi.JndiContext;
 import org.junit.Test;
 import org.slf4j.Logger;
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckTest.java
index 335ae98..7ad1cab 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckTest.java
@@ -26,7 +26,7 @@ import org.apache.camel.Header;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.junit.Test;
 
 public class ClaimCheckTest extends ContextTestSupport {
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/MyNormalizer.java b/core/camel-core/src/test/java/org/apache/camel/processor/MyNormalizer.java
index e8310a4..4c73f82 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/MyNormalizer.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/MyNormalizer.java
@@ -17,7 +17,7 @@
 package org.apache.camel.processor;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 
 // START SNIPPET: example   
 public class MyNormalizer {
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
index 36901ac..f4e4775 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
@@ -22,7 +22,6 @@ import javax.xml.transform.stream.StreamSource;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
 
@@ -51,7 +50,7 @@ public class SplitterStreamCacheTest extends ContextTestSupport {
                 context.getStreamCachingStrategy().setSpoolThreshold(-1);
 
                 from("seda:parallel?concurrentConsumers=5").streamCaching()
-                    .split(XPathBuilder.xpath("//person/city"))
+                    .split(xpath("//person/city"))
                         .to("mock:result");
             }
         };
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterAndResultTypeTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterAndResultTypeTest.java
index 509330c..a770d4f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterAndResultTypeTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterAndResultTypeTest.java
@@ -31,7 +31,7 @@ public class XPathWithNamespaceBuilderFilterAndResultTypeTest extends XPathWithN
 
                 // now lets create an xpath based Message Filter
                 from("direct:start").
-                        filter(xpath("/c:person[@name='James']", String.class).namespaces(ns)).
+                        filter(xpath("/c:person[@name='James']", String.class, ns)).
                         to("mock:result");
                 // END SNIPPET: example
             }
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java
index c61eb54..318f8b9 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java
@@ -67,7 +67,7 @@ public class XPathWithNamespaceBuilderFilterTest extends ContextTestSupport {
 
                 // now lets create an xpath based Message Filter
                 from("direct:start").
-                        filter(xpath("/c:person[@name='James']").namespaces(ns)).
+                        filter(xpath("/c:person[@name='James']", ns)).
                         to("mock:result");
                 // END SNIPPET: example
             }
diff --git a/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java b/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java
index 86ba7a3..b43cab4 100644
--- a/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java
@@ -22,6 +22,7 @@ import org.w3c.dom.Element;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.model.ModelHelper;
+import org.apache.camel.support.builder.xml.Namespaces;
 import org.junit.Test;
 
 public class DumpModelAsXmlNamespaceTest extends ContextTestSupport {
@@ -52,10 +53,13 @@ public class DumpModelAsXmlNamespaceTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                Namespaces foo = new Namespaces("foo", URL_FOO);
+                Namespaces bar = new Namespaces("bar", URL_BAR);
+
                 from("direct:start").routeId("myRoute")
                     .choice()
-                        .when(xpath("/foo:customer").namespace("foo", URL_FOO)).to("mock:foo")
-                        .when(xpath("/bar:customer").namespace("bar", URL_BAR)).to("mock:bar");
+                        .when(xpath("/foo:customer", foo)).to("mock:foo")
+                        .when(xpath("/bar:customer", bar)).to("mock:bar");
             }
         };
     }
diff --git a/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java b/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
index c235080..4535818 100644
--- a/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
@@ -37,6 +37,7 @@ import org.apache.camel.builder.FlexibleAggregationStrategy.CompletionAwareMixin
 import org.apache.camel.builder.FlexibleAggregationStrategy.TimeoutAwareMixin;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.junit.Test;
 
 /**
@@ -297,10 +298,10 @@ public class FlexibleAggregationStrategiesTest extends ContextTestSupport {
                     .aggregate(timeoutCompletionStrategy).constant(true)
                     .completionTimeout(500).completionSize(2)
                     .to("mock:result.timeoutAndCompletionAware");
-                
+
                 from("direct:start.xpath1")
                     .aggregate(AggregationStrategies.flexible(Node.class)
-                            .pick(xpath("//result[1]").nodeResult())
+                            .pick(XPathBuilder.xpath("//result[1]").nodeResult())
                             .accumulateInCollection(ArrayList.class))
                         .constant(true).completionSize(3)
                     .to("mock:result.xpath1");
diff --git a/parent/pom.xml b/parent/pom.xml
index 27dc97e..9cd84cb 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2345,6 +2345,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-xpath</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-xslt</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -3754,6 +3759,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-xpath-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-xslt-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index ebe9496..504dcf9 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -76,6 +76,7 @@
     <bundle>mvn:org.apache.camel/camel-timer/${project.version}</bundle>
     <bundle>mvn:org.apache.camel/camel-validator/${project.version}</bundle>
     <bundle>mvn:org.apache.camel/camel-vm/${project.version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-xpath/${project.version}</bundle>
     <bundle>mvn:org.apache.camel/camel-xslt/${project.version}</bundle>
     <conditional>
       <condition>shell</condition>
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/pom.xml b/platforms/spring-boot/components-starter/camel-xpath-starter/pom.xml
new file mode 100644
index 0000000..09d0808
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/pom.xml
@@ -0,0 +1,53 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-xpath-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: XPath</name>
+  <description>Spring-Boot Starter for Camel XPath language</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-xpath</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <!--START OF GENERATED CODE-->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <!--END OF GENERATED CODE-->
+  </dependencies>
+</project>
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java
new file mode 100644
index 0000000..8936f9f
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java
@@ -0,0 +1,117 @@
+/*
+ * 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.language.xpath.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.language.xpath.XPathLanguage;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spi.LanguageCustomizer;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.LanguageConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Scope;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+        XPathLanguageAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@EnableConfigurationProperties({LanguageConfigurationProperties.class,
+        XPathLanguageConfiguration.class})
+public class XPathLanguageAutoConfiguration {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(XPathLanguageAutoConfiguration.class);
+    @Autowired
+    private ApplicationContext applicationContext;
+    @Autowired
+    private CamelContext camelContext;
+    @Autowired
+    private XPathLanguageConfiguration configuration;
+    @Autowired(required = false)
+    private List<LanguageCustomizer<XPathLanguage>> customizers;
+
+    static class GroupConditions extends GroupCondition {
+        public GroupConditions() {
+            super("camel.component", "camel.component.xpath");
+        }
+    }
+
+    @Bean(name = "xpath-language")
+    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+    @ConditionalOnMissingBean(XPathLanguage.class)
+    public XPathLanguage configureXPathLanguage() throws Exception {
+        XPathLanguage language = new XPathLanguage();
+        if (CamelContextAware.class.isAssignableFrom(XPathLanguage.class)) {
+            CamelContextAware contextAware = CamelContextAware.class
+                    .cast(language);
+            if (contextAware != null) {
+                contextAware.setCamelContext(camelContext);
+            }
+        }
+        Map<String, Object> parameters = new HashMap<>();
+        IntrospectionSupport.getProperties(configuration, parameters, null,
+                false);
+        CamelPropertiesHelper.setCamelProperties(camelContext, language,
+                parameters, false);
+        if (ObjectHelper.isNotEmpty(customizers)) {
+            for (LanguageCustomizer<XPathLanguage> customizer : customizers) {
+                boolean useCustomizer = (customizer instanceof HasId)
+                        ? HierarchicalPropertiesEvaluator.evaluate(
+                                applicationContext.getEnvironment(),
+                                "camel.language.customizer",
+                                "camel.language.xpath.customizer",
+                                ((HasId) customizer).getId())
+                        : HierarchicalPropertiesEvaluator.evaluate(
+                                applicationContext.getEnvironment(),
+                                "camel.language.customizer",
+                                "camel.language.xpath.customizer");
+                if (useCustomizer) {
+                    LOGGER.debug("Configure language {}, with customizer {}",
+                            language, customizer);
+                    customizer.customize(language);
+                }
+            }
+        }
+        return language;
+    }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
new file mode 100644
index 0000000..3e839da
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
@@ -0,0 +1,132 @@
+/*
+ * 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.language.xpath.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.LanguageConfigurationPropertiesCommon;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * To use XPath (XML) in Camel expressions or predicates.
+ * 
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.language.xpath")
+public class XPathLanguageConfiguration
+        extends
+            LanguageConfigurationPropertiesCommon {
+
+    /**
+     * Whether to enable auto configuration of the xpath language. This is
+     * enabled by default.
+     */
+    private Boolean enabled;
+    /**
+     * Name of class for document type The default value is org.w3c.dom.Document
+     */
+    private String documentType;
+    /**
+     * Whether to use Saxon.
+     */
+    private Boolean saxon = false;
+    /**
+     * References to a custom XPathFactory to lookup in the registry
+     */
+    private String factoryRef;
+    /**
+     * The XPath object model to use
+     */
+    private String objectModel;
+    /**
+     * Whether to log namespaces which can assist during trouble shooting
+     */
+    private Boolean logNamespaces = false;
+    /**
+     * Whether to enable thread-safety for the returned result of the xpath
+     * expression. This applies to when using NODESET as the result type, and
+     * the returned set has multiple elements. In this situation there can be
+     * thread-safety issues if you process the NODESET concurrently such as from
+     * a Camel Splitter EIP in parallel processing mode. This option prevents
+     * concurrency issues by doing defensive copies of the nodes. It is
+     * recommended to turn this option on if you are using camel-saxon or Saxon
+     * in your application. Saxon has thread-safety issues which can be
+     * prevented by turning this option on.
+     */
+    private Boolean threadSafety = false;
+    /**
+     * Whether to trim the value to remove leading and trailing whitespaces and
+     * line breaks
+     */
+    private Boolean trim = true;
+
+    public String getDocumentType() {
+        return documentType;
+    }
+
+    public void setDocumentType(String documentType) {
+        this.documentType = documentType;
+    }
+
+    public Boolean getSaxon() {
+        return saxon;
+    }
+
+    public void setSaxon(Boolean saxon) {
+        this.saxon = saxon;
+    }
+
+    public String getFactoryRef() {
+        return factoryRef;
+    }
+
+    public void setFactoryRef(String factoryRef) {
+        this.factoryRef = factoryRef;
+    }
+
+    public String getObjectModel() {
+        return objectModel;
+    }
+
+    public void setObjectModel(String objectModel) {
+        this.objectModel = objectModel;
+    }
+
+    public Boolean getLogNamespaces() {
+        return logNamespaces;
+    }
+
+    public void setLogNamespaces(Boolean logNamespaces) {
+        this.logNamespaces = logNamespaces;
+    }
+
+    public Boolean getThreadSafety() {
+        return threadSafety;
+    }
+
+    public void setThreadSafety(Boolean threadSafety) {
+        this.threadSafety = threadSafety;
+    }
+
+    public Boolean getTrim() {
+        return trim;
+    }
+
+    public void setTrim(Boolean trim) {
+        this.trim = trim;
+    }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..d9bd350
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.language.xpath.springboot.XPathLanguageAutoConfiguration
diff --git a/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..132bb20
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-xpath-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+provides: camel-xpath
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index f33fe41..4e0d82a 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -374,6 +374,7 @@
     <module>camel-xchange-starter</module>
     <module>camel-xmlsecurity-starter</module>
     <module>camel-xmpp-starter</module>
+    <module>camel-xpath-starter</module>
     <module>camel-xslt-starter</module>
     <module>camel-xstream-starter</module>
     <module>camel-yammer-starter</module>


[camel] 03/10: camel3 - Removed unused stuff in pom.xml for camel-base

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4aa7ba16daf67fb80fefc474e9fd737db04d532c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 09:49:24 2019 +0200

    camel3 - Removed unused stuff in pom.xml for camel-base
---
 core/camel-base/pom.xml | 94 -------------------------------------------------
 1 file changed, 94 deletions(-)

diff --git a/core/camel-base/pom.xml b/core/camel-base/pom.xml
index b01068a..e8237c9 100644
--- a/core/camel-base/pom.xml
+++ b/core/camel-base/pom.xml
@@ -87,100 +87,6 @@
             <optional>true</optional>
         </dependency>
 
-        <!-- testing -->
-        <dependency>
-            <groupId>org.codehaus.woodstox</groupId>
-            <artifactId>woodstox-core-asl</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.hamcrest</groupId>
-                    <artifactId>hamcrest-core</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.openjdk.jmh</groupId>
-            <artifactId>jmh-core</artifactId>
-            <version>1.21</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.openjdk.jmh</groupId>
-            <artifactId>jmh-generator-annprocess</artifactId>
-            <version>1.21</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>java-hamcrest</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.awaitility</groupId>
-            <artifactId>awaitility</artifactId>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.hamcrest</groupId>
-                    <artifactId>hamcrest-core</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.assertj</groupId>
-            <artifactId>assertj-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- logging -->
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-api</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- for json tests -->
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- validator -->
-        <dependency>
-            <groupId>xml-resolver</groupId>
-            <artifactId>xml-resolver</artifactId>
-            <version>${xml-resolver-version}</version>
-            <scope>test</scope>
-        </dependency>
-
     </dependencies>
 
     <build>


[camel] 07/10: CAMEL-13442: camel3 - Move xpath out of camel-core

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ce5533881a98b97959dd37cb64cbbdfded42eaab
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 12:20:13 2019 +0200

    CAMEL-13442: camel3 - Move xpath out of camel-core
---
 components/readme.adoc                             |   4 +-
 core/camel-core/readme.adoc                        |   4 +-
 docs/components/modules/ROOT/nav.adoc              |   1 +
 .../modules/ROOT/pages/xpath-language.adoc         | 494 +++++++++++++++++++++
 .../camel/example/management/StockService.java     |   2 +-
 .../pojo_messaging/DistributeRecordsBean.java      |   2 +-
 6 files changed, 500 insertions(+), 7 deletions(-)

diff --git a/components/readme.adoc b/components/readme.adoc
index 2b26ed7..7bc5231 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -1000,7 +1000,7 @@ Number of Data Formats: 46 in 36 JAR artifacts (0 deprecated)
 ==== Expression Languages
 
 // languages: START
-Number of Languages: 17 in 8 JAR artifacts (0 deprecated)
+Number of Languages: 17 in 9 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -1036,7 +1036,7 @@ Number of Languages: 17 in 8 JAR artifacts (0 deprecated)
 
 | link:../core/camel-core/src/main/docs/xtokenize-language.adoc[XML Tokenize] (camel-core) | 2.14 | To use Camel message body or header with a XML tokenizer in Camel expressions or predicates.
 
-| link:../core/camel-core/src/main/docs/xpath-language.adoc[XPath] (camel-core) | 1.1 | To use XPath (XML) in Camel expressions or predicates.
+| link:camel-xpath/src/main/docs/xpath-language.adoc[XPath] (camel-xpath) | 1.1 | To use XPath (XML) in Camel expressions or predicates.
 
 | link:camel-saxon/src/main/docs/xquery-language.adoc[XQuery] (camel-saxon) | 1.0 | To use XQuery (XML) in Camel expressions or predicates.
 |===
diff --git a/core/camel-core/readme.adoc b/core/camel-core/readme.adoc
index 10a8a5b..99e7c33 100644
--- a/core/camel-core/readme.adoc
+++ b/core/camel-core/readme.adoc
@@ -61,7 +61,7 @@ Number of Data Formats: 4 in 36 JAR artifacts (0 deprecated)
 
 
 // languages: START
-Number of Languages: 10 in 1 JAR artifacts (0 deprecated)
+Number of Languages: 9 in 1 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -84,8 +84,6 @@ Number of Languages: 10 in 1 JAR artifacts (0 deprecated)
 | link:src/main/docs/tokenize-language.adoc[Tokenize] (camel-core) | 2.0 | To use Camel message body or header with a tokenizer in Camel expressions or predicates.
 
 | link:src/main/docs/xtokenize-language.adoc[XML Tokenize] (camel-core) | 2.14 | To use Camel message body or header with a XML tokenizer in Camel expressions or predicates.
-
-| link:src/main/docs/xpath-language.adoc[XPath] (camel-core) | 1.1 | To use XPath (XML) in Camel expressions or predicates.
 |===
 // languages: END
 
diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc
index 639d3a7..70e75d8 100644
--- a/docs/components/modules/ROOT/nav.adoc
+++ b/docs/components/modules/ROOT/nav.adoc
@@ -355,6 +355,7 @@
 * xref:secureXML-dataformat.adoc[XML Security DataFormat]
 * xref:xmlsecurity-component.adoc[XML Security Component]
 * xref:xmpp-component.adoc[XMPP Component]
+* xref:xpath-language.adoc[XPath Language]
 * xref:xslt-component.adoc[XSLT Component]
 * xref:json-xstream-dataformat.adoc[JSon XStream DataFormat]
 * xref:xstream-dataformat.adoc[XStream DataFormat]
diff --git a/docs/components/modules/ROOT/pages/xpath-language.adoc b/docs/components/modules/ROOT/pages/xpath-language.adoc
new file mode 100644
index 0000000..2aa0f82
--- /dev/null
+++ b/docs/components/modules/ROOT/pages/xpath-language.adoc
@@ -0,0 +1,494 @@
+[[xpath-language]]
+== XPath Language
+
+*Available as of Camel version 1.1*
+
+Camel supports http://www.w3.org/TR/xpath[XPath] to allow an
+Expression or Predicate to be
+used in the DSL or link:xml-configuration.html[Xml
+Configuration]. For example you could use XPath to create an
+Predicate in a link:message-filter.html[Message
+Filter] or as an Expression for a
+Recipient List.
+
+*Streams*
+
+If the message body is stream based, which means the input it receives
+is submitted to Camel as a stream. That means you will only be able to
+read the content of the stream *once*. So often when you use
+<<xpath-language,XPath>> as <<xpath-language,Message Filter>> or
+Content Based Router then you need to
+access the data multiple times, and you should use
+Stream Caching or convert the message body to
+a `String` prior which is safe to be re-read multiple times.
+
+[source,java]
+----
+from("queue:foo").
+  filter().xpath("//foo")).
+  to("queue:bar")
+----
+
+[source,java]
+----
+from("queue:foo").
+  choice().xpath("//foo")).to("queue:bar").
+  otherwise().to("queue:others");
+----
+
+=== XPath Language options
+
+// language options: START
+The XPath language supports 9 options, which are listed below.
+
+
+
+[width="100%",cols="2,1m,1m,6",options="header"]
+|===
+| Name | Default | Java Type | Description
+| documentType |  | String | Name of class for document type The default value is org.w3c.dom.Document
+| resultType | NODESET | String | Sets the class name of the result type (type from output) The default result type is NodeSet
+| saxon | false | Boolean | Whether to use Saxon.
+| factoryRef |  | String | References to a custom XPathFactory to lookup in the registry
+| objectModel |  | String | The XPath object model to use
+| logNamespaces | false | Boolean | Whether to log namespaces which can assist during trouble shooting
+| headerName |  | String | Name of header to use as input, instead of the message body
+| threadSafety | false | Boolean | Whether to enable thread-safety for the returned result of the xpath expression. This applies to when using NODESET as the result type, and the returned set has multiple elements. In this situation there can be thread-safety issues if you process the NODESET concurrently such as from a Camel Splitter EIP in parallel processing mode. This option prevents concurrency issues by doing defensive copies of the nodes. It is recommended to turn this option on i [...]
+| trim | true | Boolean | Whether to trim the value to remove leading and trailing whitespaces and line breaks
+|===
+// language options: END
+
+=== Namespaces
+
+You can easily use namespaces with XPath expressions using the
+Namespaces helper class.
+
+=== Variables
+
+Variables in XPath is defined in different namespaces. The default
+namespace is `http://camel.apache.org/schema/spring`.
+
+[width="100%",cols="10%,10%,10%,70%",options="header",]
+|===
+|Namespace URI |Local part |Type |Description
+
+|http://camel.apache.org/xml/in/[http://camel.apache.org/xml/in/] |in |Message |the exchange.in message
+
+|http://camel.apache.org/xml/out/[http://camel.apache.org/xml/out/] |out |Message |the exchange.out message
+
+|http://camel.apache.org/xml/function/[http://camel.apache.org/xml/function/] |functions |Object |*Camel 2.5:* Additional functions
+
+|http://camel.apache.org/xml/variables/environment-variables[http://camel.apache.org/xml/variables/environment-variables] |env |Object |OS environment variables
+
+|http://camel.apache.org/xml/variables/system-properties[http://camel.apache.org/xml/variables/system-properties] |system |Object |Java System properties
+
+|http://camel.apache.org/xml/variables/exchange-property[http://camel.apache.org/xml/variables/exchange-property] |  | Object |the exchange property
+|===
+
+Camel will resolve variables according to either:
+
+* namespace given
+* no namespace given
+
+==== Namespace given
+
+If the namespace is given then Camel is instructed exactly what to
+return. However when resolving either *in* or *out* Camel will try to
+resolve a header with the given local part first, and return it. If the
+local part has the value *body* then the body is returned instead.
+
+==== No namespace given
+
+If there is no namespace given then Camel resolves only based on the
+local part. Camel will try to resolve a variable in the following steps:
+
+* from `variables` that has been set using the `variable(name, value)`
+fluent builder
+* from message.in.header if there is a header with the given key
+* from exchange.properties if there is a property with the given key
+
+=== Functions
+
+Camel adds the following XPath functions that can be used to access the
+exchange:
+
+[width="100%",cols="10%,10%,10%,70%",options="header",]
+|===
+|Function |Argument |Type |Description
+
+|in:body |none |Object |Will return the *in* message body.
+
+|in:header |the header name |Object |Will return the *in* message header.
+
+|out:body |none |Object |Will return the *out* message body.
+
+|out:header |the header name |Object |Will return the *out* message header.
+
+|function:properties |key for property |String |*Camel 2.5:* To lookup a property using the
+<<properties-component,Properties>> component (property placeholders).
+
+|function:simple |simple expression |Object |*Camel 2.5:* To evaluate a <<simple-language,Simple>> expression.
+|===
+
+CAUTION: `function:properties` and `function:simple` is not supported
+when the return type is a `NodeSet`, such as when using with a
+Splitter EIP.
+
+Here's an example showing some of these functions in use.
+
+And the new functions introduced in Camel 2.5:
+
+=== Using XML configuration
+
+If you prefer to configure your routes in your Spring
+XML file then you can use XPath expressions as follows
+
+[source,xml]
+----
+<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">
+
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring" xmlns:foo="http://example.com/person">
+    <route>
+      <from uri="activemq:MyQueue"/>
+      <filter>
+        <xpath>/foo:person[@name='James']</xpath>
+        <to uri="mqseries:SomeOtherQueue"/>
+      </filter>
+    </route>
+  </camelContext>
+</beans>
+----
+
+Notice how we can reuse the namespace prefixes, *foo* in this case, in
+the XPath expression for easier namespace based XPath expressions!
+
+See also this
+http://camel.465427.n5.nabble.com/fail-filter-XPATH-camel-td476424.html[discussion
+on the mailinglist] about using your own namespaces with xpath
+
+=== Setting result type
+
+The <<xpath-language,XPath>> expression will return a result type using
+native XML objects such as `org.w3c.dom.NodeList`. But many times you
+want a result type to be a String. To do this you have to instruct the
+<<xpath-language,XPath>> which result type to use.
+
+In Java DSL:
+
+[source,java]
+----
+xpath("/foo:person/@id", String.class)
+----
+
+In Spring DSL you use the *resultType* attribute to provide a fully
+qualified classname:
+
+[source,xml]
+----
+<xpath resultType="java.lang.String">/foo:person/@id</xpath>
+----
+
+In @XPath: +
+ *Available as of Camel 2.1*
+
+[source,java]
+----
+@XPath(value = "concat('foo-',//order/name/)", resultType = String.class) String name)
+----
+
+Where we use the xpath function concat to prefix the order name with
+`foo-`. In this case we have to specify that we want a String as result
+type so the concat function works.
+
+=== Using XPath on Headers
+
+*Available as of Camel 2.11*
+
+Some users may have XML stored in a header. To apply an XPath to a
+header's value you can do this by defining the 'headerName' attribute.
+
+And in Java DSL you specify the headerName as the 2nd parameter as
+shown:
+
+[source,java]
+----
+  xpath("/invoice/@orderType = 'premium'", "invoiceDetails")
+----
+
+=== Examples
+
+Here is a simple
+https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java[example]
+using an XPath expression as a predicate in a
+Message Filter
+
+If you have a standard set of namespaces you wish to work with and wish
+to share them across many different XPath expressions you can use the
+NamespaceBuilder as shown
+https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java[in
+this example]
+
+In this sample we have a choice construct. The first choice evaulates if
+the message has a header key *type* that has the value *Camel*. +
+ The 2nd choice evaluates if the message body has a name tag *<name>*
+which values is *Kong*. +
+ If neither is true the message is routed in the otherwise block:
+
+And the spring XML equivalent of the route:
+
+=== XPath injection
+
+You can use Bean Integration to invoke a
+method on a bean and use various languages such as XPath to extract a
+value from the message and bind it to a method parameter.
+
+The default XPath annotation has SOAP and XML namespaces available. If
+you want to use your own namespace URIs in an XPath expression you can
+use your own copy of the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/language/XPath.html[XPath
+annotation] to create whatever namespace prefixes you want to use.
+
+i.e. cut and paste upper code to your own project in a different package
+and/or annotation name then add whatever namespace prefix/uris you want
+in scope when you use your annotation on a method parameter. Then when
+you use your annotation on a method parameter all the namespaces you
+want will be available for use in your XPath expression.
+
+For example
+
+[source,java]
+----
+public class Foo {
+    
+    @MessageDriven(uri = "activemq:my.queue")
+    public void doSomething(@MyXPath("/ns1:foo/ns2:bar/text()") String correlationID, @Body String body) {
+        // process the inbound message here
+    }
+}
+----
+
+=== Using XPathBuilder without an Exchange
+
+*Available as of Camel 2.3*
+
+You can now use the `org.apache.camel.builder.XPathBuilder` without the
+need for an Exchange. This comes handy if you want
+to use it as a helper to do custom xpath evaluations.
+
+It requires that you pass in a CamelContext
+since a lot of the moving parts inside the XPathBuilder requires access
+to the Camel Type Converter and hence why
+CamelContext is needed.
+
+For example you can do something like this:
+
+[source,java]
+----
+boolean matches = XPathBuilder.xpath("/foo/bar/@xyz").matches(context, "<foo><bar xyz='cheese'/></foo>"));
+----
+
+This will match the given predicate.
+
+You can also evaluate for example as shown in the following three
+examples:
+
+[source,java]
+----
+String name = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>cheese</bar></foo>", String.class);
+Integer number = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>123</bar></foo>", Integer.class);
+Boolean bool = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>true</bar></foo>", Boolean.class);
+----
+
+Evaluating with a String result is a common requirement and thus you can
+do it a bit simpler:
+
+[source,java]
+----
+String name = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>cheese</bar></foo>");
+----
+
+=== Using Saxon with XPathBuilder
+
+*Available as of Camel 2.3*
+
+You need to add *camel-saxon* as dependency to your project.
+
+Its now easier to use http://saxon.sourceforge.net/[Saxon] with the
+XPathBuilder which can be done in several ways as shown below. +
+ Where as the latter ones are the easiest ones.
+
+* Using a factory
+* Using ObjectModel
+
+The easy one
+
+=== Setting a custom XPathFactory using System Property
+
+*Available as of Camel 2.3*
+
+Camel now supports reading the
+http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/XPathFactory.html#newInstance(java.lang.String)[JVM
+system property `javax.xml.xpath.XPathFactory`] that can be used to set
+a custom XPathFactory to use.
+
+This unit test shows how this can be done to use Saxon instead:
+
+Camel will log at `INFO` level if it uses a non default XPathFactory
+such as:
+
+[source]
+----
+XPathBuilder  INFO  Using system property javax.xml.xpath.XPathFactory:http://saxon.sf.net/jaxp/xpath/om with value:
+                    net.sf.saxon.xpath.XPathFactoryImpl when creating XPathFactory
+----
+
+To use Apache Xerces you can configure the system property
+
+[source]
+----
+-Djavax.xml.xpath.XPathFactory=org.apache.xpath.jaxp.XPathFactoryImpl
+----
+
+=== Enabling Saxon from Spring DSL
+
+*Available as of Camel 2.10*
+
+Similarly to Java DSL, to enable Saxon from Spring DSL you have three
+options:
+
+Specifying the factory
+
+[source,xml]
+----
+<xpath factoryRef="saxonFactory" resultType="java.lang.String">current-dateTime()</xpath>
+----
+
+Specifying the object model
+
+[source,xml]
+----
+<xpath objectModel="http://saxon.sf.net/jaxp/xpath/om" resultType="java.lang.String">current-dateTime()</xpath>
+----
+
+Shortcut
+
+[source,xml]
+----
+<xpath saxon="true" resultType="java.lang.String">current-dateTime()</xpath>
+----
+
+=== Namespace auditing to aid debugging
+
+*Available as of Camel 2.10*
+
+A large number of XPath-related issues that users frequently face are
+linked to the usage of namespaces. You may have some misalignment
+between the namespaces present in your message and those that your XPath
+expression is aware of or referencing. XPath predicates or expressions
+that are unable to locate the XML elements and attributes due to
+namespaces issues may simply look like "they are not working", when in
+reality all there is to it is a lack of namespace definition.
+
+Namespaces in XML are completely necessary, and while we would love to
+simplify their usage by implementing some magic or voodoo to wire
+namespaces automatically, truth is that any action down this path would
+disagree with the standards and would greatly hinder interoperability.
+
+Therefore, the utmost we can do is assist you in debugging such issues
+by adding two new features to the XPath Expression Language and are thus
+accesible from both predicates and expressions.
+
+#=== Logging the Namespace Context of your XPath expression/predicate
+
+Every time a new XPath expression is created in the internal pool, Camel
+will log the namespace context of the expression under the
+`org.apache.camel.builder.xml.XPathBuilder` logger. Since Camel
+represents Namespace Contexts in a hierarchical fashion (parent-child
+relationships), the entire tree is output in a recursive manner with the
+following format:
+
+[source]
+----
+[me: {prefix -> namespace}, {prefix -> namespace}], [parent: [me: {prefix -> namespace}, {prefix -> namespace}], [parent: [me: {prefix -> namespace}]]]
+----
+
+Any of these options can be used to activate this logging:
+
+1.  Enable TRACE logging on the
+`org.apache.camel.builder.xml.XPathBuilder` logger, or some parent
+logger such as `org.apache.camel` or the root logger
+2.  Enable the `logNamespaces` option as indicated in
+<<xpath-language,Auditing Namespaces>>, in which case the logging will
+occur on the INFO level
+
+=== Auditing namespaces
+
+Camel is able to discover and dump all namespaces present on every
+incoming message before evaluating an XPath expression, providing all
+the richness of information you need to help you analyse and pinpoint
+possible namespace issues.
+
+To achieve this, it in turn internally uses another specially tailored
+XPath expression to extract all namespace mappings that appear in the
+message, displaying the prefix and the full namespace URI(s) for each
+individual mapping.
+
+Some points to take into account:
+
+* The implicit XML namespace
+(xmlns:xml="http://www.w3.org/XML/1998/namespace") is suppressed from
+the output because it adds no value
+* Default namespaces are listed under the DEFAULT keyword in the output
+* Keep in mind that namespaces can be remapped under different scopes.
+Think of a top-level 'a' prefix which in inner elements can be assigned
+a different namespace, or the default namespace changing in inner
+scopes. For each discovered prefix, all associated URIs are listed.
+
+You can enable this option in Java DSL and Spring DSL.
+
+Java DSL:
+
+[source,java]
+----
+XPathBuilder.xpath("/foo:person/@id", String.class).logNamespaces()
+----
+
+Spring DSL:
+
+[source,xml]
+----
+<xpath logNamespaces="true" resultType="String">/foo:person/@id</xpath>
+----
+
+The result of the auditing will be appear at the INFO level under the
+`org.apache.camel.builder.xml.XPathBuilder` logger and will look like
+the following:
+
+[source]
+----
+2012-01-16 13:23:45,878 [stSaxonWithFlag] INFO  XPathBuilder  - Namespaces discovered in message: 
+{xmlns:a=[http://apache.org/camel], DEFAULT=[http://apache.org/default], 
+xmlns:b=[http://apache.org/camelA, http://apache.org/camelB]}
+----
+
+=== Loading script from external resource
+
+*Available as of Camel 2.11*
+
+You can externalize the script and have Camel load it from a resource
+such as `"classpath:"`, `"file:"`, or `"http:"`. +
+ This is done using the following syntax: `"resource:scheme:location"`,
+eg to refer to a file on the classpath you can do:
+
+[source,java]
+----
+.setHeader("myHeader").xpath("resource:classpath:myxpath.txt", String.class)
+----
+
+=== Dependencies
+
+The XPath language is part of camel-core.
diff --git a/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java b/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
index f18c5ad..9e0051a 100644
--- a/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
+++ b/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
@@ -22,7 +22,7 @@ import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 
 public class StockService {
 
diff --git a/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java b/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
index ec425c2..bacfec0 100644
--- a/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
+++ b/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
@@ -18,7 +18,7 @@ package org.apache.camel.example.pojo_messaging;
 
 import org.apache.camel.Consume;
 import org.apache.camel.RecipientList;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 


[camel] 02/10: Fixed CS

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0004cc837d4cf62e830f859b96f6e14d618ed3c5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 09:42:43 2019 +0200

    Fixed CS
---
 .../main/java/org/apache/camel/model/language/ExpressionDefinition.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java b/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
index af5a8e2..3facfaf 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
@@ -38,13 +38,13 @@ import org.apache.camel.Expression;
 import org.apache.camel.ExpressionFactory;
 import org.apache.camel.NoSuchLanguageException;
 import org.apache.camel.Predicate;
-import org.apache.camel.support.ScriptHelper;
 import org.apache.camel.model.OtherAttributesAware;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.support.ExpressionToPredicateAdapter;
 import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.support.ScriptHelper;
 import org.apache.camel.util.CollectionStringBuffer;
 import org.apache.camel.util.ObjectHelper;
 


[camel] 10/10: CAMEL-13113: Add @Groovy annotation as camel-script was removed

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 08c28732654627e493aadb3e726fab917eb70d0a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 12:46:35 2019 +0200

    CAMEL-13113: Add @Groovy annotation as camel-script was removed
---
 .../java/org/apache/camel/language/groovy/Groovy.java} | 18 +++++++++---------
 .../main/java/org/apache/camel/language/mvel/MVEL.java |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/Groovy.java
similarity index 76%
copy from components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java
copy to components/camel-groovy/src/main/java/org/apache/camel/language/groovy/Groovy.java
index ea0fcf0..67cd11c 100644
--- a/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java
+++ b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/Groovy.java
@@ -14,7 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.language.mvel;
+package org.apache.camel.language.groovy;
+
+import org.apache.camel.support.language.LanguageAnnotation;
 
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
@@ -22,16 +24,14 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-import org.apache.camel.support.language.LanguageAnnotation;
-
 /**
- * An annotation for injection of <a href="http://mvel.codehaus.org/">MVEL</a>
- * expressions into method parameters, fields or properties
+ * Used to inject a groovy expression into a field, property, method or parameter when using
+ * <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a>.
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
-@LanguageAnnotation(language = "mvel")
-public @interface MVEL {
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
+@LanguageAnnotation(language = "groovy")
+public @interface Groovy {
     String value();
-}
\ No newline at end of file
+}
diff --git a/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java b/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java
index ea0fcf0..68be59b 100644
--- a/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java
+++ b/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
 import org.apache.camel.support.language.LanguageAnnotation;
 
 /**
- * An annotation for injection of <a href="http://mvel.codehaus.org/">MVEL</a>
+ * An annotation for injection of MVEL
  * expressions into method parameters, fields or properties
  */
 @Retention(RetentionPolicy.RUNTIME)


[camel] 06/10: CAMEL-13442: camel3 - Move xpath out of camel-core

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 07bd9a51d83db351b2a28b491326b28a9e5483de
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 12:08:19 2019 +0200

    CAMEL-13442: camel3 - Move xpath out of camel-core
---
 bom/camel-bom/pom.xml                                     | 10 ++++++++++
 .../cxf/CxfConsumerPayloadXPathClientServerTest.java      |  2 +-
 .../camel/component/cxf/CxfConsumerPayloadXPathTest.java  |  2 +-
 components/camel-xmlsecurity/pom.xml                      | 15 ++++++++++-----
 .../xmlsecurity/processor/XmlSignatureProcessor.java      |  5 ++---
 .../dataformat/xmlsecurity/XMLSecurityDataFormat.java     |  4 ++--
 .../spring-boot-dm/camel-spring-boot-dependencies/pom.xml | 10 ++++++++++
 7 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 1cc9aec..cf786f8 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -2990,6 +2990,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-xpath</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-xpath-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-xslt</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
index 3589599..650f409 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
@@ -29,8 +29,8 @@ import org.w3c.dom.Text;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.commons.lang.StringUtils;
 import org.apache.cxf.BusFactory;
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
index f10fbca..c5acd03 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
@@ -23,7 +23,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.support.DefaultExchange;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.junit4.CamelTestSupport;
diff --git a/components/camel-xmlsecurity/pom.xml b/components/camel-xmlsecurity/pom.xml
index 9a8e754..b7fefe5 100644
--- a/components/camel-xmlsecurity/pom.xml
+++ b/components/camel-xmlsecurity/pom.xml
@@ -33,16 +33,21 @@
     <name>Camel :: XML Security</name>
     <description>Camel Partial XML Encryption/Decryption and XML Signature support</description>
 
-    <properties>
-    </properties>
-
     <dependencies>
 
-        <!-- requires camel-core -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-core</artifactId>
+            <artifactId>camel-support</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xpath</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-validator</artifactId>
+        </dependency>
+
         <!-- for base 64 in XAdES -->
         <dependency>
             <groupId>commons-codec</groupId>
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlSignatureProcessor.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlSignatureProcessor.java
index b86bbb1..39cc89d 100644
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlSignatureProcessor.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlSignatureProcessor.java
@@ -33,7 +33,6 @@ import org.apache.camel.Processor;
 import org.apache.camel.component.validator.DefaultLSResourceResolver;
 import org.apache.camel.component.xmlsecurity.api.XmlSignatureConstants;
 import org.apache.camel.component.xmlsecurity.api.XmlSignatureException;
-import org.apache.camel.converter.IOConverter;
 import org.apache.camel.support.ResourceHelper;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -109,9 +108,9 @@ public abstract class XmlSignatureProcessor implements Processor {
                     "XML Signature component is wrongly configured: No XML schema found for specified schema resource URI "
                             + schemaResourceUri);
         }
-        byte[] bytes = null;
+        byte[] bytes;
         try {
-            bytes = IOConverter.toBytes(is);
+            bytes = message.getExchange().getContext().getTypeConverter().convertTo(byte[].class, is);
         } finally {
             // and make sure to close the input stream after the schema has been loaded
             IOHelper.close(is);
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
index b09fa28..57f3ac2 100644
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
@@ -48,8 +48,8 @@ import org.w3c.dom.NodeList;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Exchange;
-import org.apache.camel.builder.xml.DefaultNamespaceContext;
-import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.language.xpath.DefaultNamespaceContext;
+import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.DataFormatName;
 import org.apache.camel.spi.annotations.Dataformat;
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 5e3a5f2..c191928 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -3205,6 +3205,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-xpath</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-xpath-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-xslt</artifactId>
         <version>${project.version}</version>
       </dependency>


[camel] 08/10: CAMEL-13442: camel3 - Move xpath out of camel-core

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f261486499aad0ecd337a6ac36e80e5f0a7b82e0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 12:32:10 2019 +0200

    CAMEL-13442: camel3 - Move xpath out of camel-core
---
 .../apache/camel/language/xpath/XPathBuilder.java  |  9 +++++-
 .../camel/spi/ExpressionResultTypeAware.java       | 34 ++++++++++++++++++++++
 .../org/apache/camel/builder/SimpleBuilder.java    |  9 +++++-
 .../apache/camel/model/ExpressionNodeHelper.java   | 31 +++++++++-----------
 4 files changed, 64 insertions(+), 19 deletions(-)

diff --git a/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
index d5c8a09..c930b85 100644
--- a/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
@@ -55,6 +55,7 @@ import org.apache.camel.Predicate;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.RuntimeExpressionException;
 import org.apache.camel.WrappedFile;
+import org.apache.camel.spi.ExpressionResultTypeAware;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.NamespaceAware;
 import org.apache.camel.support.DefaultExchange;
@@ -93,7 +94,7 @@ import static org.apache.camel.support.builder.xml.Namespaces.isMatchingNamespac
  *
  * @see XPathConstants#NODESET
  */
-public class XPathBuilder extends ServiceSupport implements CamelContextAware, Expression, Predicate, NamespaceAware {
+public class XPathBuilder extends ServiceSupport implements CamelContextAware, Expression, Predicate, NamespaceAware, ExpressionResultTypeAware {
     private static final Logger LOG = LoggerFactory.getLogger(XPathBuilder.class);
     private static final String SAXON_OBJECT_MODEL_URI = "http://saxon.sf.net/jaxp/xpath/om";
     private static final String SAXON_FACTORY_CLASS_NAME = "net.sf.saxon.xpath.XPathFactoryImpl";
@@ -796,6 +797,12 @@ public class XPathBuilder extends ServiceSupport implements CamelContextAware, E
         this.simpleFunction = simpleFunction;
     }
 
+    @Override
+    public String getExpressionText() {
+        return text;
+    }
+
+    @Override
     public Class<?> getResultType() {
         return resultType;
     }
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ExpressionResultTypeAware.java b/core/camel-api/src/main/java/org/apache/camel/spi/ExpressionResultTypeAware.java
new file mode 100644
index 0000000..0e95d60
--- /dev/null
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ExpressionResultTypeAware.java
@@ -0,0 +1,34 @@
+/*
+ * 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.spi;
+
+/**
+ * Represents an {@link org.apache.camel.Expression} or {@link org.apache.camel.Predicate} that supports a result type.
+ */
+public interface ExpressionResultTypeAware {
+
+    /**
+     * Gets the expression or predicate as text
+     */
+    String getExpressionText();
+
+    /**
+     * Gets the result type
+     */
+    Class<?> getResultType();
+
+}
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/SimpleBuilder.java b/core/camel-core/src/main/java/org/apache/camel/builder/SimpleBuilder.java
index ca64713..ef15a26 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/SimpleBuilder.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/SimpleBuilder.java
@@ -20,6 +20,7 @@ import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
+import org.apache.camel.spi.ExpressionResultTypeAware;
 import org.apache.camel.spi.Language;
 import org.apache.camel.support.PredicateToExpressionAdapter;
 import org.apache.camel.support.ScriptHelper;
@@ -30,7 +31,7 @@ import org.apache.camel.support.ScriptHelper;
  * This builder is available in the Java DSL from the {@link RouteBuilder} which means that using
  * simple language for {@link Expression}s or {@link Predicate}s is very easy with the help of this builder.
  */
-public class SimpleBuilder implements Predicate, Expression {
+public class SimpleBuilder implements Predicate, Expression, ExpressionResultTypeAware {
 
     private final String text;
     private Class<?> resultType;
@@ -64,6 +65,12 @@ public class SimpleBuilder implements Predicate, Expression {
         return text;
     }
 
+    @Override
+    public String getExpressionText() {
+        return getText();
+    }
+
+    @Override
     public Class<?> getResultType() {
         return resultType;
     }
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java b/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java
index ac18235..38d75b1 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/ExpressionNodeHelper.java
@@ -23,6 +23,7 @@ import org.apache.camel.builder.ValueBuilder;
 import org.apache.camel.model.language.ExpressionDefinition;
 import org.apache.camel.model.language.SimpleExpression;
 import org.apache.camel.model.language.XPathExpression;
+import org.apache.camel.spi.ExpressionResultTypeAware;
 
 /**
  * Helper for {@link ExpressionNode}
@@ -49,16 +50,13 @@ public final class ExpressionNodeHelper {
             answer.setExpression(builder.getText());
             answer.setResultType(builder.getResultType());
             return answer;
-
-            // TODO: Make some kind of resulttype expression so we can use an interface to set both kinds
-
-/*        } else if (expression instanceof XPathBuilder) {
-            XPathBuilder builder = (XPathBuilder) expression;
+        } else if (expression instanceof ExpressionResultTypeAware && expression.getClass().getName().equals("org.apache.camel.language.xpath.XPathBuilder")) {
+            ExpressionResultTypeAware aware = (ExpressionResultTypeAware) expression;
             // we keep the original expression by using the constructor that accepts an expression
-            XPathExpression answer = new XPathExpression(builder);
-            answer.setExpression(builder.getText());
-            answer.setResultType(builder.getResultType());
-            return answer;*/
+            XPathExpression answer = new XPathExpression(expression);
+            answer.setExpression(aware.getExpressionText());
+            answer.setResultType(answer.getResultType());
+            return answer;
         } else if (expression instanceof ValueBuilder) {
             // ValueBuilder wraps the actual expression so unwrap
             ValueBuilder builder = (ValueBuilder) expression;
@@ -87,15 +85,14 @@ public final class ExpressionNodeHelper {
             SimpleExpression answer = new SimpleExpression(builder);
             answer.setExpression(builder.getText());
             return answer;
-
-            // TODO: Make some kind of resulttype expression so we can use an interface to set both kinds
-
-/*        } else if (predicate instanceof XPathBuilder) {
-            XPathBuilder builder = (XPathBuilder) predicate;
+        } else if (predicate instanceof ExpressionResultTypeAware && predicate.getClass().getName().equals("org.apache.camel.language.xpath.XPathBuilder")) {
+            ExpressionResultTypeAware aware = (ExpressionResultTypeAware) predicate;
+            Expression expression = (Expression) predicate;
             // we keep the original expression by using the constructor that accepts an expression
-            XPathExpression answer = new XPathExpression(builder);
-            answer.setExpression(builder.getText());
-            return answer;*/
+            XPathExpression answer = new XPathExpression(expression);
+            answer.setExpression(aware.getExpressionText());
+            answer.setResultType(answer.getResultType());
+            return answer;
         } else if (predicate instanceof ValueBuilder) {
             // ValueBuilder wraps the actual predicate so unwrap
             ValueBuilder builder = (ValueBuilder) predicate;


[camel] 09/10: CAMEL-13442: camel3 - Move xpath out of camel-core

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d57cae2d5bcec291ef7ca91fd7ab7943c3da8e32
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 12:45:16 2019 +0200

    CAMEL-13442: camel3 - Move xpath out of camel-core
---
 components/camel-saxon/pom.xml                     |  4 +--
 .../camel/component/xquery/XQueryBuilder.java      | 41 ++++++++++++----------
 .../camel/component/xquery/XQueryEndpoint.java     |  5 +--
 .../camel/component/xslt/SaxonXsltDTDTest.java     |  5 ++-
 4 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/components/camel-saxon/pom.xml b/components/camel-saxon/pom.xml
index 9ef3b31..ffe3e9f 100644
--- a/components/camel-saxon/pom.xml
+++ b/components/camel-saxon/pom.xml
@@ -40,11 +40,9 @@
 
     <dependencies>
 
-        <!-- TODO: camel-xpath and avoid the IOConverter dependency -->
-        <!-- requires camel-core -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-core</artifactId>
+            <artifactId>camel-xpath</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
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 016f3d2..5ac3761 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
@@ -23,7 +23,6 @@ import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.math.BigInteger;
-import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -72,7 +71,6 @@ import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeExpressionException;
 import org.apache.camel.StringSource;
-import org.apache.camel.converter.IOConverter;
 import org.apache.camel.spi.NamespaceAware;
 import org.apache.camel.support.MessageHelper;
 import org.apache.camel.util.IOHelper;
@@ -257,7 +255,11 @@ public abstract class XQueryBuilder implements Expression, Predicate, NamespaceA
         return new XQueryBuilder() {
             protected XQueryExpression createQueryExpression(StaticQueryContext staticQueryContext)
                 throws XPathException, IOException {
-                return staticQueryContext.compileQuery(reader);
+                try {
+                    return staticQueryContext.compileQuery(reader);
+                } finally {
+                    IOHelper.close(reader);
+                }
             }
         };
     }
@@ -265,26 +267,27 @@ public abstract class XQueryBuilder implements Expression, Predicate, NamespaceA
     public static XQueryBuilder xquery(final InputStream in, final String characterSet) {
         return new XQueryBuilder() {
             protected XQueryExpression createQueryExpression(StaticQueryContext staticQueryContext)
-                throws XPathException, IOException {
-                return staticQueryContext.compileQuery(in, characterSet);
+                throws XPathException {
+                try {
+                    return staticQueryContext.compileQuery(in, characterSet);
+                } finally {
+                    IOHelper.close(in);
+                }
             }
         };
     }
 
-    public static XQueryBuilder xquery(File file, String characterSet) throws IOException {
-        return xquery(IOConverter.toInputStream(file), characterSet);
-    }
-
-    public static XQueryBuilder xquery(URL url, String characterSet) throws IOException {
-        return xquery(IOConverter.toInputStream(url), characterSet);
-    }
-
-    public static XQueryBuilder xquery(File file) throws IOException {
-        return xquery(IOConverter.toInputStream(file), ObjectHelper.getDefaultCharacterSet());
-    }
-
-    public static XQueryBuilder xquery(URL url) throws IOException {
-        return xquery(IOConverter.toInputStream(url), ObjectHelper.getDefaultCharacterSet());
+    public static XQueryBuilder xquery(final InputStream in) {
+        return new XQueryBuilder() {
+            protected XQueryExpression createQueryExpression(StaticQueryContext staticQueryContext)
+                throws XPathException {
+                try {
+                    return staticQueryContext.compileQuery(in, ObjectHelper.getDefaultCharacterSet());
+                } finally {
+                    IOHelper.close(in);
+                }
+            }
+        };
     }
 
     // Fluent API
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 db7a497..ecafdbd 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
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.xquery;
 
+import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
@@ -220,9 +221,9 @@ public class XQueryEndpoint extends ProcessorEndpoint {
         super.doStart();
 
         log.debug("{} using schema resource: {}", this, resourceUri);
-        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), resourceUri);
+        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), resourceUri);
 
-        this.xquery = XQueryBuilder.xquery(url);
+        this.xquery = XQueryBuilder.xquery(is);
         this.xquery.setConfiguration(getConfiguration());
         this.xquery.setConfigurationProperties(getConfigurationProperties());
         this.xquery.setStaticQueryContext(getStaticQueryContext());
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
index d7b50e5..0027c73 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.xslt;
 
+import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.List;
 
@@ -25,8 +26,6 @@ import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.converter.IOConverter;
-import org.apache.camel.support.DefaultExchange;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -43,7 +42,7 @@ public class SaxonXsltDTDTest extends CamelTestSupport {
     
     @Test
     public void testSendingInputStreamMessage() throws Exception {
-        InputStream is = IOConverter.toInputStream(MESSAGE, new DefaultExchange(context));
+        InputStream is = new ByteArrayInputStream(MESSAGE.getBytes());
         sendEntityMessage(is);   
     }
     


[camel] 05/10: CAMEL-13442: camel3 - Move xpath out of camel-core

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 78a75373b4533d5556b63377ac07199a51154ee1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 23 11:20:34 2019 +0200

    CAMEL-13442: camel3 - Move xpath out of camel-core
---
 apache-camel/pom.xml                                           | 10 ++++++++++
 apache-camel/src/main/descriptors/common-bin.xml               |  2 ++
 .../apache/camel/spring/processor/scattergather/MyVendor.java  |  2 +-
 .../camel-xpath}/src/main/docs/xpath-language.adoc             |  0
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index d846468..2081273 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1543,6 +1543,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-xpath</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-xslt</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -2952,6 +2957,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-xpath-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-xslt-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index f90b23c..b4ee819 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -330,6 +330,7 @@
         <include>org.apache.camel:camel-xchange</include>
         <include>org.apache.camel:camel-xmlsecurity</include>
         <include>org.apache.camel:camel-xmpp</include>
+        <include>org.apache.camel:camel-xpath</include>
         <include>org.apache.camel:camel-xslt</include>
         <include>org.apache.camel:camel-xstream</include>
         <include>org.apache.camel:camel-yammer</include>
@@ -650,6 +651,7 @@
         <include>org.apache.camel:camel-xchange-starter</include>
         <include>org.apache.camel:camel-xmlsecurity-starter</include>
         <include>org.apache.camel:camel-xmpp-starter</include>
+        <include>org.apache.camel:camel-xpath-starter</include>
         <include>org.apache.camel:camel-xslt-starter</include>
         <include>org.apache.camel:camel-xstream-starter</include>
         <include>org.apache.camel:camel-yammer-starter</include>
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/scattergather/MyVendor.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/scattergather/MyVendor.java
index eb062d5..650476c 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/scattergather/MyVendor.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/scattergather/MyVendor.java
@@ -19,7 +19,7 @@ package org.apache.camel.spring.processor.scattergather;
 import org.apache.camel.Exchange;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
-import org.apache.camel.language.XPath;
+import org.apache.camel.language.xpath.XPath;
 
 //START SNIPPET: e1
 public class MyVendor {
diff --git a/core/camel-core/src/main/docs/xpath-language.adoc b/components/camel-xpath/src/main/docs/xpath-language.adoc
similarity index 100%
rename from core/camel-core/src/main/docs/xpath-language.adoc
rename to components/camel-xpath/src/main/docs/xpath-language.adoc