From e7286fa0650f024427b2bb20adddfc049fc67972 Mon Sep 17 00:00:00 2001 From: Claus Ibsen Date: Fri, 8 Mar 2024 15:56:14 +0100 Subject: [PATCH] Duration (#1102) CAMEL-20542: spring boot auto-configuration should not type convert java.time objects. --- .../camel-aws2-cw-starter/src/main/docs/aws2-cw.json | 2 +- .../aws2/cw/springboot/Cw2ComponentConfiguration.java | 2 +- .../aws2/cw/springboot/Cw2ComponentConverter.java | 2 -- .../src/main/docs/azure-servicebus.json | 4 ++-- .../springboot/ServiceBusComponentConfiguration.java | 5 ++--- .../springboot/ServiceBusComponentConverter.java | 4 ---- .../src/main/docs/azure-storage-blob.json | 6 +++--- .../blob/springboot/BlobComponentConfiguration.java | 7 ++----- .../blob/springboot/BlobComponentConverter.java | 4 ---- .../src/main/docs/azure-storage-datalake.json | 2 +- .../springboot/DataLakeComponentConfiguration.java | 2 +- .../springboot/DataLakeComponentConverter.java | 2 -- .../src/main/docs/azure-storage-queue.json | 6 +++--- .../queue/springboot/QueueComponentConfiguration.java | 7 ++----- .../queue/springboot/QueueComponentConverter.java | 2 -- .../camel-consul-starter/src/main/docs/consul.json | 6 +++--- .../springboot/ConsulComponentConfiguration.java | 7 +++---- .../consul/springboot/ConsulComponentConverter.java | 2 -- .../camel-etcd3-starter/src/main/docs/etcd3.json | 8 ++++---- .../etcd3/springboot/Etcd3ComponentConfiguration.java | 11 ++++------- .../etcd3/springboot/Etcd3ComponentConverter.java | 2 -- .../camel-minio-starter/src/main/docs/minio.json | 4 ++-- .../minio/springboot/MinioComponentConfiguration.java | 6 ++---- .../minio/springboot/MinioComponentConverter.java | 2 -- .../camel-qdrant-starter/src/main/docs/qdrant.json | 2 +- .../springboot/QdrantComponentConfiguration.java | 3 +-- .../qdrant/springboot/QdrantComponentConverter.java | 2 -- .../maven/SpringBootAutoConfigurationMojo.java | 9 +++++++++ 28 files changed, 47 insertions(+), 74 deletions(-) diff --git a/components-starter/camel-aws2-cw-starter/src/main/docs/aws2-cw.json b/components-starter/camel-aws2-cw-starter/src/main/docs/aws2-cw.json index d4a5c7ca72d..5f5734afb16 100644 --- a/components-starter/camel-aws2-cw-starter/src/main/docs/aws2-cw.json +++ b/components-starter/camel-aws2-cw-starter/src/main/docs/aws2-cw.json @@ -128,7 +128,7 @@ { "name": "camel.component.aws2-cw.timestamp", "type": "java.time.Instant", - "description": "The metric timestamp. The option is a java.time.Instant type.", + "description": "The metric timestamp", "sourceType": "org.apache.camel.component.aws2.cw.springboot.Cw2ComponentConfiguration" }, { diff --git a/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConfiguration.java b/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConfiguration.java index 8214f82297a..fcce9937464 100644 --- a/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConfiguration.java +++ b/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConfiguration.java @@ -71,7 +71,7 @@ public class Cw2ComponentConfiguration */ private String region; /** - * The metric timestamp. The option is a java.time.Instant type. + * The metric timestamp */ private Instant timestamp; /** diff --git a/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConverter.java b/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConverter.java index 78cc4bba863..b0b6bf26555 100644 --- a/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConverter.java +++ b/components-starter/camel-aws2-cw-starter/src/main/java/org/apache/camel/component/aws2/cw/springboot/Cw2ComponentConverter.java @@ -40,7 +40,6 @@ public class Cw2ComponentConverter implements GenericConverter { public Set getConvertibleTypes() { Set answer = new LinkedHashSet<>(); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.aws2.cw.Cw2Configuration.class)); - answer.add(new ConvertiblePair(String.class, java.time.Instant.class)); answer.add(new ConvertiblePair(String.class, software.amazon.awssdk.services.cloudwatch.CloudWatchClient.class)); return answer; } @@ -59,7 +58,6 @@ public Object convert( ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); switch (targetType.getName()) { case "org.apache.camel.component.aws2.cw.Cw2Configuration": return applicationContext.getBean(ref, org.apache.camel.component.aws2.cw.Cw2Configuration.class); - case "java.time.Instant": return applicationContext.getBean(ref, java.time.Instant.class); case "software.amazon.awssdk.services.cloudwatch.CloudWatchClient": return applicationContext.getBean(ref, software.amazon.awssdk.services.cloudwatch.CloudWatchClient.class); } return null; diff --git a/components-starter/camel-azure-servicebus-starter/src/main/docs/azure-servicebus.json b/components-starter/camel-azure-servicebus-starter/src/main/docs/azure-servicebus.json index 5fede5a7125..544045bb4c2 100644 --- a/components-starter/camel-azure-servicebus-starter/src/main/docs/azure-servicebus.json +++ b/components-starter/camel-azure-servicebus-starter/src/main/docs/azure-servicebus.json @@ -110,7 +110,7 @@ { "name": "camel.component.azure-servicebus.max-auto-lock-renew-duration", "type": "java.time.Duration", - "description": "Sets the amount of time to continue auto-renewing the lock. Setting ZERO disables auto-renewal. For ServiceBus receive mode (RECEIVE_AND_DELETE RECEIVE_AND_DELETE), auto-renewal is disabled. The option is a java.time.Duration type.", + "description": "Sets the amount of time to continue auto-renewing the lock. Setting ZERO disables auto-renewal. For ServiceBus receive mode (RECEIVE_AND_DELETE RECEIVE_AND_DELETE), auto-renewal is disabled.", "sourceType": "org.apache.camel.component.azure.servicebus.springboot.ServiceBusComponentConfiguration" }, { @@ -153,7 +153,7 @@ { "name": "camel.component.azure-servicebus.scheduled-enqueue-time", "type": "java.time.OffsetDateTime", - "description": "Sets OffsetDateTime at which the message should appear in the Service Bus queue or topic. The option is a java.time.OffsetDateTime type.", + "description": "Sets OffsetDateTime at which the message should appear in the Service Bus queue or topic.", "sourceType": "org.apache.camel.component.azure.servicebus.springboot.ServiceBusComponentConfiguration" }, { diff --git a/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConfiguration.java b/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConfiguration.java index df76ce52c46..f33973a4fd8 100644 --- a/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConfiguration.java +++ b/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConfiguration.java @@ -113,8 +113,7 @@ public class ServiceBusComponentConfiguration /** * Sets the amount of time to continue auto-renewing the lock. Setting ZERO * disables auto-renewal. For ServiceBus receive mode (RECEIVE_AND_DELETE - * RECEIVE_AND_DELETE), auto-renewal is disabled. The option is a - * java.time.Duration type. + * RECEIVE_AND_DELETE), auto-renewal is disabled. */ private Duration maxAutoLockRenewDuration; /** @@ -178,7 +177,7 @@ public class ServiceBusComponentConfiguration private ServiceBusProducerOperationDefinition producerOperation = ServiceBusProducerOperationDefinition.sendMessages; /** * Sets OffsetDateTime at which the message should appear in the Service Bus - * queue or topic. The option is a java.time.OffsetDateTime type. + * queue or topic. */ private OffsetDateTime scheduledEnqueueTime; /** diff --git a/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConverter.java b/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConverter.java index d7cced17fee..dbfaed50b2b 100644 --- a/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConverter.java +++ b/components-starter/camel-azure-servicebus-starter/src/main/java/org/apache/camel/component/azure/servicebus/springboot/ServiceBusComponentConverter.java @@ -43,9 +43,7 @@ public Set getConvertibleTypes() { answer.add(new ConvertiblePair(String.class, com.azure.core.util.ClientOptions.class)); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.azure.servicebus.ServiceBusConfiguration.class)); answer.add(new ConvertiblePair(String.class, com.azure.core.amqp.ProxyOptions.class)); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); answer.add(new ConvertiblePair(String.class, com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient.class)); - answer.add(new ConvertiblePair(String.class, java.time.OffsetDateTime.class)); answer.add(new ConvertiblePair(String.class, com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.class)); answer.add(new ConvertiblePair(String.class, com.azure.messaging.servicebus.ServiceBusTransactionContext.class)); answer.add(new ConvertiblePair(String.class, com.azure.core.credential.TokenCredential.class)); @@ -69,9 +67,7 @@ public Object convert( case "com.azure.core.util.ClientOptions": return applicationContext.getBean(ref, com.azure.core.util.ClientOptions.class); case "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration": return applicationContext.getBean(ref, org.apache.camel.component.azure.servicebus.ServiceBusConfiguration.class); case "com.azure.core.amqp.ProxyOptions": return applicationContext.getBean(ref, com.azure.core.amqp.ProxyOptions.class); - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); case "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient": return applicationContext.getBean(ref, com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient.class); - case "java.time.OffsetDateTime": return applicationContext.getBean(ref, java.time.OffsetDateTime.class); case "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient": return applicationContext.getBean(ref, com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.class); case "com.azure.messaging.servicebus.ServiceBusTransactionContext": return applicationContext.getBean(ref, com.azure.messaging.servicebus.ServiceBusTransactionContext.class); case "com.azure.core.credential.TokenCredential": return applicationContext.getBean(ref, com.azure.core.credential.TokenCredential.class); diff --git a/components-starter/camel-azure-storage-blob-starter/src/main/docs/azure-storage-blob.json b/components-starter/camel-azure-storage-blob-starter/src/main/docs/azure-storage-blob.json index 1dd76eb9f4a..69e8c974d4d 100644 --- a/components-starter/camel-azure-storage-blob-starter/src/main/docs/azure-storage-blob.json +++ b/components-starter/camel-azure-storage-blob-starter/src/main/docs/azure-storage-blob.json @@ -74,13 +74,13 @@ { "name": "camel.component.azure-storage-blob.change-feed-end-time", "type": "java.time.OffsetDateTime", - "description": "When using getChangeFeed producer operation, this filters the results to return events approximately before the end time. Note: A few events belonging to the next hour can also be returned. A few events belonging to this hour can be missing; to ensure all events from the hour are returned, round the end time up by an hour. The option is a java.time.OffsetDateTime type.", + "description": "When using getChangeFeed producer operation, this filters the results to return events approximately before the end time. Note: A few events belonging to the next hour can also be returned. A few events belonging to this hour can be missing; to ensure all events from the hour are returned, round the end time up by an hour.", "sourceType": "org.apache.camel.component.azure.storage.blob.springboot.BlobComponentConfiguration" }, { "name": "camel.component.azure-storage-blob.change-feed-start-time", "type": "java.time.OffsetDateTime", - "description": "When using getChangeFeed producer operation, this filters the results to return events approximately after the start time. Note: A few events belonging to the previous hour can also be returned. A few events belonging to this hour can be missing; to ensure all events from the hour are returned, round the start time down by an hour. The option is a java.time.OffsetDateTime type.", + "description": "When using getChangeFeed producer operation, this filters the results to return events approximately after the start time. Note: A few events belonging to the previous hour can also be returned. A few events belonging to this hour can be missing; to ensure all events from the hour are returned, round the start time down by an hour.", "sourceType": "org.apache.camel.component.azure.storage.blob.springboot.BlobComponentConfiguration" }, { @@ -245,7 +245,7 @@ { "name": "camel.component.azure-storage-blob.timeout", "type": "java.time.Duration", - "description": "An optional timeout value beyond which a RuntimeException will be raised. The option is a java.time.Duration type.", + "description": "An optional timeout value beyond which a RuntimeException will be raised.", "sourceType": "org.apache.camel.component.azure.storage.blob.springboot.BlobComponentConfiguration" } ], diff --git a/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConfiguration.java b/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConfiguration.java index 089c848a83c..f5f624a4e6b 100644 --- a/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConfiguration.java +++ b/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConfiguration.java @@ -129,7 +129,6 @@ public class BlobComponentConfiguration private BlobServiceClient serviceClient; /** * An optional timeout value beyond which a RuntimeException will be raised. - * The option is a java.time.Duration type. */ private Duration timeout; /** @@ -166,8 +165,7 @@ public class BlobComponentConfiguration * return events approximately before the end time. Note: A few events * belonging to the next hour can also be returned. A few events belonging * to this hour can be missing; to ensure all events from the hour are - * returned, round the end time up by an hour. The option is a - * java.time.OffsetDateTime type. + * returned, round the end time up by an hour. */ private OffsetDateTime changeFeedEndTime; /** @@ -175,8 +173,7 @@ public class BlobComponentConfiguration * return events approximately after the start time. Note: A few events * belonging to the previous hour can also be returned. A few events * belonging to this hour can be missing; to ensure all events from the hour - * are returned, round the start time down by an hour. The option is a - * java.time.OffsetDateTime type. + * are returned, round the start time down by an hour. */ private OffsetDateTime changeFeedStartTime; /** diff --git a/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConverter.java b/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConverter.java index a8c6c717581..d6588f26c16 100644 --- a/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConverter.java +++ b/components-starter/camel-azure-storage-blob-starter/src/main/java/org/apache/camel/component/azure/storage/blob/springboot/BlobComponentConverter.java @@ -42,9 +42,7 @@ public Set getConvertibleTypes() { answer.add(new ConvertiblePair(String.class, org.apache.camel.component.azure.storage.blob.BlobConfiguration.class)); answer.add(new ConvertiblePair(String.class, com.azure.storage.common.StorageSharedKeyCredential.class)); answer.add(new ConvertiblePair(String.class, com.azure.storage.blob.BlobServiceClient.class)); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); answer.add(new ConvertiblePair(String.class, com.azure.core.util.Context.class)); - answer.add(new ConvertiblePair(String.class, java.time.OffsetDateTime.class)); return answer; } @@ -64,9 +62,7 @@ public Object convert( case "org.apache.camel.component.azure.storage.blob.BlobConfiguration": return applicationContext.getBean(ref, org.apache.camel.component.azure.storage.blob.BlobConfiguration.class); case "com.azure.storage.common.StorageSharedKeyCredential": return applicationContext.getBean(ref, com.azure.storage.common.StorageSharedKeyCredential.class); case "com.azure.storage.blob.BlobServiceClient": return applicationContext.getBean(ref, com.azure.storage.blob.BlobServiceClient.class); - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); case "com.azure.core.util.Context": return applicationContext.getBean(ref, com.azure.core.util.Context.class); - case "java.time.OffsetDateTime": return applicationContext.getBean(ref, java.time.OffsetDateTime.class); } return null; } diff --git a/components-starter/camel-azure-storage-datalake-starter/src/main/docs/azure-storage-datalake.json b/components-starter/camel-azure-storage-datalake-starter/src/main/docs/azure-storage-datalake.json index eb21f914c2f..149e659bab6 100644 --- a/components-starter/camel-azure-storage-datalake-starter/src/main/docs/azure-storage-datalake.json +++ b/components-starter/camel-azure-storage-datalake-starter/src/main/docs/azure-storage-datalake.json @@ -242,7 +242,7 @@ { "name": "camel.component.azure-storage-datalake.timeout", "type": "java.time.Duration", - "description": "Timeout for operation. The option is a java.time.Duration type.", + "description": "Timeout for operation", "sourceType": "org.apache.camel.component.azure.storage.datalake.springboot.DataLakeComponentConfiguration" }, { diff --git a/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConfiguration.java b/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConfiguration.java index 4423032ff67..0d2211a4e07 100644 --- a/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConfiguration.java +++ b/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConfiguration.java @@ -148,7 +148,7 @@ public class DataLakeComponentConfiguration */ private String tenantId; /** - * Timeout for operation. The option is a java.time.Duration type. + * Timeout for operation */ private Duration timeout; /** diff --git a/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConverter.java b/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConverter.java index 8f0057b0f84..97887396ae5 100644 --- a/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConverter.java +++ b/components-starter/camel-azure-storage-datalake-starter/src/main/java/org/apache/camel/component/azure/storage/datalake/springboot/DataLakeComponentConverter.java @@ -42,7 +42,6 @@ public Set getConvertibleTypes() { answer.add(new ConvertiblePair(String.class, org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration.class)); answer.add(new ConvertiblePair(String.class, com.azure.storage.file.datalake.DataLakeServiceClient.class)); answer.add(new ConvertiblePair(String.class, com.azure.storage.common.StorageSharedKeyCredential.class)); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); answer.add(new ConvertiblePair(String.class, com.azure.identity.ClientSecretCredential.class)); answer.add(new ConvertiblePair(String.class, com.azure.core.credential.AzureSasCredential.class)); return answer; @@ -64,7 +63,6 @@ public Object convert( case "org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration": return applicationContext.getBean(ref, org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration.class); case "com.azure.storage.file.datalake.DataLakeServiceClient": return applicationContext.getBean(ref, com.azure.storage.file.datalake.DataLakeServiceClient.class); case "com.azure.storage.common.StorageSharedKeyCredential": return applicationContext.getBean(ref, com.azure.storage.common.StorageSharedKeyCredential.class); - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); case "com.azure.identity.ClientSecretCredential": return applicationContext.getBean(ref, com.azure.identity.ClientSecretCredential.class); case "com.azure.core.credential.AzureSasCredential": return applicationContext.getBean(ref, com.azure.core.credential.AzureSasCredential.class); } diff --git a/components-starter/camel-azure-storage-queue-starter/src/main/docs/azure-storage-queue.json b/components-starter/camel-azure-storage-queue-starter/src/main/docs/azure-storage-queue.json index d4b6b1e5d43..650a7720850 100644 --- a/components-starter/camel-azure-storage-queue-starter/src/main/docs/azure-storage-queue.json +++ b/components-starter/camel-azure-storage-queue-starter/src/main/docs/azure-storage-queue.json @@ -124,19 +124,19 @@ { "name": "camel.component.azure-storage-queue.time-to-live", "type": "java.time.Duration", - "description": "How long the message will stay alive in the queue. If unset the value will default to 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. The format should be in this form: PnDTnHnMn.nS., e.g: PT20.345S -- parses as 20.345 seconds, P2D -- parses as 2 days However, in case you are using EndpointDsl\/ComponentDsl, you can do something like Duration.ofSeconds() since these Java APIs are typesafe. The option is a java.time.Duration type.", + "description": "How long the message will stay alive in the queue. If unset the value will default to 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. The format should be in this form: PnDTnHnMn.nS., e.g: PT20.345S -- parses as 20.345 seconds, P2D -- parses as 2 days However, in case you are using EndpointDsl\/ComponentDsl, you can do something like Duration.ofSeconds() since these Java APIs are typesafe.", "sourceType": "org.apache.camel.component.azure.storage.queue.springboot.QueueComponentConfiguration" }, { "name": "camel.component.azure-storage-queue.timeout", "type": "java.time.Duration", - "description": "An optional timeout applied to the operation. If a response is not returned before the timeout concludes a RuntimeException will be thrown. The option is a java.time.Duration type.", + "description": "An optional timeout applied to the operation. If a response is not returned before the timeout concludes a RuntimeException will be thrown.", "sourceType": "org.apache.camel.component.azure.storage.queue.springboot.QueueComponentConfiguration" }, { "name": "camel.component.azure-storage-queue.visibility-timeout", "type": "java.time.Duration", - "description": "The timeout period for how long the message is invisible in the queue. The timeout must be between 1 seconds and 7 days. The format should be in this form: PnDTnHnMn.nS., e.g: PT20.345S -- parses as 20.345 seconds, P2D -- parses as 2 days However, in case you are using EndpointDsl\/ComponentDsl, you can do something like Duration.ofSeconds() since these Java APIs are typesafe. The option is a java.time.Duration type.", + "description": "The timeout period for how long the message is invisible in the queue. The timeout must be between 1 seconds and 7 days. The format should be in this form: PnDTnHnMn.nS., e.g: PT20.345S -- parses as 20.345 seconds, P2D -- parses as 2 days However, in case you are using EndpointDsl\/ComponentDsl, you can do something like Duration.ofSeconds() since these Java APIs are typesafe.", "sourceType": "org.apache.camel.component.azure.storage.queue.springboot.QueueComponentConfiguration" } ], diff --git a/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConfiguration.java b/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConfiguration.java index 06b129194e7..ba43ddc1f13 100644 --- a/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConfiguration.java +++ b/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConfiguration.java @@ -134,7 +134,6 @@ public class QueueComponentConfiguration /** * An optional timeout applied to the operation. If a response is not * returned before the timeout concludes a RuntimeException will be thrown. - * The option is a java.time.Duration type. */ private Duration timeout; /** @@ -144,8 +143,7 @@ public class QueueComponentConfiguration * this form: PnDTnHnMn.nS., e.g: PT20.345S -- parses as 20.345 seconds, P2D * -- parses as 2 days However, in case you are using * EndpointDsl/ComponentDsl, you can do something like Duration.ofSeconds() - * since these Java APIs are typesafe. The option is a java.time.Duration - * type. + * since these Java APIs are typesafe. */ private Duration timeToLive; /** @@ -154,8 +152,7 @@ public class QueueComponentConfiguration * this form: PnDTnHnMn.nS., e.g: PT20.345S -- parses as 20.345 seconds, P2D * -- parses as 2 days However, in case you are using * EndpointDsl/ComponentDsl, you can do something like Duration.ofSeconds() - * since these Java APIs are typesafe. The option is a java.time.Duration - * type. + * since these Java APIs are typesafe. */ private Duration visibilityTimeout; /** diff --git a/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConverter.java b/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConverter.java index 5f6ef0eb975..2c02863babc 100644 --- a/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConverter.java +++ b/components-starter/camel-azure-storage-queue-starter/src/main/java/org/apache/camel/component/azure/storage/queue/springboot/QueueComponentConverter.java @@ -41,7 +41,6 @@ public Set getConvertibleTypes() { Set answer = new LinkedHashSet<>(); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.azure.storage.queue.QueueConfiguration.class)); answer.add(new ConvertiblePair(String.class, com.azure.storage.queue.QueueServiceClient.class)); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); answer.add(new ConvertiblePair(String.class, com.azure.storage.common.StorageSharedKeyCredential.class)); return answer; } @@ -61,7 +60,6 @@ public Object convert( switch (targetType.getName()) { case "org.apache.camel.component.azure.storage.queue.QueueConfiguration": return applicationContext.getBean(ref, org.apache.camel.component.azure.storage.queue.QueueConfiguration.class); case "com.azure.storage.queue.QueueServiceClient": return applicationContext.getBean(ref, com.azure.storage.queue.QueueServiceClient.class); - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); case "com.azure.storage.common.StorageSharedKeyCredential": return applicationContext.getBean(ref, com.azure.storage.common.StorageSharedKeyCredential.class); } return null; diff --git a/components-starter/camel-consul-starter/src/main/docs/consul.json b/components-starter/camel-consul-starter/src/main/docs/consul.json index bb4cfda9226..cede3f91035 100644 --- a/components-starter/camel-consul-starter/src/main/docs/consul.json +++ b/components-starter/camel-consul-starter/src/main/docs/consul.json @@ -396,7 +396,7 @@ { "name": "camel.component.consul.connect-timeout", "type": "java.time.Duration", - "description": "Connect timeout for OkHttpClient. The option is a java.time.Duration type.", + "description": "Connect timeout for OkHttpClient", "sourceType": "org.apache.camel.component.consul.springboot.ConsulComponentConfiguration" }, { @@ -475,7 +475,7 @@ { "name": "camel.component.consul.read-timeout", "type": "java.time.Duration", - "description": "Read timeout for OkHttpClient. The option is a java.time.Duration type.", + "description": "Read timeout for OkHttpClient", "sourceType": "org.apache.camel.component.consul.springboot.ConsulComponentConfiguration" }, { @@ -526,7 +526,7 @@ { "name": "camel.component.consul.write-timeout", "type": "java.time.Duration", - "description": "Write timeout for OkHttpClient. The option is a java.time.Duration type.", + "description": "Write timeout for OkHttpClient", "sourceType": "org.apache.camel.component.consul.springboot.ConsulComponentConfiguration" }, { diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java index 88ecb890c5c..4f26c7a48d2 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java @@ -43,8 +43,7 @@ public class ConsulComponentConfiguration */ private Boolean enabled; /** - * Connect timeout for OkHttpClient. The option is a java.time.Duration - * type. + * Connect timeout for OkHttpClient */ private Duration connectTimeout; /** @@ -62,7 +61,7 @@ public class ConsulComponentConfiguration */ private Boolean pingInstance = true; /** - * Read timeout for OkHttpClient. The option is a java.time.Duration type. + * Read timeout for OkHttpClient */ private Duration readTimeout; /** @@ -74,7 +73,7 @@ public class ConsulComponentConfiguration */ private String url; /** - * Write timeout for OkHttpClient. The option is a java.time.Duration type. + * Write timeout for OkHttpClient */ private Duration writeTimeout; /** diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConverter.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConverter.java index 5b81200dcc3..a68947a903b 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConverter.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConverter.java @@ -39,7 +39,6 @@ public class ConsulComponentConverter implements GenericConverter { public Set getConvertibleTypes() { Set answer = new LinkedHashSet<>(); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); answer.add(new ConvertiblePair(String.class, org.kiwiproject.consul.Consul.class)); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.consul.ConsulConfiguration.class)); answer.add(new ConvertiblePair(String.class, org.apache.camel.support.jsse.SSLContextParameters.class)); @@ -60,7 +59,6 @@ public Object convert( } ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); switch (targetType.getName()) { - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); case "org.kiwiproject.consul.Consul": return applicationContext.getBean(ref, org.kiwiproject.consul.Consul.class); case "org.apache.camel.component.consul.ConsulConfiguration": return applicationContext.getBean(ref, org.apache.camel.component.consul.ConsulConfiguration.class); case "org.apache.camel.support.jsse.SSLContextParameters": return applicationContext.getBean(ref, org.apache.camel.support.jsse.SSLContextParameters.class); diff --git a/components-starter/camel-etcd3-starter/src/main/docs/etcd3.json b/components-starter/camel-etcd3-starter/src/main/docs/etcd3.json index 4cc86a9da53..ba9cd8dc4b2 100644 --- a/components-starter/camel-etcd3-starter/src/main/docs/etcd3.json +++ b/components-starter/camel-etcd3-starter/src/main/docs/etcd3.json @@ -48,7 +48,7 @@ { "name": "camel.component.etcd3.connection-timeout", "type": "java.time.Duration", - "description": "Configure the connection timeout. The option is a java.time.Duration type.", + "description": "Configure the connection timeout.", "sourceType": "org.apache.camel.component.etcd3.springboot.Etcd3ComponentConfiguration" }, { @@ -84,13 +84,13 @@ { "name": "camel.component.etcd3.keep-alive-time", "type": "java.time.Duration", - "description": "Configure the interval for gRPC keepalives. The current minimum allowed by gRPC is 10 seconds. The option is a java.time.Duration type.", + "description": "Configure the interval for gRPC keepalives. The current minimum allowed by gRPC is 10 seconds.", "sourceType": "org.apache.camel.component.etcd3.springboot.Etcd3ComponentConfiguration" }, { "name": "camel.component.etcd3.keep-alive-timeout", "type": "java.time.Duration", - "description": "Configure the timeout for gRPC keepalives. The option is a java.time.Duration type.", + "description": "Configure the timeout for gRPC keepalives.", "sourceType": "org.apache.camel.component.etcd3.springboot.Etcd3ComponentConfiguration" }, { @@ -155,7 +155,7 @@ { "name": "camel.component.etcd3.retry-max-duration", "type": "java.time.Duration", - "description": "Configure the retries max duration. The option is a java.time.Duration type.", + "description": "Configure the retries max duration.", "sourceType": "org.apache.camel.component.etcd3.springboot.Etcd3ComponentConfiguration" }, { diff --git a/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConfiguration.java b/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConfiguration.java index 86fbdce202c..cbc75d2f2ff 100644 --- a/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConfiguration.java +++ b/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConfiguration.java @@ -111,8 +111,7 @@ public class Etcd3ComponentConfiguration */ private Boolean autowiredEnabled = true; /** - * Configure the connection timeout. The option is a java.time.Duration - * type. + * Configure the connection timeout. */ private Duration connectionTimeout; /** @@ -121,12 +120,11 @@ public class Etcd3ComponentConfiguration private Map headers; /** * Configure the interval for gRPC keepalives. The current minimum allowed - * by gRPC is 10 seconds. The option is a java.time.Duration type. + * by gRPC is 10 seconds. */ private Duration keepAliveTime; /** - * Configure the timeout for gRPC keepalives. The option is a - * java.time.Duration type. + * Configure the timeout for gRPC keepalives. */ private Duration keepAliveTimeout; /** @@ -146,8 +144,7 @@ public class Etcd3ComponentConfiguration */ private Long retryMaxDelay = 2500L; /** - * Configure the retries max duration. The option is a java.time.Duration - * type. + * Configure the retries max duration. */ private Duration retryMaxDuration; /** diff --git a/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConverter.java b/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConverter.java index 062cf6d0ae0..5286b44952a 100644 --- a/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConverter.java +++ b/components-starter/camel-etcd3-starter/src/main/java/org/apache/camel/component/etcd3/springboot/Etcd3ComponentConverter.java @@ -40,7 +40,6 @@ public class Etcd3ComponentConverter implements GenericConverter { public Set getConvertibleTypes() { Set answer = new LinkedHashSet<>(); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.etcd3.Etcd3Configuration.class)); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); answer.add(new ConvertiblePair(String.class, io.netty.handler.ssl.SslContext.class)); return answer; } @@ -59,7 +58,6 @@ public Object convert( ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); switch (targetType.getName()) { case "org.apache.camel.component.etcd3.Etcd3Configuration": return applicationContext.getBean(ref, org.apache.camel.component.etcd3.Etcd3Configuration.class); - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); case "io.netty.handler.ssl.SslContext": return applicationContext.getBean(ref, io.netty.handler.ssl.SslContext.class); } return null; diff --git a/components-starter/camel-minio-starter/src/main/docs/minio.json b/components-starter/camel-minio-starter/src/main/docs/minio.json index ab1484eed2c..8fcab2e5992 100644 --- a/components-starter/camel-minio-starter/src/main/docs/minio.json +++ b/components-starter/camel-minio-starter/src/main/docs/minio.json @@ -205,7 +205,7 @@ { "name": "camel.component.minio.modified-since", "type": "java.time.ZonedDateTime", - "description": "Set modified since parameter for get object(s). The option is a java.time.ZonedDateTime type.", + "description": "Set modified since parameter for get object(s).", "sourceType": "org.apache.camel.component.minio.springboot.MinioComponentConfiguration" }, { @@ -324,7 +324,7 @@ { "name": "camel.component.minio.un-modified-since", "type": "java.time.ZonedDateTime", - "description": "Set un modified since parameter for get object(s). The option is a java.time.ZonedDateTime type.", + "description": "Set un modified since parameter for get object(s).", "sourceType": "org.apache.camel.component.minio.springboot.MinioComponentConfiguration" }, { diff --git a/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConfiguration.java b/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConfiguration.java index 02b9635253c..46b22faf436 100644 --- a/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConfiguration.java +++ b/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConfiguration.java @@ -193,8 +193,7 @@ public class MinioComponentConfiguration */ private Integer maxMessagesPerPoll = 10; /** - * Set modified since parameter for get object(s). The option is a - * java.time.ZonedDateTime type. + * Set modified since parameter for get object(s). */ private ZonedDateTime modifiedSince; /** @@ -229,8 +228,7 @@ public class MinioComponentConfiguration */ private String startAfter; /** - * Set un modified since parameter for get object(s). The option is a - * java.time.ZonedDateTime type. + * Set un modified since parameter for get object(s). */ private ZonedDateTime unModifiedSince; /** diff --git a/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConverter.java b/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConverter.java index aa47ed396a3..2705b7e4035 100644 --- a/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConverter.java +++ b/components-starter/camel-minio-starter/src/main/java/org/apache/camel/component/minio/springboot/MinioComponentConverter.java @@ -44,7 +44,6 @@ public Set getConvertibleTypes() { answer.add(new ConvertiblePair(String.class, io.minio.MinioClient.class)); answer.add(new ConvertiblePair(String.class, io.minio.ServerSideEncryption.class)); answer.add(new ConvertiblePair(String.class, io.minio.ServerSideEncryptionCustomerKey.class)); - answer.add(new ConvertiblePair(String.class, java.time.ZonedDateTime.class)); return answer; } @@ -66,7 +65,6 @@ public Object convert( case "io.minio.MinioClient": return applicationContext.getBean(ref, io.minio.MinioClient.class); case "io.minio.ServerSideEncryption": return applicationContext.getBean(ref, io.minio.ServerSideEncryption.class); case "io.minio.ServerSideEncryptionCustomerKey": return applicationContext.getBean(ref, io.minio.ServerSideEncryptionCustomerKey.class); - case "java.time.ZonedDateTime": return applicationContext.getBean(ref, java.time.ZonedDateTime.class); } return null; } diff --git a/components-starter/camel-qdrant-starter/src/main/docs/qdrant.json b/components-starter/camel-qdrant-starter/src/main/docs/qdrant.json index 40a07bcce71..dbaf7c98f30 100644 --- a/components-starter/camel-qdrant-starter/src/main/docs/qdrant.json +++ b/components-starter/camel-qdrant-starter/src/main/docs/qdrant.json @@ -67,7 +67,7 @@ { "name": "camel.component.qdrant.timeout", "type": "java.time.Duration", - "description": "Sets a default timeout for all requests. The option is a java.time.Duration type.", + "description": "Sets a default timeout for all requests", "sourceType": "org.apache.camel.component.qdrant.springboot.QdrantComponentConfiguration" }, { diff --git a/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConfiguration.java b/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConfiguration.java index dd1b9a77a26..a4cc20b4c0a 100644 --- a/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConfiguration.java +++ b/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConfiguration.java @@ -65,8 +65,7 @@ public class QdrantComponentConfiguration */ private Integer port = 6334; /** - * Sets a default timeout for all requests. The option is a - * java.time.Duration type. + * Sets a default timeout for all requests */ private Duration timeout; /** diff --git a/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConverter.java b/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConverter.java index bab122c30d1..699348b2355 100644 --- a/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConverter.java +++ b/components-starter/camel-qdrant-starter/src/main/java/org/apache/camel/component/qdrant/springboot/QdrantComponentConverter.java @@ -40,7 +40,6 @@ public class QdrantComponentConverter implements GenericConverter { public Set getConvertibleTypes() { Set answer = new LinkedHashSet<>(); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.qdrant.QdrantConfiguration.class)); - answer.add(new ConvertiblePair(String.class, java.time.Duration.class)); return answer; } @@ -58,7 +57,6 @@ public Object convert( ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); switch (targetType.getName()) { case "org.apache.camel.component.qdrant.QdrantConfiguration": return applicationContext.getBean(ref, org.apache.camel.component.qdrant.QdrantConfiguration.class); - case "java.time.Duration": return applicationContext.getBean(ref, java.time.Duration.class); } return null; } diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java index 48334bcc709..e0b686d4547 100644 --- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java +++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java @@ -747,6 +747,10 @@ private boolean isComplexTypeOrDuration(ComponentOptionModel option) { if (option.getJavaType().startsWith("java.util.Map") || option.getJavaType().startsWith("java.util.List") || option.getJavaType().startsWith("java.util.Set")) { return false; } + // we can configure java.time types from spring-boot so do not regard them as complex + if (option.getJavaType().startsWith("java.time")) { + return false; + } // all the object types are complex return "object".equals(option.getType()) || "duration".equals(option.getType()); } @@ -756,6 +760,11 @@ private boolean isComplexType(ComponentOptionModel option) { if (option.getJavaType().startsWith("java.util.Map") || option.getJavaType().startsWith("java.util.List") || option.getJavaType().startsWith("java.util.Set")) { return false; } + // we can configure java.time types from spring-boot so do not regard them as complex + if (option.getJavaType().startsWith("java.time")) { + return false; + } + // enums are not complex if (option.getEnums() != null && !option.getEnums().isEmpty()) { return false;