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 <claus.ib...@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,

Reply via email to