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 2021/12/21 15:35:34 UTC

[camel] branch main updated (987f9c8 -> 488c68b)

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

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


    from 987f9c8  Upgrade to logback 1.2.9 (https://jira.qos.ch/browse/LOGBACK-1591) (#6574)
     new a879553  CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
     new 24a8885  Polished
     new 038e4c8  CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
     new fbb2dda  CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
     new f80554b  CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
     new 985e5e5  CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
     new 2b30163  CAMEL-17194: componentdsl - Prepare for generate only once during project build.
     new 488c68b  Regen

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


Summary of changes:
 .../org/apache/camel/catalog/components.properties |   1 +
 .../catalog/components}/azure-servicebus.json      |   0
 .../org/apache/camel/main/components.properties    |   1 +
 dsl/camel-componentdsl/pom.xml                     |  52 ++++++
 dsl/camel-endpointdsl/pom.xml                      |  37 +++-
 .../builder/endpoint/StaticEndpointBuilders.java   | 196 ++++++++++++++++-----
 .../EndpointConsumerDeserializersResolver.java     |   1 +
 .../EndpointProducerDeserializersResolver.java     |   1 +
 .../camel/maven/packaging/ComponentDslMojo.java    | 110 ++++--------
 .../camel/maven/packaging/EndpointDslMojo.java     |  90 ++++------
 .../maven/packaging/GenerateComponentMojo.java     |   4 -
 .../apache/camel/maven/packaging/GenerateMojo.java |   4 -
 .../apache/camel/maven/packaging/MojoHelper.java   | 100 +++++++++++
 .../camel/maven/packaging/PackageLanguageMojo.java |   1 -
 .../camel/maven/packaging/PrepareCatalogMojo.java  |  72 +-------
 15 files changed, 413 insertions(+), 257 deletions(-)
 copy {components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus => catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components}/azure-servicebus.json (100%)
 create mode 100644 tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java

[camel] 01/08: CAMEL-17194: endpointdsl - Prepare for generate only once during project build.

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

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

commit a8795536d4c061625dd6ea02ad7ace960dee0bc5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 15:00:15 2021 +0100

    CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
---
 .../apache/camel/maven/packaging/EndpointDslMojo.java   | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index ba37ef6..f668dff 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -103,21 +103,6 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
     protected String componentsFactoriesPackageName;
 
     /**
-     * Generate or not the EndpointBuilderFactory interface.
-     */
-    @Parameter(defaultValue = "true")
-    protected boolean generateEndpointBuilderFactory;
-
-    /**
-     * Generate or not the EndpointBuilders interface.
-     */
-    @Parameter(defaultValue = "true")
-    protected boolean generateEndpointBuilders;
-
-    @Parameter(defaultValue = "true")
-    protected boolean generateEndpointDsl;
-
-    /**
      * The output directory
      */
     @Parameter
@@ -142,8 +127,6 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
         baseDir = project.getBasedir();
         endpointFactoriesPackageName = "org.apache.camel.builder.endpoint";
         componentsFactoriesPackageName = "org.apache.camel.builder.endpoint.dsl";
-        generateEndpointBuilderFactory = true;
-        generateEndpointBuilders = true;
         super.execute(project, projectHelper, buildContext);
     }
 

[camel] 05/08: CAMEL-17194: endpointdsl - Prepare for generate only once during project build.

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

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

commit f80554b6bc361d7bc29e7827d69f9a680966ca26
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 15:58:09 2021 +0100

    CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
---
 .../camel/maven/packaging/EndpointDslMojo.java     | 40 +++++++++++-----------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index e3a68cd..c092417 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -21,22 +21,18 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.LineNumberReader;
 import java.io.StringReader;
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import javax.annotation.Generated;
 
@@ -154,24 +150,28 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
             componentsMetadata = outputResourcesDir.toPath().resolve("metadata.json").toFile();
         }
 
-        Collection<Path> allJsonFiles = new TreeSet<>();
-        Stream.of(componentsDir.toPath())
-                .filter(dir -> !"target".equals(dir.getFileName().toString()))
-                .flatMap(p -> getComponentPath(p).stream())
-                .filter(dir -> Files.isDirectory(dir.resolve("src")))
-                .map(p -> p.resolve("target/classes"))
-                .flatMap(PackageHelper::walk).forEach(p -> {
+        List<ComponentModel> models = new ArrayList<>();
+
+        for (File dir : componentsDir.listFiles()) {
+            List<Path> subs = getComponentPath(dir.toPath());
+            for (Path sub : subs) {
+                sub = sub.resolve("src/generated/resources/");
+                PackageHelper.walk(sub).forEach(p -> {
                     String f = p.getFileName().toString();
                     if (f.endsWith(PackageHelper.JSON_SUFIX)) {
-                        allJsonFiles.add(p);
+                        try {
+                            BaseModel<?> model = JsonMapper.generateModel(p);
+                            if (model instanceof ComponentModel) {
+                                models.add((ComponentModel) model);
+                            }
+                        } catch (Exception e) {
+                            // ignore as its not a camel model
+                        }
                     }
                 });
-        final Map<Path, BaseModel<?>> allModels
-                = allJsonFiles.stream().collect(Collectors.toMap(p -> p, JsonMapper::generateModel));
-        Set<ComponentModel> models = allJsonFiles.stream()
-                .filter(p -> allModels.get(p) instanceof ComponentModel)
-                .map(p -> (ComponentModel) allModels.get(p))
-                .collect(Collectors.toCollection(TreeSet::new));
+            }
+        }
+        Collections.sort(models, (o1, o2) -> o1.getScheme().compareToIgnoreCase(o2.getScheme()));
 
         // generate component endpoint DSL files and write them
         Lock lock = LOCKS.computeIfAbsent(root, d -> new ReentrantLock());
@@ -254,7 +254,7 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
         }
     }
 
