You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/12/04 09:59:11 UTC

(camel) branch main updated (3eab34459d4 -> f7d5fc9b291)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 3eab34459d4 Bump com.dropbox.core:dropbox-core-sdk from 5.4.5 to 6.0.0 (#12303)
     new d44fba2fd9e CAMEL-20178: camel-jbang - Transform message to support components data formats
     new f7d5fc9b291 Regen

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../modules/ROOT/pages/camel-jbang.adoc            |  43 +++
 .../camel/cli/connector/LocalCliConnector.java     |  10 +
 .../endpoint/dsl/SshEndpointBuilderFactory.java    | 328 +++++++++++++++++++++
 .../commands/action/TransformMessageAction.java    |  26 +-
 4 files changed, 399 insertions(+), 8 deletions(-)


(camel) 02/02: Regen

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f7d5fc9b291dc1481313b5c533a5ddbb3d9aec8b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Dec 4 10:58:59 2023 +0100

    Regen
---
 .../endpoint/dsl/SshEndpointBuilderFactory.java    | 328 +++++++++++++++++++++
 1 file changed, 328 insertions(+)

diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
index 0ad939fbbcf..414dbaba3df 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
@@ -683,6 +683,36 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("certResourcePassword", certResourcePassword);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported ciphers in their order of
+         * preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param ciphers the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointConsumerBuilder ciphers(String ciphers) {
+            doSetProperty("ciphers", ciphers);
+            return this;
+        }
+        /**
+         * Comma-separated list of allowed/supported key exchange algorithms in
+         * their order of preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param kex the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointConsumerBuilder kex(String kex) {
+            doSetProperty("kex", kex);
+            return this;
+        }
         /**
          * Sets the KeyPairProvider reference to use when connecting using
          * Certificates to the remote SSH Server.
@@ -735,6 +765,22 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("keyType", keyType);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported message authentication code
+         * algorithms in their order of preference. The MAC algorithm is used
+         * for data integrity protection.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param macs the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointConsumerBuilder macs(String macs) {
+            doSetProperty("macs", macs);
+            return this;
+        }
         /**
          * Sets the password to use in connecting to remote SSH server. Requires
          * keyPairProvider to be set to null.
@@ -750,6 +796,21 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("password", password);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported signature algorithms in
+         * their order of preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param signatures the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointConsumerBuilder signatures(String signatures) {
+            doSetProperty("signatures", signatures);
+            return this;
+        }
         /**
          * Sets the username to use in logging into the remote SSH server.
          * 
@@ -955,6 +1016,55 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("channelType", channelType);
             return this;
         }
+        /**
+         * Instance of ClientBuilder used by the producer or consumer to create
+         * a new SshClient.
+         * 
+         * The option is a:
+         * &lt;code&gt;org.apache.sshd.client.ClientBuilder&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param clientBuilder the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointConsumerBuilder clientBuilder(
+                org.apache.sshd.client.ClientBuilder clientBuilder) {
+            doSetProperty("clientBuilder", clientBuilder);
+            return this;
+        }
+        /**
+         * Instance of ClientBuilder used by the producer or consumer to create
+         * a new SshClient.
+         * 
+         * The option will be converted to a
+         * &lt;code&gt;org.apache.sshd.client.ClientBuilder&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param clientBuilder the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointConsumerBuilder clientBuilder(
+                String clientBuilder) {
+            doSetProperty("clientBuilder", clientBuilder);
+            return this;
+        }
+        /**
+         * Whether to use compression, and if so which.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param compressions the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointConsumerBuilder compressions(
+                String compressions) {
+            doSetProperty("compressions", compressions);
+            return this;
+        }
         /**
          * Sets the shellPrompt to be dropped when response is read after
          * command execution.
@@ -1130,6 +1240,36 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("certResourcePassword", certResourcePassword);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported ciphers in their order of
+         * preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param ciphers the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointProducerBuilder ciphers(String ciphers) {
+            doSetProperty("ciphers", ciphers);
+            return this;
+        }
+        /**
+         * Comma-separated list of allowed/supported key exchange algorithms in
+         * their order of preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param kex the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointProducerBuilder kex(String kex) {
+            doSetProperty("kex", kex);
+            return this;
+        }
         /**
          * Sets the KeyPairProvider reference to use when connecting using
          * Certificates to the remote SSH Server.
@@ -1182,6 +1322,22 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("keyType", keyType);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported message authentication code
+         * algorithms in their order of preference. The MAC algorithm is used
+         * for data integrity protection.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param macs the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointProducerBuilder macs(String macs) {
+            doSetProperty("macs", macs);
+            return this;
+        }
         /**
          * Sets the password to use in connecting to remote SSH server. Requires
          * keyPairProvider to be set to null.
@@ -1197,6 +1353,21 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("password", password);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported signature algorithms in
+         * their order of preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param signatures the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointProducerBuilder signatures(String signatures) {
+            doSetProperty("signatures", signatures);
+            return this;
+        }
         /**
          * Sets the username to use in logging into the remote SSH server.
          * 
@@ -1288,6 +1459,55 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("channelType", channelType);
             return this;
         }
+        /**
+         * Instance of ClientBuilder used by the producer or consumer to create
+         * a new SshClient.
+         * 
+         * The option is a:
+         * &lt;code&gt;org.apache.sshd.client.ClientBuilder&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param clientBuilder the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointProducerBuilder clientBuilder(
+                org.apache.sshd.client.ClientBuilder clientBuilder) {
+            doSetProperty("clientBuilder", clientBuilder);
+            return this;
+        }
+        /**
+         * Instance of ClientBuilder used by the producer or consumer to create
+         * a new SshClient.
+         * 
+         * The option will be converted to a
+         * &lt;code&gt;org.apache.sshd.client.ClientBuilder&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param clientBuilder the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointProducerBuilder clientBuilder(
+                String clientBuilder) {
+            doSetProperty("clientBuilder", clientBuilder);
+            return this;
+        }
+        /**
+         * Whether to use compression, and if so which.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param compressions the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointProducerBuilder compressions(
+                String compressions) {
+            doSetProperty("compressions", compressions);
+            return this;
+        }
         /**
          * Sets the shellPrompt to be dropped when response is read after
          * command execution.
@@ -1461,6 +1681,36 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("certResourcePassword", certResourcePassword);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported ciphers in their order of
+         * preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param ciphers the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointBuilder ciphers(String ciphers) {
+            doSetProperty("ciphers", ciphers);
+            return this;
+        }
+        /**
+         * Comma-separated list of allowed/supported key exchange algorithms in
+         * their order of preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param kex the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointBuilder kex(String kex) {
+            doSetProperty("kex", kex);
+            return this;
+        }
         /**
          * Sets the KeyPairProvider reference to use when connecting using
          * Certificates to the remote SSH Server.
@@ -1512,6 +1762,22 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("keyType", keyType);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported message authentication code
+         * algorithms in their order of preference. The MAC algorithm is used
+         * for data integrity protection.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param macs the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointBuilder macs(String macs) {
+            doSetProperty("macs", macs);
+            return this;
+        }
         /**
          * Sets the password to use in connecting to remote SSH server. Requires
          * keyPairProvider to be set to null.
@@ -1527,6 +1793,21 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("password", password);
             return this;
         }
+        /**
+         * Comma-separated list of allowed/supported signature algorithms in
+         * their order of preference.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: security
+         * 
+         * @param signatures the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointBuilder signatures(String signatures) {
+            doSetProperty("signatures", signatures);
+            return this;
+        }
         /**
          * Sets the username to use in logging into the remote SSH server.
          * 
@@ -1569,6 +1850,53 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("channelType", channelType);
             return this;
         }
+        /**
+         * Instance of ClientBuilder used by the producer or consumer to create
+         * a new SshClient.
+         * 
+         * The option is a:
+         * &lt;code&gt;org.apache.sshd.client.ClientBuilder&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param clientBuilder the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointBuilder clientBuilder(
+                org.apache.sshd.client.ClientBuilder clientBuilder) {
+            doSetProperty("clientBuilder", clientBuilder);
+            return this;
+        }
+        /**
+         * Instance of ClientBuilder used by the producer or consumer to create
+         * a new SshClient.
+         * 
+         * The option will be converted to a
+         * &lt;code&gt;org.apache.sshd.client.ClientBuilder&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param clientBuilder the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointBuilder clientBuilder(String clientBuilder) {
+            doSetProperty("clientBuilder", clientBuilder);
+            return this;
+        }
+        /**
+         * Whether to use compression, and if so which.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Group: advanced
+         * 
+         * @param compressions the value to set
+         * @return the dsl builder
+         */
+        default AdvancedSshEndpointBuilder compressions(String compressions) {
+            doSetProperty("compressions", compressions);
+            return this;
+        }
         /**
          * Sets the shellPrompt to be dropped when response is read after
          * command execution.


(camel) 01/02: CAMEL-20178: camel-jbang - Transform message to support components data formats

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d44fba2fd9ef2d2a832beaaa3aae4809723f759f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Dec 4 10:58:52 2023 +0100

    CAMEL-20178: camel-jbang - Transform message to support components data formats
---
 .../modules/ROOT/pages/camel-jbang.adoc            | 43 ++++++++++++++++++++++
 .../camel/cli/connector/LocalCliConnector.java     | 10 +++++
 .../commands/action/TransformMessageAction.java    | 26 +++++++++----
 3 files changed, 71 insertions(+), 8 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index fa67359692b..c9507ffec48 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -2435,6 +2435,49 @@ You can then edit the `mystyle.xsl` file, and save the file, and watch the termi
 
 You can find this example at: https://github.com/apache/camel-kamelets-examples/tree/main/jbang/xslt-transform
 
+=== Transforming message using Data Formats
+
+Some data-formats can also be used for message transformation such as Base64, Csv, Flatpack.
+
+TIP: You can use `camel catalog dataformat --filter=transform` to see which components can be transformation.
+
+Given the below CSV file in the `daltons.csv`:
+
+[source,text]
+----
+Jack Dalton, 115, mad at Averell
+Joe Dalton, 105, calming Joe
+William Dalton, 105, keeping Joe from killing Averell
+Averell Dalton, 80, playing with Rantanplan
+Lucky Luke, 120, capturing the Daltons
+----
+
+Then you can transform this via Camel CSV dataformat from its form into Java objects (unmarshal).
+This will NOT transform the CSV into another format such as XML, but allows you to quickly try out the dataformat,
+and be able to inspect the Java object inside Camel.
+
+[source,bash]
+----
+$ camel transform message --body=file:daltons.csv --dataformat=csv
+----
+
+This will then output:
+
+[source,text]
+----
+2023-12-04 10:53:45.578  55793 --- Message transformed (success) (176ms)
+ Exchange  (DefaultExchange)  InOut   6673987D34F3B54-0000000000000000
+ Message   (DefaultMessage)
+ Body      (ArrayList) (size: 5 bytes: 224)
+ [[Jack Dalton,  115,  mad at Averell], [Joe Dalton,  105,  calming Joe], [William Dalton,  105,  keeping Joe from killing Averell], [Averell Dalton,  80,
+ playing with Rantanplan], [Lucky Luke,  120,  capturing the Daltons]]
+----
+
+As you can see Camel CSV dataformat will then unarmshal the input (from CSV file) to a `java.util.ArrayList` object
+with 5 elements (one per row), and each row is another List of the columns.
+
+NOTE: The transform message with dataformat is limited as some dataformat requires additional configuration that is not possible
+from the Camel JBang CLI.
 
 == Listing what Camel components is available
 
diff --git a/dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java b/dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java
index df593973039..8b4ee075c4a 100644
--- a/dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java
+++ b/dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java
@@ -279,6 +279,7 @@ public class LocalCliConnector extends ServiceSupport implements CliConnector, C
         String source = root.getString("source");
         String language = root.getString("language");
         String component = root.getString("component");
+        String dataformat = root.getString("dataformat");
         String template = Jsoner.unescape(root.getStringOrDefault("template", ""));
         if (component == null && template.startsWith("file:")) {
             template = "resource:" + template;
@@ -396,6 +397,15 @@ public class LocalCliConnector extends ServiceSupport implements CliConnector, C
                     uri = uri + "?contentCache=false";
                 }
                 out = producer.send(uri, out);
+            } else if (dataformat != null) {
+                // transform via dataformat
+                out.setPattern(ExchangePattern.InOut);
+                out.getMessage().setBody(inputBody);
+                if (inputHeaders != null) {
+                    out.getMessage().setHeaders(inputHeaders);
+                }
+                String uri = "dataformat:" + dataformat + ":unmarshal";
+                out = producer.send(uri, out);
             } else {
                 // transform via language
                 Language lan = camelContext.resolveLanguage(language);
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/TransformMessageAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/TransformMessageAction.java
index 140d6193a70..033c3e0c4f8 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/TransformMessageAction.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/TransformMessageAction.java
@@ -69,6 +69,11 @@ public class TransformMessageAction extends ActionWatchCommand {
                         description = "The component to use for message transformation")
     private String component;
 
+    @CommandLine.Option(names = {
+            "--dataformat" },
+                        description = "The dataformat to use for message transformation")
+    private String dataformat;
+
     @CommandLine.Option(names = {
             "--template" },
                         description = "The template to use for message transformation (prefix with file: to refer to loading message body from file)")
@@ -116,14 +121,16 @@ public class TransformMessageAction extends ActionWatchCommand {
 
     @Override
     public Integer doCall() throws Exception {
-        // either source or language/template is required
-        if (source == null && template == null && language == null && component == null) {
-            System.err.println("Either source or template and language/component must be configured");
-            return -1;
-        }
-        if (source == null && (template == null || language == null && component == null)) {
-            System.err.println("Both template and language/component must be configured");
-            return -1;
+        if (dataformat == null) {
+            // either source or language/template is required
+            if (source == null && template == null && language == null && component == null) {
+                System.err.println("Either source or template and one of language/component must be configured");
+                return -1;
+            }
+            if (source == null && (template == null || language == null && component == null)) {
+                System.err.println("Both template and one of language/component must be configured");
+                return -1;
+            }
         }
 
         Integer exit;
@@ -174,6 +181,9 @@ public class TransformMessageAction extends ActionWatchCommand {
         if (component != null) {
             root.put("component", component);
         }
+        if (dataformat != null) {
+            root.put("dataformat", dataformat);
+        }
         if (template != null) {
             root.put("template", Jsoner.escape(template));
         }