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 2022/01/23 10:29:58 UTC
[camel] branch main updated: CAMEL-17307: Add exception factory for predicate validation. Thanks to Tom Cassimon for the original work.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new ed4d79b CAMEL-17307: Add exception factory for predicate validation. Thanks to Tom Cassimon for the original work.
ed4d79b is described below
commit ed4d79bef73fdb650d8c4b8531f3441b7224f620
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Jan 23 11:28:51 2022 +0100
CAMEL-17307: Add exception factory for predicate validation. Thanks to Tom Cassimon for the original work.
---
.../org/apache/camel/catalog/models/validate.json | 1 +
.../camel/spi/PredicateExceptionFactory.java | 39 ++++++++
.../resources/org/apache/camel/model/validate.json | 1 +
.../org/apache/camel/model/ValidateDefinition.java | 48 +++++++++
.../org/apache/camel/reifier/ValidateReifier.java | 13 ++-
...alidatePredicateExceptionFactoryGlobalTest.java | 90 +++++++++++++++++
.../ValidatePredicateExceptionFactoryTest.java | 110 +++++++++++++++++++++
.../apache/camel/support/CamelContextHelper.java | 1 +
.../processor/PredicateValidatingProcessor.java | 39 +++++++-
.../java/org/apache/camel/xml/in/ModelParser.java | 9 +-
.../dsl/yaml/deserializers/ModelDeserializers.java | 8 +-
.../src/generated/resources/camel-yaml-dsl.json | 3 +
.../src/generated/resources/camelYamlDsl.json | 3 +
13 files changed, 359 insertions(+), 6 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/validate.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/validate.json
index d0fe8db..1a4dffd 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/validate.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/validate.json
@@ -13,6 +13,7 @@
},
"properties": {
"expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "csimple", "datasonnet", "exchangeProperty", "groovy", "header", "hl7terser", "joor", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "autowired": false, "secret": false, "asPredicate": true, "descrip [...]
+ "predicateExceptionFactory": { "kind": "attribute", "displayName": "Predicate Exception Factory", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The bean id of custom PredicateExceptionFactory to use for creating the exception when the validation fails. By default, Camel will throw PredicateValidationException. By using a custom factory you can control which exception to throw instead." },
"id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" },
"description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }
}
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/PredicateExceptionFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/PredicateExceptionFactory.java
new file mode 100644
index 0000000..8e70a5c
--- /dev/null
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/PredicateExceptionFactory.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+
+/**
+ * A factory that can be used to create a specific exception when a {@link Predicate} returning false, which can be used
+ * by camel-validator and other components.
+ */
+public interface PredicateExceptionFactory {
+
+ /**
+ * Allows to return a specific exception for the given predicate in case it failed
+ *
+ * @param exchange the current exchange
+ * @param predicate the predicate that returned false
+ * @param nodeId optional node id from validate EIP using this factory
+ * @return the exception, or <tt>null</tt> to not use a specific exception but let Camel use a standard
+ * exception such as PredicateValidationException.
+ */
+ Exception newPredicateException(Exchange exchange, Predicate predicate, String nodeId);
+
+}
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/validate.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/validate.json
index d0fe8db..1a4dffd 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/validate.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/validate.json
@@ -13,6 +13,7 @@
},
"properties": {
"expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "csimple", "datasonnet", "exchangeProperty", "groovy", "header", "hl7terser", "joor", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "autowired": false, "secret": false, "asPredicate": true, "descrip [...]
+ "predicateExceptionFactory": { "kind": "attribute", "displayName": "Predicate Exception Factory", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The bean id of custom PredicateExceptionFactory to use for creating the exception when the validation fails. By default, Camel will throw PredicateValidationException. By using a custom factory you can control which exception to throw instead." },
"id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" },
"description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }
}
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/ValidateDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/ValidateDefinition.java
index 33d0d77..5a7c3ea 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/ValidateDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/ValidateDefinition.java
@@ -18,13 +18,16 @@ package org.apache.camel.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.Expression;
import org.apache.camel.Predicate;
import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.spi.AsPredicate;
import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.PredicateExceptionFactory;
/**
* Validates a message based on an expression
@@ -35,6 +38,11 @@ import org.apache.camel.spi.Metadata;
@XmlAccessorType(XmlAccessType.FIELD)
public class ValidateDefinition extends ExpressionNode {
+ @XmlAttribute
+ private String predicateExceptionFactory;
+ @XmlTransient
+ private PredicateExceptionFactory factory;
+
public ValidateDefinition() {
}
@@ -71,4 +79,44 @@ public class ValidateDefinition extends ExpressionNode {
super.setExpression(expression);
}
+ public PredicateExceptionFactory getFactory() {
+ return factory;
+ }
+
+ public String getPredicateExceptionFactory() {
+ return predicateExceptionFactory;
+ }
+
+ /**
+ * The bean id of custom PredicateExceptionFactory to use for creating the exception when the validation fails.
+ *
+ * By default, Camel will throw PredicateValidationException. By using a custom factory you can control which
+ * exception to throw instead.
+ */
+ public void setPredicateExceptionFactory(String predicateExceptionFactory) {
+ this.predicateExceptionFactory = predicateExceptionFactory;
+ }
+
+ /**
+ * The custom PredicateExceptionFactory to use for creating the exception when the validation fails.
+ *
+ * By default, Camel will throw PredicateValidationException. By using a custom factory you can control which
+ * exception to throw instead.
+ */
+ public ValidateDefinition predicateExceptionFactory(PredicateExceptionFactory factory) {
+ this.factory = factory;
+ return this;
+ }
+
+ /**
+ * The bean id of the custom PredicateExceptionFactory to use for creating the exception when the validation fails.
+ *
+ * By default, Camel will throw PredicateValidationException. By using a custom factory you can control which
+ * exception to throw instead.
+ */
+ public ValidateDefinition predicateExceptionFactory(String ref) {
+ this.predicateExceptionFactory = ref;
+ return this;
+ }
+
}
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ValidateReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ValidateReifier.java
index ccf71ff..8a15799 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ValidateReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ValidateReifier.java
@@ -21,6 +21,8 @@ import org.apache.camel.Processor;
import org.apache.camel.Route;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.ValidateDefinition;
+import org.apache.camel.spi.PredicateExceptionFactory;
+import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.processor.PredicateValidatingProcessor;
public class ValidateReifier extends ExpressionReifier<ValidateDefinition> {
@@ -32,7 +34,16 @@ public class ValidateReifier extends ExpressionReifier<ValidateDefinition> {
@Override
public Processor createProcessor() throws Exception {
Predicate pred = createPredicate(definition.getExpression());
- return new PredicateValidatingProcessor(pred);
+ PredicateValidatingProcessor answer = new PredicateValidatingProcessor(pred);
+
+ PredicateExceptionFactory factory = definition.getFactory();
+ if (factory == null && definition.getPredicateExceptionFactory() != null) {
+ factory = lookupByNameAndType(definition.getPredicateExceptionFactory(), PredicateExceptionFactory.class);
+ } else if (factory == null) {
+ factory = CamelContextHelper.findByType(camelContext, PredicateExceptionFactory.class);
+ }
+ answer.setPredicateExceptionFactory(factory);
+ return answer;
}
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/ValidatePredicateExceptionFactoryGlobalTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/ValidatePredicateExceptionFactoryGlobalTest.java
new file mode 100644
index 0000000..b0e8853
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/ValidatePredicateExceptionFactoryGlobalTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.processor;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spi.PredicateExceptionFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class ValidatePredicateExceptionFactoryGlobalTest extends ContextTestSupport {
+
+ protected Endpoint startEndpoint;
+ protected MockEndpoint resultEndpoint;
+
+ @Override
+ @BeforeEach
+ public void setUp() throws Exception {
+ super.setUp();
+
+ startEndpoint = resolveMandatoryEndpoint("direct:start", Endpoint.class);
+ resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+ }
+
+ @Test
+ public void testSendMatchingMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(1);
+
+ template.sendBody(startEndpoint, "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testSendNotMatchingMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(0);
+
+ try {
+ template.sendBody(startEndpoint, "Bye World");
+ fail("CamelExecutionException expected");
+ } catch (CamelExecutionException e) {
+ // expected
+ assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ String s = "Dude was here myValidate";
+ assertStringContains(e.getCause().getMessage(), s);
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ context.getRegistry().bind("myExceptionFactory", new MyExceptionFactory());
+
+ from("direct:start").validate().simple("${body} contains 'Camel'").id("myValidate").to("mock:result");
+ }
+ };
+ }
+
+ private class MyExceptionFactory implements PredicateExceptionFactory {
+
+ @Override
+ public Exception newPredicateException(Exchange exchange, Predicate predicate, String id) {
+ throw new IllegalArgumentException("Dude was here " + id);
+ }
+ }
+}
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/ValidatePredicateExceptionFactoryTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/ValidatePredicateExceptionFactoryTest.java
new file mode 100644
index 0000000..c4286eb
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/ValidatePredicateExceptionFactoryTest.java
@@ -0,0 +1,110 @@
+/*
+ * 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.processor;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spi.PredicateExceptionFactory;
+import org.apache.camel.support.processor.PredicateValidationException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class ValidatePredicateExceptionFactoryTest extends ContextTestSupport {
+
+ protected Endpoint startEndpoint;
+ protected MockEndpoint resultEndpoint;
+
+ @Override
+ @BeforeEach
+ public void setUp() throws Exception {
+ super.setUp();
+
+ startEndpoint = resolveMandatoryEndpoint("direct:start", Endpoint.class);
+ resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+ }
+
+ @Test
+ public void testSendMatchingMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(1);
+
+ template.sendBody(startEndpoint, "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testSendNotMatchingMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(0);
+
+ try {
+ template.sendBody(startEndpoint, "Bye World");
+ fail("CamelExecutionException expected");
+ } catch (CamelExecutionException e) {
+ // expected
+ assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ String s = "Dude was here myValidate";
+ assertStringContains(e.getCause().getMessage(), s);
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testSkip() throws Exception {
+ resultEndpoint.expectedMessageCount(0);
+
+ try {
+ template.sendBody(startEndpoint, "Skip World");
+ fail("CamelExecutionException expected");
+ } catch (CamelExecutionException e) {
+ // expected normal exception
+ assertIsInstanceOf(PredicateValidationException.class, e.getCause());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .validate().simple("${body} contains 'Camel'").predicateExceptionFactory(new MyExceptionFactory())
+ .id("myValidate")
+ .to("mock:result");
+ }
+ };
+ }
+
+ private class MyExceptionFactory implements PredicateExceptionFactory {
+
+ @Override
+ public Exception newPredicateException(Exchange exchange, Predicate predicate, String id) {
+ if (exchange.getMessage().getBody(String.class).startsWith("Skip")) {
+ return null;
+ }
+ throw new IllegalArgumentException("Dude was here " + id);
+ }
+ }
+}
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java
index aef0175..8089ccd 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java
@@ -41,6 +41,7 @@ import static org.apache.camel.util.ObjectHelper.isNotEmpty;
* A number of helper methods
*/
public final class CamelContextHelper {
+
public static final String MODEL_DOCUMENTATION_PREFIX = "org/apache/camel/model/";
/**
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/processor/PredicateValidatingProcessor.java b/core/camel-support/src/main/java/org/apache/camel/support/processor/PredicateValidatingProcessor.java
index c318869..1878798 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/processor/PredicateValidatingProcessor.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/processor/PredicateValidatingProcessor.java
@@ -20,6 +20,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Predicate;
import org.apache.camel.Processor;
import org.apache.camel.Traceable;
+import org.apache.camel.spi.IdAware;
+import org.apache.camel.spi.PredicateExceptionFactory;
import org.apache.camel.support.service.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -28,11 +30,13 @@ import org.slf4j.LoggerFactory;
/**
* A processor which validates the content of the inbound message body against a {@link Predicate}.
*/
-public class PredicateValidatingProcessor extends ServiceSupport implements Processor, Traceable {
+public class PredicateValidatingProcessor extends ServiceSupport implements Processor, Traceable, IdAware {
private static final Logger LOG = LoggerFactory.getLogger(PredicateValidatingProcessor.class);
private final Predicate predicate;
+ private PredicateExceptionFactory predicateExceptionFactory;
+ private String id;
public PredicateValidatingProcessor(Predicate predicate) {
ObjectHelper.notNull(predicate, "predicate", this);
@@ -40,6 +44,16 @@ public class PredicateValidatingProcessor extends ServiceSupport implements Proc
}
@Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
public void process(Exchange exchange) throws Exception {
boolean matches = predicate.matches(exchange);
@@ -48,7 +62,14 @@ public class PredicateValidatingProcessor extends ServiceSupport implements Proc
}
if (!matches) {
- throw new PredicateValidationException(exchange, predicate);
+ Exception cause = null;
+ if (predicateExceptionFactory != null) {
+ cause = predicateExceptionFactory.newPredicateException(exchange, predicate, getId());
+ }
+ if (cause == null) {
+ cause = new PredicateValidationException(exchange, predicate);
+ }
+ throw cause;
}
}
@@ -56,6 +77,20 @@ public class PredicateValidatingProcessor extends ServiceSupport implements Proc
return predicate;
}
+ /**
+ * To use a custom factory for creating the exception to throw if predicate does not match
+ */
+ public PredicateExceptionFactory getPredicateExceptionFactory() {
+ return predicateExceptionFactory;
+ }
+
+ /**
+ * To use a custom factory for creating the exception to throw if predicate does not match
+ */
+ public void setPredicateExceptionFactory(PredicateExceptionFactory predicateExceptionFactory) {
+ this.predicateExceptionFactory = predicateExceptionFactory;
+ }
+
@Override
public String toString() {
return "validate(" + predicate + ")";
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 6cb2e05..7dd0167 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -1474,8 +1474,13 @@ public class ModelParser extends BaseParser {
}, noValueHandler());
}
protected ValidateDefinition doParseValidateDefinition() throws IOException, XmlPullParserException {
- return doParse(new ValidateDefinition(),
- processorDefinitionAttributeHandler(), expressionNodeElementHandler(), noValueHandler());
+ return doParse(new ValidateDefinition(), (def, key, val) -> {
+ if ("predicateExceptionFactory".equals(key)) {
+ def.setPredicateExceptionFactory(val);
+ return true;
+ }
+ return processorDefinitionAttributeHandler().accept(def, key, val);
+ }, expressionNodeElementHandler(), noValueHandler());
}
protected WireTapDefinition doParseWireTapDefinition() throws IOException, XmlPullParserException {
return doParse(new WireTapDefinition(), (def, key, val) -> {
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 3926cf9..0983794 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -17280,7 +17280,8 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
@YamlProperty(name = "description", type = "string"),
@YamlProperty(name = "expression", type = "object:org.apache.camel.model.language.ExpressionDefinition"),
@YamlProperty(name = "id", type = "string"),
- @YamlProperty(name = "inherit-error-handler", type = "boolean")
+ @YamlProperty(name = "inherit-error-handler", type = "boolean"),
+ @YamlProperty(name = "predicate-exception-factory", type = "string")
}
)
public static class ValidateDefinitionDeserializer extends YamlDeserializerBase<ValidateDefinition> {
@@ -17307,6 +17308,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
target.setInheritErrorHandler(java.lang.Boolean.valueOf(val));
break;
}
+ case "predicate-exception-factory": {
+ String val = asText(node);
+ target.setPredicateExceptionFactory(val);
+ break;
+ }
case "id": {
String val = asText(node);
target.setId(val);
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camel-yaml-dsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camel-yaml-dsl.json
index 0485424..952aa4e 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camel-yaml-dsl.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camel-yaml-dsl.json
@@ -3348,6 +3348,9 @@
},
"inherit-error-handler" : {
"type" : "boolean"
+ },
+ "predicate-exception-factory" : {
+ "type" : "string"
}
}
},
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camelYamlDsl.json
index 7892f44..ee97153 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camelYamlDsl.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/camelYamlDsl.json
@@ -3252,6 +3252,9 @@
},
"inheritErrorHandler" : {
"type" : "boolean"
+ },
+ "predicateExceptionFactory" : {
+ "type" : "string"
}
}
},