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/12/18 13:58:05 UTC
[camel] branch main updated (95351e385ff -> ecabb7c2ef1)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from 95351e385ff Regen for commit 343319ff302eed55894c85cb16888553795c698a
new 7a4f42aa443 Polished
new 6c7d0c84b4a Make XmlHelper more secure
new ecabb7c2ef1 Add missing descriptions to some options in route for XML DSL
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/camel/catalog/models/route.json | 5 +++-
.../apache/camel/catalog/schemas/camel-spring.xsd | 34 +++++++++++++++++++---
.../apache/camel/impl/engine/DefaultTracer.java | 7 -----
.../resources/org/apache/camel/model/route.json | 5 +++-
.../org/apache/camel/model/RouteDefinition.java | 2 +-
.../camel/dsl/jbang/core/common/XmlHelper.java | 5 ++++
.../java/org/apache/camel/maven/XmlHelper.java | 19 +++++++++++-
.../camel/maven/packaging/SchemaGeneratorMojo.java | 22 ++++++++++++--
8 files changed, 82 insertions(+), 17 deletions(-)
[camel] 03/03: Add missing descriptions to some options in route for XML DSL
Posted by da...@apache.org.
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
commit ecabb7c2ef147bd56afd48691460e2e8448e3caa
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 18 14:57:43 2022 +0100
Add missing descriptions to some options in route for XML DSL
---
.../org/apache/camel/catalog/models/route.json | 5 +++-
.../apache/camel/catalog/schemas/camel-spring.xsd | 34 +++++++++++++++++++---
.../resources/org/apache/camel/model/route.json | 5 +++-
.../org/apache/camel/model/RouteDefinition.java | 2 +-
.../camel/maven/packaging/SchemaGeneratorMojo.java | 22 ++++++++++++--
5 files changed, 59 insertions(+), 9 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/route.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/route.json
index ad97683f253..ef4583cf14a 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/route.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/route.json
@@ -13,9 +13,12 @@
},
"properties": {
"group": { "kind": "attribute", "displayName": "Group", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The group that this route belongs to; could be the name of the RouteBuilder class or be explicitly configured in the XML. May be null." },
+ "nodePrefixId": { "kind": "attribute", "displayName": "Node Prefix Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets a prefix to use for all node ids (not route id)." },
+ "routeConfigurationId": { "kind": "attribute", "displayName": "Route Configuration Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The route configuration id or pattern this route should use for configuration. Multiple id\/pattern can be separated by comma." },
+ "precondition": { "kind": "attribute", "displayName": "Precondition", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The predicate of the precondition in simple language to evaluate in order to determine if this route should be included or not." },
"streamCache": { "kind": "attribute", "displayName": "Stream Cache", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether stream caching is enabled on this route." },
"trace": { "kind": "attribute", "displayName": "Trace", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether tracing is enabled on this route." },
- "messageHistory": { "kind": "attribute", "displayName": "Message History", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "true", "description": "Whether message history is enabled on this route." },
+ "messageHistory": { "kind": "attribute", "displayName": "Message History", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether message history is enabled on this route." },
"logMask": { "kind": "attribute", "displayName": "Log Mask", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "description": "Whether security mask for Logging is enabled on this route." },
"delayer": { "kind": "attribute", "displayName": "Delayer", "required": false, "type": "duration", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether to slow down processing messages by a given delay in msec." },
"autoStartup": { "kind": "attribute", "displayName": "Auto Startup", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "true", "description": "Whether to auto start this route" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 0f56ca75b83..9f7700b0877 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -16179,19 +16179,45 @@ Whether security mask for Logging is enabled on this route. Default value: false
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Whether message history is enabled on this route. Default value: true
+Whether message history is enabled on this route.
]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="nodePrefixId" type="xs:string"/>
+ <xs:attribute name="nodePrefixId" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ <![CDATA[
+Sets a prefix to use for all node ids (not route id).
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
- <xs:attribute name="precondition" type="xs:string"/>
+ <xs:attribute name="precondition" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ <![CDATA[
+The predicate of the precondition in simple language to evaluate in order to
+determine if this route should be included or not.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="rest" type="xs:boolean"/>
- <xs:attribute name="routeConfigurationId" type="xs:string"/>
+ <xs:attribute name="routeConfigurationId" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ <![CDATA[
+The route configuration id or pattern this route should use for configuration.
+Multiple id/pattern can be separated by comma.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="routePolicyRef" type="xs:string">
<xs:annotation>
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/route.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/route.json
index ad97683f253..ef4583cf14a 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/route.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/route.json
@@ -13,9 +13,12 @@
},
"properties": {
"group": { "kind": "attribute", "displayName": "Group", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The group that this route belongs to; could be the name of the RouteBuilder class or be explicitly configured in the XML. May be null." },
+ "nodePrefixId": { "kind": "attribute", "displayName": "Node Prefix Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets a prefix to use for all node ids (not route id)." },
+ "routeConfigurationId": { "kind": "attribute", "displayName": "Route Configuration Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The route configuration id or pattern this route should use for configuration. Multiple id\/pattern can be separated by comma." },
+ "precondition": { "kind": "attribute", "displayName": "Precondition", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The predicate of the precondition in simple language to evaluate in order to determine if this route should be included or not." },
"streamCache": { "kind": "attribute", "displayName": "Stream Cache", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether stream caching is enabled on this route." },
"trace": { "kind": "attribute", "displayName": "Trace", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether tracing is enabled on this route." },
- "messageHistory": { "kind": "attribute", "displayName": "Message History", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "true", "description": "Whether message history is enabled on this route." },
+ "messageHistory": { "kind": "attribute", "displayName": "Message History", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether message history is enabled on this route." },
"logMask": { "kind": "attribute", "displayName": "Log Mask", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "description": "Whether security mask for Logging is enabled on this route." },
"delayer": { "kind": "attribute", "displayName": "Delayer", "required": false, "type": "duration", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Whether to slow down processing messages by a given delay in msec." },
"autoStartup": { "kind": "attribute", "displayName": "Auto Startup", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "true", "description": "Whether to auto start this route" },
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
index 534ae072df8..ea92bc4611b 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
@@ -927,7 +927,7 @@ public class RouteDefinition extends OutputDefinition<RouteDefinition>
* Whether message history is enabled on this route.
*/
@XmlAttribute
- @Metadata(label = "advanced", javaType = "java.lang.Boolean", defaultValue = "true")
+ @Metadata(label = "advanced", javaType = "java.lang.Boolean")
public void setMessageHistory(String messageHistory) {
this.messageHistory = messageHistory;
}
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
index 8707c55bf34..c8300353a7d 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
@@ -644,7 +644,25 @@ public class SchemaGeneratorMojo extends AbstractGeneratorMojo {
false, null, null, false, false);
eipOptions.add(ep);
- // group
+ // nodePrefixId
+ docComment = findJavaDoc(null, "nodePrefixId", null, classElement, true);
+ ep = createOption("nodePrefixId", "Node Prefix Id", "attribute", "java.lang.String", false, "", "", docComment, false, null,
+ false, null, null, false, false);
+ eipOptions.add(ep);
+
+ // routeConfigurationId
+ docComment = findJavaDoc(null, "routeConfigurationId", null, classElement, true);
+ ep = createOption("routeConfigurationId", "Route Configuration Id", "attribute", "java.lang.String", false, "", "", docComment, false, null,
+ false, null, null, false, false);
+ eipOptions.add(ep);
+
+ // precondition
+ docComment = findJavaDoc(null, "precondition", null, classElement, true);
+ ep = createOption("precondition", "Precondition", "attribute", "java.lang.String", false, "", "", docComment, false,
+ null, false, null, null, false, false);
+ eipOptions.add(ep);
+
+ // stream cache
docComment = findJavaDoc(null, "streamCache", null, classElement, true);
ep = createOption("streamCache", "Stream Cache", "attribute", "java.lang.String", false, "", "", docComment, false,
null,
@@ -660,7 +678,7 @@ public class SchemaGeneratorMojo extends AbstractGeneratorMojo {
// message history
docComment = findJavaDoc(null, "messageHistory", null, classElement, true);
- ep = createOption("messageHistory", "Message History", "attribute", "java.lang.String", false, "true", "", docComment,
+ ep = createOption("messageHistory", "Message History", "attribute", "java.lang.String", false, "", "", docComment,
false, null, false, null, null, false, false);
eipOptions.add(ep);
[camel] 02/03: Make XmlHelper more secure
Posted by da...@apache.org.
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
commit 6c7d0c84b4aa5a481bd864e7f17db66d51659acf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 18 14:38:39 2022 +0100
Make XmlHelper more secure
---
.../apache/camel/dsl/jbang/core/common/XmlHelper.java | 5 +++++
.../main/java/org/apache/camel/maven/XmlHelper.java | 19 ++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/XmlHelper.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/XmlHelper.java
index afc58f99cd9..452307af4cd 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/XmlHelper.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/XmlHelper.java
@@ -42,6 +42,11 @@ public final class XmlHelper {
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
} catch (ParserConfigurationException e) {
}
+ try {
+ // Disable the external-parameter-entities by default
+ factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ } catch (ParserConfigurationException e) {
+ }
// setup the SecurityManager by default if it's apache xerces
try {
Class<?> smClass = ObjectHelper.loadClass("org.apache.xerces.util.SecurityManager");
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java
index 5d0e9d1ec10..bcb505d833d 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java
@@ -41,9 +41,26 @@ public final class XmlHelper {
public static Document buildNamespaceAwareDocument(File xml)
throws SAXException, ParserConfigurationException, IOException {
+
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
- factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
+ try {
+ // Set secure processing
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ } catch (ParserConfigurationException e) {
+ }
+ try {
+ // Disable the external-general-entities by default
+ factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ } catch (ParserConfigurationException e) {
+ }
+ try {
+ // Disable the external-parameter-entities by default
+ factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ } catch (ParserConfigurationException e) {
+ }
return factory.newDocumentBuilder().parse(xml);
}
[camel] 01/03: Polished
Posted by da...@apache.org.
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
commit 7a4f42aa443c60a5f17a73ff15424aa0b2227524
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 18 14:11:41 2022 +0100
Polished
---
.../src/main/java/org/apache/camel/impl/engine/DefaultTracer.java | 7 -------
1 file changed, 7 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultTracer.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultTracer.java
index 3401ddb1cab..6d25689fd5c 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultTracer.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultTracer.java
@@ -124,13 +124,6 @@ public class DefaultTracer extends ServiceSupport implements CamelContextAware,
boolean original = route.getRouteId().equals(exchange.getFromRouteId());
String arrow = original ? "*-->" : "--->";
- // we need to capture original source:line-number
- if (original && camelContext.isDebugging()) {
- // TODO: use in dumpTrace
- int line = route.getInput().getLineNumber();
- String loc = route.getInput().getLocation();
- }
-
StringBuilder sb = new StringBuilder();
sb.append(String.format(tracingFormat, arrow, route.getRouteId(), label));
sb.append(" ");