You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/05/02 20:37:32 UTC

(camel) branch kamelet-ctr4 created (now ab0b868bc49)

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

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


      at ab0b868bc49 CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets

This branch includes the following new commits:

     new 697e2c120d4 CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
     new 1eb0641c45c CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
     new 1af7be28e1d CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
     new ab0b868bc49 CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets

The 4 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) 03/04: CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets

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

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

commit 1af7be28e1d8fcb06926549c4d5fc5e6db334fa4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 2 22:02:03 2024 +0200

    CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
---
 .../org/apache/camel/model/templatedRouteBean.json | 28 ---------
 .../services/org/apache/camel/model.properties     |  1 -
 .../resources/org/apache/camel/model/jaxb.index    |  1 -
 .../camel/model/TemplatedRouteBeanDefinition.java  | 34 -----------
 .../java/org/apache/camel/xml/in/ModelParser.java  | 71 +++++++++++-----------
 .../java/org/apache/camel/xml/out/ModelWriter.java |  9 ---
 .../org/apache/camel/yaml/out/ModelWriter.java     |  9 ---
 7 files changed, 34 insertions(+), 119 deletions(-)

diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json
deleted file mode 100644
index d487b346f69..00000000000
--- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
-  "model": {
-    "kind": "model",
-    "name": "templatedRouteBean",
-    "title": "Templated Route Bean",
-    "description": "A bean as input of a route template (local bean)",
-    "deprecated": true,
-    "label": "configuration",
-    "javaType": "org.apache.camel.model.TemplatedRouteBeanDefinition",
-    "abstract": false,
-    "input": false,
-    "output": false
-  },
-  "properties": {
-    "name": { "index": 0, "kind": "attribute", "displayName": "Name", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the bean (bean id)" },
-    "type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The class name (fully qualified) of the bean" },
-    "initMethod": { "index": 2, "kind": "attribute", "displayName": "Init Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the custom initialization method to invoke after setting bean properties. The method must have no arguments, but may throw any exception." },
-    "destroyMethod": { "index": 3, "kind": "attribute", "displayName": "Destroy Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down. The method must have no arguments, but may throw any exception." },
-    "factoryMethod": { "index": 4, "kind": "attribute", "displayName": "Factory Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of method to invoke when creating the bean via a factory bean." },
-    "factoryBean": { "index": 5, "kind": "attribute", "displayName": "Factory Bean", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of factory bean (bean id) to use for creating the bean." },
-    "builderClass": { "index": 6, "kind": "attribute", "displayName": "Builder Class", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Fully qualified class name of builder class to use for creating and configuring the bean. The builder will use the properties values to configure the bean." },
-    "builderMethod": { "index": 7, "kind": "attribute", "displayName": "Builder Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "build", "description": "Name of method when using builder class. This method is invoked after configuring to create the actual bean. This method is often named build (used by default)." },
-    "scriptLanguage": { "index": 8, "kind": "attribute", "displayName": "Script Language", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The script language to use when using inlined script for creating the bean, such as groovy, java, javascript etc." },
-    "constructors": { "index": 9, "kind": "element", "displayName": "Constructors", "group": "common", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Optional constructor arguments for creating the bean. Arguments correspond to specific index of the constructor argument list, starting from zero." },
-    "properties": { "index": 10, "kind": "element", "displayName": "Properties", "group": "common", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Optional properties to set on the created bean." },
-    "script": { "index": 11, "kind": "element", "displayName": "Script", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The script to execute that creates the bean when using scripting languages. If the script use the prefix resource: such as resource:classpath:com\/foo\/myscript.groovy, resource:file:\/var\/myscript.groovy, then its loaded from the ex [...]
-  }
-}
diff --git a/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties b/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties
index e58e8efc4ee..85aabd5069c 100644
--- a/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties
+++ b/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties
@@ -193,7 +193,6 @@ syslog
 tarFile
 templateParameter
 templatedRoute
-templatedRouteBean
 templatedRouteParameter
 templatedRoutes
 threadPoolProfile
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/jaxb.index b/core/camel-core-model/src/generated/resources/org/apache/camel/model/jaxb.index
index 551d455421c..5ff0c2477d3 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/jaxb.index
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/jaxb.index
@@ -92,7 +92,6 @@ SortDefinition
 SplitDefinition
 StepDefinition
 StopDefinition
-TemplatedRouteBeanDefinition
 TemplatedRouteDefinition
 TemplatedRouteParameterDefinition
 TemplatedRoutesDefinition
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java
deleted file mode 100644
index a88081cd84c..00000000000
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.model;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlRootElement;
-
-import org.apache.camel.spi.Metadata;
-
-/**
- * A bean as input of a route template (local bean)
- */
-@Metadata(label = "configuration")
-@XmlRootElement(name = "templatedRouteBean")
-@XmlAccessorType(XmlAccessType.FIELD)
-@Deprecated
-public class TemplatedRouteBeanDefinition
-        extends BeanFactoryDefinition<TemplatedRouteBeanDefinition, TemplatedRouteDefinition> {
-}
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 1c8833dd7f4..ebaa69a555c 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -1078,43 +1078,6 @@ public class ModelParser extends BaseParser {
     protected StopDefinition doParseStopDefinition() throws IOException, XmlPullParserException {
         return doParse(new StopDefinition(), processorDefinitionAttributeHandler(), optionalIdentifiedDefinitionElementHandler(), noValueHandler());
     }
-    protected TemplatedRouteBeanDefinition doParseTemplatedRouteBeanDefinition() throws IOException, XmlPullParserException {
-        return doParse(new TemplatedRouteBeanDefinition(), beanFactoryDefinitionAttributeHandler(), beanFactoryDefinitionElementHandler(), noValueHandler());
-    }
-    protected <T extends BeanFactoryDefinition> AttributeHandler<T> beanFactoryDefinitionAttributeHandler() {
-        return (def, key, val) -> switch (key) {
-            case "builderClass": def.setBuilderClass(val); yield true;
-            case "builderMethod": def.setBuilderMethod(val); yield true;
-            case "destroyMethod": def.setDestroyMethod(val); yield true;
-            case "factoryBean": def.setFactoryBean(val); yield true;
-            case "factoryMethod": def.setFactoryMethod(val); yield true;
-            case "initMethod": def.setInitMethod(val); yield true;
-            case "name": def.setName(val); yield true;
-            case "scriptLanguage": def.setScriptLanguage(val); yield true;
-            case "type": def.setType(val); yield true;
-            default: yield false;
-        };
-    }
-    protected <T extends BeanFactoryDefinition> ElementHandler<T> beanFactoryDefinitionElementHandler() {
-        return (def, key) -> switch (key) {
-            case "constructors": def.setConstructors(new BeanConstructorsAdapter().unmarshal(doParseBeanConstructorsDefinition())); yield true;
-            case "properties": def.setProperties(new BeanPropertiesAdapter().unmarshal(doParseBeanPropertiesDefinition())); yield true;
-            case "script": def.setScript(doParseText()); yield true;
-            default: yield false;
-        };
-    }
-    protected BeanConstructorsDefinition doParseBeanConstructorsDefinition() throws IOException, XmlPullParserException {
-        return doParse(new BeanConstructorsDefinition(), noAttributeHandler(), (def, key) -> switch (key) {
-                case "constructor": doAdd(doParseBeanConstructorDefinition(), def.getConstructors(), def::setConstructors); yield true;
-                default: yield false;
-            }, noValueHandler());
-    }
-    protected BeanPropertiesDefinition doParseBeanPropertiesDefinition() throws IOException, XmlPullParserException {
-        return doParse(new BeanPropertiesDefinition(), noAttributeHandler(), (def, key) -> switch (key) {
-                case "property": doAdd(doParseBeanPropertyDefinition(), def.getProperties(), def::setProperties); yield true;
-                default: yield false;
-            }, noValueHandler());
-    }
     protected TemplatedRouteDefinition doParseTemplatedRouteDefinition() throws IOException, XmlPullParserException {
         return doParse(new TemplatedRouteDefinition(), (def, key, val) -> switch (key) {
                 case "prefixId": def.setPrefixId(val); yield true;
@@ -1391,6 +1354,18 @@ public class ModelParser extends BaseParser {
                 default: yield false;
             }, noElementHandler(), noValueHandler());
     }
+    protected BeanConstructorsDefinition doParseBeanConstructorsDefinition() throws IOException, XmlPullParserException {
+        return doParse(new BeanConstructorsDefinition(), noAttributeHandler(), (def, key) -> switch (key) {
+                case "constructor": doAdd(doParseBeanConstructorDefinition(), def.getConstructors(), def::setConstructors); yield true;
+                default: yield false;
+            }, noValueHandler());
+    }
+    protected BeanPropertiesDefinition doParseBeanPropertiesDefinition() throws IOException, XmlPullParserException {
+        return doParse(new BeanPropertiesDefinition(), noAttributeHandler(), (def, key) -> switch (key) {
+                case "property": doAdd(doParseBeanPropertyDefinition(), def.getProperties(), def::setProperties); yield true;
+                default: yield false;
+            }, noValueHandler());
+    }
     protected BeanPropertyDefinition doParseBeanPropertyDefinition() throws IOException, XmlPullParserException {
         return doParse(new BeanPropertyDefinition(), (def, key, val) -> switch (key) {
                 case "key": def.setKey(val); yield true;
@@ -1401,6 +1376,28 @@ public class ModelParser extends BaseParser {
                 default: yield false;
             }, noValueHandler());
     }
+    protected <T extends BeanFactoryDefinition> AttributeHandler<T> beanFactoryDefinitionAttributeHandler() {
+        return (def, key, val) -> switch (key) {
+            case "builderClass": def.setBuilderClass(val); yield true;
+            case "builderMethod": def.setBuilderMethod(val); yield true;
+            case "destroyMethod": def.setDestroyMethod(val); yield true;
+            case "factoryBean": def.setFactoryBean(val); yield true;
+            case "factoryMethod": def.setFactoryMethod(val); yield true;
+            case "initMethod": def.setInitMethod(val); yield true;
+            case "name": def.setName(val); yield true;
+            case "scriptLanguage": def.setScriptLanguage(val); yield true;
+            case "type": def.setType(val); yield true;
+            default: yield false;
+        };
+    }
+    protected <T extends BeanFactoryDefinition> ElementHandler<T> beanFactoryDefinitionElementHandler() {
+        return (def, key) -> switch (key) {
+            case "constructors": def.setConstructors(new BeanConstructorsAdapter().unmarshal(doParseBeanConstructorsDefinition())); yield true;
+            case "properties": def.setProperties(new BeanPropertiesAdapter().unmarshal(doParseBeanPropertiesDefinition())); yield true;
+            case "script": def.setScript(doParseText()); yield true;
+            default: yield false;
+        };
+    }
     protected BlacklistServiceCallServiceFilterConfiguration doParseBlacklistServiceCallServiceFilterConfiguration() throws IOException, XmlPullParserException {
         return doParse(new BlacklistServiceCallServiceFilterConfiguration(), identifiedTypeAttributeHandler(), (def, key) -> switch (key) {
                 case "servers": doAdd(doParseText(), def.getServers(), def::setServers); yield true;
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index b8cd80175f7..bae84909145 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -303,9 +303,6 @@ public class ModelWriter extends BaseWriter {
     public void writeStopDefinition(StopDefinition def) throws IOException {
         doWriteStopDefinition("stop", def);
     }
-    public void writeTemplatedRouteBeanDefinition(TemplatedRouteBeanDefinition def) throws IOException {
-        doWriteTemplatedRouteBeanDefinition("templatedRouteBean", def);
-    }
     public void writeTemplatedRouteDefinition(TemplatedRouteDefinition def) throws IOException {
         doWriteTemplatedRouteDefinition("templatedRoute", def);
     }
@@ -1727,12 +1724,6 @@ public class ModelWriter extends BaseWriter {
         doWriteProcessorDefinitionAttributes(def);
         endElement(name);
     }
-    protected void doWriteTemplatedRouteBeanDefinition(String name, TemplatedRouteBeanDefinition def) throws IOException {
-        startElement(name);
-        doWriteBeanFactoryDefinitionAttributes(def);
-        doWriteBeanFactoryDefinitionElements(def);
-        endElement(name);
-    }
     protected void doWriteTemplatedRouteDefinition(String name, TemplatedRouteDefinition def) throws IOException {
         startElement(name);
         doWriteAttribute("routeId", def.getRouteId());
diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
index 6a1e6fc3a1d..51a66d56caf 100644
--- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
+++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
@@ -303,9 +303,6 @@ public class ModelWriter extends BaseWriter {
     public void writeStopDefinition(StopDefinition def) throws IOException {
         doWriteStopDefinition("stop", def);
     }
-    public void writeTemplatedRouteBeanDefinition(TemplatedRouteBeanDefinition def) throws IOException {
-        doWriteTemplatedRouteBeanDefinition("templatedRouteBean", def);
-    }
     public void writeTemplatedRouteDefinition(TemplatedRouteDefinition def) throws IOException {
         doWriteTemplatedRouteDefinition("templatedRoute", def);
     }
@@ -1727,12 +1724,6 @@ public class ModelWriter extends BaseWriter {
         doWriteProcessorDefinitionAttributes(def);
         endElement(name);
     }
-    protected void doWriteTemplatedRouteBeanDefinition(String name, TemplatedRouteBeanDefinition def) throws IOException {
-        startElement(name);
-        doWriteBeanFactoryDefinitionAttributes(def);
-        doWriteBeanFactoryDefinitionElements(def);
-        endElement(name);
-    }
     protected void doWriteTemplatedRouteDefinition(String name, TemplatedRouteDefinition def) throws IOException {
         startElement(name);
         doWriteAttribute("routeId", def.getRouteId());


(camel) 02/04: CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets

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

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

commit 1eb0641c45c088da55669cf0b96961405324fa99
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 2 22:00:03 2024 +0200

    CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
---
 .../yaml/deserializers/TemplatedRouteDefinitionDeserializer.java   | 7 ++++---
 .../src/generated/resources/schema/camelYamlDsl.json               | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteDefinitionDeserializer.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteDefinitionDeserializer.java
index 5cc4a48ae89..a68c1618532 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteDefinitionDeserializer.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteDefinitionDeserializer.java
@@ -19,9 +19,9 @@ package org.apache.camel.dsl.yaml.deserializers;
 import java.util.List;
 
 import org.apache.camel.dsl.yaml.common.YamlDeserializerBase;
-import org.apache.camel.model.TemplatedRouteBeanDefinition;
 import org.apache.camel.model.TemplatedRouteDefinition;
 import org.apache.camel.model.TemplatedRouteParameterDefinition;
+import org.apache.camel.model.app.RegistryBeanDefinition;
 import org.apache.camel.spi.annotations.YamlIn;
 import org.apache.camel.spi.annotations.YamlProperty;
 import org.apache.camel.spi.annotations.YamlType;
@@ -43,7 +43,7 @@ import org.snakeyaml.engine.v2.nodes.Node;
                   @YamlProperty(name = "parameters",
                                 type = "array:org.apache.camel.model.TemplatedRouteParameterDefinition"),
                   @YamlProperty(name = "beans",
-                                type = "array:org.apache.camel.model.TemplatedRouteBeanDefinition")
+                                type = "array:org.apache.camel.model.app.RegistryBeanDefinition")
           })
 public class TemplatedRouteDefinitionDeserializer extends YamlDeserializerBase<TemplatedRouteDefinition> {
 
@@ -80,7 +80,8 @@ public class TemplatedRouteDefinitionDeserializer extends YamlDeserializerBase<T
                 break;
             }
             case "beans": {
-                List<TemplatedRouteBeanDefinition> items = asFlatList(node, TemplatedRouteBeanDefinition.class);
+                List<RegistryBeanDefinition<TemplatedRouteDefinition>> items
+                        = (List) asFlatList(node, RegistryBeanDefinition.class);
                 target.setBeans(items);
                 break;
             }
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index 1d5df7fc101..450cef2214d 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -6675,7 +6675,7 @@
           "beans" : {
             "type" : "array",
             "items" : {
-              "$ref" : "#/items/definitions/org.apache.camel.model.TemplatedRouteBeanDefinition"
+              "$ref" : "#/items/definitions/org.apache.camel.model.app.RegistryBeanDefinition"
             }
           },
           "parameters" : {


(camel) 04/04: CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets

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

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

commit ab0b868bc49d7d6511b66eb7c25940516e39b151
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 2 22:14:23 2024 +0200

    CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
---
 .../org/apache/camel/catalog/models.properties     |   1 -
 .../camel/catalog/models/templatedRouteBean.json   |  28 ----
 .../apache/camel/catalog/schemas/camel-spring.xsd  | 143 ++-------------------
 .../camel-yaml-dsl-deserializers/pom.xml           |   2 -
 .../dsl/yaml/deserializers/CustomResolver.java     |   2 -
 .../TemplatedRouteBeanDefinitionDeserializer.java  |  63 ---------
 .../generated/resources/schema/camelYamlDsl.json   |  43 -------
 7 files changed, 12 insertions(+), 270 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties
index 737505a8fcd..fa06cb94ce5 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties
@@ -192,7 +192,6 @@ syslog
 tarFile
 templateParameter
 templatedRoute
-templatedRouteBean
 templatedRouteParameter
 templatedRoutes
 threadPoolProfile
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json
deleted file mode 100644
index d487b346f69..00000000000
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
-  "model": {
-    "kind": "model",
-    "name": "templatedRouteBean",
-    "title": "Templated Route Bean",
-    "description": "A bean as input of a route template (local bean)",
-    "deprecated": true,
-    "label": "configuration",
-    "javaType": "org.apache.camel.model.TemplatedRouteBeanDefinition",
-    "abstract": false,
-    "input": false,
-    "output": false
-  },
-  "properties": {
-    "name": { "index": 0, "kind": "attribute", "displayName": "Name", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the bean (bean id)" },
-    "type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The class name (fully qualified) of the bean" },
-    "initMethod": { "index": 2, "kind": "attribute", "displayName": "Init Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the custom initialization method to invoke after setting bean properties. The method must have no arguments, but may throw any exception." },
-    "destroyMethod": { "index": 3, "kind": "attribute", "displayName": "Destroy Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down. The method must have no arguments, but may throw any exception." },
-    "factoryMethod": { "index": 4, "kind": "attribute", "displayName": "Factory Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of method to invoke when creating the bean via a factory bean." },
-    "factoryBean": { "index": 5, "kind": "attribute", "displayName": "Factory Bean", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of factory bean (bean id) to use for creating the bean." },
-    "builderClass": { "index": 6, "kind": "attribute", "displayName": "Builder Class", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Fully qualified class name of builder class to use for creating and configuring the bean. The builder will use the properties values to configure the bean." },
-    "builderMethod": { "index": 7, "kind": "attribute", "displayName": "Builder Method", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "build", "description": "Name of method when using builder class. This method is invoked after configuring to create the actual bean. This method is often named build (used by default)." },
-    "scriptLanguage": { "index": 8, "kind": "attribute", "displayName": "Script Language", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The script language to use when using inlined script for creating the bean, such as groovy, java, javascript etc." },
-    "constructors": { "index": 9, "kind": "element", "displayName": "Constructors", "group": "common", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Optional constructor arguments for creating the bean. Arguments correspond to specific index of the constructor argument list, starting from zero." },
-    "properties": { "index": 10, "kind": "element", "displayName": "Properties", "group": "common", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Optional properties to set on the created bean." },
-    "script": { "index": 11, "kind": "element", "displayName": "Script", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The script to execute that creates the bean when using scripting languages. If the script use the prefix resource: such as resource:classpath:com\/foo\/myscript.groovy, resource:file:\/var\/myscript.groovy, then its loaded from the ex [...]
-  }
-}
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 5a43bd3cac1..21fd2144c23 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -1937,15 +1937,6 @@ A route template parameter
       <xs:documentation xml:lang="en">
 <![CDATA[
 Defines a templated route (a route built from a route template)
-]]>
-      </xs:documentation>
-    </xs:annotation>
-  </xs:element>
-  <xs:element name="templatedRouteBean" type="tns:templatedRouteBeanDefinition">
-    <xs:annotation>
-      <xs:documentation xml:lang="en">
-<![CDATA[
-Deprecated: A bean as input of a route template (local bean)
 ]]>
       </xs:documentation>
     </xs:annotation>
@@ -4009,122 +4000,19 @@ implementation. Default value: Singleton
   </xs:complexType>
   <xs:complexType abstract="true" name="beanFactoryDefinition">
     <xs:sequence>
-      <xs:element minOccurs="0" name="constructors" type="tns:beanConstructorsDefinition">
-        <xs:annotation>
-          <xs:documentation xml:lang="en">
-<![CDATA[
-Optional constructor arguments for creating the bean. Arguments correspond to specific index of the constructor argument
-list, starting from zero.
-]]>
-          </xs:documentation>
-        </xs:annotation>
-      </xs:element>
-      <xs:element minOccurs="0" name="properties" type="tns:beanPropertiesDefinition">
-        <xs:annotation>
-          <xs:documentation xml:lang="en">
-<![CDATA[
-Optional properties to set on the created bean.
-]]>
-          </xs:documentation>
-        </xs:annotation>
-      </xs:element>
-      <xs:element minOccurs="0" name="script" type="xs:string">
-        <xs:annotation>
-          <xs:documentation xml:lang="en">
-<![CDATA[
-The script to execute that creates the bean when using scripting languages. If the script use the prefix resource: such
-as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external
-resource.
-]]>
-          </xs:documentation>
-        </xs:annotation>
-      </xs:element>
+      <xs:element minOccurs="0" name="constructors" type="tns:beanConstructorsDefinition"/>
+      <xs:element minOccurs="0" name="properties" type="tns:beanPropertiesDefinition"/>
+      <xs:element minOccurs="0" name="script" type="xs:string"/>
     </xs:sequence>
-    <xs:attribute name="name" type="xs:string" use="required">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-The name of the bean (bean id).
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="type" type="xs:string" use="required">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-The class name (fully qualified) of the bean.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="initMethod" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-The name of the custom initialization method to invoke after setting bean properties. The method must have no arguments,
-but may throw any exception.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="destroyMethod" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down. The method must
-have no arguments, but may throw any exception.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="factoryMethod" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-Name of method to invoke when creating the bean via a factory bean.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="factoryBean" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-Name of factory bean (bean id) to use for creating the bean.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="builderClass" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-Fully qualified class name of builder class to use for creating and configuring the bean. The builder will use the
-properties values to configure the bean.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="builderMethod" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-Name of method when using builder class. This method is invoked after configuring to create the actual bean. This method
-is often named build (used by default). Default value: build
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
-    <xs:attribute name="scriptLanguage" type="xs:string">
-      <xs:annotation>
-        <xs:documentation xml:lang="en">
-<![CDATA[
-The script language to use when using inlined script for creating the bean, such as groovy, java, javascript etc.
-]]>
-        </xs:documentation>
-      </xs:annotation>
-    </xs:attribute>
+    <xs:attribute name="name" type="xs:string" use="required"/>
+    <xs:attribute name="type" type="xs:string" use="required"/>
+    <xs:attribute name="initMethod" type="xs:string"/>
+    <xs:attribute name="destroyMethod" type="xs:string"/>
+    <xs:attribute name="factoryMethod" type="xs:string"/>
+    <xs:attribute name="factoryBean" type="xs:string"/>
+    <xs:attribute name="builderClass" type="xs:string"/>
+    <xs:attribute name="builderMethod" type="xs:string"/>
+    <xs:attribute name="scriptLanguage" type="xs:string"/>
   </xs:complexType>
   <xs:complexType name="beanConstructorsDefinition">
     <xs:sequence>
@@ -13511,13 +13399,6 @@ individual unit of work. Default value: false
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>
-  <xs:complexType name="templatedRouteBeanDefinition">
-    <xs:complexContent>
-      <xs:extension base="tns:beanFactoryDefinition">
-        <xs:sequence/>
-      </xs:extension>
-    </xs:complexContent>
-  </xs:complexType>
   <xs:complexType name="templatedRouteDefinition">
     <xs:sequence>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="parameter" type="tns:templatedRouteParameterDefinition">
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/pom.xml b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/pom.xml
index 506aca97819..11fbd71d725 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/pom.xml
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/pom.xml
@@ -132,10 +132,8 @@
                                 <bannedDefinition>org.apache.camel.model.RouteTemplateDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.RouteTemplateContextRefDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.RouteTemplatesDefinition</bannedDefinition>
-                                <bannedDefinition>org.apache.camel.model.RouteTemplateBeanDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.TemplatedRouteDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.TemplatedRoutesDefinition</bannedDefinition>
-                                <bannedDefinition>org.apache.camel.model.TemplatedRouteBeanDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.RoutesDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.RestsDefinition</bannedDefinition>
                                 <bannedDefinition>org.apache.camel.model.RouteConfigurationDefinition</bannedDefinition>
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/CustomResolver.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/CustomResolver.java
index 937a93d54dc..a3ccb36cfc2 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/CustomResolver.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/CustomResolver.java
@@ -65,8 +65,6 @@ public class CustomResolver implements YamlDeserializerResolver {
             case "templatedRoute":
             case "org.apache.camel.model.TemplatedRouteDefinition":
                 return new TemplatedRouteDefinitionDeserializer();
-            case "org.apache.camel.model.TemplatedRouteBeanDefinition":
-                return new TemplatedRouteBeanDefinitionDeserializer();
             case "org.apache.camel.dsl.yaml.deserializers.OutputAwareFromDefinition":
                 return new OutputAwareFromDefinitionDeserializer();
 
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteBeanDefinitionDeserializer.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteBeanDefinitionDeserializer.java
deleted file mode 100644
index ef863e147d4..00000000000
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/TemplatedRouteBeanDefinitionDeserializer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.yaml.deserializers;
-
-import org.apache.camel.dsl.yaml.common.YamlDeserializerResolver;
-import org.apache.camel.model.TemplatedRouteBeanDefinition;
-import org.apache.camel.spi.annotations.YamlProperty;
-import org.apache.camel.spi.annotations.YamlType;
-
-/**
- * The YAML deserializer for the bean factory used by the templated routes.
- */
-@YamlType(
-          inline = false,
-          types = TemplatedRouteBeanDefinition.class,
-          order = YamlDeserializerResolver.ORDER_DEFAULT,
-          nodes = { "templated-route-bean", "templatedRouteBean" },
-          properties = {
-                  @YamlProperty(name = "name", type = "string", required = true),
-                  @YamlProperty(name = "type", type = "string", required = true),
-                  @YamlProperty(name = "constructors", type = "object"),
-                  @YamlProperty(name = "properties", type = "object"),
-                  @YamlProperty(name = "initMethod", type = "string"),
-                  @YamlProperty(name = "destroyMethod", type = "string"),
-                  @YamlProperty(name = "factoryMethod", type = "string"),
-                  @YamlProperty(name = "factoryBean", type = "string"),
-                  @YamlProperty(name = "builderClass", type = "string"),
-                  @YamlProperty(name = "builderMethod", type = "string"),
-                  @YamlProperty(name = "scriptLanguage", type = "string"),
-                  @YamlProperty(name = "script", type = "string")
-          })
-public class TemplatedRouteBeanDefinitionDeserializer extends BeanFactoryDefinitionDeserializer<TemplatedRouteBeanDefinition> {
-
-    public TemplatedRouteBeanDefinitionDeserializer() {
-        super(TemplatedRouteBeanDefinition.class);
-    }
-
-    @Override
-    protected TemplatedRouteBeanDefinition newInstance() {
-        return new TemplatedRouteBeanDefinition();
-    }
-
-    @Override
-    protected TemplatedRouteBeanDefinition newInstance(String value) {
-        TemplatedRouteBeanDefinition answer = new TemplatedRouteBeanDefinition();
-        answer.setName(value);
-        return answer;
-    }
-}
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index 450cef2214d..5fda37d1ff8 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -6625,49 +6625,6 @@
           }
         }
       },
-      "org.apache.camel.model.TemplatedRouteBeanDefinition" : {
-        "type" : "object",
-        "additionalProperties" : false,
-        "properties" : {
-          "builderClass" : {
-            "type" : "string"
-          },
-          "builderMethod" : {
-            "type" : "string"
-          },
-          "constructors" : {
-            "type" : "object"
-          },
-          "destroyMethod" : {
-            "type" : "string"
-          },
-          "factoryBean" : {
-            "type" : "string"
-          },
-          "factoryMethod" : {
-            "type" : "string"
-          },
-          "initMethod" : {
-            "type" : "string"
-          },
-          "name" : {
-            "type" : "string"
-          },
-          "properties" : {
-            "type" : "object"
-          },
-          "script" : {
-            "type" : "string"
-          },
-          "scriptLanguage" : {
-            "type" : "string"
-          },
-          "type" : {
-            "type" : "string"
-          }
-        },
-        "required" : [ "name", "type" ]
-      },
       "org.apache.camel.model.TemplatedRouteDefinition" : {
         "type" : "object",
         "additionalProperties" : false,


(camel) 01/04: CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets

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

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

commit 697e2c120d4e7e0497ba2f72f258489ef3f72ba3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 2 21:54:31 2024 +0200

    CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets
---
 .../camel/catalog/models/templatedRoute.json       |  2 +-
 .../camel/catalog/models/templatedRouteBean.json   |  2 +-
 .../apache/camel/catalog/schemas/camel-spring.xsd  |  4 ++--
 .../java/org/apache/camel/impl/DefaultModel.java   |  5 ++---
 .../org/apache/camel/model/templatedRoute.json     |  2 +-
 .../org/apache/camel/model/templatedRouteBean.json |  2 +-
 .../camel/model/TemplatedRouteBeanDefinition.java  |  1 +
 .../camel/model/TemplatedRouteDefinition.java      | 23 +++++++++++-----------
 .../java/org/apache/camel/xml/in/ModelParser.java  |  2 +-
 .../java/org/apache/camel/xml/out/ModelWriter.java |  2 +-
 .../org/apache/camel/yaml/out/ModelWriter.java     |  2 +-
 11 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRoute.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRoute.json
index 6e72d6f6a60..4757d0c39b6 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRoute.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRoute.json
@@ -16,6 +16,6 @@
     "routeId": { "index": 1, "kind": "attribute", "displayName": "Route Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of the route built from the route template." },
     "prefixId": { "index": 2, "kind": "attribute", "displayName": "Prefix Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets a prefix to use for all node ids (not route id)." },
     "parameter": { "index": 3, "kind": "element", "displayName": "Parameter", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.TemplatedRouteParameterDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Adds an input parameter of the template to build the route" },
-    "bean": { "index": 4, "kind": "element", "displayName": "Bean", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.TemplatedRouteBeanDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Adds a local bean as input of the template to build the route" }
+    "bean": { "index": 4, "kind": "element", "displayName": "Bean", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.app.RegistryBeanDefinition<org.apache.camel.model.TemplatedRouteDefinition>>", "deprecated": false, "autowired": false, "secret": false, "description": "Adds a local bean as input of the template to build the route" }
   }
 }
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json
index 04f6d78a1d9..d487b346f69 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/templatedRouteBean.json
@@ -4,7 +4,7 @@
     "name": "templatedRouteBean",
     "title": "Templated Route Bean",
     "description": "A bean as input of a route template (local bean)",
-    "deprecated": false,
+    "deprecated": true,
     "label": "configuration",
     "javaType": "org.apache.camel.model.TemplatedRouteBeanDefinition",
     "abstract": false,
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 56c1a04480e..5a43bd3cac1 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -1945,7 +1945,7 @@ Defines a templated route (a route built from a route template)
     <xs:annotation>
       <xs:documentation xml:lang="en">
 <![CDATA[
-A bean as input of a route template (local bean)
+Deprecated: A bean as input of a route template (local bean)
 ]]>
       </xs:documentation>
     </xs:annotation>
@@ -13529,7 +13529,7 @@ Adds an input parameter of the template to build the route.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
-      <xs:element maxOccurs="unbounded" minOccurs="0" name="bean" type="tns:templatedRouteBeanDefinition">
+      <xs:element maxOccurs="unbounded" minOccurs="0" name="bean" type="tns:registryBeanDefinition">
         <xs:annotation>
           <xs:documentation xml:lang="en">
 <![CDATA[
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
index ea41f2587b4..8717282647a 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
@@ -47,7 +47,6 @@ import org.apache.camel.model.RouteFilters;
 import org.apache.camel.model.RouteTemplateDefinition;
 import org.apache.camel.model.RouteTemplateParameterDefinition;
 import org.apache.camel.model.RoutesDefinition;
-import org.apache.camel.model.TemplatedRouteBeanDefinition;
 import org.apache.camel.model.TemplatedRouteDefinition;
 import org.apache.camel.model.TemplatedRouteParameterDefinition;
 import org.apache.camel.model.ToDefinition;
@@ -557,9 +556,9 @@ public class DefaultModel implements Model {
 
         final RouteTemplateContext routeTemplateContext = toRouteTemplateContext(templatedRouteDefinition);
         // Bind the beans into the context
-        final List<TemplatedRouteBeanDefinition> beans = templatedRouteDefinition.getBeans();
+        final List<RegistryBeanDefinition<TemplatedRouteDefinition>> beans = templatedRouteDefinition.getBeans();
         if (beans != null) {
-            for (TemplatedRouteBeanDefinition beanDefinition : beans) {
+            for (RegistryBeanDefinition<TemplatedRouteDefinition> beanDefinition : beans) {
                 BeanModelHelper.bind(beanDefinition, routeTemplateContext);
             }
         }
diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRoute.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRoute.json
index 6e72d6f6a60..4757d0c39b6 100644
--- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRoute.json
+++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRoute.json
@@ -16,6 +16,6 @@
     "routeId": { "index": 1, "kind": "attribute", "displayName": "Route Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of the route built from the route template." },
     "prefixId": { "index": 2, "kind": "attribute", "displayName": "Prefix Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets a prefix to use for all node ids (not route id)." },
     "parameter": { "index": 3, "kind": "element", "displayName": "Parameter", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.TemplatedRouteParameterDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Adds an input parameter of the template to build the route" },
-    "bean": { "index": 4, "kind": "element", "displayName": "Bean", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.TemplatedRouteBeanDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Adds a local bean as input of the template to build the route" }
+    "bean": { "index": 4, "kind": "element", "displayName": "Bean", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.app.RegistryBeanDefinition<org.apache.camel.model.TemplatedRouteDefinition>>", "deprecated": false, "autowired": false, "secret": false, "description": "Adds a local bean as input of the template to build the route" }
   }
 }
diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json
index 04f6d78a1d9..d487b346f69 100644
--- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json
+++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/templatedRouteBean.json
@@ -4,7 +4,7 @@
     "name": "templatedRouteBean",
     "title": "Templated Route Bean",
     "description": "A bean as input of a route template (local bean)",
-    "deprecated": false,
+    "deprecated": true,
     "label": "configuration",
     "javaType": "org.apache.camel.model.TemplatedRouteBeanDefinition",
     "abstract": false,
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java
index feed846653a..a88081cd84c 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteBeanDefinition.java
@@ -28,6 +28,7 @@ import org.apache.camel.spi.Metadata;
 @Metadata(label = "configuration")
 @XmlRootElement(name = "templatedRouteBean")
 @XmlAccessorType(XmlAccessType.FIELD)
+@Deprecated
 public class TemplatedRouteBeanDefinition
         extends BeanFactoryDefinition<TemplatedRouteBeanDefinition, TemplatedRouteDefinition> {
 }
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteDefinition.java
index 6d1b728e9cd..e5f09bcd1aa 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/TemplatedRouteDefinition.java
@@ -32,6 +32,7 @@ import jakarta.xml.bind.annotation.XmlType;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.RouteTemplateContext;
+import org.apache.camel.model.app.RegistryBeanDefinition;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.Resource;
 import org.apache.camel.spi.ResourceAware;
@@ -61,7 +62,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
     private List<TemplatedRouteParameterDefinition> parameters;
     @XmlElement(name = "bean")
     @Metadata(description = "Adds a local bean as input of the template to build the route")
-    private List<TemplatedRouteBeanDefinition> beans;
+    private List<RegistryBeanDefinition<TemplatedRouteDefinition>> beans;
 
     public String getRouteTemplateRef() {
         return routeTemplateRef;
@@ -79,11 +80,11 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         this.parameters = parameters;
     }
 
-    public List<TemplatedRouteBeanDefinition> getBeans() {
+    public List<RegistryBeanDefinition<TemplatedRouteDefinition>> getBeans() {
         return beans;
     }
 
-    public void setBeans(List<TemplatedRouteBeanDefinition> beans) {
+    public void setBeans(List<RegistryBeanDefinition<TemplatedRouteDefinition>> beans) {
         this.beans = beans;
     }
 
@@ -157,7 +158,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setName(name);
         def.setBeanType(type);
         beans.add(def);
@@ -175,7 +176,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setName(name);
         if (bean instanceof RouteTemplateContext.BeanSupplier) {
             def.setBeanSupplier((RouteTemplateContext.BeanSupplier<Object>) bean);
@@ -201,7 +202,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setName(name);
         def.setBeanSupplier(ctx -> ((Supplier<?>) bean).get());
         beans.add(def);
@@ -219,7 +220,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setName(name);
         def.setBeanType(type);
         def.setBeanSupplier(bean);
@@ -238,7 +239,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setName(name);
         def.setType(language);
         def.setScript(script);
@@ -258,7 +259,7 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setName(name);
         def.setBeanType(type);
         def.setType(language);
@@ -273,11 +274,11 @@ public class TemplatedRouteDefinition implements CamelContextAware, ResourceAwar
      * @param  name the name of the bean
      * @return      fluent builder to choose which language and script to use for creating the bean
      */
-    public TemplatedRouteBeanDefinition bean(String name) {
+    public RegistryBeanDefinition<TemplatedRouteDefinition> bean(String name) {
         if (beans == null) {
             beans = new ArrayList<>();
         }
-        TemplatedRouteBeanDefinition def = new TemplatedRouteBeanDefinition();
+        RegistryBeanDefinition<TemplatedRouteDefinition> def = new RegistryBeanDefinition<>();
         def.setParent(this);
         def.setName(name);
         beans.add(def);
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index c48f006aaaf..1c8833dd7f4 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -1122,7 +1122,7 @@ public class ModelParser extends BaseParser {
                 case "routeTemplateRef": def.setRouteTemplateRef(val); yield true;
                 default: yield false;
             }, (def, key) -> switch (key) {
-                case "bean": doAdd(doParseTemplatedRouteBeanDefinition(), def.getBeans(), def::setBeans); yield true;
+                case "bean": doAdd(doParseRegistryBeanDefinition(), def.getBeans(), def::setBeans); yield true;
                 case "parameter": doAdd(doParseTemplatedRouteParameterDefinition(), def.getParameters(), def::setParameters); yield true;
                 default: yield false;
             }, noValueHandler());
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 11d23552707..b8cd80175f7 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -1738,7 +1738,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("routeId", def.getRouteId());
         doWriteAttribute("routeTemplateRef", def.getRouteTemplateRef());
         doWriteAttribute("prefixId", def.getPrefixId());
-        doWriteList(null, "bean", def.getBeans(), this::doWriteTemplatedRouteBeanDefinition);
+        doWriteList(null, "bean", def.getBeans(), this::doWriteRegistryBeanDefinition);
         doWriteList(null, "parameter", def.getParameters(), this::doWriteTemplatedRouteParameterDefinition);
         endElement(name);
     }
diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
index fd3e89c23d8..6a1e6fc3a1d 100644
--- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
+++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
@@ -1738,7 +1738,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("routeId", def.getRouteId());
         doWriteAttribute("routeTemplateRef", def.getRouteTemplateRef());
         doWriteAttribute("prefixId", def.getPrefixId());
-        doWriteList(null, "bean", def.getBeans(), this::doWriteTemplatedRouteBeanDefinition);
+        doWriteList(null, "bean", def.getBeans(), this::doWriteRegistryBeanDefinition);
         doWriteList(null, "parameter", def.getParameters(), this::doWriteTemplatedRouteParameterDefinition);
         endElement(name);
     }