This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-17339-web3j in repository https://gitbox.apache.org/repos/asf/camel.git
commit cb1ba46d6f480b7c4886b19802597b2f3a7b135c Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Jul 23 15:00:21 2025 +0200 CAMEL-17339 - Avoid List<String> as configuration parameter types in Endpoint configurations - Camel Web3j Signed-off-by: Andrea Cosentino <[email protected]> --- .../org/apache/camel/catalog/components/web3j.json | 8 +- .../component/web3j/Web3jComponentConfigurer.java | 18 +-- .../component/web3j/Web3jEndpointConfigurer.java | 18 +-- .../org/apache/camel/component/web3j/web3j.json | 8 +- .../camel/component/web3j/Web3jConfiguration.java | 52 ++++++--- .../camel/component/web3j/Web3jConsumer.java | 4 +- .../camel/component/web3j/Web3jProducer.java | 2 +- .../ROOT/pages/camel-4x-upgrade-guide-4_14.adoc | 4 + .../dsl/Web3jComponentBuilderFactory.java | 19 ++-- .../endpoint/dsl/Web3jEndpointBuilderFactory.java | 123 +++------------------ 10 files changed, 82 insertions(+), 174 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/web3j.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/web3j.json index 079a6e6c43b..7e87d745661 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/web3j.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/web3j.json @@ -24,13 +24,13 @@ "remote": true }, "componentProperties": { - "addresses": { "index": 0, "kind": "property", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a list of addresses." }, + "addresses": { "index": 0, "kind": "property", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a comma separated list of addresses." }, "configuration": { "index": 1, "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.web3j.Web3jConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "Default configuration" }, "fromAddress": { "index": 2, "kind": "property", "displayName": "From Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is send from" }, "fromBlock": { "index": 3, "kind": "property", "displayName": "From Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for [...] "fullTransactionObjects": { "index": 4, "kind": "property", "displayName": "Full Transaction Objects", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true it returns the full transaction objects, if false only the hashes [...] "gasLimit": { "index": 5, "kind": "property", "displayName": "Gas Limit", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.math.BigInteger", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The maximum gas allowed in this block." }, - "privateFor": { "index": 6, "kind": "property", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A transaction privateFor nodes with public keys in a Quorum network" }, + "privateFor": { "index": 6, "kind": "property", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A comma separated transaction privateFor nodes with public keys in a Quorum network" }, "quorumAPI": { "index": 7, "kind": "property", "displayName": "Quorum API", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true, this will support Quorum API." }, "toAddress": { "index": 8, "kind": "property", "displayName": "To Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is directed to." }, "toBlock": { "index": 9, "kind": "property", "displayName": "To Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for not [...] @@ -105,12 +105,12 @@ }, "properties": { "nodeAddress": { "index": 0, "kind": "path", "displayName": "Node Address", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Sets the node address used to communicate" }, - "addresses": { "index": 1, "kind": "parameter", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a list of addresses." }, + "addresses": { "index": 1, "kind": "parameter", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a comma separated list of addresses." }, "fromAddress": { "index": 2, "kind": "parameter", "displayName": "From Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is send from" }, "fromBlock": { "index": 3, "kind": "parameter", "displayName": "From Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for [...] "fullTransactionObjects": { "index": 4, "kind": "parameter", "displayName": "Full Transaction Objects", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true it returns the full transaction objects, if false only the hashe [...] "gasLimit": { "index": 5, "kind": "parameter", "displayName": "Gas Limit", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.math.BigInteger", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The maximum gas allowed in this block." }, - "privateFor": { "index": 6, "kind": "parameter", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A transaction privateFor nodes with public keys in a Quorum network" }, + "privateFor": { "index": 6, "kind": "parameter", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A comma separated transaction privateFor nodes with public keys in a Quorum network" }, "quorumAPI": { "index": 7, "kind": "parameter", "displayName": "Quorum API", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true, this will support Quorum API." }, "toAddress": { "index": 8, "kind": "parameter", "displayName": "To Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is directed to." }, "toBlock": { "index": 9, "kind": "parameter", "displayName": "To Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for not [...] diff --git a/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jComponentConfigurer.java b/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jComponentConfigurer.java index bf0dd5c210c..40eb94e6105 100644 --- a/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jComponentConfigurer.java +++ b/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jComponentConfigurer.java @@ -31,7 +31,7 @@ public class Web3jComponentConfigurer extends PropertyConfigurerSupport implemen Web3jComponent target = (Web3jComponent) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "address": getOrCreateConfiguration(target).setAddress(property(camelContext, java.lang.String.class, value)); return true; - case "addresses": getOrCreateConfiguration(target).setAddresses(property(camelContext, java.util.List.class, value)); return true; + case "addresses": getOrCreateConfiguration(target).setAddresses(property(camelContext, java.lang.String.class, value)); return true; case "atblock": case "atBlock": getOrCreateConfiguration(target).setAtBlock(property(camelContext, java.lang.String.class, value)); return true; case "autowiredenabled": @@ -73,7 +73,7 @@ public class Web3jComponentConfigurer extends PropertyConfigurerSupport implemen case "position": getOrCreateConfiguration(target).setPosition(property(camelContext, java.math.BigInteger.class, value)); return true; case "priority": getOrCreateConfiguration(target).setPriority(property(camelContext, java.math.BigInteger.class, value)); return true; case "privatefor": - case "privateFor": getOrCreateConfiguration(target).setPrivateFor(property(camelContext, java.util.List.class, value)); return true; + case "privateFor": getOrCreateConfiguration(target).setPrivateFor(property(camelContext, java.lang.String.class, value)); return true; case "quorumapi": case "quorumAPI": getOrCreateConfiguration(target).setQuorumAPI(property(camelContext, boolean.class, value)); return true; case "sha3hashofdatatosign": @@ -100,7 +100,7 @@ public class Web3jComponentConfigurer extends PropertyConfigurerSupport implemen public Class<?> getOptionType(String name, boolean ignoreCase) { switch (ignoreCase ? name.toLowerCase() : name) { case "address": return java.lang.String.class; - case "addresses": return java.util.List.class; + case "addresses": return java.lang.String.class; case "atblock": case "atBlock": return java.lang.String.class; case "autowiredenabled": @@ -142,7 +142,7 @@ public class Web3jComponentConfigurer extends PropertyConfigurerSupport implemen case "position": return java.math.BigInteger.class; case "priority": return java.math.BigInteger.class; case "privatefor": - case "privateFor": return java.util.List.class; + case "privateFor": return java.lang.String.class; case "quorumapi": case "quorumAPI": return boolean.class; case "sha3hashofdatatosign": @@ -234,15 +234,5 @@ public class Web3jComponentConfigurer extends PropertyConfigurerSupport implemen default: return null; } } - - @Override - public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "addresses": return java.lang.String.class; - case "privatefor": - case "privateFor": return java.lang.String.class; - default: return null; - } - } } diff --git a/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jEndpointConfigurer.java b/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jEndpointConfigurer.java index 05e645e3e02..29cf7f10a3e 100644 --- a/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jEndpointConfigurer.java +++ b/components/camel-web3j/src/generated/java/org/apache/camel/component/web3j/Web3jEndpointConfigurer.java @@ -24,7 +24,7 @@ public class Web3jEndpointConfigurer extends PropertyConfigurerSupport implement Web3jEndpoint target = (Web3jEndpoint) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "address": target.getConfiguration().setAddress(property(camelContext, java.lang.String.class, value)); return true; - case "addresses": target.getConfiguration().setAddresses(property(camelContext, java.util.List.class, value)); return true; + case "addresses": target.getConfiguration().setAddresses(property(camelContext, java.lang.String.class, value)); return true; case "atblock": case "atBlock": target.getConfiguration().setAtBlock(property(camelContext, java.lang.String.class, value)); return true; case "blockhash": @@ -67,7 +67,7 @@ public class Web3jEndpointConfigurer extends PropertyConfigurerSupport implement case "position": target.getConfiguration().setPosition(property(camelContext, java.math.BigInteger.class, value)); return true; case "priority": target.getConfiguration().setPriority(property(camelContext, java.math.BigInteger.class, value)); return true; case "privatefor": - case "privateFor": target.getConfiguration().setPrivateFor(property(camelContext, java.util.List.class, value)); return true; + case "privateFor": target.getConfiguration().setPrivateFor(property(camelContext, java.lang.String.class, value)); return true; case "quorumapi": case "quorumAPI": target.getConfiguration().setQuorumAPI(property(camelContext, boolean.class, value)); return true; case "sha3hashofdatatosign": @@ -94,7 +94,7 @@ public class Web3jEndpointConfigurer extends PropertyConfigurerSupport implement public Class<?> getOptionType(String name, boolean ignoreCase) { switch (ignoreCase ? name.toLowerCase() : name) { case "address": return java.lang.String.class; - case "addresses": return java.util.List.class; + case "addresses": return java.lang.String.class; case "atblock": case "atBlock": return java.lang.String.class; case "blockhash": @@ -137,7 +137,7 @@ public class Web3jEndpointConfigurer extends PropertyConfigurerSupport implement case "position": return java.math.BigInteger.class; case "priority": return java.math.BigInteger.class; case "privatefor": - case "privateFor": return java.util.List.class; + case "privateFor": return java.lang.String.class; case "quorumapi": case "quorumAPI": return boolean.class; case "sha3hashofdatatosign": @@ -230,15 +230,5 @@ public class Web3jEndpointConfigurer extends PropertyConfigurerSupport implement default: return null; } } - - @Override - public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "addresses": return java.lang.String.class; - case "privatefor": - case "privateFor": return java.lang.String.class; - default: return null; - } - } } diff --git a/components/camel-web3j/src/generated/resources/META-INF/org/apache/camel/component/web3j/web3j.json b/components/camel-web3j/src/generated/resources/META-INF/org/apache/camel/component/web3j/web3j.json index 079a6e6c43b..7e87d745661 100644 --- a/components/camel-web3j/src/generated/resources/META-INF/org/apache/camel/component/web3j/web3j.json +++ b/components/camel-web3j/src/generated/resources/META-INF/org/apache/camel/component/web3j/web3j.json @@ -24,13 +24,13 @@ "remote": true }, "componentProperties": { - "addresses": { "index": 0, "kind": "property", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a list of addresses." }, + "addresses": { "index": 0, "kind": "property", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a comma separated list of addresses." }, "configuration": { "index": 1, "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.web3j.Web3jConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "Default configuration" }, "fromAddress": { "index": 2, "kind": "property", "displayName": "From Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is send from" }, "fromBlock": { "index": 3, "kind": "property", "displayName": "From Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for [...] "fullTransactionObjects": { "index": 4, "kind": "property", "displayName": "Full Transaction Objects", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true it returns the full transaction objects, if false only the hashes [...] "gasLimit": { "index": 5, "kind": "property", "displayName": "Gas Limit", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.math.BigInteger", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The maximum gas allowed in this block." }, - "privateFor": { "index": 6, "kind": "property", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A transaction privateFor nodes with public keys in a Quorum network" }, + "privateFor": { "index": 6, "kind": "property", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A comma separated transaction privateFor nodes with public keys in a Quorum network" }, "quorumAPI": { "index": 7, "kind": "property", "displayName": "Quorum API", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true, this will support Quorum API." }, "toAddress": { "index": 8, "kind": "property", "displayName": "To Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is directed to." }, "toBlock": { "index": 9, "kind": "property", "displayName": "To Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for not [...] @@ -105,12 +105,12 @@ }, "properties": { "nodeAddress": { "index": 0, "kind": "path", "displayName": "Node Address", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Sets the node address used to communicate" }, - "addresses": { "index": 1, "kind": "parameter", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a list of addresses." }, + "addresses": { "index": 1, "kind": "parameter", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "Contract address or a comma separated list of addresses." }, "fromAddress": { "index": 2, "kind": "parameter", "displayName": "From Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is send from" }, "fromBlock": { "index": 3, "kind": "parameter", "displayName": "From Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for [...] "fullTransactionObjects": { "index": 4, "kind": "parameter", "displayName": "Full Transaction Objects", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true it returns the full transaction objects, if false only the hashe [...] "gasLimit": { "index": 5, "kind": "parameter", "displayName": "Gas Limit", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.math.BigInteger", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The maximum gas allowed in this block." }, - "privateFor": { "index": 6, "kind": "parameter", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A transaction privateFor nodes with public keys in a Quorum network" }, + "privateFor": { "index": 6, "kind": "parameter", "displayName": "Private For", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "A comma separated transaction privateFor nodes with public keys in a Quorum network" }, "quorumAPI": { "index": 7, "kind": "parameter", "displayName": "Quorum API", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "If true, this will support Quorum API." }, "toAddress": { "index": 8, "kind": "parameter", "displayName": "To Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The address the transaction is directed to." }, "toBlock": { "index": 9, "kind": "parameter", "displayName": "To Block", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "latest", "configurationClass": "org.apache.camel.component.web3j.Web3jConfiguration", "configurationField": "configuration", "description": "The block number, or the string latest for the last mined block or pending, earliest for not [...] diff --git a/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConfiguration.java b/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConfiguration.java index ced2535296d..a6dd8aef0d1 100644 --- a/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConfiguration.java +++ b/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConfiguration.java @@ -17,7 +17,6 @@ package org.apache.camel.component.web3j; import java.math.BigInteger; -import java.util.Arrays; import java.util.List; import org.apache.camel.RuntimeCamelException; @@ -41,13 +40,13 @@ public class Web3jConfiguration implements Cloneable { private String atBlock; @UriParam(label = "common") - private List<String> addresses; + private String addresses; @UriParam(label = "producer") private String address; @UriParam(label = "common", javaType = "java.lang.String") - private List<String> topics; + private String topics; @UriParam(label = "producer") private BigInteger position; @@ -128,16 +127,24 @@ public class Web3jConfiguration implements Cloneable { private boolean quorumAPI; @UriParam(label = "common") - private List<String> privateFor; + private String privateFor; - public List<String> getPrivateFor() { + public String getPrivateFor() { return privateFor; } + public List<String> getPrivateForAsList() { + if (privateFor != null) { + return List.of(privateFor.split(",")); + } else { + return null; + } + } + /** - * A transaction privateFor nodes with public keys in a Quorum network + * A comma separated transaction privateFor nodes with public keys in a Quorum network */ - public void setPrivateFor(List<String> privateFor) { + public void setPrivateFor(String privateFor) { this.privateFor = privateFor; } @@ -452,31 +459,42 @@ public class Web3jConfiguration implements Cloneable { this.atBlock = atBlock; } - public List<String> getAddresses() { + public String getAddresses() { return addresses; } + public List<String> getAddressesAsList() { + if (addresses != null) { + return List.of(addresses.split(",")); + } else { + return null; + } + } + /** - * Contract address or a list of addresses. + * Contract address or a comma separated list of addresses. */ - public void setAddresses(List<String> addresses) { + public void setAddresses(String addresses) { this.addresses = addresses; } - public List<String> getTopics() { + public String getTopics() { return topics; } + public List<String> getTopicsAsList() { + if (topics != null) { + return List.of(topics.split(",")); + } else { + return null; + } + } + /** * Topics are order-dependent. Each topic can also be a list of topics. Specify multiple topics separated by comma. */ - public void setTopics(List<String> topics) { - this.topics = topics; - } - public void setTopics(String topics) { - String[] arr = topics.split(","); - this.topics = Arrays.asList(arr); + this.topics = topics; } public String getAddress() { diff --git a/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConsumer.java b/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConsumer.java index 8ae27134ac4..1716ab9e8ef 100644 --- a/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConsumer.java +++ b/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jConsumer.java @@ -61,8 +61,8 @@ public class Web3jConsumer extends DefaultConsumer { switch (configuration.getOperation()) { case Web3jConstants.ETH_LOG_OBSERVABLE: EthFilter ethFilter = Web3jEndpoint.buildEthFilter(toDefaultBlockParameter(configuration.getFromBlock()), - toDefaultBlockParameter(configuration.getToBlock()), configuration.getAddresses(), - configuration.getTopics()); + toDefaultBlockParameter(configuration.getToBlock()), configuration.getAddressesAsList(), + configuration.getTopicsAsList()); subscription = web3j.ethLogFlowable(ethFilter).subscribe( this::ethLogObservable, t -> processError(t, Web3jConstants.ETH_LOG_OBSERVABLE), diff --git a/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jProducer.java b/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jProducer.java index fcfb859954b..fd4ab876b38 100644 --- a/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jProducer.java +++ b/components/camel-web3j/src/main/java/org/apache/camel/component/web3j/Web3jProducer.java @@ -975,7 +975,7 @@ public class Web3jProducer extends HeaderSelectorProducer { BigInteger gasLimit = message.getHeader(Web3jConstants.GAS_LIMIT, configuration::getGasLimit, BigInteger.class); BigInteger value = message.getHeader(Web3jConstants.VALUE, configuration::getValue, BigInteger.class); String data = message.getHeader(Web3jConstants.DATA, configuration::getData, String.class); - List<String> privateFor = message.getHeader(Web3jConstants.PRIVATE_FOR, configuration::getPrivateFor, List.class); + List<String> privateFor = message.getHeader(Web3jConstants.PRIVATE_FOR, configuration::getPrivateForAsList, List.class); String privateFrom = message.getHeader(Web3jConstants.PRIVATE_FROM, String.class); PrivateTransaction transaction = new PrivateTransaction(fromAddress, nonce, gasLimit, toAddress, value, data, privateFrom, privateFor); diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc index b060534da84..8ccc0635239 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc @@ -46,3 +46,7 @@ The availableZones parameter for camel-huawei-dms has been defined as String ins The ids parameter for camel-weather has been defined as String instead of List<String>. For the migration users will need to, eventually, define ids as a comma separated list of id instead of a List instance. For more information the related issue is CAMEL-17339. +=== camel-web3j + +The addresses, privateFor and Topics parameters for camel-web3j have been defined as String instead of List<String>. For the migration users will need to, eventually, define addresses, privateFor or topics as a comma separated list of addresses, privateFor or topics instead of a List instance. For more information the related issue is CAMEL-17339. + diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Web3jComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Web3jComponentBuilderFactory.java index a6240b6e176..ba277e04355 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Web3jComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Web3jComponentBuilderFactory.java @@ -51,17 +51,16 @@ public interface Web3jComponentBuilderFactory { interface Web3jComponentBuilder extends ComponentBuilder<Web3jComponent> { /** - * Contract address or a list of addresses. + * Contract address or a comma separated list of addresses. * - * The option is a: - * <code>java.util.List&lt;java.lang.String&gt;</code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * * @param addresses the value to set * @return the dsl builder */ - default Web3jComponentBuilder addresses(java.util.List<java.lang.String> addresses) { + default Web3jComponentBuilder addresses(java.lang.String addresses) { doSetProperty("addresses", addresses); return this; } @@ -149,17 +148,17 @@ public interface Web3jComponentBuilderFactory { } /** - * A transaction privateFor nodes with public keys in a Quorum network. + * A comma separated transaction privateFor nodes with public keys in a + * Quorum network. * - * The option is a: - * <code>java.util.List&lt;java.lang.String&gt;</code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * * @param privateFor the value to set * @return the dsl builder */ - default Web3jComponentBuilder privateFor(java.util.List<java.lang.String> privateFor) { + default Web3jComponentBuilder privateFor(java.lang.String privateFor) { doSetProperty("privateFor", privateFor); return this; } @@ -696,13 +695,13 @@ public interface Web3jComponentBuilderFactory { String name, Object value) { switch (name) { - case "addresses": getOrCreateConfiguration((Web3jComponent) component).setAddresses((java.util.List) value); return true; + case "addresses": getOrCreateConfiguration((Web3jComponent) component).setAddresses((java.lang.String) value); return true; case "configuration": ((Web3jComponent) component).setConfiguration((org.apache.camel.component.web3j.Web3jConfiguration) value); return true; case "fromAddress": getOrCreateConfiguration((Web3jComponent) component).setFromAddress((java.lang.String) value); return true; case "fromBlock": getOrCreateConfiguration((Web3jComponent) component).setFromBlock((java.lang.String) value); return true; case "fullTransactionObjects": getOrCreateConfiguration((Web3jComponent) component).setFullTransactionObjects((boolean) value); return true; case "gasLimit": getOrCreateConfiguration((Web3jComponent) component).setGasLimit((java.math.BigInteger) value); return true; - case "privateFor": getOrCreateConfiguration((Web3jComponent) component).setPrivateFor((java.util.List) value); return true; + case "privateFor": getOrCreateConfiguration((Web3jComponent) component).setPrivateFor((java.lang.String) value); return true; case "quorumAPI": getOrCreateConfiguration((Web3jComponent) component).setQuorumAPI((boolean) value); return true; case "toAddress": getOrCreateConfiguration((Web3jComponent) component).setToAddress((java.lang.String) value); return true; case "toBlock": getOrCreateConfiguration((Web3jComponent) component).setToBlock((java.lang.String) value); return true; diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Web3jEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Web3jEndpointBuilderFactory.java index 90b646d8f88..c4d2a3f4cb3 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Web3jEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Web3jEndpointBuilderFactory.java @@ -44,25 +44,9 @@ public interface Web3jEndpointBuilderFactory { return (AdvancedWeb3jEndpointConsumerBuilder) this; } /** - * Contract address or a list of addresses. - * - * The option is a: <code>java.util.List<java.lang.String></code> - * type. - * - * Group: common - * - * @param addresses the value to set - * @return the dsl builder - */ - default Web3jEndpointConsumerBuilder addresses(List<java.lang.String> addresses) { - doSetProperty("addresses", addresses); - return this; - } - /** - * Contract address or a list of addresses. + * Contract address or a comma separated list of addresses. * - * The option will be converted to a - * <code>java.util.List<java.lang.String></code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -165,25 +149,10 @@ public interface Web3jEndpointBuilderFactory { return this; } /** - * A transaction privateFor nodes with public keys in a Quorum network. - * - * The option is a: <code>java.util.List<java.lang.String></code> - * type. - * - * Group: common - * - * @param privateFor the value to set - * @return the dsl builder - */ - default Web3jEndpointConsumerBuilder privateFor(List<java.lang.String> privateFor) { - doSetProperty("privateFor", privateFor); - return this; - } - /** - * A transaction privateFor nodes with public keys in a Quorum network. + * A comma separated transaction privateFor nodes with public keys in a + * Quorum network. * - * The option will be converted to a - * <code>java.util.List<java.lang.String></code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -439,25 +408,9 @@ public interface Web3jEndpointBuilderFactory { } /** - * Contract address or a list of addresses. - * - * The option is a: <code>java.util.List<java.lang.String></code> - * type. - * - * Group: common - * - * @param addresses the value to set - * @return the dsl builder - */ - default Web3jEndpointProducerBuilder addresses(List<java.lang.String> addresses) { - doSetProperty("addresses", addresses); - return this; - } - /** - * Contract address or a list of addresses. + * Contract address or a comma separated list of addresses. * - * The option will be converted to a - * <code>java.util.List<java.lang.String></code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -560,25 +513,10 @@ public interface Web3jEndpointBuilderFactory { return this; } /** - * A transaction privateFor nodes with public keys in a Quorum network. - * - * The option is a: <code>java.util.List<java.lang.String></code> - * type. - * - * Group: common - * - * @param privateFor the value to set - * @return the dsl builder - */ - default Web3jEndpointProducerBuilder privateFor(List<java.lang.String> privateFor) { - doSetProperty("privateFor", privateFor); - return this; - } - /** - * A transaction privateFor nodes with public keys in a Quorum network. + * A comma separated transaction privateFor nodes with public keys in a + * Quorum network. * - * The option will be converted to a - * <code>java.util.List<java.lang.String></code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -1198,25 +1136,9 @@ public interface Web3jEndpointBuilderFactory { } /** - * Contract address or a list of addresses. - * - * The option is a: <code>java.util.List<java.lang.String></code> - * type. - * - * Group: common - * - * @param addresses the value to set - * @return the dsl builder - */ - default Web3jEndpointBuilder addresses(List<java.lang.String> addresses) { - doSetProperty("addresses", addresses); - return this; - } - /** - * Contract address or a list of addresses. + * Contract address or a comma separated list of addresses. * - * The option will be converted to a - * <code>java.util.List<java.lang.String></code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -1319,25 +1241,10 @@ public interface Web3jEndpointBuilderFactory { return this; } /** - * A transaction privateFor nodes with public keys in a Quorum network. - * - * The option is a: <code>java.util.List<java.lang.String></code> - * type. - * - * Group: common - * - * @param privateFor the value to set - * @return the dsl builder - */ - default Web3jEndpointBuilder privateFor(List<java.lang.String> privateFor) { - doSetProperty("privateFor", privateFor); - return this; - } - /** - * A transaction privateFor nodes with public keys in a Quorum network. + * A comma separated transaction privateFor nodes with public keys in a + * Quorum network. * - * The option will be converted to a - * <code>java.util.List<java.lang.String></code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common *
