You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/11/13 07:34:26 UTC
[camel] 01/05: CAMEL-15836 - Camel-AWS2-S3: enable autowire on the
s3 client
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit af55432e1be188f3be3a3253b16f863f58acdbf5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 13 08:20:08 2020 +0100
CAMEL-15836 - Camel-AWS2-S3: enable autowire on the s3 client
---
.../resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc | 4 ++--
.../apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java | 5 +++++
.../org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java | 5 +++++
.../resources/org/apache/camel/component/aws2/s3/aws2-s3.json | 4 ++--
components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc | 4 ++--
.../java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java | 2 ++
.../apache/camel/component/aws2/s3/S3ComponentConfigurationTest.java | 2 +-
docs/components/modules/ROOT/pages/aws2-s3-component.adoc | 4 ++--
8 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
index 08619f1..fa366ec 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
@@ -54,7 +54,7 @@ The AWS 2 S3 Storage Service component supports 42 options, which are listed bel
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
+| *amazonS3Client* (common) | *Autowired* Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
| *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfterRead option enabled and it will create the destinationBucket if it doesn't exist already. | true | boolean
| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean
| *configuration* (common) | The component configuration | | AWS2S3Configuration
@@ -134,7 +134,7 @@ with the following path and query parameters:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
+| *amazonS3Client* (common) | *Autowired* Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
| *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfterRead option enabled and it will create the destinationBucket if it doesn't exist already. | true | boolean
| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean
| *overrideEndpoint* (common) | Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride option | false | boolean
diff --git a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
index 54b6de2..f7f701d 100644
--- a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
+++ b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
@@ -111,6 +111,11 @@ public class AWS2S3ComponentConfigurer extends PropertyConfigurerSupport impleme
}
@Override
+ public String[] getAutowiredNames() {
+ return new String[]{"amazonS3Client"};
+ }
+
+ @Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
case "accesskey":
diff --git a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
index a6063ff..c023c6a 100644
--- a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
+++ b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
@@ -139,6 +139,11 @@ public class AWS2S3EndpointConfigurer extends PropertyConfigurerSupport implemen
}
@Override
+ public String[] getAutowiredNames() {
+ return new String[]{"amazonS3Client"};
+ }
+
+ @Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
case "accesskey":
diff --git a/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json b/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
index c5f9391..2c7b6eb 100644
--- a/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
+++ b/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
@@ -22,7 +22,7 @@
"lenientProperties": false
},
"componentProperties": {
- "amazonS3Client": { "kind": "property", "displayName": "Amazon S3 Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.s3.S3Client", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Reference to a com.amazonaws.services.s3.AmazonS3 in the registry." },
+ "amazonS3Client": { "kind": "property", "displayName": "Amazon S3 Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.s3.S3Client", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Reference to a com.amazonaws.services.s3.AmazonS3 in the registry." },
"autoCreateBucket": { "kind": "property", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfter [...]
"autoDiscoverClient": { "kind": "property", "displayName": "Auto Discover Client", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Setting the autoDiscoverClient mechanism, if true, the component will look for a client ins [...]
"configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configuration" },
@@ -67,7 +67,7 @@
},
"properties": {
"bucketNameOrArn": { "kind": "path", "displayName": "Bucket Name Or Arn", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Bucket name or ARN" },
- "amazonS3Client": { "kind": "parameter", "displayName": "Amazon S3 Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.s3.S3Client", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Reference to a com.amazonaws.services.s3.AmazonS3 in the registry." },
+ "amazonS3Client": { "kind": "parameter", "displayName": "Amazon S3 Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.s3.S3Client", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Reference to a com.amazonaws.services.s3.AmazonS3 in the registry." },
"autoCreateBucket": { "kind": "parameter", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfte [...]
"autoDiscoverClient": { "kind": "parameter", "displayName": "Auto Discover Client", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Setting the autoDiscoverClient mechanism, if true, the component will look for a client in [...]
"overrideEndpoint": { "kind": "parameter", "displayName": "Override Endpoint", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpoi [...]
diff --git a/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc b/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
index 08619f1..fa366ec 100644
--- a/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
+++ b/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
@@ -54,7 +54,7 @@ The AWS 2 S3 Storage Service component supports 42 options, which are listed bel
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
+| *amazonS3Client* (common) | *Autowired* Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
| *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfterRead option enabled and it will create the destinationBucket if it doesn't exist already. | true | boolean
| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean
| *configuration* (common) | The component configuration | | AWS2S3Configuration
@@ -134,7 +134,7 @@ with the following path and query parameters:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
+| *amazonS3Client* (common) | *Autowired* Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
| *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfterRead option enabled and it will create the destinationBucket if it doesn't exist already. | true | boolean
| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean
| *overrideEndpoint* (common) | Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride option | false | boolean
diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
index ebdafdb..36e6ace 100644
--- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
+++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.aws2.s3;
import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriParams;
import software.amazon.awssdk.core.Protocol;
@@ -27,6 +28,7 @@ public class AWS2S3Configuration implements Cloneable {
private String bucketName;
@UriParam
+ @Metadata(autowired = true)
private S3Client amazonS3Client;
@UriParam(label = "security", secret = true)
private String accessKey;
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentConfigurationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentConfigurationTest.java
index b8c0846..cf978ce 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentConfigurationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentConfigurationTest.java
@@ -47,7 +47,7 @@ public class S3ComponentConfigurationTest extends CamelTestSupport {
"aws2-s3://MyBucket?accessKey=RAW(XXX)&secretKey=RAW(XXX)®ion=eu-west-1&autoDiscoverClient=false");
assertEquals("MyBucket", endpoint.getConfiguration().getBucketName());
- assertNotSame(client, endpoint.getConfiguration().getAmazonS3Client());
+ assertSame(client, endpoint.getConfiguration().getAmazonS3Client());
}
@Test
diff --git a/docs/components/modules/ROOT/pages/aws2-s3-component.adoc b/docs/components/modules/ROOT/pages/aws2-s3-component.adoc
index 80a9f95..40e061a 100644
--- a/docs/components/modules/ROOT/pages/aws2-s3-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws2-s3-component.adoc
@@ -56,7 +56,7 @@ The AWS 2 S3 Storage Service component supports 42 options, which are listed bel
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
+| *amazonS3Client* (common) | *Autowired* Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
| *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfterRead option enabled and it will create the destinationBucket if it doesn't exist already. | true | boolean
| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean
| *configuration* (common) | The component configuration | | AWS2S3Configuration
@@ -136,7 +136,7 @@ with the following path and query parameters:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
+| *amazonS3Client* (common) | *Autowired* Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. | | S3Client
| *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket bucketName. This will apply also in case of moveAfterRead option enabled and it will create the destinationBucket if it doesn't exist already. | true | boolean
| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean
| *overrideEndpoint* (common) | Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride option | false | boolean