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 5ceba4f7e5a upgrade to mina 2.2.4 (#16655) 5ceba4f7e5a is described below commit 5ceba4f7e5a427712e5624cf9d16ce2b40861810 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Dec 27 09:57:29 2024 +0100 upgrade to mina 2.2.4 (#16655) * CAMEL-21571: camel-mina - Upgrade to 2.2.4 and add option to configure codec allow pattern for object serialization. --- .../org/apache/camel/catalog/components/mina.json | 20 +++--- .../component/mina/MinaComponentConfigurer.java | 6 ++ .../component/mina/MinaEndpointConfigurer.java | 6 ++ .../component/mina/MinaEndpointUriFactory.java | 3 +- .../org/apache/camel/component/mina/mina.json | 20 +++--- .../camel/component/mina/MinaConfiguration.java | 18 +++++- .../apache/camel/component/mina/MinaConsumer.java | 4 ++ .../apache/camel/component/mina/MinaProducer.java | 4 ++ .../component/mina/MinaProducerConcurrentTest.java | 2 +- .../mina/MinaTransferExchangeOptionTest.java | 6 +- .../mina/MinaVMTransferExchangeOptionTest.java | 5 +- .../ROOT/pages/camel-4x-upgrade-guide-4_10.adoc | 4 ++ .../ROOT/pages/camel-4x-upgrade-guide-4_4.adoc | 7 +++ .../ROOT/pages/camel-4x-upgrade-guide-4_8.adoc | 7 +++ .../component/dsl/MinaComponentBuilderFactory.java | 22 ++++++- .../endpoint/dsl/MinaEndpointBuilderFactory.java | 72 ++++++++++++++++++++-- parent/pom.xml | 2 +- 17 files changed, 175 insertions(+), 33 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina.json index fd8a25a0ac1..f46565c71ee 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina.json @@ -40,17 +40,18 @@ "disconnectOnNoReply": { "index": 13, "kind": "property", "displayName": "Disconnect On No Reply", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "If sync is enabled then this option dictates MinaConsumer if it should disco [...] "maximumPoolSize": { "index": 14, "kind": "property", "displayName": "Maximum Pool Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 16, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Number of worker threads in the worker pool for TCP and UDP" }, "orderedThreadPoolExecutor": { "index": 15, "kind": "property", "displayName": "Ordered Thread Pool Executor", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Whether to use ordered thread pool, to ensure events are process [...] - "transferExchange": { "index": 16, "kind": "property", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the [...] + "transferExchange": { "index": 16, "kind": "property", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the b [...] "allowDefaultCodec": { "index": 17, "kind": "property", "displayName": "Allow Default Codec", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "The mina component installs a default codec if both, codec is null and textline is fals [...] "codec": { "index": 18, "kind": "property", "displayName": "Codec", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.mina.filter.codec.ProtocolCodecFactory", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To use a custom minda codec implementation." }, "decoderMaxLineLength": { "index": 19, "kind": "property", "displayName": "Decoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1024, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol decoder max line length. By default the default value o [...] "encoderMaxLineLength": { "index": 20, "kind": "property", "displayName": "Encoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol encoder max line length. By default the default value of [...] "encoding": { "index": 21, "kind": "property", "displayName": "Encoding", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol. If not provided, [...] "filters": { "index": 22, "kind": "property", "displayName": "Filters", "group": "codec", "label": "codec", "required": false, "type": "array", "javaType": "java.util.List<org.apache.mina.core.filterchain.IoFilter>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can set a list of Mina IoFilters to use." }, - "textline": { "index": 23, "kind": "property", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; if [...] - "textlineDelimiter": { "index": 24, "kind": "property", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only use [...] - "sslContextParameters": { "index": 25, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." }, - "useGlobalSslContextParameters": { "index": 26, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } + "objectCodecPattern": { "index": 23, "kind": "property", "displayName": "Object Codec Pattern", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Accept the wildcard specified classes for Object deserialization, unless they are otherwise rejecte [...] + "textline": { "index": 24, "kind": "property", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; if [...] + "textlineDelimiter": { "index": 25, "kind": "property", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only use [...] + "sslContextParameters": { "index": 26, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." }, + "useGlobalSslContextParameters": { "index": 27, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } }, "headers": { "CamelMinaCloseSessionWhenComplete": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Indicates whether the session should be closed after complete", "constantName": "org.apache.camel.component.mina.MinaConstants#MINA_CLOSE_SESSION_WHEN_COMPLETE" }, @@ -78,15 +79,16 @@ "disconnectOnNoReply": { "index": 16, "kind": "parameter", "displayName": "Disconnect On No Reply", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "If sync is enabled then this option dictates MinaConsumer if it should disc [...] "maximumPoolSize": { "index": 17, "kind": "parameter", "displayName": "Maximum Pool Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 16, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Number of worker threads in the worker pool for TCP and UDP" }, "orderedThreadPoolExecutor": { "index": 18, "kind": "parameter", "displayName": "Ordered Thread Pool Executor", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Whether to use ordered thread pool, to ensure events are proces [...] - "transferExchange": { "index": 19, "kind": "parameter", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the [...] + "transferExchange": { "index": 19, "kind": "parameter", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the [...] "allowDefaultCodec": { "index": 20, "kind": "parameter", "displayName": "Allow Default Codec", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "The mina component installs a default codec if both, codec is null and textline is fal [...] "codec": { "index": 21, "kind": "parameter", "displayName": "Codec", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.mina.filter.codec.ProtocolCodecFactory", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To use a custom minda codec implementation." }, "decoderMaxLineLength": { "index": 22, "kind": "parameter", "displayName": "Decoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1024, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol decoder max line length. By default the default value [...] "encoderMaxLineLength": { "index": 23, "kind": "parameter", "displayName": "Encoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol encoder max line length. By default the default value of [...] "encoding": { "index": 24, "kind": "parameter", "displayName": "Encoding", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol. If not provided, [...] "filters": { "index": 25, "kind": "parameter", "displayName": "Filters", "group": "codec", "label": "codec", "required": false, "type": "array", "javaType": "java.util.List<org.apache.mina.core.filterchain.IoFilter>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can set a list of Mina IoFilters to use." }, - "textline": { "index": 26, "kind": "parameter", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; i [...] - "textlineDelimiter": { "index": 27, "kind": "parameter", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only us [...] - "sslContextParameters": { "index": 28, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." } + "objectCodecPattern": { "index": 26, "kind": "parameter", "displayName": "Object Codec Pattern", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Accept the wildcard specified classes for Object deserialization, unless they are otherwise reject [...] + "textline": { "index": 27, "kind": "parameter", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; i [...] + "textlineDelimiter": { "index": 28, "kind": "parameter", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only us [...] + "sslContextParameters": { "index": 29, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." } } } diff --git a/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaComponentConfigurer.java b/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaComponentConfigurer.java index ec368b2cc9e..1b697bec50e 100644 --- a/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaComponentConfigurer.java +++ b/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaComponentConfigurer.java @@ -61,6 +61,8 @@ public class MinaComponentConfigurer extends PropertyConfigurerSupport implement case "minaLogger": getOrCreateConfiguration(target).setMinaLogger(property(camelContext, boolean.class, value)); return true; case "noreplyloglevel": case "noReplyLogLevel": getOrCreateConfiguration(target).setNoReplyLogLevel(property(camelContext, org.apache.camel.LoggingLevel.class, value)); return true; + case "objectcodecpattern": + case "objectCodecPattern": getOrCreateConfiguration(target).setObjectCodecPattern(property(camelContext, java.lang.String.class, value)); return true; case "orderedthreadpoolexecutor": case "orderedThreadPoolExecutor": getOrCreateConfiguration(target).setOrderedThreadPoolExecutor(property(camelContext, boolean.class, value)); return true; case "sslcontextparameters": @@ -114,6 +116,8 @@ public class MinaComponentConfigurer extends PropertyConfigurerSupport implement case "minaLogger": return boolean.class; case "noreplyloglevel": case "noReplyLogLevel": return org.apache.camel.LoggingLevel.class; + case "objectcodecpattern": + case "objectCodecPattern": return java.lang.String.class; case "orderedthreadpoolexecutor": case "orderedThreadPoolExecutor": return boolean.class; case "sslcontextparameters": @@ -168,6 +172,8 @@ public class MinaComponentConfigurer extends PropertyConfigurerSupport implement case "minaLogger": return getOrCreateConfiguration(target).isMinaLogger(); case "noreplyloglevel": case "noReplyLogLevel": return getOrCreateConfiguration(target).getNoReplyLogLevel(); + case "objectcodecpattern": + case "objectCodecPattern": return getOrCreateConfiguration(target).getObjectCodecPattern(); case "orderedthreadpoolexecutor": case "orderedThreadPoolExecutor": return getOrCreateConfiguration(target).isOrderedThreadPoolExecutor(); case "sslcontextparameters": diff --git a/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointConfigurer.java b/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointConfigurer.java index 68e424ef1ab..70c6c2d93c2 100644 --- a/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointConfigurer.java +++ b/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointConfigurer.java @@ -55,6 +55,8 @@ public class MinaEndpointConfigurer extends PropertyConfigurerSupport implements case "minaLogger": target.getConfiguration().setMinaLogger(property(camelContext, boolean.class, value)); return true; case "noreplyloglevel": case "noReplyLogLevel": target.getConfiguration().setNoReplyLogLevel(property(camelContext, org.apache.camel.LoggingLevel.class, value)); return true; + case "objectcodecpattern": + case "objectCodecPattern": target.getConfiguration().setObjectCodecPattern(property(camelContext, java.lang.String.class, value)); return true; case "orderedthreadpoolexecutor": case "orderedThreadPoolExecutor": target.getConfiguration().setOrderedThreadPoolExecutor(property(camelContext, boolean.class, value)); return true; case "sslcontextparameters": @@ -107,6 +109,8 @@ public class MinaEndpointConfigurer extends PropertyConfigurerSupport implements case "minaLogger": return boolean.class; case "noreplyloglevel": case "noReplyLogLevel": return org.apache.camel.LoggingLevel.class; + case "objectcodecpattern": + case "objectCodecPattern": return java.lang.String.class; case "orderedthreadpoolexecutor": case "orderedThreadPoolExecutor": return boolean.class; case "sslcontextparameters": @@ -160,6 +164,8 @@ public class MinaEndpointConfigurer extends PropertyConfigurerSupport implements case "minaLogger": return target.getConfiguration().isMinaLogger(); case "noreplyloglevel": case "noReplyLogLevel": return target.getConfiguration().getNoReplyLogLevel(); + case "objectcodecpattern": + case "objectCodecPattern": return target.getConfiguration().getObjectCodecPattern(); case "orderedthreadpoolexecutor": case "orderedThreadPoolExecutor": return target.getConfiguration().isOrderedThreadPoolExecutor(); case "sslcontextparameters": diff --git a/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointUriFactory.java b/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointUriFactory.java index 98fb150831b..e408d94dba7 100644 --- a/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointUriFactory.java +++ b/components/camel-mina/src/generated/java/org/apache/camel/component/mina/MinaEndpointUriFactory.java @@ -23,7 +23,7 @@ public class MinaEndpointUriFactory extends org.apache.camel.support.component.E private static final Set<String> SECRET_PROPERTY_NAMES; private static final Set<String> MULTI_VALUE_PREFIXES; static { - Set<String> props = new HashSet<>(29); + Set<String> props = new HashSet<>(30); props.add("allowDefaultCodec"); props.add("bridgeErrorHandler"); props.add("cachedAddress"); @@ -43,6 +43,7 @@ public class MinaEndpointUriFactory extends org.apache.camel.support.component.E props.add("maximumPoolSize"); props.add("minaLogger"); props.add("noReplyLogLevel"); + props.add("objectCodecPattern"); props.add("orderedThreadPoolExecutor"); props.add("port"); props.add("protocol"); diff --git a/components/camel-mina/src/generated/resources/META-INF/org/apache/camel/component/mina/mina.json b/components/camel-mina/src/generated/resources/META-INF/org/apache/camel/component/mina/mina.json index fd8a25a0ac1..f46565c71ee 100644 --- a/components/camel-mina/src/generated/resources/META-INF/org/apache/camel/component/mina/mina.json +++ b/components/camel-mina/src/generated/resources/META-INF/org/apache/camel/component/mina/mina.json @@ -40,17 +40,18 @@ "disconnectOnNoReply": { "index": 13, "kind": "property", "displayName": "Disconnect On No Reply", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "If sync is enabled then this option dictates MinaConsumer if it should disco [...] "maximumPoolSize": { "index": 14, "kind": "property", "displayName": "Maximum Pool Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 16, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Number of worker threads in the worker pool for TCP and UDP" }, "orderedThreadPoolExecutor": { "index": 15, "kind": "property", "displayName": "Ordered Thread Pool Executor", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Whether to use ordered thread pool, to ensure events are process [...] - "transferExchange": { "index": 16, "kind": "property", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the [...] + "transferExchange": { "index": 16, "kind": "property", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the b [...] "allowDefaultCodec": { "index": 17, "kind": "property", "displayName": "Allow Default Codec", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "The mina component installs a default codec if both, codec is null and textline is fals [...] "codec": { "index": 18, "kind": "property", "displayName": "Codec", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.mina.filter.codec.ProtocolCodecFactory", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To use a custom minda codec implementation." }, "decoderMaxLineLength": { "index": 19, "kind": "property", "displayName": "Decoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1024, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol decoder max line length. By default the default value o [...] "encoderMaxLineLength": { "index": 20, "kind": "property", "displayName": "Encoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol encoder max line length. By default the default value of [...] "encoding": { "index": 21, "kind": "property", "displayName": "Encoding", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol. If not provided, [...] "filters": { "index": 22, "kind": "property", "displayName": "Filters", "group": "codec", "label": "codec", "required": false, "type": "array", "javaType": "java.util.List<org.apache.mina.core.filterchain.IoFilter>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can set a list of Mina IoFilters to use." }, - "textline": { "index": 23, "kind": "property", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; if [...] - "textlineDelimiter": { "index": 24, "kind": "property", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only use [...] - "sslContextParameters": { "index": 25, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." }, - "useGlobalSslContextParameters": { "index": 26, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } + "objectCodecPattern": { "index": 23, "kind": "property", "displayName": "Object Codec Pattern", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Accept the wildcard specified classes for Object deserialization, unless they are otherwise rejecte [...] + "textline": { "index": 24, "kind": "property", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; if [...] + "textlineDelimiter": { "index": 25, "kind": "property", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only use [...] + "sslContextParameters": { "index": 26, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." }, + "useGlobalSslContextParameters": { "index": 27, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } }, "headers": { "CamelMinaCloseSessionWhenComplete": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Indicates whether the session should be closed after complete", "constantName": "org.apache.camel.component.mina.MinaConstants#MINA_CLOSE_SESSION_WHEN_COMPLETE" }, @@ -78,15 +79,16 @@ "disconnectOnNoReply": { "index": 16, "kind": "parameter", "displayName": "Disconnect On No Reply", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "If sync is enabled then this option dictates MinaConsumer if it should disc [...] "maximumPoolSize": { "index": 17, "kind": "parameter", "displayName": "Maximum Pool Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 16, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Number of worker threads in the worker pool for TCP and UDP" }, "orderedThreadPoolExecutor": { "index": 18, "kind": "parameter", "displayName": "Ordered Thread Pool Executor", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Whether to use ordered thread pool, to ensure events are proces [...] - "transferExchange": { "index": 19, "kind": "parameter", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the [...] + "transferExchange": { "index": 19, "kind": "parameter", "displayName": "Transfer Exchange", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. You can transfer the exchange over the wire instead of just the [...] "allowDefaultCodec": { "index": 20, "kind": "parameter", "displayName": "Allow Default Codec", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "The mina component installs a default codec if both, codec is null and textline is fal [...] "codec": { "index": 21, "kind": "parameter", "displayName": "Codec", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.mina.filter.codec.ProtocolCodecFactory", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To use a custom minda codec implementation." }, "decoderMaxLineLength": { "index": 22, "kind": "parameter", "displayName": "Decoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1024, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol decoder max line length. By default the default value [...] "encoderMaxLineLength": { "index": 23, "kind": "parameter", "displayName": "Encoder Max Line Length", "group": "codec", "label": "codec", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To set the textline protocol encoder max line length. By default the default value of [...] "encoding": { "index": 24, "kind": "parameter", "displayName": "Encoding", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol. If not provided, [...] "filters": { "index": 25, "kind": "parameter", "displayName": "Filters", "group": "codec", "label": "codec", "required": false, "type": "array", "javaType": "java.util.List<org.apache.mina.core.filterchain.IoFilter>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "You can set a list of Mina IoFilters to use." }, - "textline": { "index": 26, "kind": "parameter", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; i [...] - "textlineDelimiter": { "index": 27, "kind": "parameter", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only us [...] - "sslContextParameters": { "index": 28, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." } + "objectCodecPattern": { "index": 26, "kind": "parameter", "displayName": "Object Codec Pattern", "group": "codec", "label": "codec", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Accept the wildcard specified classes for Object deserialization, unless they are otherwise reject [...] + "textline": { "index": 27, "kind": "parameter", "displayName": "Textline", "group": "codec", "label": "codec", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; i [...] + "textlineDelimiter": { "index": 28, "kind": "parameter", "displayName": "Textline Delimiter", "group": "codec", "label": "codec", "required": false, "type": "object", "javaType": "org.apache.camel.component.mina.MinaTextLineDelimiter", "enum": [ "DEFAULT", "AUTO", "UNIX", "WINDOWS", "MAC" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "Only us [...] + "sslContextParameters": { "index": 29, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mina.MinaConfiguration", "configurationField": "configuration", "description": "To configure SSL security." } } } diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConfiguration.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConfiguration.java index 8f78fd412ad..11d9ba6fcbc 100644 --- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConfiguration.java +++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConfiguration.java @@ -61,6 +61,7 @@ public class MinaConfiguration implements Cloneable { @UriParam(label = "producer,advanced", defaultValue = "true") private boolean lazySessionCreation = true; @UriParam(label = "advanced") + @Deprecated private boolean transferExchange; @UriParam private boolean minaLogger; @@ -72,6 +73,8 @@ public class MinaConfiguration implements Cloneable { private List<IoFilter> filters; @UriParam(label = "codec", defaultValue = "true") private boolean allowDefaultCodec = true; + @UriParam(label = "codec") + private String objectCodecPattern; @UriParam private boolean disconnect; @UriParam(label = "advanced", defaultValue = "true") @@ -246,7 +249,8 @@ public class MinaConfiguration implements Cloneable { * Only used for TCP. You can transfer the exchange over the wire instead of just the body. The following fields are * transferred: In body, Out body, fault body, In headers, Out headers, fault headers, exchange properties, exchange * exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and - * log it at WARN level. + * log it at WARN level. Also make sure to configure objectCodecPattern to * (star) to allow transferring java + * objects. */ public void setTransferExchange(boolean transferExchange) { this.transferExchange = transferExchange; @@ -317,6 +321,18 @@ public class MinaConfiguration implements Cloneable { return allowDefaultCodec; } + public String getObjectCodecPattern() { + return objectCodecPattern; + } + + /** + * Accept the wildcard specified classes for Object deserialization, unless they are otherwise rejected. Multiple + * patterns can be separated by comma. + */ + public void setObjectCodecPattern(String pattern) { + this.objectCodecPattern = pattern; + } + public boolean isDisconnect() { return disconnect; } diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java index 1a2635afa23..cd019ec8977 100644 --- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java +++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java @@ -269,6 +269,10 @@ public class MinaConsumer extends DefaultConsumer { } } else { ObjectSerializationCodecFactory codecFactory = new ObjectSerializationCodecFactory(); + if (configuration.getObjectCodecPattern() != null) { + String[] arr = configuration.getObjectCodecPattern().split(","); + codecFactory.accept(arr); + } addCodecFactory(service, codecFactory); LOG.debug("{}: Using ObjectSerializationCodecFactory: {}", type, codecFactory); } diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java index 0c8fcf58285..ddb26027906 100644 --- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java +++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java @@ -370,6 +370,10 @@ public class MinaProducer extends DefaultProducer { codecFactory.getEncoderMaxLineLength(), codecFactory.getDecoderMaxLineLength()); } else { ObjectSerializationCodecFactory codecFactory = new ObjectSerializationCodecFactory(); + if (configuration.getObjectCodecPattern() != null) { + String[] arr = configuration.getObjectCodecPattern().split(","); + codecFactory.accept(arr); + } addCodecFactory(service, codecFactory); LOG.debug("{}: Using ObjectSerializationCodecFactory: {}", type, codecFactory); } diff --git a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java index cb3b69b93cc..f13382080e1 100644 --- a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java +++ b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java @@ -77,7 +77,7 @@ public class MinaProducerConcurrentTest extends BaseMinaTest { return new RouteBuilder() { public void configure() { - fromF("mina:tcp://localhost:%1$s?sync=true", getPort()).process(exchange -> { + fromF("mina:tcp://localhost:%1$s?sync=true&objectCodecPattern=*", getPort()).process(exchange -> { String body = exchange.getIn().getBody(String.class); exchange.getMessage().setBody("Bye " + body); }).to("mock:result"); diff --git a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java index 364435a41c3..3be82f8e993 100644 --- a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java +++ b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java @@ -54,7 +54,8 @@ public class MinaTransferExchangeOptionTest extends BaseMinaTest { private Exchange sendExchange(boolean setException) throws Exception { Endpoint endpoint = context.getEndpoint( - String.format("mina:tcp://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort())); + String.format("mina:tcp://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true&objectCodecPattern=*", + getPort())); Producer producer = endpoint.createProducer(); Exchange exchange = endpoint.createExchange(); @@ -99,7 +100,8 @@ public class MinaTransferExchangeOptionTest extends BaseMinaTest { return new RouteBuilder() { public void configure() { - fromF("mina:tcp://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort()) + fromF("mina:tcp://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true&objectCodecPattern=*", + getPort()) .process(e -> { LOG.debug("Enter Processor..."); assertNotNull(e.getIn().getBody()); diff --git a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTransferExchangeOptionTest.java b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTransferExchangeOptionTest.java index 9a8804a12a5..814d41504a7 100644 --- a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTransferExchangeOptionTest.java +++ b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTransferExchangeOptionTest.java @@ -50,7 +50,8 @@ public class MinaVMTransferExchangeOptionTest extends BaseMinaTest { private Exchange sendExchange(boolean setException) throws Exception { Endpoint endpoint = context.getEndpoint( - String.format("mina:vm://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort())); + String.format("mina:vm://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true&objectCodecPattern=*", + getPort())); Exchange exchange = endpoint.createExchange(); Message message = exchange.getIn(); @@ -95,7 +96,7 @@ public class MinaVMTransferExchangeOptionTest extends BaseMinaTest { return new RouteBuilder() { public void configure() { - fromF("mina:vm://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort()) + fromF("mina:vm://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true&objectCodecPattern=*", getPort()) .process(e -> { assertNotNull(e.getIn().getBody()); assertNotNull(e.getIn().getHeaders()); diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc index fe30dd9391c..c69e7440a40 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_10.adoc @@ -18,6 +18,10 @@ The `camel-jgroups-cluster-service-starter` in Camel Spring Boot has been remove The camel-jbang commands for `camel-k` has been removed. +=== camel-mina + +If using object codec, then you should configure the `objectCodecPattern` configuration to specify +which java classes (FQN) to allow for Object serialization. You can use `*` to accept all patterns. === camel-google-pubsub-lite diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc index dd2d864e321..d88d0e0dbb9 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc @@ -4,6 +4,13 @@ This document is for helping you upgrade your Apache Camel application from Camel 4.x to 4.y. For example, if you are upgrading Camel 4.0 to 4.2, then you should follow the guides from both 4.0 to 4.1 and 4.1 to 4.2. +== Upgrading from 4.4.4 to 4.4.5 + +=== camel-mina + +If using object codec, then you should configure the `objectCodecPattern` configuration to specify +which java classes (FQN) to allow for Object serialization. You can use `*` to accept all patterns. + == Upgrading from 4.4.3 to 4.4.4 The `camel-opentelemetry` component has had significant bug fixes to handle span activation/deactivations diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc index 4951161f31d..0183892599a 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc @@ -4,6 +4,13 @@ This document is for helping you upgrade your Apache Camel application from Camel 4.x to 4.y. For example, if you are upgrading Camel 4.0 to 4.2, then you should follow the guides from both 4.0 to 4.1 and 4.1 to 4.2. +== Upgrading from 4.8.2 to 4.8.3 + +=== camel-mina + +If using object codec, then you should configure the `objectCodecPattern` configuration to specify +which java classes (FQN) to allow for Object serialization. You can use `*` to accept all patterns. + == Upgrading from 4.8.1 to 4.8.2 === camel-management diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MinaComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MinaComponentBuilderFactory.java index caedcd98745..7c66053729f 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MinaComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MinaComponentBuilderFactory.java @@ -364,7 +364,8 @@ public interface MinaComponentBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option is a: <code>boolean</code> type. * @@ -374,6 +375,7 @@ public interface MinaComponentBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default MinaComponentBuilder transferExchange(boolean transferExchange) { doSetProperty("transferExchange", transferExchange); return this; @@ -486,6 +488,23 @@ public interface MinaComponentBuilderFactory { return this; } + /** + * Accept the wildcard specified classes for Object deserialization, + * unless they are otherwise rejected. Multiple patterns can be + * separated by comma. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: codec + * + * @param objectCodecPattern the value to set + * @return the dsl builder + */ + default MinaComponentBuilder objectCodecPattern(java.lang.String objectCodecPattern) { + doSetProperty("objectCodecPattern", objectCodecPattern); + return this; + } + /** * Only used for TCP. If no codec is specified, you can use this flag to @@ -599,6 +618,7 @@ public interface MinaComponentBuilderFactory { case "encoderMaxLineLength": getOrCreateConfiguration((MinaComponent) component).setEncoderMaxLineLength((int) value); return true; case "encoding": getOrCreateConfiguration((MinaComponent) component).setEncoding((java.lang.String) value); return true; case "filters": getOrCreateConfiguration((MinaComponent) component).setFilters((java.util.List) value); return true; + case "objectCodecPattern": getOrCreateConfiguration((MinaComponent) component).setObjectCodecPattern((java.lang.String) value); return true; case "textline": getOrCreateConfiguration((MinaComponent) component).setTextline((boolean) value); return true; case "textlineDelimiter": getOrCreateConfiguration((MinaComponent) component).setTextlineDelimiter((org.apache.camel.component.mina.MinaTextLineDelimiter) value); return true; case "sslContextParameters": getOrCreateConfiguration((MinaComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaEndpointBuilderFactory.java index d5c83fbdc50..2ec811c6137 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaEndpointBuilderFactory.java @@ -415,6 +415,22 @@ public interface MinaEndpointBuilderFactory { doSetProperty("filters", filters); return this; } + /** + * Accept the wildcard specified classes for Object deserialization, + * unless they are otherwise rejected. Multiple patterns can be + * separated by comma. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: codec + * + * @param objectCodecPattern the value to set + * @return the dsl builder + */ + default MinaEndpointConsumerBuilder objectCodecPattern(String objectCodecPattern) { + doSetProperty("objectCodecPattern", objectCodecPattern); + return this; + } /** * Only used for TCP. If no codec is specified, you can use this flag to * indicate a text line based codec; if not specified or the value is @@ -776,7 +792,8 @@ public interface MinaEndpointBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option is a: <code>boolean</code> type. * @@ -786,6 +803,7 @@ public interface MinaEndpointBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default AdvancedMinaEndpointConsumerBuilder transferExchange(boolean transferExchange) { doSetProperty("transferExchange", transferExchange); return this; @@ -796,7 +814,8 @@ public interface MinaEndpointBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option will be converted to a <code>boolean</code> type. * @@ -806,6 +825,7 @@ public interface MinaEndpointBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default AdvancedMinaEndpointConsumerBuilder transferExchange(String transferExchange) { doSetProperty("transferExchange", transferExchange); return this; @@ -1162,6 +1182,22 @@ public interface MinaEndpointBuilderFactory { doSetProperty("filters", filters); return this; } + /** + * Accept the wildcard specified classes for Object deserialization, + * unless they are otherwise rejected. Multiple patterns can be + * separated by comma. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: codec + * + * @param objectCodecPattern the value to set + * @return the dsl builder + */ + default MinaEndpointProducerBuilder objectCodecPattern(String objectCodecPattern) { + doSetProperty("objectCodecPattern", objectCodecPattern); + return this; + } /** * Only used for TCP. If no codec is specified, you can use this flag to * indicate a text line based codec; if not specified or the value is @@ -1482,7 +1518,8 @@ public interface MinaEndpointBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option is a: <code>boolean</code> type. * @@ -1492,6 +1529,7 @@ public interface MinaEndpointBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default AdvancedMinaEndpointProducerBuilder transferExchange(boolean transferExchange) { doSetProperty("transferExchange", transferExchange); return this; @@ -1502,7 +1540,8 @@ public interface MinaEndpointBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option will be converted to a <code>boolean</code> type. * @@ -1512,6 +1551,7 @@ public interface MinaEndpointBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default AdvancedMinaEndpointProducerBuilder transferExchange(String transferExchange) { doSetProperty("transferExchange", transferExchange); return this; @@ -1869,6 +1909,22 @@ public interface MinaEndpointBuilderFactory { doSetProperty("filters", filters); return this; } + /** + * Accept the wildcard specified classes for Object deserialization, + * unless they are otherwise rejected. Multiple patterns can be + * separated by comma. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: codec + * + * @param objectCodecPattern the value to set + * @return the dsl builder + */ + default MinaEndpointBuilder objectCodecPattern(String objectCodecPattern) { + doSetProperty("objectCodecPattern", objectCodecPattern); + return this; + } /** * Only used for TCP. If no codec is specified, you can use this flag to * indicate a text line based codec; if not specified or the value is @@ -2082,7 +2138,8 @@ public interface MinaEndpointBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option is a: <code>boolean</code> type. * @@ -2092,6 +2149,7 @@ public interface MinaEndpointBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default AdvancedMinaEndpointBuilder transferExchange(boolean transferExchange) { doSetProperty("transferExchange", transferExchange); return this; @@ -2102,7 +2160,8 @@ public interface MinaEndpointBuilderFactory { * body, Out body, fault body, In headers, Out headers, fault headers, * exchange properties, exchange exception. This requires that the * objects are serializable. Camel will exclude any non-serializable - * objects and log it at WARN level. + * objects and log it at WARN level. Also make sure to configure + * objectCodecPattern to (star) to allow transferring java objects. * * The option will be converted to a <code>boolean</code> type. * @@ -2112,6 +2171,7 @@ public interface MinaEndpointBuilderFactory { * @param transferExchange the value to set * @return the dsl builder */ + @Deprecated default AdvancedMinaEndpointBuilder transferExchange(String transferExchange) { doSetProperty("transferExchange", transferExchange); return this; diff --git a/parent/pom.xml b/parent/pom.xml index 6393e7a50a5..9bfd9f1f81b 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -364,7 +364,7 @@ <microprofile-config-version>3.1</microprofile-config-version> <microprofile-fault-tolerance-version>4.1.1</microprofile-fault-tolerance-version> <milvus-client-version>2.5.2</milvus-client-version> - <mina-version>2.2.3</mina-version> + <mina-version>2.2.4</mina-version> <minidns-version>0.3.4</minidns-version> <minimal-json-version>0.9.5</minimal-json-version> <minio-version>8.5.14</minio-version>