Re: [I] [CI] - Quarkus Main Branch Build Failure [camel-quarkus]

2023-12-30 Thread via GitHub


github-actions[bot] commented on issue #2926:
URL: https://github.com/apache/camel-quarkus/issues/2926#issuecomment-1872661450

   The 
[quarkus-main](https://github.com/apache/camel-quarkus/tree/quarkus-main) 
branch build has failed:
   
   * Build ID: 7367807402-1347-3dd5cd1b-81e0-4df8-a714-e4264c343db4
   * Camel Quarkus Commit: 5ee9509a8d804f7580d68ed4c38ee0ac94e02b4e
   
   * Quarkus Main Commit: 71a94baced4e5617ae09f5bc06bccb1c9144fd85
   * Link to build: 
https://github.com/apache/camel-quarkus/actions/runs/7367807402


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [Github Actions] Periodic Sync Camel Spring Boot (Camel 4) [camel-spring-boot]

2023-12-30 Thread via GitHub


oscerd closed pull request #1057: [Github Actions] Periodic Sync Camel Spring 
Boot (Camel 4)
URL: https://github.com/apache/camel-spring-boot/pull/1057


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel-k) branch release-2.2.x updated: chore: nightly SBOM update

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch release-2.2.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-2.2.x by this push:
 new fd5a97d4d chore: nightly SBOM update
fd5a97d4d is described below

commit fd5a97d4dcdfb154db12f99fa3adf23592a4e0f3
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Dec 31 00:37:42 2023 +

chore: nightly SBOM update
---
 camel-k-sbom/camel-k-sbom.json | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/camel-k-sbom/camel-k-sbom.json b/camel-k-sbom/camel-k-sbom.json
index 98b27928f..00c43853b 100644
--- a/camel-k-sbom/camel-k-sbom.json
+++ b/camel-k-sbom/camel-k-sbom.json
@@ -2,10 +2,10 @@
   "$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json;,
   "bomFormat": "CycloneDX",
   "specVersion": "1.4",