-    private void executeComponent(Set<ComponentModel> allModels) throws MojoFailureException {
+    private void executeComponent(List<ComponentModel> allModels) throws MojoFailureException {
         if (!allModels.isEmpty()) {
             getLog().debug("Found " + allModels.size() + " components");
 
@@ -953,7 +953,7 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
         desc += "\n";
         desc += "\nCategory: " + model.getLabel();
         desc += "\nSince: " + model.getFirstVersionShort();
-        desc += "\nMaven coordinates: " + project.getGroupId() + ":" + project.getArtifactId();
+        desc += "\nMaven coordinates: " + model.getGroupId() + ":" + model.getArtifactId();
 
         // include javadoc for all path parameters and mark which are required
         desc += "\n";

[camel] 08/08: Regen

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

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

commit 488c68b5bc3c6cdd3a53cebd97a9548a9d17bd3b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 16:31:06 2021 +0100

    Regen
---
 .../org/apache/camel/catalog/components.properties |  1 +
 .../camel/catalog/components/azure-servicebus.json | 75 ++++++++++++++++++++++
 .../org/apache/camel/main/components.properties    |  1 +
 .../EndpointConsumerDeserializersResolver.java     |  1 +
 .../EndpointProducerDeserializersResolver.java     |  1 +
 5 files changed, 79 insertions(+)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties
index 45f83a8..e87efd1 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties
@@ -41,6 +41,7 @@ aws2-sts
 aws2-translate
 azure-cosmosdb
 azure-eventhubs
+azure-servicebus
 azure-storage-blob
 azure-storage-datalake
 azure-storage-queue
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
new file mode 100644
index 0000000..839c424
--- /dev/null
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
@@ -0,0 +1,75 @@
+{
+  "component": {
+    "kind": "component",
+    "name": "azure-servicebus",
+    "title": "Azure ServiceBus",
+    "description": "Send and receive messages to\/from Azure Event Bus.",
+    "deprecated": false,
+    "firstVersion": "3.12.0",
+    "label": "cloud,messaging",
+    "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusComponent",
+    "supportLevel": "Stable",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-azure-servicebus",
+    "version": "3.15.0-SNAPSHOT",
+    "scheme": "azure-servicebus",
+    "extendsScheme": "",
+    "syntax": "azure-servicebus:queueNameOrTopicName",
+    "async": false,
+    "api": false,
+    "consumerOnly": false,
+    "producerOnly": false,
+    "lenientProperties": false
+  },
+  "componentProperties": {
+    "amqpRetryOptions": { "kind": "property", "displayName": "Amqp Retry Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.AmqpRetryOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the retry options for Service Bus clients. If not specified, the defaul [...]
+    "amqpTransportType": { "kind": "property", "displayName": "Amqp Transport Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.AmqpTransportType", "enum": [ "Amqp", "AmqpWebSockets" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "AMQP", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the tr [...]
+    "clientOptions": { "kind": "property", "displayName": "Client Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.util.ClientOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the ClientOptions to be sent from the client built from this builder, enabling cu [...]
+    "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configurations" },
+    "proxyOptions": { "kind": "property", "displayName": "Proxy Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.ProxyOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the proxy configuration to use for ServiceBusSenderAsyncClient. When a proxy is conf [...]
+    "serviceBusType": { "kind": "property", "displayName": "Service Bus Type", "group": "common", "label": "common", "required": true, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusType", "enum": [ "queue", "topic" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "queue", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration [...]
+    "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...]
+    "consumerOperation": { "kind": "property", "displayName": "Consumer Operation", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusConsumerOperationDefinition", "enum": [ "receiveMessages", "peekMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "receiveMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", [...]
+    "disableAutoComplete": { "kind": "property", "displayName": "Disable Auto Complete", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Disables auto-complete and auto-abandon of received messages. By defaul [...]
+    "maxAutoLockRenewDuration": { "kind": "property", "displayName": "Max Auto Lock Renew Duration", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "5min", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the amount of time to continue auto-renewin [...]
+    "peekNumMaxMessages": { "kind": "property", "displayName": "Peek Num Max Messages", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Set the max number of messages to be peeked during the peek operation." },
+    "prefetchCount": { "kind": "property", "displayName": "Prefetch Count", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the prefetch count of the receiver. For both {link ServiceBusReceiveMode#PEEK_LOCK PEEK [...]
+    "receiverAsyncClient": { "kind": "property", "displayName": "Receiver Async Client", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the receiverAsy [...]
+    "serviceBusReceiveMode": { "kind": "property", "displayName": "Service Bus Receive Mode", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.models.ServiceBusReceiveMode", "enum": [ "PEEK_LOCK", "RECEIVE_AND_DELETE" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PEEK_LOCK", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationFie [...]
+    "subQueue": { "kind": "property", "displayName": "Sub Queue", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.models.SubQueue", "enum": [ "NONE", "DEAD_LETTER_QUEUE", "TRANSFER_DEAD_LETTER_QUEUE" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the [...]
+    "subscriptionName": { "kind": "property", "displayName": "Subscription Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the name of the subscription in the topic to listen to. topicOrQueueName and serviceBusT [...]
+    "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
+    "producerOperation": { "kind": "property", "displayName": "Producer Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "sendMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", " [...]
+    "scheduledEnqueueTime": { "kind": "property", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the Service Bus qu [...]
+    "senderAsyncClient": { "kind": "property", "displayName": "Sender Async Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets SenderAsyncClient to  [...]
+    "serviceBusTransactionContext": { "kind": "property", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents transaction i [...]
+    "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
+    "connectionString": { "kind": "property", "displayName": "Connection String", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the connection string for a Service Bus namespace or a specific Ser [...]
+  },
+  "properties": {
+    "topicOrQueueName": { "kind": "path", "displayName": "Topic Or Queue Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Selected topic name or the queue name, that is depending on serviceBusType config. For example if service [...]
+    "amqpRetryOptions": { "kind": "parameter", "displayName": "Amqp Retry Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.AmqpRetryOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the retry options for Service Bus clients. If not specified, the defau [...]
+    "amqpTransportType": { "kind": "parameter", "displayName": "Amqp Transport Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.AmqpTransportType", "enum": [ "Amqp", "AmqpWebSockets" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "AMQP", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the t [...]
+    "clientOptions": { "kind": "parameter", "displayName": "Client Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.util.ClientOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the ClientOptions to be sent from the client built from this builder, enabling c [...]
+    "proxyOptions": { "kind": "parameter", "displayName": "Proxy Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.ProxyOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the proxy configuration to use for ServiceBusSenderAsyncClient. When a proxy is con [...]
+    "serviceBusType": { "kind": "parameter", "displayName": "Service Bus Type", "group": "common", "label": "common", "required": true, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusType", "enum": [ "queue", "topic" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "queue", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuratio [...]
+    "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...]
+    "consumerOperation": { "kind": "parameter", "displayName": "Consumer Operation", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusConsumerOperationDefinition", "enum": [ "receiveMessages", "peekMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "receiveMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration" [...]
+    "disableAutoComplete": { "kind": "parameter", "displayName": "Disable Auto Complete", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Disables auto-complete and auto-abandon of received messages. By defau [...]
+    "maxAutoLockRenewDuration": { "kind": "parameter", "displayName": "Max Auto Lock Renew Duration", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "5min", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the amount of time to continue auto-renewi [...]
+    "peekNumMaxMessages": { "kind": "parameter", "displayName": "Peek Num Max Messages", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Set the max number of messages to be peeked during the peek operation." },
+    "prefetchCount": { "kind": "parameter", "displayName": "Prefetch Count", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the prefetch count of the receiver. For both {link ServiceBusReceiveMode#PEEK_LOCK PEE [...]
+    "receiverAsyncClient": { "kind": "parameter", "displayName": "Receiver Async Client", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the receiverAs [...]
+    "serviceBusReceiveMode": { "kind": "parameter", "displayName": "Service Bus Receive Mode", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.models.ServiceBusReceiveMode", "enum": [ "PEEK_LOCK", "RECEIVE_AND_DELETE" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PEEK_LOCK", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationFi [...]
+    "subQueue": { "kind": "parameter", "displayName": "Sub Queue", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.models.SubQueue", "enum": [ "NONE", "DEAD_LETTER_QUEUE", "TRANSFER_DEAD_LETTER_QUEUE" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets th [...]
+    "subscriptionName": { "kind": "parameter", "displayName": "Subscription Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the name of the subscription in the topic to listen to. topicOrQueueName and serviceBus [...]
+    "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...]
+    "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
+    "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...]
+    "producerOperation": { "kind": "parameter", "displayName": "Producer Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "sendMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",  [...]
+    "scheduledEnqueueTime": { "kind": "parameter", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the Service Bus q [...]
+    "senderAsyncClient": { "kind": "parameter", "displayName": "Sender Async Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets SenderAsyncClient to [...]
+    "serviceBusTransactionContext": { "kind": "parameter", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents transaction  [...]
+    "connectionString": { "kind": "parameter", "displayName": "Connection String", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the connection string for a Service Bus namespace or a specific Se [...]
+  }
+}
diff --git a/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties b/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties
index 45f83a8..e87efd1 100644
--- a/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties
+++ b/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties
@@ -41,6 +41,7 @@ aws2-sts
 aws2-translate
 azure-cosmosdb
 azure-eventhubs
+azure-servicebus
 azure-storage-blob
 azure-storage-datalake
 azure-storage-queue
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointConsumerDeserializersResolver.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointConsumerDeserializersResolver.java
index bb9181a..7a80e87 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointConsumerDeserializersResolver.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointConsumerDeserializersResolver.java
@@ -36,6 +36,7 @@ public final class EndpointConsumerDeserializersResolver implements YamlDeserial
             case "aws2-sqs":
             case "azure-cosmosdb":
             case "azure-eventhubs":
+            case "azure-servicebus":
             case "azure-storage-blob":
             case "azure-storage-datalake":
             case "azure-storage-queue":
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointProducerDeserializersResolver.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointProducerDeserializersResolver.java
index 7e9b067..a593cf1 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointProducerDeserializersResolver.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/EndpointProducerDeserializersResolver.java
@@ -56,6 +56,7 @@ public final class EndpointProducerDeserializersResolver implements YamlDeserial
             case "aws2-translate":
             case "azure-cosmosdb":
             case "azure-eventhubs":
+            case "azure-servicebus":
             case "azure-storage-blob":
             case "azure-storage-datalake":
             case "azure-storage-queue":

[camel] 03/08: CAMEL-17194: endpointdsl - Prepare for generate only once during project build.

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

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

commit 038e4c8d634982d0166027b4ab57ec1b8c5958ff
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 15:10:05 2021 +0100

    CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
---
 dsl/camel-endpointdsl/pom.xml                      | 37 +++++++++++++++++++++-
 .../maven/packaging/GenerateComponentMojo.java     |  4 ---
 .../apache/camel/maven/packaging/GenerateMojo.java |  4 ---
 3 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/dsl/camel-endpointdsl/pom.xml b/dsl/camel-endpointdsl/pom.xml
index 380e13f..57cc91e 100644
--- a/dsl/camel-endpointdsl/pom.xml
+++ b/dsl/camel-endpointdsl/pom.xml
@@ -33,7 +33,6 @@
     <description>The Camel Endpoint DSL</description>
 
     <properties>
-        <camel-generate-endpoint-dsl>true</camel-generate-endpoint-dsl>
         <camel.osgi.import>
             javax.xml.bind*;version="[2.2,3.0)",
             *
@@ -111,6 +110,42 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-package-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate</id>
+                        <goals>
+                            <goal>generate-endpoint-dsl</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                            <goal>add-resource</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/generated/java</source>
+                            </sources>
+                            <resources>
+                                <resource>
+                                    <directory>src/generated/resources</directory>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <!-- The non generated code depends on the generated code,
                      so skip the first compilation phase -->
                 <artifactId>maven-compiler-plugin</artifactId>
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateComponentMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateComponentMojo.java
index 765b078..c5de00d 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateComponentMojo.java
@@ -52,10 +52,6 @@ public class GenerateComponentMojo extends AbstractGenerateMojo {
         invoke(PrepareComponentMojo.class);
         // validate-components
         invoke(ValidateComponentMojo.class);
-        // generate-endpoint-dsl
-        invoke(EndpointDslMojo.class);
-        // generate-component-dsl
-        invoke(ComponentDslMojo.class);
     }
 
 }
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateMojo.java
index f77da4d..880ded0 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateMojo.java
@@ -62,10 +62,6 @@ public class GenerateMojo extends AbstractGenerateMojo {
         invoke(PackageLegalMojo.class);
         // validate-components
         invoke(ValidateComponentMojo.class);
-        // generate-endpoint-dsl
-        invoke(EndpointDslMojo.class);
-        // generate-component-dsl
-        invoke(ComponentDslMojo.class);
         // update-readme
         invoke(UpdateReadmeMojo.class);
     }

[camel] 02/08: Polished

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

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

commit 24a8885965f28ece0075704809021a2fb61ec032
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 15:03:14 2021 +0100

    Polished
---
 .../main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java  | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
index e3abe72..399cab9 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
@@ -116,7 +116,6 @@ public class PackageLanguageMojo extends AbstractGeneratorMojo {
         StringBuilder buffer = new StringBuilder();
         int count = 0;
 
-        // TODO
         File f = new File(project.getBasedir(), "target/classes");
         f = new File(f, "META-INF/services/org/apache/camel/language");
         if (f.exists() && f.isDirectory()) {

[camel] 06/08: CAMEL-17194: endpointdsl - Prepare for generate only once during project build.

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

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

commit 985e5e56ff5a488c8fff228343627c431bac2803
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 16:05:59 2021 +0100

    CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
---
 .../builder/endpoint/StaticEndpointBuilders.java   | 196 ++++++++++++++++-----
 .../camel/maven/packaging/EndpointDslMojo.java     |  72 +-------
 .../apache/camel/maven/packaging/MojoHelper.java   | 100 +++++++++++
 .../camel/maven/packaging/PrepareCatalogMojo.java  |  72 +-------
 4 files changed, 253 insertions(+), 187 deletions(-)

diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index 099fbf5..94cb38a 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -169,6 +169,49 @@ public class StaticEndpointBuilders {
         return org.apache.camel.builder.endpoint.dsl.WsEndpointBuilderFactory.endpointBuilder(componentName, path);
     }
     /**
+     * Async HTTP Client (AHC) Secure Websocket (Secure) (camel-ahc-ws)
+     * Exchange data with external Websocket servers using Async Http Client.
+     * 
+     * Category: websocket
+     * Since: 2.14
+     * Maven coordinates: org.apache.camel:camel-ahc-ws
+     * 
+     * Syntax: <code>ahc-wss:httpUri</code>
+     * 
+     * Path parameter: httpUri (required)
+     * The URI to use such as http://hostname:port/path
+     * 
+     * @param path httpUri
+     * @return the dsl builder
+     */
+    public static org.apache.camel.builder.endpoint.dsl.WsEndpointBuilderFactory.WsEndpointBuilder ahcWss(
+            String path) {
+        return org.apache.camel.builder.endpoint.dsl.WsEndpointBuilderFactory.endpointBuilder("ahc-wss", path);
+    }
+    /**
+     * Async HTTP Client (AHC) Secure Websocket (Secure) (camel-ahc-ws)
+     * Exchange data with external Websocket servers using Async Http Client.
+     * 
+     * Category: websocket
+     * Since: 2.14
+     * Maven coordinates: org.apache.camel:camel-ahc-ws
+     * 
+     * Syntax: <code>ahc-wss:httpUri</code>
+     * 
+     * Path parameter: httpUri (required)
+     * The URI to use such as http://hostname:port/path
+     * 
+     * @param componentName to use a custom component name for the endpoint
+     * instead of the default name
+     * @param path httpUri
+     * @return the dsl builder
+     */
+    public static org.apache.camel.builder.endpoint.dsl.WsEndpointBuilderFactory.WsEndpointBuilder ahcWss(
+            String componentName,
+            String path) {
+        return org.apache.camel.builder.endpoint.dsl.WsEndpointBuilderFactory.endpointBuilder(componentName, path);
+    }
+    /**
      * AMQP (camel-amqp)
      * Messaging with AMQP protocol using Apache QPid Client.
      * 
@@ -2910,6 +2953,65 @@ public class StaticEndpointBuilders {
         return org.apache.camel.builder.endpoint.dsl.CometdEndpointBuilderFactory.endpointBuilder(componentName, path);
     }
     /**
+     * CometD (Secure) (camel-cometd)
+     * Offers publish/subscribe, peer-to-peer (via a server), and RPC style
+     * messaging using the CometD/Bayeux protocol.
+     * 
+     * Category: websocket
+     * Since: 2.0
+     * Maven coordinates: org.apache.camel:camel-cometd
+     * 
+     * Syntax: <code>cometds:host:port/channelName</code>
+     * 
+     * Path parameter: host (required)
+     * Hostname
+     * 
+     * Path parameter: port (required)
+     * Host port number
+     * 
+     * Path parameter: channelName (required)
+     * The channelName represents a topic that can be subscribed to by the Camel
+     * endpoints.
+     * 
+     * @param path host:port/channelName
+     * @return the dsl builder
+     */
+    public static org.apache.camel.builder.endpoint.dsl.CometdEndpointBuilderFactory.CometdEndpointBuilder cometds(
+            String path) {
+        return org.apache.camel.builder.endpoint.dsl.CometdEndpointBuilderFactory.endpointBuilder("cometds", path);
+    }
+    /**
+     * CometD (Secure) (camel-cometd)
+     * Offers publish/subscribe, peer-to-peer (via a server), and RPC style
+     * messaging using the CometD/Bayeux protocol.
+     * 
+     * Category: websocket
+     * Since: 2.0
+     * Maven coordinates: org.apache.camel:camel-cometd
+     * 
+     * Syntax: <code>cometds:host:port/channelName</code>
+     * 
+     * Path parameter: host (required)
+     * Hostname
+     * 
+     * Path parameter: port (required)
+     * Host port number
+     * 
+     * Path parameter: channelName (required)
+     * The channelName represents a topic that can be subscribed to by the Camel
+     * endpoints.
+     * 
+     * @param componentName to use a custom component name for the endpoint
+     * instead of the default name
+     * @param path host:port/channelName
+     * @return the dsl builder
+     */
+    public static org.apache.camel.builder.endpoint.dsl.CometdEndpointBuilderFactory.CometdEndpointBuilder cometds(
+            String componentName,
+            String path) {
+        return org.apache.camel.builder.endpoint.dsl.CometdEndpointBuilderFactory.endpointBuilder(componentName, path);
+    }
+    /**
      * Consul (camel-consul)
      * Integrate with Consul service discovery and configuration store.
      * 
@@ -6914,51 +7016,6 @@ public class StaticEndpointBuilders {
      * Since: 3.12
      * Maven coordinates: org.apache.camel:camel-huaweicloud-imagerecognition
      * 
-     * Syntax: <code>hwcloud-image:operation</code>
-     * 
-     * Path parameter: operation (required)
-     * Name of Image Recognition operation to perform, including
-     * celebrityRecognition and tagRecognition
-     * 
-     * @param path operation
-     * @return the dsl builder
-     */
-    public static org.apache.camel.builder.endpoint.dsl.ImageRecognitionEndpointBuilderFactory.ImageRecognitionEndpointBuilder hwcloudImage(
-            String path) {
-        return org.apache.camel.builder.endpoint.dsl.ImageRecognitionEndpointBuilderFactory.endpointBuilder("hwcloud-image", path);
-    }
-    /**
-     * Huawei Cloud Image Recognition (camel-huaweicloud-imagerecognition)
-     * To identify objects, scenes, and concepts in images on Huawei Cloud
-     * 
-     * Category: cloud,messaging
-     * Since: 3.12
-     * Maven coordinates: org.apache.camel:camel-huaweicloud-imagerecognition
-     * 
-     * Syntax: <code>hwcloud-image:operation</code>
-     * 
-     * Path parameter: operation (required)
-     * Name of Image Recognition operation to perform, including
-     * celebrityRecognition and tagRecognition
-     * 
-     * @param componentName to use a custom component name for the endpoint
-     * instead of the default name
-     * @param path operation
-     * @return the dsl builder
-     */
-    public static org.apache.camel.builder.endpoint.dsl.ImageRecognitionEndpointBuilderFactory.ImageRecognitionEndpointBuilder hwcloudImage(
-            String componentName,
-            String path) {
-        return org.apache.camel.builder.endpoint.dsl.ImageRecognitionEndpointBuilderFactory.endpointBuilder(componentName, path);
-    }
-    /**
-     * Huawei Cloud Image Recognition (camel-huaweicloud-imagerecognition)
-     * To identify objects, scenes, and concepts in images on Huawei Cloud
-     * 
-     * Category: cloud,messaging
-     * Since: 3.12
-     * Maven coordinates: org.apache.camel:camel-huaweicloud-imagerecognition
-     * 
      * Syntax: <code>hwcloud-imagerecognition:operation</code>
      * 
      * Path parameter: operation (required)
@@ -12083,6 +12140,55 @@ public class StaticEndpointBuilders {
         return org.apache.camel.builder.endpoint.dsl.PlatformHttpEndpointBuilderFactory.endpointBuilder(componentName, path);
     }
     /**
+     * POP3 (camel-mail)
+     * Send and receive emails using imap, pop3 and smtp protocols.
+     * 
+     * Category: mail
+     * Since: 1.0
+     * Maven coordinates: org.apache.camel:camel-mail
+     * 
+     * Syntax: <code>pop3:host:port</code>
+     * 
+     * Path parameter: host (required)
+     * The mail server host name
+     * 
+     * Path parameter: port
+     * The port number of the mail server
+     * 
+     * @param path host:port
+     * @return the dsl builder
+     */
+    public static org.apache.camel.builder.endpoint.dsl.MailEndpointBuilderFactory.MailEndpointBuilder pop3(
+            String path) {
+        return org.apache.camel.builder.endpoint.dsl.MailEndpointBuilderFactory.endpointBuilder("pop3", path);
+    }
+    /**
+     * POP3 (camel-mail)
+     * Send and receive emails using imap, pop3 and smtp protocols.
+     * 
+     * Category: mail
+     * Since: 1.0
+     * Maven coordinates: org.apache.camel:camel-mail
+     * 
+     * Syntax: <code>pop3:host:port</code>
+     * 
+     * Path parameter: host (required)
+     * The mail server host name
+     * 
+     * Path parameter: port
+     * The port number of the mail server
+     * 
+     * @param componentName to use a custom component name for the endpoint
+     * instead of the default name
+     * @param path host:port
+     * @return the dsl builder
+     */
+    public static org.apache.camel.builder.endpoint.dsl.MailEndpointBuilderFactory.MailEndpointBuilder pop3(
+            String componentName,
+            String path) {
+        return org.apache.camel.builder.endpoint.dsl.MailEndpointBuilderFactory.endpointBuilder(componentName, path);
+    }
+    /**
      * PubNub (camel-pubnub)
      * Send and receive messages to/from PubNub data stream network for
      * connected devices.
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index c092417..a82c663 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -62,6 +62,7 @@ import org.jboss.forge.roaster.model.source.MethodSource;
 import org.jboss.forge.roaster.model.source.ParameterSource;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
+import static org.apache.camel.maven.packaging.MojoHelper.getComponentPath;
 import static org.apache.camel.tooling.util.PackageHelper.findCamelDirectory;
 import static org.apache.camel.tooling.util.PackageHelper.loadText;
 
@@ -183,77 +184,6 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
         }
     }
 
-    private List<Path> getComponentPath(Path dir) {
-        switch (dir.getFileName().toString()) {
-            case "camel-as2":
-                return Collections.singletonList(dir.resolve("camel-as2-component"));
-            case "camel-avro-rpc":
-                return Collections.singletonList(dir.resolve("camel-avro-rpc-component"));
-            case "camel-salesforce":
-                return Collections.singletonList(dir.resolve("camel-salesforce-component"));
-            case "camel-olingo2":
-                return Collections.singletonList(dir.resolve("camel-olingo2-component"));
-            case "camel-olingo4":
-                return Collections.singletonList(dir.resolve("camel-olingo4-component"));
-            case "camel-box":
-                return Collections.singletonList(dir.resolve("camel-box-component"));
-            case "camel-servicenow":
-                return Collections.singletonList(dir.resolve("camel-servicenow-component"));
-            case "camel-fhir":
-                return Collections.singletonList(dir.resolve("camel-fhir-component"));
-            case "camel-infinispan":
-                return Arrays.asList(dir.resolve("camel-infinispan"), dir.resolve("camel-infinispan-embedded"));
-            case "camel-azure":
-                return Arrays.asList(dir.resolve("camel-azure-eventhubs"), dir.resolve("camel-azure-storage-blob"),
-                        dir.resolve("camel-azure-storage-datalake"), dir.resolve("camel-azure-cosmosdb"),
-                        dir.resolve("camel-azure-storage-queue"));
-            case "camel-google":
-                return Arrays.asList(dir.resolve("camel-google-bigquery"), dir.resolve("camel-google-calendar"),
-                        dir.resolve("camel-google-drive"), dir.resolve("camel-google-mail"), dir.resolve("camel-google-pubsub"),
-                        dir.resolve("camel-google-sheets"),
-                        dir.resolve("camel-google-storage"), dir.resolve("camel-google-functions"));
-            case "camel-debezium":
-                return Arrays.asList(dir.resolve("camel-debezium-mongodb"), dir.resolve("camel-debezium-mysql"),
-                        dir.resolve("camel-debezium-postgres"), dir.resolve("camel-debezium-sqlserver"));
-            case "camel-microprofile":
-                return Arrays.asList(dir.resolve("camel-microprofile-config"),
-                        dir.resolve("camel-microprofile-fault-tolerance"),
-                        dir.resolve("camel-microprofile-health"), dir.resolve("camel-microprofile-metrics"));
-            case "camel-test":
-                return Arrays.asList(dir.resolve("camel-test"),
-                        dir.resolve("camel-test-cdi"),
-                        dir.resolve("camel-testcontainers"), dir.resolve("camel-testcontainers-junit5"),
-                        dir.resolve("camel-testcontainers-spring"), dir.resolve("camel-testcontainers-spring-junit5"),
-                        dir.resolve("camel-test-junit5"), dir.resolve("camel-test-spring"),
-                        dir.resolve("camel-test-spring-junit5"));
-            case "camel-aws":
-                return Arrays.asList(dir.resolve("camel-aws2-athena"), dir.resolve("camel-aws2-cw"),
-                        dir.resolve("camel-aws2-ddb"), dir.resolve("camel-aws2-ec2"),
-                        dir.resolve("camel-aws2-ecs"), dir.resolve("camel-aws2-eks"), dir.resolve("camel-aws2-eventbridge"),
-                        dir.resolve("camel-aws2-iam"),
-                        dir.resolve("camel-aws2-kinesis"), dir.resolve("camel-aws2-kms"), dir.resolve("camel-aws2-lambda"),
-                        dir.resolve("camel-aws2-mq"),
-                        dir.resolve("camel-aws2-msk"), dir.resolve("camel-aws2-s3"), dir.resolve("camel-aws2-ses"),
-                        dir.resolve("camel-aws2-sns"),
-                        dir.resolve("camel-aws2-sqs"), dir.resolve("camel-aws2-sts"), dir.resolve("camel-aws2-translate"),
-                        dir.resolve("camel-aws-xray"), dir.resolve("camel-aws-secrets-manager"));
-            case "camel-vertx":
-                return Arrays.asList(dir.resolve("camel-vertx"),
-                        dir.resolve("camel-vertx-http"),
-                        dir.resolve("camel-vertx-kafka").resolve("camel-vertx-kafka-component"),
-                        dir.resolve("camel-vertx-websocket"));
-            case "camel-huawei":
-                return Arrays.asList(dir.resolve("camel-huaweicloud-functiongraph"),
-                        dir.resolve("camel-huaweicloud-smn"),
-                        dir.resolve("camel-huaweicloud-iam"),
-                        dir.resolve("camel-huaweicloud-dms"),
-                        dir.resolve("camel-huaweicloud-imagerecognition"),
-                        dir.resolve("camel-huaweicloud-obs"));
-            default:
-                return Collections.singletonList(dir);
-        }
-    }
-
     private void executeComponent(List<ComponentModel> allModels) throws MojoFailureException {
         if (!allModels.isEmpty()) {
             getLog().debug("Found " + allModels.size() + " components");
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java
new file mode 100644
index 0000000..1c7ece6
--- /dev/null
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java
@@ -0,0 +1,100 @@
+/*
+ * 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.maven.packaging;
+
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public final class MojoHelper {
+
+    private MojoHelper() {
+    }
+
+    public static List<Path> getComponentPath(Path dir) {
+        switch (dir.getFileName().toString()) {
+            case "camel-as2":
+                return Collections.singletonList(dir.resolve("camel-as2-component"));
+            case "camel-avro-rpc":
+                return Collections.singletonList(dir.resolve("camel-avro-rpc-component"));
+            case "camel-salesforce":
+                return Collections.singletonList(dir.resolve("camel-salesforce-component"));
+            case "camel-olingo2":
+                return Collections.singletonList(dir.resolve("camel-olingo2-component"));
+            case "camel-olingo4":
+                return Collections.singletonList(dir.resolve("camel-olingo4-component"));
+            case "camel-box":
+                return Collections.singletonList(dir.resolve("camel-box-component"));
+            case "camel-servicenow":
+                return Collections.singletonList(dir.resolve("camel-servicenow-component"));
+            case "camel-fhir":
+                return Collections.singletonList(dir.resolve("camel-fhir-component"));
+            case "camel-infinispan":
+                return Arrays.asList(dir.resolve("camel-infinispan"), dir.resolve("camel-infinispan-embedded"));
+            case "camel-azure":
+                return Arrays.asList(dir.resolve("camel-azure-eventhubs"), dir.resolve("camel-azure-storage-blob"),
+                        dir.resolve("camel-azure-storage-datalake"), dir.resolve("camel-azure-cosmosdb"),
+                        dir.resolve("camel-azure-storage-queue"), dir.resolve("camel-azure-servicebus"));
+            case "camel-google":
+                return Arrays.asList(dir.resolve("camel-google-bigquery"), dir.resolve("camel-google-calendar"),
+                        dir.resolve("camel-google-drive"), dir.resolve("camel-google-mail"), dir.resolve("camel-google-pubsub"),
+                        dir.resolve("camel-google-sheets"),
+                        dir.resolve("camel-google-storage"), dir.resolve("camel-google-functions"));
+            case "camel-debezium":
+                return Arrays.asList(dir.resolve("camel-debezium-mongodb"), dir.resolve("camel-debezium-mysql"),
+                        dir.resolve("camel-debezium-postgres"), dir.resolve("camel-debezium-sqlserver"));
+            case "camel-microprofile":
+                return Arrays.asList(dir.resolve("camel-microprofile-config"),
+                        dir.resolve("camel-microprofile-fault-tolerance"),
+                        dir.resolve("camel-microprofile-health"), dir.resolve("camel-microprofile-metrics"));
+            case "camel-test":
+                return Arrays.asList(dir.resolve("camel-test"),
+                        dir.resolve("camel-test-cdi"),
+                        dir.resolve("camel-testcontainers"), dir.resolve("camel-testcontainers-junit5"),
+                        dir.resolve("camel-testcontainers-spring"), dir.resolve("camel-testcontainers-spring-junit5"),
+                        dir.resolve("camel-test-junit5"), dir.resolve("camel-test-spring"),
+                        dir.resolve("camel-test-spring-junit5"));
+            case "camel-aws":
+                return Arrays.asList(dir.resolve("camel-aws2-athena"), dir.resolve("camel-aws2-cw"),
+                        dir.resolve("camel-aws2-ddb"), dir.resolve("camel-aws2-ec2"),
+                        dir.resolve("camel-aws2-ecs"), dir.resolve("camel-aws2-eks"), dir.resolve("camel-aws2-eventbridge"),
+                        dir.resolve("camel-aws2-iam"),
+                        dir.resolve("camel-aws2-kinesis"), dir.resolve("camel-aws2-kms"), dir.resolve("camel-aws2-lambda"),
+                        dir.resolve("camel-aws2-mq"),
+                        dir.resolve("camel-aws2-msk"), dir.resolve("camel-aws2-s3"), dir.resolve("camel-aws2-ses"),
+                        dir.resolve("camel-aws2-sns"),
+                        dir.resolve("camel-aws2-sqs"), dir.resolve("camel-aws2-sts"), dir.resolve("camel-aws2-translate"),
+                        dir.resolve("camel-aws-xray"), dir.resolve("camel-aws-secrets-manager"));
+            case "camel-vertx":
+                return Arrays.asList(dir.resolve("camel-vertx"),
+                        dir.resolve("camel-vertx-http"),
+                        dir.resolve("camel-vertx-kafka").resolve("camel-vertx-kafka-component"),
+                        dir.resolve("camel-vertx-websocket"));
+            case "camel-huawei":
+                return Arrays.asList(dir.resolve("camel-huaweicloud-functiongraph"),
+                        dir.resolve("camel-huaweicloud-smn"),
+                        dir.resolve("camel-huaweicloud-iam"),
+                        dir.resolve("camel-huaweicloud-dms"),
+                        dir.resolve("camel-huaweicloud-imagerecognition"),
+                        dir.resolve("camel-huaweicloud-obs"));
+            default:
+                return Collections.singletonList(dir);
+        }
+    }
+
+}
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
index fd73f33..f3d7190 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
@@ -56,6 +56,7 @@ import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 
+import static org.apache.camel.maven.packaging.MojoHelper.getComponentPath;
 import static org.apache.camel.tooling.util.PackageHelper.loadText;
 
 /**
@@ -1142,75 +1143,4 @@ public class PrepareCatalogMojo extends AbstractMojo {
         return byName.values().stream().flatMap(l -> l.stream().skip(1)).collect(Collectors.toCollection(TreeSet::new));
     }
 
-    private List<Path> getComponentPath(Path dir) {
-        switch (dir.getFileName().toString()) {
-            case "camel-as2":
-                return Collections.singletonList(dir.resolve("camel-as2-component"));
-            case "camel-avro-rpc":
-                return Collections.singletonList(dir.resolve("camel-avro-rpc-component"));
-            case "camel-salesforce":
-                return Collections.singletonList(dir.resolve("camel-salesforce-component"));
-            case "camel-olingo2":
-                return Collections.singletonList(dir.resolve("camel-olingo2-component"));
-            case "camel-olingo4":
-                return Collections.singletonList(dir.resolve("camel-olingo4-component"));
-            case "camel-box":
-                return Collections.singletonList(dir.resolve("camel-box-component"));
-            case "camel-servicenow":
-                return Collections.singletonList(dir.resolve("camel-servicenow-component"));
-            case "camel-fhir":
-                return Collections.singletonList(dir.resolve("camel-fhir-component"));
-            case "camel-infinispan":
-                return Arrays.asList(dir.resolve("camel-infinispan"), dir.resolve("camel-infinispan-embedded"));
-            case "camel-azure":
-                return Arrays.asList(dir.resolve("camel-azure-eventhubs"), dir.resolve("camel-azure-storage-blob"),
-                        dir.resolve("camel-azure-storage-datalake"), dir.resolve("camel-azure-cosmosdb"),
-                        dir.resolve("camel-azure-storage-queue"));
-            case "camel-google":
-                return Arrays.asList(dir.resolve("camel-google-bigquery"), dir.resolve("camel-google-calendar"),
-                        dir.resolve("camel-google-drive"), dir.resolve("camel-google-mail"), dir.resolve("camel-google-pubsub"),
-                        dir.resolve("camel-google-sheets"),
-                        dir.resolve("camel-google-storage"), dir.resolve("camel-google-functions"));
-            case "camel-debezium":
-                return Arrays.asList(dir.resolve("camel-debezium-mongodb"), dir.resolve("camel-debezium-mysql"),
-                        dir.resolve("camel-debezium-postgres"), dir.resolve("camel-debezium-sqlserver"));
-            case "camel-microprofile":
-                return Arrays.asList(dir.resolve("camel-microprofile-config"),
-                        dir.resolve("camel-microprofile-fault-tolerance"),
-                        dir.resolve("camel-microprofile-health"), dir.resolve("camel-microprofile-metrics"));
-            case "camel-test":
-                return Arrays.asList(dir.resolve("camel-test"),
-                        dir.resolve("camel-test-cdi"),
-                        dir.resolve("camel-testcontainers"), dir.resolve("camel-testcontainers-junit5"),
-                        dir.resolve("camel-testcontainers-spring"), dir.resolve("camel-testcontainers-spring-junit5"),
-                        dir.resolve("camel-test-junit5"), dir.resolve("camel-test-spring"),
-                        dir.resolve("camel-test-spring-junit5"));
-            case "camel-aws":
-                return Arrays.asList(dir.resolve("camel-aws2-athena"), dir.resolve("camel-aws2-cw"),
-                        dir.resolve("camel-aws2-ddb"), dir.resolve("camel-aws2-ec2"),
-                        dir.resolve("camel-aws2-ecs"), dir.resolve("camel-aws2-eks"), dir.resolve("camel-aws2-eventbridge"),
-                        dir.resolve("camel-aws2-iam"),
-                        dir.resolve("camel-aws2-kinesis"), dir.resolve("camel-aws2-kms"), dir.resolve("camel-aws2-lambda"),
-                        dir.resolve("camel-aws2-mq"),
-                        dir.resolve("camel-aws2-msk"), dir.resolve("camel-aws2-s3"), dir.resolve("camel-aws2-ses"),
-                        dir.resolve("camel-aws2-sns"),
-                        dir.resolve("camel-aws2-sqs"), dir.resolve("camel-aws2-sts"), dir.resolve("camel-aws2-translate"),
-                        dir.resolve("camel-aws-xray"), dir.resolve("camel-aws-secrets-manager"));
-            case "camel-vertx":
-                return Arrays.asList(dir.resolve("camel-vertx"),
-                        dir.resolve("camel-vertx-http"),
-                        dir.resolve("camel-vertx-kafka").resolve("camel-vertx-kafka-component"),
-                        dir.resolve("camel-vertx-websocket"));
-            case "camel-huawei":
-                return Arrays.asList(dir.resolve("camel-huaweicloud-functiongraph"),
-                        dir.resolve("camel-huaweicloud-smn"),
-                        dir.resolve("camel-huaweicloud-iam"),
-                        dir.resolve("camel-huaweicloud-dms"),
-                        dir.resolve("camel-huaweicloud-imagerecognition"),
-                        dir.resolve("camel-huaweicloud-obs"));
-            default:
-                return Collections.singletonList(dir);
-        }
-    }
-
 }

[camel] 07/08: CAMEL-17194: componentdsl - Prepare for generate only once during project build.

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

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

commit 2b30163cb2f7f9589637fe86664e42193a505840
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 16:10:41 2021 +0100

    CAMEL-17194: componentdsl - Prepare for generate only once during project build.
---
 dsl/camel-componentdsl/pom.xml                     |  52 ++++++++++
 .../camel/maven/packaging/ComponentDslMojo.java    | 110 +++++++--------------
 .../camel/maven/packaging/EndpointDslMojo.java     |   2 +-
 3 files changed, 88 insertions(+), 76 deletions(-)

diff --git a/dsl/camel-componentdsl/pom.xml b/dsl/camel-componentdsl/pom.xml
index 691a8cc..3ee756e 100644
--- a/dsl/camel-componentdsl/pom.xml
+++ b/dsl/camel-componentdsl/pom.xml
@@ -100,4 +100,56 @@
 
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-package-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-component-dsl</id>
+                        <goals>
+                            <goal>generate-component-dsl</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                            <goal>add-resource</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/generated/java</source>
+                            </sources>
+                            <resources>
+                                <resource>
+                                    <directory>src/generated/resources</directory>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!-- The non generated code depends on the generated code,
+                     so skip the first compilation phase -->
+                <artifactId>maven-compiler-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-compile</id>
+                        <phase>none</phase>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
\ No newline at end of file
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ComponentDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ComponentDslMojo.java
index 6c708d6..08a9c8a 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ComponentDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ComponentDslMojo.java
@@ -17,13 +17,10 @@
 package org.apache.camel.maven.packaging;
 
 import java.io.File;
-import java.io.IOError;
-import java.io.IOException;
 import java.io.InputStream;
-import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.ArrayList;
 import java.util.Comparator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -31,15 +28,15 @@ import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
-import java.util.function.Supplier;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import org.apache.camel.maven.packaging.dsl.component.ComponentDslBuilderFactoryGenerator;
 import org.apache.camel.maven.packaging.dsl.component.ComponentsBuilderFactoryGenerator;
 import org.apache.camel.maven.packaging.dsl.component.ComponentsDslMetadataRegistry;
+import org.apache.camel.tooling.model.BaseModel;
 import org.apache.camel.tooling.model.ComponentModel;
 import org.apache.camel.tooling.model.JsonMapper;
+import org.apache.camel.tooling.util.PackageHelper;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -50,6 +47,7 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
+import static org.apache.camel.maven.packaging.MojoHelper.getComponentPath;
 import static org.apache.camel.tooling.util.PackageHelper.findCamelDirectory;
 import static org.apache.camel.tooling.util.PackageHelper.loadText;
 
@@ -104,6 +102,12 @@ public class ComponentDslMojo extends AbstractGeneratorMojo {
     @Parameter(defaultValue = "org.apache.camel.builder.component.dsl")
     protected String componentsDslFactoriesPackageName;
 
+    /**
+     * The components directory where all the Apache Camel components are
+     */
+    @Parameter(defaultValue = "${project.build.directory}/../../../components")
+    protected File componentsDir;
+
     @Override
     public void execute(MavenProject project, MavenProjectHelper projectHelper, BuildContext buildContext)
             throws MojoFailureException, MojoExecutionException {
@@ -132,40 +136,41 @@ public class ComponentDslMojo extends AbstractGeneratorMojo {
             componentsMetadata = outputResourcesDir.toPath().resolve("metadata.json").toFile();
         }
 
-        Map<File, Supplier<String>> files;
-
-        try (Stream<Path> pathStream = Files.find(buildDir.toPath(), Integer.MAX_VALUE, super::isJsonFile)) {
-            files = pathStream.collect(Collectors.toMap(Path::toFile, s -> cache(() -> loadJson(s.toFile()))));
-        } catch (IOException e) {
-            throw new RuntimeException(e.getMessage(), e);
+        List<ComponentModel> models = new ArrayList<>();
+
+        for (File dir : componentsDir.listFiles()) {
+            List<Path> subs = getComponentPath(dir.toPath());
+            for (Path sub : subs) {
+                sub = sub.resolve("src/generated/resources/");
+                PackageHelper.walk(sub).forEach(p -> {
+                    String f = p.getFileName().toString();
+                    if (f.endsWith(PackageHelper.JSON_SUFIX)) {
+                        try {
+                            BaseModel<?> model = JsonMapper.generateModel(p);
+                            if (model instanceof ComponentModel) {
+                                models.add((ComponentModel) model);
+                            }
+                        } catch (Exception e) {
+                            // ignore as its not a camel model
+                        }
+                    }
+                });
+            }
         }
+        models.sort((o1, o2) -> o1.getScheme().compareToIgnoreCase(o2.getScheme()));
 
         Lock lock = LOCKS.computeIfAbsent(root, d -> new ReentrantLock());
         lock.lock();
         try {
-            executeComponent(files);
+            executeComponent(models);
         } finally {
             lock.unlock();
         }
     }
 
-    private void executeComponent(Map<File, Supplier<String>> jsonFiles) throws MojoExecutionException, MojoFailureException {
-        // find the component names
-        Set<String> componentNames = new TreeSet<>();
-        findComponentNames(buildDir, componentNames);
-
-        // create auto configuration for the components
-        if (!componentNames.isEmpty()) {
-            getLog().debug("Found " + componentNames.size() + " components");
-
-            List<ComponentModel> allModels = new LinkedList<>();
-            for (String componentName : componentNames) {
-                String json = loadComponentJson(jsonFiles, componentName);
-                if (json != null) {
-                    ComponentModel model = JsonMapper.generateComponentModel(json);
-                    allModels.add(model);
-                }
-            }
+    private void executeComponent(List<ComponentModel> allModels) throws MojoExecutionException, MojoFailureException {
+        if (!allModels.isEmpty()) {
+            getLog().debug("Found " + allModels.size() + " components");
 
             // Group the models by implementing classes
             Map<String, List<ComponentModel>> grModels
@@ -239,51 +244,6 @@ public class ComponentDslMojo extends AbstractGeneratorMojo {
         }
     }
 
-    protected static String loadJson(File file) {
-        try {
-            return loadText(file);
-        } catch (IOException e) {
-            throw new IOError(e);
-        }
-    }
-
-    protected static String loadComponentJson(Map<File, Supplier<String>> jsonFiles, String componentName) {
-        return loadJsonOfType(jsonFiles, componentName, "component");
-    }
-
-    protected static String loadJsonOfType(Map<File, Supplier<String>> jsonFiles, String modelName, String type) {
-        for (Map.Entry<File, Supplier<String>> entry : jsonFiles.entrySet()) {
-            if (entry.getKey().getName().equals(modelName + ".json")) {
-                String json = entry.getValue().get();
-                if (json.contains("\"kind\": \"" + type + "\"")) {
-                    return json;
-                }
-            }
-        }
-        return null;
-    }
-
-    protected void findComponentNames(File dir, Set<String> componentNames) {
-        File f = new File(dir, "classes/META-INF/services/org/apache/camel/component");
-
-        if (f.exists() && f.isDirectory()) {
-            File[] files = f.listFiles();
-            if (files != null) {
-                for (File file : files) {
-                    // skip directories as there may be a sub .resolver
-                    // directory
-                    if (file.isDirectory()) {
-                        continue;
-                    }
-                    String name = file.getName();
-                    if (name.charAt(0) != '.') {
-                        componentNames.add(name);
-                    }
-                }
-            }
-        }
-    }
-
     protected boolean writeSourceIfChanged(String source, String filePath, String fileName, File outputDir)
             throws MojoFailureException {
         Path target = outputDir.toPath().resolve(filePath).resolve(fileName);
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index a82c663..1534970 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -172,7 +172,7 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
                 });
             }
         }
-        Collections.sort(models, (o1, o2) -> o1.getScheme().compareToIgnoreCase(o2.getScheme()));
+        models.sort((o1, o2) -> o1.getScheme().compareToIgnoreCase(o2.getScheme()));
 
         // generate component endpoint DSL files and write them
         Lock lock = LOCKS.computeIfAbsent(root, d -> new ReentrantLock());

[camel] 04/08: CAMEL-17194: endpointdsl - Prepare for generate only once during project build.

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

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

commit fbb2dda116664825863a84e667e46019449a6ea4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 15:28:04 2021 +0100

    CAMEL-17194: endpointdsl - Prepare for generate only once during project build.
---
 dsl/camel-endpointdsl/pom.xml                      |   2 +-
 .../camel/maven/packaging/EndpointDslMojo.java     | 133 +++++++++++++++------
 2 files changed, 100 insertions(+), 35 deletions(-)

diff --git a/dsl/camel-endpointdsl/pom.xml b/dsl/camel-endpointdsl/pom.xml
index 57cc91e..cbcb82b 100644
--- a/dsl/camel-endpointdsl/pom.xml
+++ b/dsl/camel-endpointdsl/pom.xml
@@ -114,7 +114,7 @@
                 <artifactId>camel-package-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>generate</id>
+                        <id>generate-endpoint-dsl</id>
                         <goals>
                             <goal>generate-endpoint-dsl</goal>
                         </goals>
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index f668dff..e3a68cd 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -17,7 +17,6 @@
 package org.apache.camel.maven.packaging;
 
 import java.io.File;
-import java.io.IOError;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.LineNumberReader;
@@ -26,8 +25,8 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -41,6 +40,7 @@ import java.util.stream.Stream;
 
 import javax.annotation.Generated;
 
+import org.apache.camel.tooling.model.BaseModel;
 import org.apache.camel.tooling.model.ComponentModel;
 import org.apache.camel.tooling.model.ComponentModel.EndpointOptionModel;
 import org.apache.camel.tooling.model.JsonMapper;
@@ -120,6 +120,12 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
     @Parameter
     protected File outputResourcesDir;
 
+    /**
+     * The components directory where all the Apache Camel components are
+     */
+    @Parameter(defaultValue = "${project.build.directory}/../../../components")
+    protected File componentsDir;
+
     @Override
     public void execute(MavenProject project, MavenProjectHelper projectHelper, BuildContext buildContext)
             throws MojoFailureException, MojoExecutionException {
@@ -148,56 +154,115 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
             componentsMetadata = outputResourcesDir.toPath().resolve("metadata.json").toFile();
         }
 
-        Map<File, Supplier<String>> files;
-
-        try (Stream<Path> pathStream = Files.find(buildDir.toPath(), Integer.MAX_VALUE, super::isJsonFile)) {
-            files = pathStream.collect(Collectors.toMap(Path::toFile, s -> cache(() -> loadJson(s.toFile()))));
-        } catch (IOException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        }
+        Collection<Path> allJsonFiles = new TreeSet<>();
+        Stream.of(componentsDir.toPath())
+                .filter(dir -> !"target".equals(dir.getFileName().toString()))
+                .flatMap(p -> getComponentPath(p).stream())
+                .filter(dir -> Files.isDirectory(dir.resolve("src")))
+                .map(p -> p.resolve("target/classes"))
+                .flatMap(PackageHelper::walk).forEach(p -> {
+                    String f = p.getFileName().toString();
+                    if (f.endsWith(PackageHelper.JSON_SUFIX)) {
+                        allJsonFiles.add(p);
+                    }
+                });
+        final Map<Path, BaseModel<?>> allModels
+                = allJsonFiles.stream().collect(Collectors.toMap(p -> p, JsonMapper::generateModel));
+        Set<ComponentModel> models = allJsonFiles.stream()
+                .filter(p -> allModels.get(p) instanceof ComponentModel)
+                .map(p -> (ComponentModel) allModels.get(p))
+                .collect(Collectors.toCollection(TreeSet::new));
 
         // generate component endpoint DSL files and write them
         Lock lock = LOCKS.computeIfAbsent(root, d -> new ReentrantLock());
         lock.lock();
         try {
-            executeComponent(files);
+            executeComponent(models);
         } finally {
             lock.unlock();
         }
     }
 
-    private static String loadJson(File file) {
-        try {
-            return loadText(file);
-        } catch (IOException e) {
-            throw new IOError(e);
+    private List<Path> getComponentPath(Path dir) {
+        switch (dir.getFileName().toString()) {
+            case "camel-as2":
+                return Collections.singletonList(dir.resolve("camel-as2-component"));
+            case "camel-avro-rpc":
+                return Collections.singletonList(dir.resolve("camel-avro-rpc-component"));
+            case "camel-salesforce":
+                return Collections.singletonList(dir.resolve("camel-salesforce-component"));
+            case "camel-olingo2":
+                return Collections.singletonList(dir.resolve("camel-olingo2-component"));
+            case "camel-olingo4":
+                return Collections.singletonList(dir.resolve("camel-olingo4-component"));
+            case "camel-box":
+                return Collections.singletonList(dir.resolve("camel-box-component"));
+            case "camel-servicenow":
+                return Collections.singletonList(dir.resolve("camel-servicenow-component"));
+            case "camel-fhir":
+                return Collections.singletonList(dir.resolve("camel-fhir-component"));
+            case "camel-infinispan":
+                return Arrays.asList(dir.resolve("camel-infinispan"), dir.resolve("camel-infinispan-embedded"));
+            case "camel-azure":
+                return Arrays.asList(dir.resolve("camel-azure-eventhubs"), dir.resolve("camel-azure-storage-blob"),
+                        dir.resolve("camel-azure-storage-datalake"), dir.resolve("camel-azure-cosmosdb"),
+                        dir.resolve("camel-azure-storage-queue"));
+            case "camel-google":
+                return Arrays.asList(dir.resolve("camel-google-bigquery"), dir.resolve("camel-google-calendar"),
+                        dir.resolve("camel-google-drive"), dir.resolve("camel-google-mail"), dir.resolve("camel-google-pubsub"),
+                        dir.resolve("camel-google-sheets"),
+                        dir.resolve("camel-google-storage"), dir.resolve("camel-google-functions"));
+            case "camel-debezium":
+                return Arrays.asList(dir.resolve("camel-debezium-mongodb"), dir.resolve("camel-debezium-mysql"),
+                        dir.resolve("camel-debezium-postgres"), dir.resolve("camel-debezium-sqlserver"));
+            case "camel-microprofile":
+                return Arrays.asList(dir.resolve("camel-microprofile-config"),
+                        dir.resolve("camel-microprofile-fault-tolerance"),
+                        dir.resolve("camel-microprofile-health"), dir.resolve("camel-microprofile-metrics"));
+            case "camel-test":
+                return Arrays.asList(dir.resolve("camel-test"),
+                        dir.resolve("camel-test-cdi"),
+                        dir.resolve("camel-testcontainers"), dir.resolve("camel-testcontainers-junit5"),
+                        dir.resolve("camel-testcontainers-spring"), dir.resolve("camel-testcontainers-spring-junit5"),
+                        dir.resolve("camel-test-junit5"), dir.resolve("camel-test-spring"),
+                        dir.resolve("camel-test-spring-junit5"));
+            case "camel-aws":
+                return Arrays.asList(dir.resolve("camel-aws2-athena"), dir.resolve("camel-aws2-cw"),
+                        dir.resolve("camel-aws2-ddb"), dir.resolve("camel-aws2-ec2"),
+                        dir.resolve("camel-aws2-ecs"), dir.resolve("camel-aws2-eks"), dir.resolve("camel-aws2-eventbridge"),
+                        dir.resolve("camel-aws2-iam"),
+                        dir.resolve("camel-aws2-kinesis"), dir.resolve("camel-aws2-kms"), dir.resolve("camel-aws2-lambda"),
+                        dir.resolve("camel-aws2-mq"),
+                        dir.resolve("camel-aws2-msk"), dir.resolve("camel-aws2-s3"), dir.resolve("camel-aws2-ses"),
+                        dir.resolve("camel-aws2-sns"),
+                        dir.resolve("camel-aws2-sqs"), dir.resolve("camel-aws2-sts"), dir.resolve("camel-aws2-translate"),
+                        dir.resolve("camel-aws-xray"), dir.resolve("camel-aws-secrets-manager"));
+            case "camel-vertx":
+                return Arrays.asList(dir.resolve("camel-vertx"),
+                        dir.resolve("camel-vertx-http"),
+                        dir.resolve("camel-vertx-kafka").resolve("camel-vertx-kafka-component"),
+                        dir.resolve("camel-vertx-websocket"));
+            case "camel-huawei":
+                return Arrays.asList(dir.resolve("camel-huaweicloud-functiongraph"),
+                        dir.resolve("camel-huaweicloud-smn"),
+                        dir.resolve("camel-huaweicloud-iam"),
+                        dir.resolve("camel-huaweicloud-dms"),
+                        dir.resolve("camel-huaweicloud-imagerecognition"),
+                        dir.resolve("camel-huaweicloud-obs"));
+            default:
+                return Collections.singletonList(dir);
         }
     }
 
-    private void executeComponent(Map<File, Supplier<String>> jsonFiles) throws MojoFailureException {
-        // find the component names
-        Set<String> componentNames = new TreeSet<>();
-        findComponentNames(buildDir, componentNames);
-
-        // create auto configuration for the components
-        if (!componentNames.isEmpty()) {
-            getLog().debug("Found " + componentNames.size() + " components");
-
-            List<ComponentModel> allModels = new LinkedList<>();
-            for (String componentName : componentNames) {
-                String json = loadComponentJson(jsonFiles, componentName);
-                if (json != null) {
-                    ComponentModel model = JsonMapper.generateComponentModel(json);
-                    allModels.add(model);
-                }
-            }
+    private void executeComponent(Set<ComponentModel> allModels) throws MojoFailureException {
+        if (!allModels.isEmpty()) {
+            getLog().debug("Found " + allModels.size() + " components");
 
             // Group the models by implementing classes
             Map<String, List<ComponentModel>> grModels
                     = allModels.stream().collect(Collectors.groupingBy(ComponentModel::getJavaType));
             for (List<ComponentModel> compModels : grModels.values()) {
-                ComponentModel model = compModels.get(0); // They should be
-                                                         // equivalent
+                ComponentModel model = compModels.get(0); // They should be equivalent
                 List<String> aliases = compModels.stream().map(ComponentModel::getScheme).sorted().collect(Collectors.toList());
 
                 String overrideComponentName = null;