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 <claus.ib...@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>