This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch kamelet-ctr5 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3861d43c20ab415eaa8ad6d70ce0209d4268e480 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri May 3 07:15:16 2024 +0200 CAMEL-20514: camel-model - Add support for bean constructors for beans in route templates or kamelets --- .../org/apache/camel/spi/ModelToXMLDumper.java | 2 +- .../org/apache/camel/spi/ModelToYAMLDumper.java | 2 +- .../org/apache/camel/model/app/jaxb.index | 1 - .../camel/model/app/RegistryBeanDefinition.java | 35 ---------------------- .../org/apache/camel/xml/LwModelToXMLDumper.java | 12 ++++---- .../camel/xml/jaxb/JaxbModelToXMLDumper.java | 12 ++++---- .../org/apache/camel/yaml/LwModelToYAMLDumper.java | 12 ++++---- 7 files changed, 20 insertions(+), 56 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java b/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java index 47ee821349a..4c41645a4d1 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java @@ -59,7 +59,7 @@ public interface ModelToXMLDumper { * Dumps the beans as XML * * @param context the CamelContext - * @param beans list of beans (RegistryBeanDefinition) + * @param beans list of beans (BeanFactoryDefinition) * @return the output in XML (is formatted) * @throws Exception is throw if error marshalling to XML */ diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ModelToYAMLDumper.java b/core/camel-api/src/main/java/org/apache/camel/spi/ModelToYAMLDumper.java index e4139b1a089..d6bda7e689b 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/ModelToYAMLDumper.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/ModelToYAMLDumper.java @@ -61,7 +61,7 @@ public interface ModelToYAMLDumper { * Dumps the beans as YAML * * @param context the CamelContext - * @param beans list of beans (RegistryBeanDefinition) + * @param beans list of beans (BeanFactoryDefinition) * @return the output in YAML (is formatted) * @throws Exception is throw if error marshalling to YAML */ diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/app/jaxb.index b/core/camel-core-model/src/generated/resources/org/apache/camel/model/app/jaxb.index index d5d2a547b9d..4a07d359a8c 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/app/jaxb.index +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/app/jaxb.index @@ -6,4 +6,3 @@ BeanPropertiesDefinition BeanPropertyDefinition BeansDefinition ComponentScanDefinition -RegistryBeanDefinition diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/app/RegistryBeanDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/app/RegistryBeanDefinition.java deleted file mode 100644 index c3c3bc4fea0..00000000000 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/app/RegistryBeanDefinition.java +++ /dev/null @@ -1,35 +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.app; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlType; - -import org.apache.camel.model.BeanFactoryDefinition; -import org.apache.camel.spi.Metadata; - -/** - * Define custom beans that can be used in your Camel routes and in general. - */ -@Metadata(label = "configuration") -@XmlType -@XmlAccessorType(XmlAccessType.FIELD) -@Deprecated -public class RegistryBeanDefinition<P> extends BeanFactoryDefinition<P> { - -} diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java index 2a3afe62958..0e8279d5b1c 100644 --- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java +++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java @@ -181,9 +181,9 @@ public class LwModelToXMLDumper implements ModelToXMLDumper { StringWriter buffer = new StringWriter(); BeanModelWriter writer = new BeanModelWriter(buffer); - List<BeanFactoryDefinition> list = new ArrayList<>(); + List<BeanFactoryDefinition<?>> list = new ArrayList<>(); for (Object bean : beans) { - if (bean instanceof BeanFactoryDefinition rb) { + if (bean instanceof BeanFactoryDefinition<?> rb) { list.add(rb); } } @@ -310,16 +310,16 @@ public class LwModelToXMLDumper implements ModelToXMLDumper { // noop } - public void writeBeans(List<BeanFactoryDefinition> beans) { + public void writeBeans(List<BeanFactoryDefinition<?>> beans) { if (beans.isEmpty()) { return; } - for (BeanFactoryDefinition b : beans) { - doWriteRegistryBeanDefinition(b); + for (BeanFactoryDefinition<?> b : beans) { + doWriteBeanFactoryDefinition(b); } } - private void doWriteRegistryBeanDefinition(BeanFactoryDefinition b) { + private void doWriteBeanFactoryDefinition(BeanFactoryDefinition<?> b) { String type = b.getType(); if (type.startsWith("#class:")) { type = type.substring(7); diff --git a/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java b/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java index 0c0e3b71d52..c4787049ed8 100644 --- a/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java +++ b/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java @@ -227,9 +227,9 @@ public class JaxbModelToXMLDumper implements ModelToXMLDumper { StringWriter buffer = new StringWriter(); BeanModelWriter writer = new BeanModelWriter(buffer); - List<BeanFactoryDefinition> list = new ArrayList<>(); + List<BeanFactoryDefinition<?>> list = new ArrayList<>(); for (Object bean : beans) { - if (bean instanceof BeanFactoryDefinition rb) { + if (bean instanceof BeanFactoryDefinition<?> rb) { list.add(rb); } } @@ -295,16 +295,16 @@ public class JaxbModelToXMLDumper implements ModelToXMLDumper { // noop } - public void writeBeans(List<BeanFactoryDefinition> beans) { + public void writeBeans(List<BeanFactoryDefinition<?>> beans) { if (beans.isEmpty()) { return; } - for (BeanFactoryDefinition b : beans) { - doWriteRegistryBeanDefinition(b); + for (BeanFactoryDefinition<?> b : beans) { + doWriteBeanFactoryDefinition(b); } } - private void doWriteRegistryBeanDefinition(BeanFactoryDefinition b) { + private void doWriteBeanFactoryDefinition(BeanFactoryDefinition<?> b) { String type = b.getType(); if (type.startsWith("#class:")) { type = type.substring(7); diff --git a/core/camel-yaml-io/src/main/java/org/apache/camel/yaml/LwModelToYAMLDumper.java b/core/camel-yaml-io/src/main/java/org/apache/camel/yaml/LwModelToYAMLDumper.java index 735800925a9..01c01040ea3 100644 --- a/core/camel-yaml-io/src/main/java/org/apache/camel/yaml/LwModelToYAMLDumper.java +++ b/core/camel-yaml-io/src/main/java/org/apache/camel/yaml/LwModelToYAMLDumper.java @@ -169,9 +169,9 @@ public class LwModelToYAMLDumper implements ModelToYAMLDumper { StringWriter buffer = new StringWriter(); BeanModelWriter writer = new BeanModelWriter(buffer); - List<BeanFactoryDefinition> list = new ArrayList<>(); + List<BeanFactoryDefinition<?>> list = new ArrayList<>(); for (Object bean : beans) { - if (bean instanceof BeanFactoryDefinition rb) { + if (bean instanceof BeanFactoryDefinition<?> rb) { list.add(rb); } } @@ -298,17 +298,17 @@ public class LwModelToYAMLDumper implements ModelToYAMLDumper { // noop } - public void writeBeans(List<BeanFactoryDefinition> beans) { + public void writeBeans(List<BeanFactoryDefinition<?>> beans) { if (beans.isEmpty()) { return; } buffer.write("- beans:\n"); - for (BeanFactoryDefinition b : beans) { - doWriteRegistryBeanDefinition(b); + for (BeanFactoryDefinition<?> b : beans) { + doWriteBeanFactoryDefinition(b); } } - private void doWriteRegistryBeanDefinition(BeanFactoryDefinition b) { + private void doWriteBeanFactoryDefinition(BeanFactoryDefinition<?> b) { String type = b.getType(); if (type.startsWith("#class:")) { type = type.substring(7);