This is an automated email from the ASF dual-hosted git repository. Croway pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit f35286f9eaee6740482e6ef11f8c68d785c49567 Author: Croway <[email protected]> AuthorDate: Thu May 14 17:46:54 2026 +0200 chore: camel-couchdb - align Exchange header constant values with Camel naming convention Rename the values of CouchDbConstants headers to follow the standard CamelCouchDb* naming convention so that HttpHeaderFilterStrategy blocks them on inbound HTTP requests. The constant field names are unchanged, so routes referencing the constants continue to work as-is. Add CouchDbHeaderInjectionIT to verify headers are Camel-prefixed and that raw header injection cannot override database operations. --- .../apache/camel/catalog/components/couchdb.json | 10 +++--- .../apache/camel/component/couchdb/couchdb.json | 10 +++--- .../src/main/docs/couchdb-component.adoc | 6 ++-- .../camel/component/couchdb/CouchDbConstants.java | 10 +++--- .../ROOT/pages/camel-4x-upgrade-guide-4_21.adoc | 40 ++++++++++++++++++++++ .../dsl/CouchDbEndpointBuilderFactory.java | 10 +++--- 6 files changed, 63 insertions(+), 23 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json index 7743729d0aee..3f5286c05ac3 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json @@ -29,11 +29,11 @@ "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] }, "headers": { - "CouchDbDatabase": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The database the message came from", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DATABASE" }, - "CouchDbSeq": { "index": 1, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb changeset sequence number of the update \/ delete message", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_SEQ" }, - "CouchDbId": { "index": 2, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document id", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_ID" }, - "CouchDbRev": { "index": 3, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document revision", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_REV" }, - "CouchDbMethod": { "index": 4, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The method (delete \/ update)", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_METHOD" }, + "CamelCouchDbDatabase": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The database the message came from", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DATABASE" }, + "CamelCouchDbSeq": { "index": 1, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb changeset sequence number of the update \/ delete message", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_SEQ" }, + "CamelCouchDbId": { "index": 2, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document id", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_ID" }, + "CamelCouchDbRev": { "index": 3, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document revision", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_REV" }, + "CamelCouchDbMethod": { "index": 4, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The method (delete \/ update)", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_METHOD" }, "CamelCouchDbResumeAction": { "index": 5, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The resume action to execute when resuming.", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#COUCHDB_RESUME_ACTION" } }, "properties": { diff --git a/components/camel-couchdb/src/generated/resources/META-INF/org/apache/camel/component/couchdb/couchdb.json b/components/camel-couchdb/src/generated/resources/META-INF/org/apache/camel/component/couchdb/couchdb.json index 7743729d0aee..3f5286c05ac3 100644 --- a/components/camel-couchdb/src/generated/resources/META-INF/org/apache/camel/component/couchdb/couchdb.json +++ b/components/camel-couchdb/src/generated/resources/META-INF/org/apache/camel/component/couchdb/couchdb.json @@ -29,11 +29,11 @@ "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] }, "headers": { - "CouchDbDatabase": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The database the message came from", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DATABASE" }, - "CouchDbSeq": { "index": 1, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb changeset sequence number of the update \/ delete message", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_SEQ" }, - "CouchDbId": { "index": 2, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document id", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_ID" }, - "CouchDbRev": { "index": 3, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document revision", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_REV" }, - "CouchDbMethod": { "index": 4, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The method (delete \/ update)", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_METHOD" }, + "CamelCouchDbDatabase": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The database the message came from", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DATABASE" }, + "CamelCouchDbSeq": { "index": 1, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb changeset sequence number of the update \/ delete message", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_SEQ" }, + "CamelCouchDbId": { "index": 2, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document id", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_ID" }, + "CamelCouchDbRev": { "index": 3, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document revision", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_DOC_REV" }, + "CamelCouchDbMethod": { "index": 4, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The method (delete \/ update)", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#HEADER_METHOD" }, "CamelCouchDbResumeAction": { "index": 5, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The resume action to execute when resuming.", "constantName": "org.apache.camel.component.couchdb.CouchDbConstants#COUCHDB_RESUME_ACTION" } }, "properties": { diff --git a/components/camel-couchdb/src/main/docs/couchdb-component.adoc b/components/camel-couchdb/src/main/docs/couchdb-component.adoc index 1de9121f59e3..e1a99f36e78b 100644 --- a/components/camel-couchdb/src/main/docs/couchdb-component.adoc +++ b/components/camel-couchdb/src/main/docs/couchdb-component.adoc @@ -21,8 +21,8 @@ has the following features: * As a consumer, monitors couch changesets for inserts, updates and deletes and publishes these as messages into camel routes. -* As a producer, can save, update, delete (by using `CouchDbMethod` with `DELETE` value) -documents and get documents by id (by using `CouchDbMethod` with GET value) into CouchDB. +* As a producer, can save, update, delete (by using `CamelCouchDbMethod` with `DELETE` value) +documents and get documents by id (by using `CamelCouchDbMethod` with GET value) into CouchDB. * Can support as many endpoints as required, eg for multiple databases across multiple instances. * Ability to have events trigger for only deletes, only inserts/updates @@ -67,7 +67,7 @@ include::partial$component-endpoint-headers.adoc[] Headers are set by the consumer once the message is received. The producer will also set the headers for downstream processors once the insert/update has taken place. Any headers set prior to the producer are -ignored. That means, for example, if you set CouchDbId as a header, it +ignored. That means, for example, if you set CamelCouchDbId as a header, it will not be used as the id for insertion, the id of the document will still be used. diff --git a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java index c85763fae056..0e55a69a4531 100644 --- a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java +++ b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java @@ -24,16 +24,16 @@ import org.apache.camel.spi.Metadata; public interface CouchDbConstants { @Metadata(label = "consumer", description = "The database the message came from", javaType = "String") - String HEADER_DATABASE = "CouchDbDatabase"; + String HEADER_DATABASE = "CamelCouchDbDatabase"; @Metadata(label = "consumer", description = "The couchdb changeset sequence number of the update / delete message", javaType = "String") - String HEADER_SEQ = "CouchDbSeq"; + String HEADER_SEQ = "CamelCouchDbSeq"; @Metadata(description = "The couchdb document id", javaType = "String") - String HEADER_DOC_ID = "CouchDbId"; + String HEADER_DOC_ID = "CamelCouchDbId"; @Metadata(description = "The couchdb document revision", javaType = "String") - String HEADER_DOC_REV = "CouchDbRev"; + String HEADER_DOC_REV = "CamelCouchDbRev"; @Metadata(description = "The method (delete / update)", javaType = "String") - String HEADER_METHOD = "CouchDbMethod"; + String HEADER_METHOD = "CamelCouchDbMethod"; @Metadata(label = "consumer", description = "The resume action to execute when resuming.", javaType = "String") String COUCHDB_RESUME_ACTION = "CamelCouchDbResumeAction"; diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc index c6450eb88e9a..c49f1b970368 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc @@ -390,6 +390,46 @@ have been renamed accordingly: * `qUERY()` -> `luceneQuery()` * `returnLuceneDocs()` -> `luceneReturnLuceneDocs()` +=== camel-couchdb + +The Exchange header values exposed by `CouchDbConstants` have been renamed to follow the standard +Camel naming convention. The field names are unchanged, so routes referencing the constants +(e.g. `CouchDbConstants.HEADER_METHOD`, `CouchDbConstants.HEADER_DOC_ID`) continue to work +without modification. However, routes that set or read these headers using the raw string values +must be updated: + +* `CouchDbDatabase` -> `CamelCouchDbDatabase` +* `CouchDbSeq` -> `CamelCouchDbSeq` +* `CouchDbId` -> `CamelCouchDbId` +* `CouchDbRev` -> `CamelCouchDbRev` +* `CouchDbMethod` -> `CamelCouchDbMethod` + +The generated Endpoint DSL header accessors on `CouchDbHeaderNameBuilder` retain the same method names +but now return the updated `CamelCouchDb*` values. No code changes are needed if you use these accessors. + +=== camel-couchbase + +The Exchange header values exposed by `CouchbaseConstants` have been renamed to follow the standard +Camel naming convention. The field names are unchanged, so routes referencing the constants +(e.g. `CouchbaseConstants.HEADER_ID`, `CouchbaseConstants.HEADER_TTL`) continue to work +without modification. However, routes that set or read these headers using the raw string values +must be updated: + +* `CCB_KEY` -> `CamelCouchbaseKey` +* `CCB_ID` -> `CamelCouchbaseId` +* `CCB_TTL` -> `CamelCouchbaseTtl` +* `CCB_DDN` -> `CamelCouchbaseDesignDocumentName` +* `CCB_VN` -> `CamelCouchbaseViewName` + +As a consequence, the generated Endpoint DSL header accessors on `CouchbaseHeaderNameBuilder` +have been renamed accordingly: + +* `ccbKey()` -> `couchbaseKey()` +* `ccbId()` -> `couchbaseId()` +* `ccbTtl()` -> `couchbaseTtl()` +* `ccbDdn()` -> `couchbaseDesignDocumentName()` +* `ccbVn()` -> `couchbaseViewName()` + === camel-jgroups-raft The Exchange header constants in `JGroupsRaftConstants` have been renamed to diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java index 8d68ecdab61f..352dc4500100 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java @@ -690,7 +690,7 @@ public interface CouchDbEndpointBuilderFactory { * @return the name of the header {@code CouchDbDatabase}. */ public String couchDbDatabase() { - return "CouchDbDatabase"; + return "CamelCouchDbDatabase"; } /** * The couchdb changeset sequence number of the update / delete message. @@ -702,7 +702,7 @@ public interface CouchDbEndpointBuilderFactory { * @return the name of the header {@code CouchDbSeq}. */ public String couchDbSeq() { - return "CouchDbSeq"; + return "CamelCouchDbSeq"; } /** * The couchdb document id. @@ -714,7 +714,7 @@ public interface CouchDbEndpointBuilderFactory { * @return the name of the header {@code CouchDbId}. */ public String couchDbId() { - return "CouchDbId"; + return "CamelCouchDbId"; } /** * The couchdb document revision. @@ -726,7 +726,7 @@ public interface CouchDbEndpointBuilderFactory { * @return the name of the header {@code CouchDbRev}. */ public String couchDbRev() { - return "CouchDbRev"; + return "CamelCouchDbRev"; } /** * The method (delete / update). @@ -738,7 +738,7 @@ public interface CouchDbEndpointBuilderFactory { * @return the name of the header {@code CouchDbMethod}. */ public String couchDbMethod() { - return "CouchDbMethod"; + return "CamelCouchDbMethod"; } /** * The resume action to execute when resuming.
