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 2018/02/07 09:44:59 UTC

[camel] 02/10: CAMEL-12234 - Camel-AWS: Since we are using builders, we need to remove the AWS endpoint options on the components that are using them - AWS DDB

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 a18a0dbc8b91df63e724981d41385c3319c44c6e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Feb 7 09:41:30 2018 +0100

    CAMEL-12234 - Camel-AWS: Since we are using builders, we need to remove the AWS endpoint options on the components that are using them - AWS DDB
---
 components/camel-aws/src/main/docs/aws-ddb-component.adoc   |  5 ++---
 .../apache/camel/component/aws/ddb/DdbConfiguration.java    | 13 -------------
 .../org/apache/camel/component/aws/ddb/DdbEndpoint.java     | 10 +++-------
 .../aws/ddb/springboot/DdbComponentConfiguration.java       | 12 ------------
 4 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/components/camel-aws/src/main/docs/aws-ddb-component.adoc b/components/camel-aws/src/main/docs/aws-ddb-component.adoc
index 918d5a6..d98f95c 100644
--- a/components/camel-aws/src/main/docs/aws-ddb-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-ddb-component.adoc
@@ -61,13 +61,12 @@ with the following path and query parameters:
 | *tableName* | *Required* The name of the table currently worked with. |  | String
 |===
 
-==== Query Parameters (14 parameters):
+==== Query Parameters (13 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *amazonDDBClient* (producer) | To use the AmazonDynamoDB as the client |  | AmazonDynamoDB
-| *amazonDdbEndpoint* (producer) | The endpoint with which the AWS-DDB client wants to work with. |  | String
 | *consistentRead* (producer) | Determines whether or not strong consistency should be enforced when data is read. | false | boolean
 | *keyAttributeName* (producer) | Attribute name when creating table |  | String
 | *keyAttributeType* (producer) | Attribute type when creating table |  | String
@@ -340,4 +339,4 @@ where `${camel-version`} must be replaced by the actual version of Camel
 * link:endpoint.html[Endpoint]
 * link:getting-started.html[Getting Started]
 
-* link:aws.html[AWS Component]
\ No newline at end of file
+* link:aws.html[AWS Component]
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
index cecd2c5..f245ec4 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
@@ -36,8 +36,6 @@ public class DdbConfiguration implements Cloneable {
     @UriParam
     private AmazonDynamoDB amazonDDBClient;
     @UriParam
-    private String amazonDdbEndpoint;
-    @UriParam
     private boolean consistentRead;
     @UriParam(defaultValue = "PutItem")
     private DdbOperations operation = DdbOperations.PutItem;
@@ -56,17 +54,6 @@ public class DdbConfiguration implements Cloneable {
     @UriParam
     private String region;
 
-    /**
-     * The endpoint with which the AWS-DDB client wants to work with.
-     */
-    public void setAmazonDdbEndpoint(String amazonDdbEndpoint) {
-        this.amazonDdbEndpoint = amazonDdbEndpoint;
-    }
-
-    public String getAmazonDdbEndpoint() {
-        return amazonDdbEndpoint;
-    }
-
     public String getAccessKey() {
         return accessKey;
     }
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
index 306aa06..f3a65fb 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
@@ -23,6 +23,7 @@ import com.amazonaws.auth.AWSCredentialsProvider;
 import com.amazonaws.auth.AWSStaticCredentialsProvider;
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
+import com.amazonaws.regions.Regions;
 import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
 import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
 import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
@@ -89,10 +90,6 @@ public class DdbEndpoint extends ScheduledPollEndpoint {
         ddbClient = configuration.getAmazonDDBClient() != null ? configuration.getAmazonDDBClient()
             : createDdbClient();
         
-        if (ObjectHelper.isNotEmpty(configuration.getAmazonDdbEndpoint())) {
-            ddbClient.setEndpoint(configuration.getAmazonDdbEndpoint());
-        }
-        
         String tableName = getConfiguration().getTableName();
         LOG.trace("Querying whether table [{}] already exists...", tableName);
 
@@ -163,9 +160,8 @@ public class DdbEndpoint extends ScheduledPollEndpoint {
                 clientBuilder = AmazonDynamoDBClientBuilder.standard().withClientConfiguration(clientConfiguration);
             }
         }
-        if (ObjectHelper.isNotEmpty(configuration.getAmazonDdbEndpoint()) && ObjectHelper.isNotEmpty(configuration.getRegion())) {
-            EndpointConfiguration endpointConfiguration = new EndpointConfiguration(configuration.getAmazonDdbEndpoint(), configuration.getRegion());
-            clientBuilder = clientBuilder.withEndpointConfiguration(endpointConfiguration);
+        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+            clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
         }
         client = clientBuilder.build();
         return client;
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentConfiguration.java
index 1beee46..ac1fd2c 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentConfiguration.java
@@ -103,10 +103,6 @@ public class DdbComponentConfiguration
     public static class DdbConfigurationNestedConfiguration {
         public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.aws.ddb.DdbConfiguration.class;
         /**
-         * The endpoint with which the AWS-DDB client wants to work with.
-         */
-        private String amazonDdbEndpoint;
-        /**
          * Amazon AWS Access Key
          */
         private String accessKey;
@@ -153,14 +149,6 @@ public class DdbComponentConfiguration
         private Integer proxyPort;
         private String region;
 
-        public String getAmazonDdbEndpoint() {
-            return amazonDdbEndpoint;
-        }
-
-        public void setAmazonDdbEndpoint(String amazonDdbEndpoint) {
-            this.amazonDdbEndpoint = amazonDdbEndpoint;
-        }
-
         public String getAccessKey() {
             return accessKey;
         }

-- 
To stop receiving notification emails like this one, please contact
acosentino@apache.org.