-  "serialNumber": "urn:uuid:ca93e8c3-6e4b-4a2e-8672-3e5f72b23788",
+  "serialNumber": "urn:uuid:ab8f172e-101f-44f4-9782-fc867ffed267",
   "version": 1,
   "metadata": {
-"timestamp": "2023-12-30T01:13:40Z",
+"timestamp": "2023-12-31T00:37:42Z",
 "tools": [
   {
 "vendor": "CycloneDX",
@@ -46,11 +46,11 @@
   }
 ],
 "component": {
-  "bom-ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231229011614-c3b2c9076b7c?type=module",
+  "bom-ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231230011340-ec0ffece5d97?type=module",
   "type": "application",
   "name": "github.com/apache/camel-k/v2",
-  "version": "v0.0.0-20231229011614-c3b2c9076b7c",
-  "purl": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231229011614-c3b2c9076b7c?type=module\u0026goos=linux\u0026goarch=amd64",
+  "version": "v0.0.0-20231230011340-ec0ffece5d97",
+  "purl": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231230011340-ec0ffece5d97?type=module\u0026goos=linux\u0026goarch=amd64",
   "externalReferences": [
 {
   "url": "https://github.com/apache/camel-k;,
@@ -3830,7 +3830,7 @@
   ],
   "dependencies": [
 {
-  "ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231229011614-c3b2c9076b7c?type=module",
+  "ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231230011340-ec0ffece5d97?type=module",
   "dependsOn": [
 "pkg:golang/github.com/Masterminds/semver@v1.5.0?type=module",
 "pkg:golang/github.com/container-tools/spectrum@v0.6.42?type=module",



[PR] [Github Actions] Periodic Sync Camel Spring Boot (Camel 4) [camel-spring-boot]

2023-12-30 Thread via GitHub


github-actions[bot] opened a new pull request, #1057:
URL: https://github.com/apache/camel-spring-boot/pull/1057

   Periodic Sync of Camel Spring Boot Main Branch with main Camel Main.
   see 
https://github.com/apache/camel-spring-boot/blob/main/.github/workflows/automatic-sync-main.yml


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel-k) branch release-2.1.x updated: chore: nightly SBOM update

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch release-2.1.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-2.1.x by this push:
 new b867b1905 chore: nightly SBOM update
b867b1905 is described below

commit b867b190507b21a8cf368860d9f53d9b9772b31d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Dec 30 23:52:09 2023 +

chore: nightly SBOM update
---
 camel-k-sbom/camel-k-sbom.json | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/camel-k-sbom/camel-k-sbom.json b/camel-k-sbom/camel-k-sbom.json
index 2f4dafa8c..58b0cff28 100644
--- a/camel-k-sbom/camel-k-sbom.json
+++ b/camel-k-sbom/camel-k-sbom.json
@@ -2,10 +2,10 @@
   "$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json;,
   "bomFormat": "CycloneDX",
   "specVersion": "1.4",
-  "serialNumber": "urn:uuid:07cb627a-b01e-49e8-98dc-7a5f367a882e",
+  "serialNumber": "urn:uuid:21ff78f7-e220-4235-bb36-e900714312da",
   "version": 1,
   "metadata": {
-"timestamp": "2023-12-30T00:28:14Z",
+"timestamp": "2023-12-30T23:52:09Z",
 "tools": [
   {
 "vendor": "CycloneDX",
@@ -46,11 +46,11 @@
   }
 ],
 "component": {
-  "bom-ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231229003112-1b2978e61fa8?type=module",
+  "bom-ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231230002814-ae0d7f14cdd4?type=module",
   "type": "application",
   "name": "github.com/apache/camel-k/v2",
-  "version": "v0.0.0-20231229003112-1b2978e61fa8",
-  "purl": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231229003112-1b2978e61fa8?type=module\u0026goos=linux\u0026goarch=amd64",
+  "version": "v0.0.0-20231230002814-ae0d7f14cdd4",
+  "purl": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231230002814-ae0d7f14cdd4?type=module\u0026goos=linux\u0026goarch=amd64",
   "externalReferences": [
 {
   "url": "https://github.com/apache/camel-k;,
@@ -3853,7 +3853,7 @@
   ],
   "dependencies": [
 {
-  "ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231229003112-1b2978e61fa8?type=module",
+  "ref": 
"pkg:golang/github.com/apache/camel-k/v2@v0.0.0-20231230002814-ae0d7f14cdd4?type=module",
   "dependsOn": [
 "pkg:golang/github.com/Masterminds/semver@v1.5.0?type=module",
 "pkg:golang/github.com/container-tools/spectrum@v0.6.38?type=module",



(camel) branch var updated (599cbb6413b -> 392738b66ec)

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


from 599cbb6413b CAMEL-19749: Add variables as concept to Camel
 add 392738b66ec CAMEL-19749: Add variables as concept to Camel

No new revisions were added by this update.

Summary of changes:
 .../camel/component/robotframework/RobotFrameworkCamelUtils.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)



Re: [PR] CAMEL-19749: Introduce variables to Camel [camel]

2023-12-30 Thread via GitHub


davsclaus commented on PR #12624:
URL: https://github.com/apache/camel/pull/12624#issuecomment-1872546970

   A little example at
   https://github.com/apache/camel-kamelets-examples/tree/main/jbang/variables


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel-kamelets-examples) branch main updated: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
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-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
 new 1579ece  CAMEL-19749: Add variables as concept to Camel
1579ece is described below

commit 1579ece5969e7254fea15c833042b4d17f85466a
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 14:23:00 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 jbang/variables/README.adoc | 59 +
 jbang/variables/myapp.java  | 18 ++
 2 files changed, 77 insertions(+)

diff --git a/jbang/variables/README.adoc b/jbang/variables/README.adoc
new file mode 100644
index 000..263a07d
--- /dev/null
+++ b/jbang/variables/README.adoc
@@ -0,0 +1,59 @@
+== Variables
+
+This example shows how you can use global variables with Camel routes.
+
+=== Install JBang
+
+First install JBang according to https://www.jbang.dev
+
+When JBang is installed then you should be able to run from a shell:
+
+[source,sh]
+
+$ jbang --version
+
+
+This will output the version of JBang.
+
+To run this example you can either install Camel on JBang via:
+
+[source,sh]
+
+$ jbang app install camel@apache/camel
+
+
+Which allows to run CamelJBang with `camel` as shown below.
+
+=== How to run
+
+Then you can run this example using:
+
+[source,sh]
+
+$ camel run myapp.java
+
+
+Or run with wildcard:
+
+[source,sh]
+
+$ camel run *
+
+
+You can list the variables from the CLI by executing:
+
+[source,sh]
+
+$ camel get variable
+
+
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!
diff --git a/jbang/variables/myapp.java b/jbang/variables/myapp.java
new file mode 100644
index 000..6f684e8
--- /dev/null
+++ b/jbang/variables/myapp.java
@@ -0,0 +1,18 @@
+// camel-k: language=java
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class myapp extends RouteBuilder {
+
+@Override
+public void configure() throws Exception {
+from("timer:java")
+.setVariable("global:app", simple("${camelId}"))
+.setVariable("global:random", simple("${random(1,10)}"));
+
+from("timer:random?period={{time:1000}}")
+.setBody(simple("Random number: ${variable.global:random}"))
+.log("${body}");
+
+}
+}



Re: [PR] CAMEL-19749: Introduce variables to Camel [camel]

2023-12-30 Thread via GitHub


davsclaus commented on PR #12624:
URL: https://github.com/apache/camel/pull/12624#issuecomment-1872546702

   This is the initial work to get the basics of variables into Camel. I wanted 
to get a PR in shape before too much activity happens.
   
   What can come in new PRs is work to make variables easier to be used from a 
few common EIPs such as from / to / toD and other feedback


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] CAMEL-19749: Introduce variables to Camel [camel]

2023-12-30 Thread via GitHub


github-actions[bot] commented on PR #12624:
URL: https://github.com/apache/camel/pull/12624#issuecomment-1872546466

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions 
to run
   
   * You can use the command `/component-test (camel-)component-name1 
(camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and 
`test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache 
Camel committers](https://camel.apache.org/community/team/#committers) have 
access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before 
sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] CAMEL-19749: Introduce variables to Camel [camel]

2023-12-30 Thread via GitHub


davsclaus opened a new pull request, #12624:
URL: https://github.com/apache/camel/pull/12624

   # Description
   
   
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (note that 
Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   
   
   # Apache Camel coding standards and style
   
   - [ ] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   
   
   - [ ] I have run `mvn clean install -DskipTests` locally and I have 
committed all auto-generated changes
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) 16/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 08c6d2e68b4517c5ff8e9d3f5afff4c73bf8921c
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 09:52:45 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../camel/spi/BrowsableVariableRepository.java}| 36 +++---
 .../mbean/ManagedVariableRepositoryMBean.java  | 12 
 .../management/JmxManagementLifecycleStrategy.java |  4 +--
 .../mbean/ManagedVariableRepository.java   | 26 +---
 .../camel/support/ExchangeVariableRepository.java  |  3 +-
 .../camel/support/GlobalVariableRepository.java| 29 -
 6 files changed, 97 insertions(+), 13 deletions(-)

diff --git 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
 
b/core/camel-api/src/main/java/org/apache/camel/spi/BrowsableVariableRepository.java
similarity index 56%
copy from 
core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
copy to 
core/camel-api/src/main/java/org/apache/camel/spi/BrowsableVariableRepository.java
index d9e4ea37583..2de29f5881a 100644
--- 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/BrowsableVariableRepository.java
@@ -14,13 +14,39 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.api.management.mbean;
+package org.apache.camel.spi;
 
-import org.apache.camel.api.management.ManagedAttribute;
+import java.util.Map;
+import java.util.stream.Stream;
 
-public interface ManagedVariableRepositoryMBean extends ManagedServiceMBean {
+/**
+ * A {@link VariableRepository} that can browse the variables.
+ */
+public interface BrowsableVariableRepository extends VariableRepository {
+
+/**
+ * Are there any variables in the repository.
+ */
+boolean hasVariables();
+
+/**
+ * Number of variables
+ */
+int size();
+
+/**
+ * The variable names
+ */
+Stream names();
+
+/**
+ * Gets all the variables in a Map
+ */
+Map getVariables();
 
-@ManagedAttribute(description = "Repository ID")
-String getId();
+/**
+ * Removes all variables
+ */
+void clear();
 
 }
diff --git 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
index d9e4ea37583..afcd503e8ee 100644
--- 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
+++ 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
@@ -16,11 +16,23 @@
  */
 package org.apache.camel.api.management.mbean;
 
+import java.util.Set;
+
 import org.apache.camel.api.management.ManagedAttribute;
+import org.apache.camel.api.management.ManagedOperation;
 
 public interface ManagedVariableRepositoryMBean extends ManagedServiceMBean {
 
 @ManagedAttribute(description = "Repository ID")
 String getId();
 
+@ManagedAttribute(description = "Number of variables")
+int getSize();
+
+@ManagedOperation(description = "Removes all variables")
+void clear();
+
+@ManagedOperation(description = "Variable names")
+Set names();
+
 }
diff --git 
a/core/camel-management/src/main/java/org/apache/camel/management/JmxManagementLifecycleStrategy.java
 
b/core/camel-management/src/main/java/org/apache/camel/management/JmxManagementLifecycleStrategy.java
index 83192a799f7..426ce12f53b 100644
--- 
a/core/camel-management/src/main/java/org/apache/camel/management/JmxManagementLifecycleStrategy.java
+++ 
b/core/camel-management/src/main/java/org/apache/camel/management/JmxManagementLifecycleStrategy.java
@@ -84,6 +84,7 @@ import org.apache.camel.model.ProcessorDefinitionHelper;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.spi.AsyncProcessorAwaitManager;
 import org.apache.camel.spi.BeanIntrospection;
+import org.apache.camel.spi.BrowsableVariableRepository;
 import org.apache.camel.spi.ConsumerCache;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.DumpRoutesStrategy;
@@ -107,7 +108,6 @@ import org.apache.camel.spi.TransformerRegistry;
 import org.apache.camel.spi.TypeConverterRegistry;
 import org.apache.camel.spi.UnitOfWork;
 import org.apache.camel.spi.ValidatorRegistry;
-import org.apache.camel.spi.VariableRepository;
 import org.apache.camel.support.TimerListenerManager;
 import org.apache.camel.support.service.ServiceSupport;
 import 

(camel) 21/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit e079301501fe588969918efc276b9d9083df1464
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 14:06:39 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
index 5353c4ac3fd..2190fc9242a 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
@@ -79,7 +79,8 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 protected void doStart() throws Exception {
 super.doStart();
 
-VariableRepository repo = CamelContextHelper.lookup(camelContext, 
GLOBAL_VARIABLE_REPOSITORY_ID, VariableRepository.class);
+VariableRepository repo
+= CamelContextHelper.lookup(camelContext, 
GLOBAL_VARIABLE_REPOSITORY_ID, VariableRepository.class);
 if (repo != null) {
 LOG.info("Using VariableRepository: {} as global repository", 
repo.getId());
 global = repo;



(camel) 19/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit b7a068594820f5ea4642707eb9a2fccab3947394
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 13:28:47 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../java/org/apache/camel/impl/console/VariablesDevConsole.java | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git 
a/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
 
b/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
index 87018f3bf9a..4f1e95415ac 100644
--- 
a/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
+++ 
b/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
@@ -60,10 +60,6 @@ public class VariablesDevConsole extends AbstractDevConsole {
 Set repos = 
getCamelContext().getRegistry().findByType(BrowsableVariableRepository.class);
 for (BrowsableVariableRepository repo : repos) {
 List arr = new ArrayList<>();
-JsonObject jo = new JsonObject();
-root.put(repo.getId(), jo);
-jo.put("id", repo.getId());
-jo.put("size", repo.size());
 for (Map.Entry entry : 
repo.getVariables().entrySet()) {
 String k = entry.getKey();
 Object v = entry.getValue();
@@ -77,7 +73,7 @@ public class VariablesDevConsole extends AbstractDevConsole {
 arr.add(e);
 }
 if (!arr.isEmpty()) {
-jo.put("variables", arr);
+root.put(repo.getId(), arr);
 }
 }
 



(camel) 24/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit a93137d6145f47ba6dfba8a3277045417f161c70
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 14:56:02 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../engine/DefaultVariableRepositoryFactory.java   |  9 ++-
 .../mbean/ManagedVariableRepositoryMBean.java  |  4 +-
 .../working-with-camel-core/pages/index.adoc   |  1 +
 docs/user-manual/modules/ROOT/pages/variables.adoc | 82 ++
 4 files changed, 91 insertions(+), 5 deletions(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
index 2190fc9242a..0410f5afc1c 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
@@ -47,11 +47,14 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 
 @Override
 public VariableRepository getVariableRepository(String id) {
-if ("global".equals(id)) {
+if (global != null && "global".equals(id)) {
 return global;
 }
 
 VariableRepository repo = CamelContextHelper.lookup(camelContext, id, 
VariableRepository.class);
+if (repo == null) {
+repo = CamelContextHelper.lookup(camelContext, id + 
"-variable-repository", VariableRepository.class);
+}
 if (repo == null) {
 // try via factory finder
 Class clazz = factoryFinder.findClass(id).orElse(null);
@@ -79,8 +82,8 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 protected void doStart() throws Exception {
 super.doStart();
 
-VariableRepository repo
-= CamelContextHelper.lookup(camelContext, 
GLOBAL_VARIABLE_REPOSITORY_ID, VariableRepository.class);
+// let's see if there is a custom global repo
+VariableRepository repo = getVariableRepository("global");
 if (repo != null) {
 LOG.info("Using VariableRepository: {} as global repository", 
repo.getId());
 global = repo;
diff --git 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
index 8614f2b812c..6a976f07bee 100644
--- 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
+++ 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
@@ -18,11 +18,11 @@ package org.apache.camel.api.management.mbean;
 
 import java.util.Set;
 
+import javax.management.openmbean.TabularData;
+
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedOperation;
 
-import javax.management.openmbean.TabularData;
-
 public interface ManagedVariableRepositoryMBean extends ManagedServiceMBean {
 
 @ManagedAttribute(description = "Repository ID")
diff --git a/docs/main/modules/working-with-camel-core/pages/index.adoc 
b/docs/main/modules/working-with-camel-core/pages/index.adoc
index fa5127d92e6..4ce6e00653a 100644
--- a/docs/main/modules/working-with-camel-core/pages/index.adoc
+++ b/docs/main/modules/working-with-camel-core/pages/index.adoc
@@ -94,6 +94,7 @@ Learn about additional ways to customize your integrations. 
Explore alternatives
 ** xref:manual::spring.adoc[Spring]
 ** xref:manual::spring-xml-extensions.adoc[Spring XML Extensions]
 ** xref:manual::validator.adoc[Validator]
+** xref:manual::variables.adoc[Variables]
 ** xref:manual::what-are-the-dependencies.adoc[Camel Requirements]
 ** xref:manual::testing.adoc[Testing]
 
diff --git a/docs/user-manual/modules/ROOT/pages/variables.adoc 
b/docs/user-manual/modules/ROOT/pages/variables.adoc
new file mode 100644
index 000..4715d124d98
--- /dev/null
+++ b/docs/user-manual/modules/ROOT/pages/variables.adoc
@@ -0,0 +1,82 @@
+= Variables
+
+*Available from Camel 4.4*
+
+In Camel 4.4, we have introduced the concept of _variables_.
+
+A variable is a key/value that can hold a value that can either be private per 
`Exchange` or global shared
+in the `CamelContext`.
+
+NOTE: You can also use _exchange properties_ as variables but the exchange 
properties are also used internally by Camel,
+and some EIPs and components. With the newly introduced _variables_ then these 
are exclusively for end users.
+
+== Variable Repository
+
+The variables are stored in one or more 
`org.apache.camel.spi.VariableRepository`. By default, there are 

(camel) 05/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 10e8d0da4a400d802d7ce23319da0ba71b0db8c3
Author: Claus Ibsen 
AuthorDate: Thu Dec 28 13:28:01 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../org/apache/camel/catalog/components/log.json   |  5 ++--
 .../camel/component/log/LogEndpointConfigurer.java |  6 +
 .../camel/component/log/LogEndpointUriFactory.java |  3 ++-
 .../org/apache/camel/component/log/log.json|  5 ++--
 .../apache/camel/component/log/LogEndpoint.java| 13 -
 .../log/DefaultExchangeFormatterTest.java  |  1 +
 .../DefaultExchangeFormatterConfigurer.java|  6 +
 .../processor/DefaultExchangeFormatter.java| 19 +
 .../endpoint/dsl/LogEndpointBuilderFactory.java| 31 ++
 9 files changed, 83 insertions(+), 6 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/log.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/log.json
index 26bebc29b44..64f0087f0e7 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/log.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/log.json
@@ -60,7 +60,8 @@
 "showRouteId": { "index": 28, "kind": "parameter", "displayName": "Show 
Route Id", "group": "formatting", "label": "formatting", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Show route ID." 
},
 "showStackTrace": { "index": 29, "kind": "parameter", "displayName": "Show 
Stack Trace", "group": "formatting", "label": "formatting", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Show the stack 
trace, if an exchange has an exception. Only effective if one of showAll, 
showException or showCaughtException are enabled." },
 "showStreams": { "index": 30, "kind": "parameter", "displayName": "Show 
Streams", "group": "formatting", "label": "formatting", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Whether Camel 
should show stream bodies or not (eg such as java.io.InputStream). Beware if 
you enable this option then you may not be able later to access the message 
body as the stream have already bee [...]
-"skipBodyLineSeparator": { "index": 31, "kind": "parameter", 
"displayName": "Skip Body Line Separator", "group": "formatting", "label": 
"formatting", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Whether to skip line separators when logging the message body. 
This allows to log the message body in one line, setting this option to false 
will preserve any line separators from t [...]
-"style": { "index": 32, "kind": "parameter", "displayName": "Style", 
"group": "formatting", "label": "formatting", "required": false, "type": 
"object", "javaType": 
"org.apache.camel.support.processor.DefaultExchangeFormatter.OutputStyle", 
"enum": [ "Default", "Tab", "Fixed" ], "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "Default", "description": "Sets the outputs 
style to use." }
+"showVariables": { "index": 31, "kind": "parameter", "displayName": "Show 
Variables", "group": "formatting", "label": "formatting", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Show the 
variables." },
+"skipBodyLineSeparator": { "index": 32, "kind": "parameter", 
"displayName": "Skip Body Line Separator", "group": "formatting", "label": 
"formatting", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Whether to skip line separators when logging the message body. 
This allows to log the message body in one line, setting this option to false 
will preserve any line separators from t [...]
+"style": { "index": 33, "kind": "parameter", "displayName": "Style", 
"group": "formatting", "label": "formatting", "required": false, "type": 
"object", "javaType": 
"org.apache.camel.support.processor.DefaultExchangeFormatter.OutputStyle", 
"enum": [ "Default", "Tab", "Fixed" ], "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "Default", "description": "Sets the outputs 
style to use." }
   }
 }
diff --git 

(camel) 25/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 599cbb6413b35cda72f7bb3f208e9bb58a837e6c
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 16:09:38 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../org/apache/camel/builder/BuilderSupport.java   | 34 +
 docs/user-manual/modules/ROOT/pages/variables.adoc | 58 +-
 2 files changed, 91 insertions(+), 1 deletion(-)

diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
index efd82afa711..1fabeee1813 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
@@ -124,18 +124,38 @@ public abstract class BuilderSupport implements 
CamelContextAware {
 
 /**
  * Returns a JOOR expression value builder
+ *
+ * @deprecated use java instead
  */
+@Deprecated
 public ValueBuilder joor(String value) {
 return Builder.joor(value);
 }
 
 /**
  * Returns a JOOR expression value builder
+ *
+ * @deprecated use java instead
  */
+@Deprecated
 public ValueBuilder joor(String value, Class resultType) {
 return Builder.joor(value, resultType);
 }
 
+/**
+ * Returns a Java expression value builder
+ */
+public ValueBuilder java(String value) {
+return Builder.java(value);
+}
+
+/**
+ * Returns a Java expression value builder
+ */
+public ValueBuilder java(String value, Class resultType) {
+return Builder.java(value, resultType);
+}
+
 /**
  * Returns a JSonPath expression value builder
  */
@@ -153,6 +173,20 @@ public abstract class BuilderSupport implements 
CamelContextAware {
 return Builder.jsonpath(value, resultType);
 }
 
+/**
+ * Returns a JQ expression value builder
+ */
+public ValueBuilder jq(String value) {
+return Builder.jq(value);
+}
+
+/**
+ * Returns a JQ expression value builder
+ */
+public ValueBuilder jq(String value, Class resultType) {
+return Builder.jq(value, resultType);
+}
+
 /**
  * Returns a compiled simple expression value builder
  */
diff --git a/docs/user-manual/modules/ROOT/pages/variables.adoc 
b/docs/user-manual/modules/ROOT/pages/variables.adoc
index 4715d124d98..f3fb2e7f989 100644
--- a/docs/user-manual/modules/ROOT/pages/variables.adoc
+++ b/docs/user-manual/modules/ROOT/pages/variables.adoc
@@ -79,4 +79,60 @@ xref:components:eips:setVariable-eip.adoc[SetVariable], and 
xref:components:eips
 
 These EIPs makes it possible to set and remove variables from routes. And you 
can also access variables from the 
xref:components:languages:simple-language.adoc[Simple] language.
 
-TODO: Some examples here
+In the following route we set a variable on the exchange which we use later to 
build a human-readable event message:
+
+[tabs]
+
+Java::
++
+[source,java]
+
+from("kafka:order.in")
+  .setVariable("customerId", jq(".customer.custId"))
+  .setVariable("country", jq(".customer.address.co"))
+  .transform().simple("Order received from customer ${variable.customerId} in 
${variable.country}")
+  .to("kafka:order.event");
+
+
+XML::
++
+[source,xml]
+
+
+
+
+.customer.custId
+
+
+.customer.address.co
+
+
+Order received from customer ${variable.customerId} in 
${variable.country}
+
+
+
+
+
+YAML::
++
+[source,yaml]
+
+- route:
+from:
+  uri: kafka:order.in
+  steps:
+- setVariable:
+name: customerId
+jq:
+  expression: .customer.custId
+- setVariable:
+name: country
+jq:
+  expression: .customer.address.co
+- transform:
+simple:
+  expression: "Order received from customer ${variable.customerId} 
in ${variable.country}"
+- to:
+uri: kafka:order.event
+
+



(camel) 10/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit c5f19f53fe35bb12024ceb8bb8522a2ef0151e7a
Author: Claus Ibsen 
AuthorDate: Fri Dec 29 18:30:12 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../main/java/org/apache/camel/CamelContext.java   |  19 
 .../src/main/java/org/apache/camel/Exchange.java   |   6 +-
 .../java/org/apache/camel/ExchangeExtension.java   |   1 +
 .../org/apache/camel/spi/VariableRepository.java   |  55 ++
 .../camel/spi/VariableRepositoryFactory.java   |  32 ++
 .../camel/impl/engine/AbstractCamelContext.java|  26 +
 .../engine/DefaultVariableRepositoryFactory.java   |  75 ++
 .../camel/impl/engine/SimpleCamelContext.java  |   6 ++
 .../camel/processor/SetVariableProcessor.java  |  40 +++-
 .../camel/processor/CustomGlobalVariableTest.java  | 112 +
 .../camel/processor/SetGlobalVariableTest.java |  74 ++
 .../mbean/ManagedVariableRepositoryMBean.java  |  26 +
 .../management/JmxManagementLifecycleStrategy.java |   4 +
 .../mbean/ManagedVariableRepository.java   |  41 
 .../management/ManagedNonManagedServiceTest.java   |   2 +-
 ...edProducerRouteAddRemoveRegisterAlwaysTest.java |   2 +-
 .../management/ManagedRouteAddRemoveTest.java  |   2 +-
 .../org/apache/camel/support/AbstractExchange.java |  86 
 .../camel/support/DefaultPooledExchange.java   |   3 -
 .../camel/support/ExchangeVariableRepository.java  |  87 
 .../camel/support/ExtendedExchangeExtension.java   |   3 +-
 .../camel/support/GlobalVariableRepository.java|  58 +++
 .../camel/support/builder/ExpressionBuilder.java   |   2 +-
 .../processor/DefaultExchangeFormatter.java|   8 +-
 .../java/org/apache/camel/util/StringHelper.java   |  18 
 25 files changed, 728 insertions(+), 60 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java 
b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java
index 22cfc3ed793..8fadd42919f 100644
--- a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java
+++ b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java
@@ -806,6 +806,25 @@ public interface CamelContext extends 
CamelContextLifecycle, RuntimeConfiguratio
  */
 String resolvePropertyPlaceholders(String text);
 
+/**
+ * To get a variable by name.
+ *
+ * @param  name the variable name. Can be prefixed with repo-id:name to 
lookup the variable from a specific
+ *  repository. If no repo-id is provided, then global 
repository will be used.
+ * @return  the variable, or null if not found.
+ */
+Object getVariable(String name);
+
+/**
+ * To get a variable by name and covert to the given type.
+ *
+ * @param  name the variable name. Can be prefixed with repo-id:name to 
lookup the variable from a specific
+ *  repository. If no repo-id is provided, then global 
repository will be used.
+ * @param  type the type to convert the variable to
+ * @return  the variable, or null if not found.
+ */
+ T getVariable(String name, Class type);
+
 /**
  * Returns the configured properties component or create one if none has 
been configured.
  *
diff --git a/core/camel-api/src/main/java/org/apache/camel/Exchange.java 
b/core/camel-api/src/main/java/org/apache/camel/Exchange.java
index a91f9865b6c..1946492717d 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Exchange.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Exchange.java
@@ -449,7 +449,7 @@ public interface Exchange {
  T getVariable(String name, Object defaultValue, Class type);
 
 /**
- * Sets a varialbe on the exchange
+ * Sets a variable on the exchange
  *
  * @param name  of the variable
  * @param value the value of the variable
@@ -460,7 +460,7 @@ public interface Exchange {
  * Removes the given variable
  *
  * @param  name of the variable
- * @return  the old value of the variable
+ * @return  the old value of the variable, or null if there 
was no variable for the given name
  */
 Object removeVariable(String name);
 
@@ -485,7 +485,7 @@ public interface Exchange {
 /**
  * Returns the variables
  *
- * @return the variables in a Map
+ * @return the variables in a Map.
  */
 Map getVariables();
 
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/ExchangeExtension.java 
b/core/camel-api/src/main/java/org/apache/camel/ExchangeExtension.java
index 7ea4a144193..f076041c70c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/ExchangeExtension.java
+++ b/core/camel-api/src/main/java/org/apache/camel/ExchangeExtension.java
@@ -272,4 +272,5 @@ public interface 

(camel) 15/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 69577edc2cf49e95bf94477813125acf2bc02319
Author: Claus Ibsen 
AuthorDate: Fri Dec 29 20:47:25 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../apache/camel/language/simple/SimpleTest.java   | 35 ++
 .../camel/support/builder/ExpressionBuilder.java   | 43 --
 2 files changed, 74 insertions(+), 4 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
index d0f672df846..7550edc2ca4 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
@@ -45,6 +45,8 @@ import org.apache.camel.spi.Language;
 import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.spi.UuidGenerator;
+import org.apache.camel.spi.VariableRepository;
+import org.apache.camel.spi.VariableRepositoryFactory;
 import org.apache.camel.util.InetAddressUtil;
 import org.apache.camel.util.StringHelper;
 import org.junit.jupiter.api.Test;
@@ -951,6 +953,39 @@ public class SimpleTest extends LanguageTestSupport {
 assertExpression("${variables}", variables);
 }
 
+@Test
+public void testGlobalVariable() throws Exception {
+// exchange has 1 variable already set
+Map variables = exchange.getVariables();
+assertEquals(1, variables.size());
+
+VariableRepository global = 
context.getCamelContextExtension().getContextPlugin(VariableRepositoryFactory.class)
+.getVariableRepository("global");
+global.setVariable("foo", "123");
+global.setVariable("bar", "456");
+global.setVariable("cheese", "gorgonzola");
+
+// exchange scoped
+assertExpression("${variable.cheese}", "gauda");
+assertExpression("${variable.foo}", null);
+assertExpression("${variable.bar}", null);
+
+// global scoped
+assertExpression("${variable.global:cheese}", "gorgonzola");
+assertExpression("${variable.global:foo}", "123");
+assertExpression("${variable.global:bar}", "456");
+
+// exchange scoped
+assertExpression("${variableAs('cheese', 'String')}", "gauda");
+assertExpression("${variableAs('foo', 'int')}", null);
+assertExpression("${variableAA('bar', 'int')}", null);
+
+// global scoped
+assertExpression("${variableAs('global:cheese', 'String')}", 
"gorgonzola");
+assertExpression("${variableAs('global:foo', 'int')}", 123);
+assertExpression("${variableAs('global:bar', 'int')}", 456);
+}
+
 @Test
 public void testVariableKeyWithSpace() throws Exception {
 exchange.getVariables().putAll(exchange.getMessage().getHeaders());
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
index 2d105ed02f8..2939d2c1362 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
@@ -44,6 +44,8 @@ import org.apache.camel.spi.Language;
 import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.spi.UnitOfWork;
+import org.apache.camel.spi.VariableRepository;
+import org.apache.camel.spi.VariableRepositoryFactory;
 import org.apache.camel.support.ConstantExpressionAdapter;
 import org.apache.camel.support.ExchangeHelper;
 import org.apache.camel.support.ExpressionAdapter;
@@ -196,15 +198,29 @@ public class ExpressionBuilder {
  */
 public static Expression variableExpression(final Expression variableName) 
{
 return new ExpressionAdapter() {
+private VariableRepositoryFactory factory;
+
 @Override
 public Object evaluate(Exchange exchange) {
-String name = variableName.evaluate(exchange, String.class);
-return exchange.getVariable(name);
+String key = variableName.evaluate(exchange, String.class);
+String id = StringHelper.before(key, ":");
+if (id != null) {
+VariableRepository repo = 
factory.getVariableRepository(id);
+if (repo != null) {
+key = StringHelper.after(key, ":");
+return repo.getVariable(key);
+} else {
+throw new IllegalArgumentException("VariableRepository 
with id: " + id + " does not exists");
+}
+   

(camel) 08/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit fe894f1815e1702bfb21e65e173e8c34df660cfc
Author: Claus Ibsen 
AuthorDate: Thu Dec 28 18:56:25 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../apache/camel/catalog/components/thymeleaf.json |  14 +-
 .../camel-chunk/src/main/docs/chunk-component.adoc |   2 +
 .../src/main/docs/freemarker-component.adoc|   2 +
 .../camel-jslt/src/main/docs/jslt-component.adoc   |   1 +
 .../apache/camel/component/jslt/JsltEndpoint.java  |   3 +
 .../src/main/docs/mustache-component.adoc  |   2 +
 .../camel-mvel/src/main/docs/mvel-component.adoc   |   1 +
 .../robotframework/RobotFrameworkCamelUtils.java   |   6 +
 .../src/main/docs/string-template-component.adoc   |  26 +++
 .../camel/component/thymeleaf/thymeleaf.json   |  14 +-
 .../component/thymeleaf/ThymeleafEndpoint.java |  78 +
 .../src/main/docs/velocity-component.adoc  |   2 +
 .../org/apache/camel/util/ExchangeHelperTest.java  |  13 +-
 .../org/apache/camel/support/ExchangeHelper.java   |   1 +
 .../dsl/ThymeleafEndpointBuilderFactory.java   | 177 +++--
 15 files changed, 164 insertions(+), 178 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json
index ca54a5ade49..bcd8df3ac89 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json
@@ -39,12 +39,12 @@
 "cacheTimeToLive": { "index": 3, "kind": "parameter", "displayName": 
"Cache Time To Live", "group": "producer", "label": "", "required": false, 
"type": "integer", "javaType": "java.lang.Long", "deprecated": false, 
"autowired": false, "secret": false, "description": "The cache Time To Live for 
templates, expressed in milliseconds." },
 "checkExistence": { "index": 4, "kind": "parameter", "displayName": "Check 
Existence", "group": "producer", "label": "", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "description": "Whether a template resources will be 
checked for existence before being returned." },
 "contentCache": { "index": 5, "kind": "parameter", "displayName": "Content 
Cache", "group": "producer", "label": "", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": false, "description": "Sets whether to use resource 
content cache or not" },
-"encoding": { "index": 6, "kind": "parameter", "displayName": "Encoding", 
"group": "producer", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The character encoding to be used for reading 
template resources." },
-"order": { "index": 7, "kind": "parameter", "displayName": "Order", 
"group": "producer", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false, 
"secret": false, "description": "The order in which this template will be 
resolved as part of the resolver chain." },
-"prefix": { "index": 8, "kind": "parameter", "displayName": "Prefix", 
"group": "producer", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "An optional prefix added to template names to 
convert them into resource names." },
-"resolver": { "index": 9, "kind": "parameter", "displayName": "Resolver", 
"group": "producer", "label": "", "required": false, "type": "object", 
"javaType": "org.apache.camel.component.thymeleaf.ThymeleafResolverType", 
"enum": [ "CLASS_LOADER", "DEFAULT", "FILE", "STRING", "URL", "WEB_APP" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"CLASS_LOADER", "description": "The type of resolver to be used by the template 
engine." },
-"suffix": { "index": 10, "kind": "parameter", "displayName": "Suffix", 
"group": "producer", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "An optional suffix added to template names to 
convert them into resource names." },
-"templateMode": { "index": 11, "kind": "parameter", "displayName": 
"Template Mode", "group": "producer", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The template mode to be applied to 
templates." },
-

(camel) 20/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 93f35d7d1b894a1f2bd07e0eccf78b3bb644d9a1
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 13:59:25 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../camel/cli/connector/LocalCliConnector.java |   7 +
 .../dsl/jbang/core/commands/CamelJBangMain.java|   1 +
 .../jbang/core/commands/process/ListVariable.java  | 169 +
 3 files changed, 177 insertions(+)

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 bc7b89a9ddb..bf2f3cacfc8 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
@@ -943,6 +943,13 @@ public class LocalCliConnector extends ServiceSupport 
implements CliConnector, C
 root.put("consumers", json);
 }
 }
+DevConsole dc15 = dcr.resolveById("variables");
+if (dc15 != null) {
+JsonObject json = (JsonObject) 
dc15.call(DevConsole.MediaType.JSON);
+if (json != null && !json.isEmpty()) {
+root.put("variables", json);
+}
+}
 }
 // various details
 JsonObject services = collectServices();
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
index f66f17b4ebe..bce20df06d9 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
@@ -76,6 +76,7 @@ public class CamelJBangMain implements Callable {
 .addSubcommand("processor", new CommandLine(new 
CamelProcessorStatus(main)))
 .addSubcommand("count", new CommandLine(new 
CamelCount(main)))
 .addSubcommand("health", new CommandLine(new 
ListHealth(main)))
+.addSubcommand("variable", new CommandLine(new 
ListVariable(main)))
 .addSubcommand("consumer", new CommandLine(new 
ListConsumer(main)))
 .addSubcommand("endpoint", new CommandLine(new 
ListEndpoint(main)))
 .addSubcommand("event", new CommandLine(new 
ListEvent(main)))
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
new file mode 100644
index 000..ee6549d2844
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.process;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import com.github.freva.asciitable.AsciiTable;
+import com.github.freva.asciitable.Column;
+import com.github.freva.asciitable.HorizontalAlign;
+import com.github.freva.asciitable.OverflowBehaviour;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.common.ProcessHelper;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+@Command(name = "variable", description = "List variables in a running Camel 
integration", sortOptions = false)
+public class ListVariable extends ProcessWatchCommand {
+
+public 

(camel) 18/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 7e55671cd8bbd55fae43e7b80a0edd077b8a4b0d
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 13:21:32 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../java/org/apache/camel/spi/VariableRepositoryFactory.java | 4 ++--
 .../camel/impl/engine/DefaultVariableRepositoryFactory.java  | 3 ++-
 .../java/org/apache/camel/impl/console/VariablesDevConsole.java  | 9 +++--
 .../org/apache/camel/processor/CustomGlobalVariableTest.java | 4 ++--
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
 
b/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
index 6928e343f84..00344d23f3c 100644
--- 
a/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
@@ -22,9 +22,9 @@ package org.apache.camel.spi;
 public interface VariableRepositoryFactory {
 
 /**
- * ID for custom global {@link VariableRepository}.
+ * Registry bean id for global {@link VariableRepository}.
  */
-String GLOBAL_VARIABLE_FACTORY_ID = "global-variable-repository";
+String GLOBAL_VARIABLE_REPOSITORY_ID = "global-variable-repository";
 
 /**
  * Gets the {@link VariableRepository} for the given id
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
index 1c4a65569b4..5353c4ac3fd 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
@@ -79,12 +79,13 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 protected void doStart() throws Exception {
 super.doStart();
 
-VariableRepository repo = CamelContextHelper.lookup(camelContext, 
GLOBAL_VARIABLE_FACTORY_ID, VariableRepository.class);
+VariableRepository repo = CamelContextHelper.lookup(camelContext, 
GLOBAL_VARIABLE_REPOSITORY_ID, VariableRepository.class);
 if (repo != null) {
 LOG.info("Using VariableRepository: {} as global repository", 
repo.getId());
 global = repo;
 } else {
 global = new GlobalVariableRepository();
+camelContext.getRegistry().bind(GLOBAL_VARIABLE_REPOSITORY_ID, 
global);
 }
 
 if (!camelContext.hasService(global)) {
diff --git 
a/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
 
b/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
index a25e0a103eb..87018f3bf9a 100644
--- 
a/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
+++ 
b/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
@@ -39,12 +39,13 @@ public class VariablesDevConsole extends AbstractDevConsole 
{
 
 Set repos = 
getCamelContext().getRegistry().findByType(BrowsableVariableRepository.class);
 for (BrowsableVariableRepository repo : repos) {
-sb.append(String.format("Variable repository: %s (size: %n)", 
repo.getId(), repo.size()));
+sb.append(String.format("Repository: %s (size: %d)", repo.getId(), 
repo.size()));
 sb.append("\n");
 for (Map.Entry entry : 
repo.getVariables().entrySet()) {
 String k = entry.getKey();
 Object v = entry.getValue();
-sb.append(String.format("\n%s = %s", k, v));
+String t = v != null ? v.getClass().getName() : "";
+sb.append(String.format("\n%s (%s) = %s", k, t, v));
 }
 sb.append("\n");
 }
@@ -66,9 +67,13 @@ public class VariablesDevConsole extends AbstractDevConsole {
 for (Map.Entry entry : 
repo.getVariables().entrySet()) {
 String k = entry.getKey();
 Object v = entry.getValue();
+String t = v != null ? v.getClass().getName() : null;
 JsonObject e = new JsonObject();
 e.put("key", k);
 e.put("value", v);
+if (t != null) {
+e.put("className", t);
+}
 arr.add(e);
 }
 if (!arr.isEmpty()) {
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/CustomGlobalVariableTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/CustomGlobalVariableTest.java
index ad5b4a0a8d4..609ed161d27 100644

(camel) 04/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit a1da0560b6104fb2191dc46e2e7a86a252040138
Author: Claus Ibsen 
AuthorDate: Thu Dec 28 13:19:45 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../camel-bean/src/main/docs/bean-language.adoc|   2 +-
 .../bean/AbstractCamelInvocationHandler.java   |  14 +++
 .../org/apache/camel/component/bean/BeanInfo.java  |   7 ++
 .../src/main/java/org/apache/camel/Variable.java   |  39 +++
 .../src/main/java/org/apache/camel/Variables.java  |  34 ++
 .../component/bean/BeanPipelineVariablesTest.java  |  96 +
 ...eanWithPropertiesAndVariablesInjectionTest.java |  97 +
 .../bean/BeanWithVariablesAndBodyInject3Test.java  |  87 
 .../BeanWithVariablesAndBodyInjectionTest.java |  99 ++
 .../camel/processor/MethodFilterVariableTest.java  |  74 +
 .../camel/support/builder/ExpressionBuilder.java   | 115 +
 .../ROOT/pages/parameter-binding-annotations.adoc  |   9 +-
 12 files changed, 671 insertions(+), 2 deletions(-)

diff --git a/components/camel-bean/src/main/docs/bean-language.adoc 
b/components/camel-bean/src/main/docs/bean-language.adoc
index 85996a113ab..f7138e4e5ce 100644
--- a/components/camel-bean/src/main/docs/bean-language.adoc
+++ b/components/camel-bean/src/main/docs/bean-language.adoc
@@ -76,7 +76,7 @@ public boolean isGoldCustomer(String body) {...}
 === Using Annotations for bean integration
 
 You can also use the xref:manual::bean-integration.adoc[Bean Integration]
-annotations, such as `@Header`, `@Body` etc
+annotations, such as `@Header`, `@Body`, `@Variable` etc
 
 [source,java]
 
diff --git 
a/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractCamelInvocationHandler.java
 
b/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractCamelInvocationHandler.java
index b7cc688765e..4cd04ab2b37 100644
--- 
a/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractCamelInvocationHandler.java
+++ 
b/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractCamelInvocationHandler.java
@@ -43,6 +43,8 @@ import org.apache.camel.Headers;
 import org.apache.camel.InvalidPayloadException;
 import org.apache.camel.Producer;
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.Variable;
+import org.apache.camel.Variables;
 import org.apache.camel.support.DefaultExchange;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StringHelper;
@@ -109,6 +111,8 @@ public abstract class AbstractCamelInvocationHandler 
implements InvocationHandle
 for (Parameter parameter : method.getParameters()) {
 if (parameter.isAnnotationPresent(Header.class)
 || parameter.isAnnotationPresent(Headers.class)
+|| parameter.isAnnotationPresent(Variable.class)
+|| parameter.isAnnotationPresent(Variables.class)
 || 
parameter.isAnnotationPresent(ExchangeProperty.class)
 || parameter.isAnnotationPresent(Body.class)) {
 canUseBinding = true;
@@ -139,6 +143,16 @@ public abstract class AbstractCamelInvocationHandler 
implements InvocationHandle
 if (map != null) {
 exchange.getIn().getHeaders().putAll(map);
 }
+} else if 
(ann.annotationType().isAssignableFrom(Variable.class)) {
+Variable variable = (Variable) ann;
+String name = variable.value();
+exchange.setVariable(name, value);
+} else if 
(ann.annotationType().isAssignableFrom(Variables.class)) {
+Map map
+= 
exchange.getContext().getTypeConverter().tryConvertTo(Map.class, exchange, 
value);
+if (map != null) {
+exchange.getVariables().putAll(map);
+}
 } else if 
(ann.annotationType().isAssignableFrom(ExchangeProperty.class)) {
 ExchangeProperty ep = (ExchangeProperty) ann;
 String name = ep.value();
diff --git 
a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java
 
b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java
index 5e0a27b908f..99b646dcaa3 100644
--- 
a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java
+++ 
b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java
@@ -42,6 +42,8 @@ import org.apache.camel.Header;
 import 

(camel) 17/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 98e0b91b64de72db5a1f58cfe0ce3ffb853ec083
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 10:00:10 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../org/apache/camel/dev-console/variables |  2 +
 .../camel/impl/console/VariablesDevConsole.java| 81 ++
 2 files changed, 83 insertions(+)

diff --git 
a/core/camel-console/src/generated/resources/META-INF/services/org/apache/camel/dev-console/variables
 
b/core/camel-console/src/generated/resources/META-INF/services/org/apache/camel/dev-console/variables
new file mode 100644
index 000..09e0f310219
--- /dev/null
+++ 
b/core/camel-console/src/generated/resources/META-INF/services/org/apache/camel/dev-console/variables
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.impl.console.VariablesDevConsole
diff --git 
a/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
 
b/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
new file mode 100644
index 000..a25e0a103eb
--- /dev/null
+++ 
b/core/camel-console/src/main/java/org/apache/camel/impl/console/VariablesDevConsole.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.impl.console;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.camel.spi.BrowsableVariableRepository;
+import org.apache.camel.spi.annotations.DevConsole;
+import org.apache.camel.support.console.AbstractDevConsole;
+import org.apache.camel.util.json.JsonObject;
+
+@DevConsole("variables")
+public class VariablesDevConsole extends AbstractDevConsole {
+
+public VariablesDevConsole() {
+super("camel", "variables", "Variables", "Displays variables");
+}
+
+@Override
+protected String doCallText(Map options) {
+StringBuilder sb = new StringBuilder();
+
+Set repos = 
getCamelContext().getRegistry().findByType(BrowsableVariableRepository.class);
+for (BrowsableVariableRepository repo : repos) {
+sb.append(String.format("Variable repository: %s (size: %n)", 
repo.getId(), repo.size()));
+sb.append("\n");
+for (Map.Entry entry : 
repo.getVariables().entrySet()) {
+String k = entry.getKey();
+Object v = entry.getValue();
+sb.append(String.format("\n%s = %s", k, v));
+}
+sb.append("\n");
+}
+
+return sb.toString();
+}
+
+@Override
+protected JsonObject doCallJson(Map options) {
+JsonObject root = new JsonObject();
+
+Set repos = 
getCamelContext().getRegistry().findByType(BrowsableVariableRepository.class);
+for (BrowsableVariableRepository repo : repos) {
+List arr = new ArrayList<>();
+JsonObject jo = new JsonObject();
+root.put(repo.getId(), jo);
+jo.put("id", repo.getId());
+jo.put("size", repo.size());
+for (Map.Entry entry : 
repo.getVariables().entrySet()) {
+String k = entry.getKey();
+Object v = entry.getValue();
+JsonObject e = new JsonObject();
+e.put("key", k);
+e.put("value", v);
+arr.add(e);
+}
+if (!arr.isEmpty()) {
+jo.put("variables", arr);
+}
+}
+
+return root;
+}
+}



(camel) 23/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 93ec9c3f608a86ca541c1b47f48d4f5762386f4f
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 14:23:13 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../apache/camel/dsl/jbang/core/commands/process/ListVariable.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
index ee6549d2844..b19927f1bfa 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVariable.java
@@ -107,10 +107,10 @@ public class ListVariable extends ProcessWatchCommand {
 new 
Column().header("NAME").dataAlign(HorizontalAlign.LEFT).maxWidth(30, 
OverflowBehaviour.ELLIPSIS_RIGHT)
 .with(r -> r.name),
 new 
Column().header("REPOSITORY").headerAlign(HorizontalAlign.CENTER).with(r -> 
r.id),
-new 
Column().header("KEY").dataAlign(HorizontalAlign.LEFT).maxWidth(50, 
OverflowBehaviour.ELLIPSIS_RIGHT)
-.with(r -> r.key),
 new 
Column().header("TYPE").headerAlign(HorizontalAlign.CENTER)
 .maxWidth(40, 
OverflowBehaviour.ELLIPSIS_LEFT).with(r -> r.className),
+new 
Column().header("KEY").dataAlign(HorizontalAlign.LEFT).maxWidth(50, 
OverflowBehaviour.ELLIPSIS_RIGHT)
+.with(r -> r.key),
 new 
Column().header("VALUE").headerAlign(HorizontalAlign.RIGHT).maxWidth(80, 
OverflowBehaviour.NEWLINE)
 .with(r -> r.value.toString();
 }



(camel) 14/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit f2febe6a26e21c25782722763f058a707778c7c9
Author: Claus Ibsen 
AuthorDate: Fri Dec 29 19:52:20 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../camel/processor/RemoveVariableProcessor.java   | 48 --
 .../camel/reifier/RemoveVariableReifier.java   | 13 +++-
 .../camel/processor/RemoveGlobalVariableTest.java  | 77 ++
 3 files changed, 131 insertions(+), 7 deletions(-)

diff --git 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RemoveVariableProcessor.java
 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RemoveVariableProcessor.java
index e9e9238a80d..bcc150ebfbd 100644
--- 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RemoveVariableProcessor.java
+++ 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RemoveVariableProcessor.java
@@ -17,28 +17,60 @@
 package org.apache.camel.processor;
 
 import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
 import org.apache.camel.Traceable;
 import org.apache.camel.spi.IdAware;
 import org.apache.camel.spi.RouteIdAware;
+import org.apache.camel.spi.VariableRepository;
+import org.apache.camel.spi.VariableRepositoryFactory;
 import org.apache.camel.support.AsyncProcessorSupport;
+import org.apache.camel.util.StringHelper;
 
 /**
  * A processor which removes the variable
  */
-public class RemoveVariableProcessor extends AsyncProcessorSupport implements 
Traceable, IdAware, RouteIdAware {
+public class RemoveVariableProcessor extends AsyncProcessorSupport
+implements Traceable, IdAware, RouteIdAware, CamelContextAware {
+private CamelContext camelContext;
 private String id;
 private String routeId;
-private final String variableName;
+private final Expression variableName;
+private VariableRepositoryFactory factory;
 
-public RemoveVariableProcessor(String variableName) {
+public RemoveVariableProcessor(Expression variableName) {
 this.variableName = variableName;
 }
 
+@Override
+public CamelContext getCamelContext() {
+return camelContext;
+}
+
+@Override
+public void setCamelContext(CamelContext camelContext) {
+this.camelContext = camelContext;
+}
+
 @Override
 public boolean process(Exchange exchange, AsyncCallback callback) {
 try {
-exchange.removeVariable(variableName);
+String key = variableName.evaluate(exchange, String.class);
+String id = StringHelper.before(key, ":");
+if (id != null) {
+VariableRepository repo = factory.getVariableRepository(id);
+if (repo != null) {
+key = StringHelper.after(key, ":");
+repo.removeVariable(key);
+} else {
+exchange.setException(
+new IllegalArgumentException("VariableRepository 
with id: " + id + " does not exists"));
+}
+} else {
+exchange.removeVariable(key);
+}
 } catch (Exception e) {
 exchange.setException(e);
 }
@@ -47,6 +79,12 @@ public class RemoveVariableProcessor extends 
AsyncProcessorSupport implements Tr
 return true;
 }
 
+@Override
+protected void doBuild() throws Exception {
+super.doBuild();
+factory = 
getCamelContext().getCamelContextExtension().getContextPlugin(VariableRepositoryFactory.class);
+}
+
 @Override
 public String toString() {
 return id;
@@ -78,7 +116,7 @@ public class RemoveVariableProcessor extends 
AsyncProcessorSupport implements Tr
 }
 
 public String getVariableName() {
-return variableName;
+return variableName.toString();
 }
 
 }
diff --git 
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RemoveVariableReifier.java
 
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RemoveVariableReifier.java
index 79fe16b3586..4774ac0c231 100644
--- 
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RemoveVariableReifier.java
+++ 
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RemoveVariableReifier.java
@@ -16,11 +16,13 @@
  */
 package org.apache.camel.reifier;
 
+import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.model.RemoveVariableDefinition;
 import org.apache.camel.processor.RemoveVariableProcessor;
+import org.apache.camel.support.LanguageSupport;
 
 public class RemoveVariableReifier extends 

(camel) branch var created (now 599cbb6413b)

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


  at 599cbb6413b CAMEL-19749: Add variables as concept to Camel

This branch includes the following new commits:

 new 8e81b17b175 CAMEL-19749: Add variables as concept to Camel
 new 967572075c2 CAMEL-19749: Add variables as concept to Camel
 new ade0af75c83 CAMEL-19749: Add variables as concept to Camel
 new a1da0560b61 CAMEL-19749: Add variables as concept to Camel
 new 10e8d0da4a4 CAMEL-19749: Add variables as concept to Camel
 new 77bea9c115b CAMEL-19749: Add variables as concept to Camel
 new 2cadfd5532b CAMEL-19749: Add variables as concept to Camel
 new fe894f1815e CAMEL-19749: Add variables as concept to Camel
 new 23ef6d654bf CAMEL-19749: Add variables as concept to Camel
 new c5f19f53fe3 CAMEL-19749: Add variables as concept to Camel
 new cee13b54b0a CAMEL-19749: Add variables as concept to Camel
 new 61dd45599c7 CAMEL-19749: Add variables as concept to Camel
 new 16bf21cb099 CAMEL-19749: Add variables as concept to Camel
 new f2febe6a26e CAMEL-19749: Add variables as concept to Camel
 new 69577edc2cf CAMEL-19749: Add variables as concept to Camel
 new 08c6d2e68b4 CAMEL-19749: Add variables as concept to Camel
 new 98e0b91b64d CAMEL-19749: Add variables as concept to Camel
 new 7e55671cd8b CAMEL-19749: Add variables as concept to Camel
 new b7a06859482 CAMEL-19749: Add variables as concept to Camel
 new 93f35d7d1b8 CAMEL-19749: Add variables as concept to Camel
 new e079301501f CAMEL-19749: Add variables as concept to Camel
 new 64febd93924 CAMEL-19749: Add variables as concept to Camel
 new 93ec9c3f608 CAMEL-19749: Add variables as concept to Camel
 new a93137d6145 CAMEL-19749: Add variables as concept to Camel
 new 599cbb6413b CAMEL-19749: Add variables as concept to Camel

The 25 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.




(camel) 12/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 61dd45599c77e582b81dd8e0cdd5413061822fe7
Author: Claus Ibsen 
AuthorDate: Fri Dec 29 19:14:52 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../engine/DefaultVariableRepositoryFactory.java   | 28 ++
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
index 5161c43976e..1c4a65569b4 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
@@ -17,7 +17,9 @@
 package org.apache.camel.impl.engine;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.StaticService;
+import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.spi.VariableRepository;
 import org.apache.camel.spi.VariableRepositoryFactory;
 import org.apache.camel.support.CamelContextHelper;
@@ -33,8 +35,11 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 
 private static final Logger LOG = 
LoggerFactory.getLogger(DefaultVariableRepositoryFactory.class);
 
+public static final String RESOURCE_PATH = 
"META-INF/services/org/apache/camel/variable-repository/";
+
 private final CamelContext camelContext;
 private VariableRepository global;
+private FactoryFinder factoryFinder;
 
 public DefaultVariableRepositoryFactory(CamelContext camelContext) {
 this.camelContext = camelContext;
@@ -46,13 +51,28 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 return global;
 }
 
-// otherwise lookup in registry if the repo exists
 VariableRepository repo = CamelContextHelper.lookup(camelContext, id, 
VariableRepository.class);
-if (repo != null) {
-return repo;
+if (repo == null) {
+// try via factory finder
+Class clazz = factoryFinder.findClass(id).orElse(null);
+if (clazz != null && 
VariableRepository.class.isAssignableFrom(clazz)) {
+repo = (VariableRepository) 
camelContext.getInjector().newInstance(clazz, true);
+camelContext.getRegistry().bind(id, repo);
+try {
+camelContext.addService(repo);
+} catch (Exception e) {
+throw RuntimeCamelException.wrapRuntimeException(e);
+}
+}
 }
 
-return null;
+return repo;
+}
+
+@Override
+protected void doBuild() throws Exception {
+super.doBuild();
+this.factoryFinder = 
camelContext.getCamelContextExtension().getBootstrapFactoryFinder(RESOURCE_PATH);
 }
 
 @Override



(camel) 11/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit cee13b54b0a7e71dc74d21a9305c58c4fc6da954
Author: Claus Ibsen 
AuthorDate: Fri Dec 29 18:59:28 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../main/java/org/apache/camel/spi/VariableRepositoryFactory.java| 5 +
 .../apache/camel/impl/engine/DefaultVariableRepositoryFactory.java   | 2 +-
 .../java/org/apache/camel/processor/CustomGlobalVariableTest.java| 3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
 
b/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
index ba7aefeb473..6928e343f84 100644
--- 
a/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/VariableRepositoryFactory.java
@@ -21,6 +21,11 @@ package org.apache.camel.spi;
  */
 public interface VariableRepositoryFactory {
 
+/**
+ * ID for custom global {@link VariableRepository}.
+ */
+String GLOBAL_VARIABLE_FACTORY_ID = "global-variable-repository";
+
 /**
  * Gets the {@link VariableRepository} for the given id
  *
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
index 524192b909f..5161c43976e 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultVariableRepositoryFactory.java
@@ -59,7 +59,7 @@ public class DefaultVariableRepositoryFactory extends 
ServiceSupport implements
 protected void doStart() throws Exception {
 super.doStart();
 
-VariableRepository repo = 
CamelContextHelper.findSingleByType(camelContext, VariableRepository.class);
+VariableRepository repo = CamelContextHelper.lookup(camelContext, 
GLOBAL_VARIABLE_FACTORY_ID, VariableRepository.class);
 if (repo != null) {
 LOG.info("Using VariableRepository: {} as global repository", 
repo.getId());
 global = repo;
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/CustomGlobalVariableTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/CustomGlobalVariableTest.java
index 82192e1efbf..ad5b4a0a8d4 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/CustomGlobalVariableTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/CustomGlobalVariableTest.java
@@ -28,6 +28,7 @@ import org.apache.camel.support.service.ServiceSupport;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
+import static 
org.apache.camel.spi.VariableRepositoryFactory.GLOBAL_VARIABLE_FACTORY_ID;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 
@@ -39,7 +40,7 @@ public class CustomGlobalVariableTest extends 
ContextTestSupport {
 @Override
 protected CamelContext createCamelContext() throws Exception {
 CamelContext context = super.createCamelContext();
-context.getRegistry().bind("myGlobal", new MyGlobalRepo());
+context.getRegistry().bind(GLOBAL_VARIABLE_FACTORY_ID, new 
MyGlobalRepo());
 return context;
 }
 



(camel) 01/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 8e81b17b175544e5f7d10ba4c0449ddca06764fc
Author: Claus Ibsen 
AuthorDate: Thu Dec 28 10:40:30 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../src/main/java/org/apache/camel/Exchange.java   |  77 
 .../java/org/apache/camel/ExchangeTestSupport.java |   1 +
 .../org/apache/camel/impl/DefaultExchangeTest.java | 136 +
 .../org/apache/camel/support/AbstractExchange.java | 109 -
 4 files changed, 322 insertions(+), 1 deletion(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Exchange.java 
b/core/camel-api/src/main/java/org/apache/camel/Exchange.java
index 9e7abd83ad0..a91f9865b6c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Exchange.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Exchange.java
@@ -419,6 +419,83 @@ public interface Exchange {
  */
 boolean hasProperties();
 
+/**
+ * Returns a variable by name
+ *
+ * @param  name the name of the variable
+ * @return  the value of the given variable or null if there 
is no variable for the given name
+ */
+Object getVariable(String name);
+
+/**
+ * Returns a variable by name and specifying the type required
+ *
+ * @param  name the name of the variable
+ * @param  type the type of the variable
+ * @return  the value of the given variable or null if there 
is no variable for the given name or
+ *  null if it cannot be converted to the given type
+ */
+ T getVariable(String name, Class type);
+
+/**
+ * Returns a variable by name and specifying the type required
+ *
+ * @param  name the name of the variable
+ * @param  defaultValue the default value to return if variable was absent
+ * @param  type the type of the variable
+ * @return  the value of the given variable or 
defaultValue if there is no variable for the
+ *  given name or null if it cannot be 
converted to the given type
+ */
+ T getVariable(String name, Object defaultValue, Class type);
+
+/**
+ * Sets a varialbe on the exchange
+ *
+ * @param name  of the variable
+ * @param value the value of the variable
+ */
+void setVariable(String name, Object value);
+
+/**
+ * Removes the given variable
+ *
+ * @param  name of the variable
+ * @return  the old value of the variable
+ */
+Object removeVariable(String name);
+
+/**
+ * Remove all the variables matching a specific pattern
+ *
+ * @param  pattern pattern of names
+ * @return boolean whether any variables matched
+ */
+boolean removeVariables(String pattern);
+
+/**
+ * Removes the variables that match the given pattern, except for 
the ones matching one or more
+ * excludePatterns
+ *
+ * @param  pattern pattern of names that should be removed
+ * @param  excludePatterns one or more pattern of variable names that 
should be excluded (= preserved)
+ * @return boolean whether any variables matched
+ */
+boolean removeVariables(String pattern, String... excludePatterns);
+
+/**
+ * Returns the variables
+ *
+ * @return the variables in a Map
+ */
+Map getVariables();
+
+/**
+ * Returns whether any variables have been set
+ *
+ * @return true if any variables has been set
+ */
+boolean hasVariables();
+
 /**
  * Returns the inbound request message
  *
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java 
b/core/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java
index 422d82d141f..872c588d6e3 100644
--- a/core/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java
+++ b/core/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java
@@ -44,6 +44,7 @@ public abstract class ExchangeTestSupport extends 
ContextTestSupport {
 in.setBody("world!");
 
 exchange.setProperty("foobar", "cba");
+exchange.setVariable("cheese", "gauda");
 }
 
 @Override
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java 
b/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java
index 6147d9877ec..b8aa1d8af06 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java
@@ -142,6 +142,30 @@ public class DefaultExchangeTest extends 
ExchangeTestSupport {
 assertEquals("banana", exchange.getProperty("beer", "banana", 
String.class));
 }
 
+@Test
+public void testVariable() throws Exception {
+

(camel) 07/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 2cadfd5532b12f9398f4d6f95409011a63cff908
Author: Claus Ibsen 
AuthorDate: Thu Dec 28 13:48:31 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../java/org/apache/camel/language/simple/SimpleExpressionBuilder.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
index ea80baf72a8..9ec436ae6ec 100644
--- 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
+++ 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
@@ -77,8 +77,7 @@ public final class SimpleExpressionBuilder {
 }
 
 /**
- * Returns the expression for the variable invoking methods defined in a 
simple OGNL
- * notation
+ * Returns the expression for the variable invoking methods defined in a 
simple OGNL notation
  *
  * @param ognl methods to invoke on the variable in a simple OGNL syntax
  */



(camel) 22/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 64febd93924dc0d18ff9c930e4634271c36422e0
Author: Claus Ibsen 
AuthorDate: Sat Dec 30 14:18:08 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../api/management/mbean/CamelOpenMBeanTypes.java  | 13 ++
 .../mbean/ManagedVariableRepositoryMBean.java  |  5 +++
 .../mbean/ManagedVariableRepository.java   | 47 ++
 3 files changed, 65 insertions(+)

diff --git 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
index 93b01ebd60d..a89c5100773 100644
--- 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
+++ 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
@@ -295,4 +295,17 @@ public final class CamelOpenMBeanTypes {
 SimpleType.STRING, SimpleType.STRING, 
SimpleType.STRING, SimpleType.STRING });
 }
 
+public static CompositeType camelVariablesCompositeType() throws 
OpenDataException {
+return new CompositeType(
+"variables", "Variables",
+new String[] { "id", "key", "className", "value" },
+new String[] { "Id", "Key", "className", "Value" },
+new OpenType[] { SimpleType.STRING, SimpleType.STRING, 
SimpleType.STRING, SimpleType.STRING });
+}
+
+public static TabularType camelVariablesTabularType() throws 
OpenDataException {
+CompositeType ct = camelVariablesCompositeType();
+return new TabularType("variables", "Variables", ct, new String[] { 
"id", "key" });
+}
+
 }
diff --git 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
index afcd503e8ee..8614f2b812c 100644
--- 
a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
+++ 
b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedVariableRepositoryMBean.java
@@ -21,6 +21,8 @@ import java.util.Set;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedOperation;
 
+import javax.management.openmbean.TabularData;
+
 public interface ManagedVariableRepositoryMBean extends ManagedServiceMBean {
 
 @ManagedAttribute(description = "Repository ID")
@@ -35,4 +37,7 @@ public interface ManagedVariableRepositoryMBean extends 
ManagedServiceMBean {
 @ManagedOperation(description = "Variable names")
 Set names();
 
+@ManagedOperation(description = "List all variables")
+TabularData variables();
+
 }
diff --git 
a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedVariableRepository.java
 
b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedVariableRepository.java
index eef3e4c8306..ecf42907f5e 100644
--- 
a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedVariableRepository.java
+++ 
b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedVariableRepository.java
@@ -16,14 +16,23 @@
  */
 package org.apache.camel.management.mbean;
 
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.api.management.mbean.CamelOpenMBeanTypes;
 import org.apache.camel.api.management.mbean.ManagedVariableRepositoryMBean;
 import org.apache.camel.spi.BrowsableVariableRepository;
 
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+
 @ManagedResource(description = "Managed VariableRepository")
 public class ManagedVariableRepository extends ManagedService implements 
ManagedVariableRepositoryMBean {
 private final BrowsableVariableRepository variableRepository;
@@ -56,4 +65,42 @@ public class ManagedVariableRepository extends 
ManagedService implements Managed
 public Set names() {
 return variableRepository.names().collect(Collectors.toSet());
 }
+
+@Override
+public TabularData variables() {
+try {
+final TabularData answer = new 
TabularDataSupport(CamelOpenMBeanTypes.camelVariablesTabularType());
+final CompositeType type = 

(camel) 06/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 77bea9c115b33bc7326b240217af919c2d0265e1
Author: Claus Ibsen 
AuthorDate: Thu Dec 28 13:43:07 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../modules/languages/pages/simple-language.adoc   | 15 -
 .../language/simple/SimpleExpressionBuilder.java   | 17 +
 .../simple/ast/SimpleFunctionExpression.java   | 71 
 .../apache/camel/language/simple/SimpleTest.java   | 75 +-
 .../org/apache/camel/support/LanguageHelper.java   | 15 +
 .../camel/support/builder/ExpressionBuilder.java   |  2 +-
 6 files changed, 192 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
 
b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
index 4789404a6cb..9a663faf367 100644
--- 
a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
+++ 
b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
@@ -127,6 +127,18 @@ classname
 
 |headers |Map |refer to the headers
 
+|variable.foo |Object |refer to the foo variable
+
+|variable[foo] |Object |refer to the foo variable
+
+|variable.foo.*OGNL* |Object |refer to the foo variable and invoke its
+value using a Camel OGNL expression.
+
+|variableAs(_key_,_type_) |Type |converts the variable to the given type 
determined by its
+classname
+
+|variables |Map |refer to the variables
+
 |exchangeProperty.foo |Object |refer to the foo property on the exchange
 
 |exchangeProperty[foo] |Object |refer to the foo property on the exchange
@@ -165,7 +177,8 @@ exceptions (`Exchange.EXCEPTION_CAUGHT`) if the Exchange 
has any.
 |date:_command_ |Date |evaluates to a Date object.
 Supported commands are: *now* for current timestamp,
 *exchangeCreated* for the timestamp when the current exchange was created,
-*header.xxx* to use the Long/Date object header with the key xxx.
+*header.xxx* to use the Long/Date object in the header with the key xxx.
+*variable.xxx* to use the Long/Date in the variable with the key xxx.
 *exchangeProperty.xxx* to use the Long/Date object in the exchange property 
with the key xxx.
 *file* for the last modified timestamp of the file (available with a File 
consumer).
 Command accepts offsets such as: *now-24h* or *header.xxx+1h* or even 
*now+1h30m-100*.
diff --git 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
index 0be12c475a1..ea80baf72a8 100644
--- 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
+++ 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
@@ -76,6 +76,21 @@ public final class SimpleExpressionBuilder {
 });
 }
 
+/**
+ * Returns the expression for the variable invoking methods defined in a 
simple OGNL
+ * notation
+ *
+ * @param ognl methods to invoke on the variable in a simple OGNL syntax
+ */
+public static Expression variablesOgnlExpression(final String ognl) {
+return new KeyedOgnlExpressionAdapter(
+ognl, "variableOgnl(" + ognl + ")",
+(exchange, exp) -> {
+String text = exp.evaluate(exchange, String.class);
+return exchange.getVariable(text);
+});
+}
+
 /**
  * Returns the message history (including exchange details or not)
  */
@@ -596,6 +611,8 @@ public final class SimpleExpressionBuilder {
 date = LanguageHelper.dateFromExchangeCreated(exchange);
 } else if (command.startsWith("header.")) {
 date = LanguageHelper.dateFromHeader(exchange, command, (e, o) -> 
tryConvertingAsDate(e, o, command));
+} else if (command.startsWith("variable.")) {
+date = LanguageHelper.dateFromVariable(exchange, command, (e, o) 
-> tryConvertingAsDate(e, o, command));
 } else if (command.startsWith("exchangeProperty.")) {
 date = LanguageHelper.dateFromExchangeProperty(exchange, command, 
(e, o) -> tryConvertingAsDate(e, o, command));
 } else if ("file".equals(command)) {
diff --git 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
index ddc8fd13425..fb04db0eefa 100644
--- 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
+++ 

(camel) 09/25: CAMEL-19749: Add variables as concept to Camel

2023-12-30 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit 23ef6d654bf1d3c3e46733f5fdf0322351040151
Author: Claus Ibsen 
AuthorDate: Fri Dec 29 12:45:33 2023 +0100

CAMEL-19749: Add variables as concept to Camel
---
 .../org/apache/camel/model/removeVariable.xml  | 29 ++
 .../org/apache/camel/model/setVariable.xml | 28 +
 2 files changed, 57 insertions(+)

diff --git 
a/core/camel-core/src/test/resources/org/apache/camel/model/removeVariable.xml 
b/core/camel-core/src/test/resources/org/apache/camel/model/removeVariable.xml
new file mode 100644
index 000..cf9f70bb857
--- /dev/null
+++ 
b/core/camel-core/src/test/resources/org/apache/camel/model/removeVariable.xml
@@ -0,0 +1,29 @@
+
+
+http://camel.apache.org/schema/spring;>
+  
+
+
+  ${body}
+
+
+
+  
+
diff --git 
a/core/camel-core/src/test/resources/org/apache/camel/model/setVariable.xml 
b/core/camel-core/src/test/resources/org/apache/camel/model/setVariable.xml
new file mode 100644
index 000..59fc7f8749c
--- /dev/null
+++ b/core/camel-core/src/test/resources/org/apache/camel/model/setVariable.xml
@@ -0,0 +1,28 @@
+
+
+http://camel.apache.org/schema/spring;>
+  
+
+
+  ${body}
+
+ 
+  
+



(camel) branch regen_bot updated (ec517d32270 -> 51ba2a82c8a)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch regen_bot
in repository https://gitbox.apache.org/repos/asf/camel.git


from ec517d32270 Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 (#12621)
 add 51ba2a82c8a Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10 (#12622)

No new revisions were added by this update.

Summary of changes:
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(camel) branch dependabot/maven/org.slf4j-slf4j-api-2.0.10 deleted (was 4186b04aea6)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch dependabot/maven/org.slf4j-slf4j-api-2.0.10
in repository https://gitbox.apache.org/repos/asf/camel.git


 was 4186b04aea6 Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(camel) branch main updated (ec517d32270 -> 51ba2a82c8a)

2023-12-30 Thread acosentino
This is an automated email from the ASF dual-hosted git repository.

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


from ec517d32270 Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 (#12621)
 add 51ba2a82c8a Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10 (#12622)

No new revisions were added by this update.

Summary of changes:
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



Re: [PR] Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10 [camel]

2023-12-30 Thread via GitHub


oscerd merged PR #12622:
URL: https://github.com/apache/camel/pull/12622


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) branch regen_bot updated (d19b9ef6aed -> ec517d32270)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch regen_bot
in repository https://gitbox.apache.org/repos/asf/camel.git


from d19b9ef6aed camel-json-validator: Added options to set 
DeserializationFeature for ObjectMapper (#12620)
 add ec517d32270 Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 (#12621)

No new revisions were added by this update.

Summary of changes:
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(camel) branch dependabot/maven/californium-version-3.10.0 deleted (was 3559e3feaf9)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch dependabot/maven/californium-version-3.10.0
in repository https://gitbox.apache.org/repos/asf/camel.git


 was 3559e3feaf9 Bump californium-version from 2.8.0 to 3.10.0

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



Re: [PR] Bump californium-version from 2.8.0 to 3.10.0 [camel]

2023-12-30 Thread via GitHub


dependabot[bot] commented on PR #12623:
URL: https://github.com/apache/camel/pull/12623#issuecomment-1872494006

   OK, I won't notify you again about this release, but will get in touch when 
a new version is available. You can also ignore all major, minor, or patch 
releases for a dependency by adding an [`ignore` 
condition](https://docs.github.com/en/code-security/supply-chain-security/configuration-options-for-dependency-updates#ignore)
 with the desired `update_types` to your config file.
   
   If you change your mind, just re-open this PR and I'll resolve any conflicts 
on it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump californium-version from 2.8.0 to 3.10.0 [camel]

2023-12-30 Thread via GitHub


oscerd closed pull request #12623: Bump californium-version from 2.8.0 to 3.10.0
URL: https://github.com/apache/camel/pull/12623


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) branch dependabot/maven/aws-java-sdk2-version-2.22.9 deleted (was 8c4b331df1c)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch 
dependabot/maven/aws-java-sdk2-version-2.22.9
in repository https://gitbox.apache.org/repos/asf/camel.git


 was 8c4b331df1c Bump aws-java-sdk2-version from 2.22.7 to 2.22.9

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(camel) branch main updated (d19b9ef6aed -> ec517d32270)

2023-12-30 Thread acosentino
This is an automated email from the ASF dual-hosted git repository.

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


from d19b9ef6aed camel-json-validator: Added options to set 
DeserializationFeature for ObjectMapper (#12620)
 add ec517d32270 Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 (#12621)

No new revisions were added by this update.

Summary of changes:
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



Re: [PR] Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 [camel]

2023-12-30 Thread via GitHub


oscerd merged PR #12621:
URL: https://github.com/apache/camel/pull/12621


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump californium-version from 2.8.0 to 3.10.0 [camel]

2023-12-30 Thread via GitHub


github-actions[bot] commented on PR #12623:
URL: https://github.com/apache/camel/pull/12623#issuecomment-1872485959

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions 
to run
   
   * You can use the command `/component-test (camel-)component-name1 
(camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and 
`test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache 
Camel committers](https://camel.apache.org/community/team/#committers) have 
access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before 
sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) branch dependabot/maven/californium-version-3.10.0 created (now 3559e3feaf9)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch dependabot/maven/californium-version-3.10.0
in repository https://gitbox.apache.org/repos/asf/camel.git


  at 3559e3feaf9 Bump californium-version from 2.8.0 to 3.10.0

No new revisions were added by this update.



[PR] Bump californium-version from 2.8.0 to 3.10.0 [camel]

2023-12-30 Thread via GitHub


dependabot[bot] opened a new pull request, #12623:
URL: https://github.com/apache/camel/pull/12623

   Bumps `californium-version` from 2.8.0 to 3.10.0.
   Updates `org.eclipse.californium:californium-core` from 2.8.0 to 3.10.0
   
   Updates `org.eclipse.californium:element-connector-tcp-netty` from 2.8.0 to 
3.10.0
   
   
   Dependabot will resolve any conflicts with this PR as long as you don't 
alter it yourself. You can also trigger a rebase manually by commenting 
`@dependabot rebase`.
   
   [//]: # (dependabot-automerge-start)
   [//]: # (dependabot-automerge-end)
   
   ---
   
   
   Dependabot commands and options
   
   
   You can trigger Dependabot actions by commenting on this PR:
   - `@dependabot rebase` will rebase this PR
   - `@dependabot recreate` will recreate this PR, overwriting any edits that 
have been made to it
   - `@dependabot merge` will merge this PR after your CI passes on it
   - `@dependabot squash and merge` will squash and merge this PR after your CI 
passes on it
   - `@dependabot cancel merge` will cancel a previously requested merge and 
block automerging
   - `@dependabot reopen` will reopen this PR if it is closed
   - `@dependabot close` will close this PR and stop Dependabot recreating it. 
You can achieve the same result by closing it manually
   - `@dependabot show  ignore conditions` will show all of 
the ignore conditions of the specified dependency
   - `@dependabot ignore this major version` will close this PR and stop 
Dependabot creating any more for this major version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this minor version` will close this PR and stop 
Dependabot creating any more for this minor version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this dependency` will close this PR and stop 
Dependabot creating any more for this dependency (unless you reopen the PR or 
upgrade to it yourself)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 [camel]

2023-12-30 Thread via GitHub


github-actions[bot] commented on PR #12621:
URL: https://github.com/apache/camel/pull/12621#issuecomment-1872485820

   :robot: The Apache Camel test robot will run the tests for you :+1:


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 [camel]

2023-12-30 Thread via GitHub


oscerd commented on PR #12621:
URL: https://github.com/apache/camel/pull/12621#issuecomment-1872485765

   /component-test aws


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) branch regen_bot updated (183b1e0d64c -> d19b9ef6aed)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch regen_bot
in repository https://gitbox.apache.org/repos/asf/camel.git


from 183b1e0d64c Bump slf4j-version from 2.0.9 to 2.0.10 (#12618)
 add f70df08b4e1 Bump org.jsoup:jsoup from 1.17.1 to 1.17.2 (#12619)
 add d19b9ef6aed camel-json-validator: Added options to set 
DeserializationFeature for ObjectMapper (#12620)

No new revisions were added by this update.

Summary of changes:
 .../camel/catalog/components/json-validator.json   |  6 ++-
 .../JsonValidatorEndpointConfigurer.java   | 12 +
 .../JsonValidatorEndpointUriFactory.java   |  4 +-
 .../component/jsonvalidator/json-validator.json|  6 ++-
 .../jsonvalidator/JsonValidatorEndpoint.java   | 52 +++---
 ...a => ValidatorDeserializationFeaturesTest.java} | 61 ++
 parent/pom.xml |  2 +-
 7 files changed, 85 insertions(+), 58 deletions(-)
 copy 
components/camel-json-validator/src/test/java/org/apache/camel/component/jsonvalidator/{FileValidatorRouteTest.java
 => ValidatorDeserializationFeaturesTest.java} (53%)



[PR] Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10 [camel]

2023-12-30 Thread via GitHub


dependabot[bot] opened a new pull request, #12622:
URL: https://github.com/apache/camel/pull/12622

   Bumps org.slf4j:slf4j-api from 2.0.9 to 2.0.10.
   
   
   [![Dependabot compatibility 
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.slf4j:slf4j-api=maven=2.0.9=2.0.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
   
   Dependabot will resolve any conflicts with this PR as long as you don't 
alter it yourself. You can also trigger a rebase manually by commenting 
`@dependabot rebase`.
   
   [//]: # (dependabot-automerge-start)
   [//]: # (dependabot-automerge-end)
   
   ---
   
   
   Dependabot commands and options
   
   
   You can trigger Dependabot actions by commenting on this PR:
   - `@dependabot rebase` will rebase this PR
   - `@dependabot recreate` will recreate this PR, overwriting any edits that 
have been made to it
   - `@dependabot merge` will merge this PR after your CI passes on it
   - `@dependabot squash and merge` will squash and merge this PR after your CI 
passes on it
   - `@dependabot cancel merge` will cancel a previously requested merge and 
block automerging
   - `@dependabot reopen` will reopen this PR if it is closed
   - `@dependabot close` will close this PR and stop Dependabot recreating it. 
You can achieve the same result by closing it manually
   - `@dependabot show  ignore conditions` will show all of 
the ignore conditions of the specified dependency
   - `@dependabot ignore this major version` will close this PR and stop 
Dependabot creating any more for this major version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this minor version` will close this PR and stop 
Dependabot creating any more for this minor version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this dependency` will close this PR and stop 
Dependabot creating any more for this dependency (unless you reopen the PR or 
upgrade to it yourself)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10 [camel]

2023-12-30 Thread via GitHub


github-actions[bot] commented on PR #12622:
URL: https://github.com/apache/camel/pull/12622#issuecomment-1872484797

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions 
to run
   
   * You can use the command `/component-test (camel-)component-name1 
(camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and 
`test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache 
Camel committers](https://camel.apache.org/community/team/#committers) have 
access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before 
sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) branch dependabot/maven/org.slf4j-slf4j-api-2.0.10 created (now 4186b04aea6)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch dependabot/maven/org.slf4j-slf4j-api-2.0.10
in repository https://gitbox.apache.org/repos/asf/camel.git


  at 4186b04aea6 Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10

No new revisions were added by this update.



(camel) branch main updated: camel-json-validator: Added options to set DeserializationFeature for ObjectMapper (#12620)

2023-12-30 Thread davsclaus
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 d19b9ef6aed camel-json-validator: Added options to set 
DeserializationFeature for ObjectMapper (#12620)
d19b9ef6aed is described below

commit d19b9ef6aedee3567c10981cafdcfce4b744372b
Author: Ivan Mashtak 
AuthorDate: Sat Dec 30 11:41:25 2023 +0300

camel-json-validator: Added options to set DeserializationFeature for 
ObjectMapper (#12620)
---
 .../camel/catalog/components/json-validator.json   |  6 +-
 .../JsonValidatorEndpointConfigurer.java   | 12 
 .../JsonValidatorEndpointUriFactory.java   |  4 +-
 .../component/jsonvalidator/json-validator.json|  6 +-
 .../jsonvalidator/JsonValidatorEndpoint.java   | 52 +---
 .../ValidatorDeserializationFeaturesTest.java  | 69 ++
 6 files changed, 137 insertions(+), 12 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/json-validator.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/json-validator.json
index 5c84e48720f..3b96226b987 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/json-validator.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/json-validator.json
@@ -34,7 +34,9 @@
 "failOnNullHeader": { "index": 4, "kind": "parameter", "displayName": 
"Fail On Null Header", "group": "producer", "label": "", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": true, "description": "Whether to fail 
if no header exists when validating against a header." },
 "headerName": { "index": 5, "kind": "parameter", "displayName": "Header 
Name", "group": "producer", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "To validate against a header instead of the 
message body." },
 "lazyStartProducer": { "index": 6, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produc [...]
-"errorHandler": { "index": 7, "kind": "parameter", "displayName": "Error 
Handler", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": 
"org.apache.camel.component.jsonvalidator.JsonValidatorErrorHandler", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
use a custom ValidatorErrorHandler. The default error handler captures the 
errors and throws an exception." },
-"uriSchemaLoader": { "index": 8, "kind": "parameter", "displayName": "Uri 
Schema Loader", "group": "advanced", "label": "advanced", "required": false, 
"type": "object", "javaType": 
"org.apache.camel.component.jsonvalidator.JsonUriSchemaLoader", "deprecated": 
false, "autowired": false, "secret": false, "description": "To use a custom 
schema loader allowing for adding custom format validation. The default 
implementation will create a schema loader that tries to determine the schema 
ver [...]
+"disabledDeserializationFeatures": { "index": 7, "kind": "parameter", 
"displayName": "Disabled Deserialization Features", "group": "advanced", 
"label": "advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Comma-separated list of Jackson DeserializationFeature enum 
values which will be disabled for parsing exchange body" },
+"enabledDeserializationFeatures": { "index": 8, "kind": "parameter", 
"displayName": "Enabled Deserialization Features", "group": "advanced", 
"label": "advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Comma-separated list of Jackson DeserializationFeature enum 
values which will be enabled for parsing exchange body" },
+"errorHandler": { "index": 9, "kind": "parameter", "displayName": "Error 
Handler", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": 
"org.apache.camel.component.jsonvalidator.JsonValidatorErrorHandler", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
use a custom ValidatorErrorHandler. The default error handler captures the 
errors and throws an 

Re: [PR] CAMEL-20285 camel-json-validator: Added options to set DeserializationFeature for ObjectMapper [camel]

2023-12-30 Thread via GitHub


davsclaus merged PR #12620:
URL: https://github.com/apache/camel/pull/12620


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 [camel]

2023-12-30 Thread via GitHub


github-actions[bot] commented on PR #12621:
URL: https://github.com/apache/camel/pull/12621#issuecomment-1872483762

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions 
to run
   
   * You can use the command `/component-test (camel-)component-name1 
(camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and 
`test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache 
Camel committers](https://camel.apache.org/community/team/#committers) have 
access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before 
sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(camel) branch dependabot/maven/aws-java-sdk2-version-2.22.9 created (now 8c4b331df1c)

2023-12-30 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch 
dependabot/maven/aws-java-sdk2-version-2.22.9
in repository https://gitbox.apache.org/repos/asf/camel.git


  at 8c4b331df1c Bump aws-java-sdk2-version from 2.22.7 to 2.22.9

No new revisions were added by this update.



[PR] Bump aws-java-sdk2-version from 2.22.7 to 2.22.9 [camel]

2023-12-30 Thread via GitHub


dependabot[bot] opened a new pull request, #12621:
URL: https://github.com/apache/camel/pull/12621

   Bumps `aws-java-sdk2-version` from 2.22.7 to 2.22.9.
   Updates `software.amazon.awssdk:sqs` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:kinesis` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:s3` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:sns` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:cloudwatch` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:ec2` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:eventbridge` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:iam` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:kms` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:lambda` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:secretsmanager` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:sts` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:dynamodb` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:config` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:apache-client` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:athena` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:cloudtrail` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:ecs` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:eks` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:netty-nio-client` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:firehose` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:kafka` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:mq` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:redshiftdata` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:ses` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:sfn` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:timestreamquery` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:timestreamwrite` from 2.22.7 to 2.22.9
   
   Updates `software.amazon.awssdk:translate` from 2.22.7 to 2.22.9
   
   
   Dependabot will resolve any conflicts with this PR as long as you don't 
alter it yourself. You can also trigger a rebase manually by commenting 
`@dependabot rebase`.
   
   [//]: # (dependabot-automerge-start)
   [//]: # (dependabot-automerge-end)
   
   ---
   
   
   Dependabot commands and options
   
   
   You can trigger Dependabot actions by commenting on this PR:
   - `@dependabot rebase` will rebase this PR
   - `@dependabot recreate` will recreate this PR, overwriting any edits that 
have been made to it
   - `@dependabot merge` will merge this PR after your CI passes on it
   - `@dependabot squash and merge` will squash and merge this PR after your CI 
passes on it
   - `@dependabot cancel merge` will cancel a previously requested merge and 
block automerging
   - `@dependabot reopen` will reopen this PR if it is closed
   - `@dependabot close` will close this PR and stop Dependabot recreating it. 
You can achieve the same result by closing it manually
   - `@dependabot show  ignore conditions` will show all of 
the ignore conditions of the specified dependency
   - `@dependabot ignore this major version` will close this PR and stop 
Dependabot creating any more for this major version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this minor version` will close this PR and stop 
Dependabot creating any more for this minor version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this dependency` will close this PR and stop 
Dependabot creating any more for this dependency (unless you reopen the PR or 
upgrade to it yourself)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org