camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [5/6] camel git commit: CAMEL-9045 Camel-aws: Make it easier to configure http proxy, aws-ddb component
Date Sat, 01 Aug 2015 09:17:12 GMT
CAMEL-9045 Camel-aws: Make it easier to configure http proxy, aws-ddb component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7b49e8de
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7b49e8de
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7b49e8de

Branch: refs/heads/master
Commit: 7b49e8deabbcf65defbd818d9c1e6e01e21d0562
Parents: c092429
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Sat Aug 1 11:06:39 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Sat Aug 1 11:06:39 2015 +0200

----------------------------------------------------------------------
 .../component/aws/ddb/DdbConfiguration.java     | 26 ++++++++++++++++++++
 .../camel/component/aws/ddb/DdbEndpoint.java    | 14 ++++++++---
 2 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7b49e8de/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
----------------------------------------------------------------------
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 0fb0228..e8060c8 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
@@ -48,6 +48,10 @@ public class DdbConfiguration {
     private String keyAttributeName;
     @UriParam
     private String keyAttributeType;
+    @UriParam
+    private String proxyHost;
+    @UriParam
+    private Integer proxyPort;
 
     /**
      * The region with which the AWS-DDB client wants to work with.
@@ -169,4 +173,26 @@ public class DdbConfiguration {
     public void setKeyAttributeType(String keyAttributeType) {
         this.keyAttributeType = keyAttributeType;
     }
+    
+    /**
+     * To define a proxy host when instantiating the SQS client
+     */
+    public String getProxyHost() {
+        return proxyHost;
+    }
+
+    public void setProxyHost(String proxyHost) {
+        this.proxyHost = proxyHost;
+    }
+
+    /**
+     * To define a proxy port when instantiating the SQS client
+     */
+    public Integer getProxyPort() {
+        return proxyPort;
+    }
+
+    public void setProxyPort(Integer proxyPort) {
+        this.proxyPort = proxyPort;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7b49e8de/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
----------------------------------------------------------------------
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 18dd765..4c471fc 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
@@ -17,6 +17,7 @@
 package org.apache.camel.component.aws.ddb;
 
 import com.amazonaws.AmazonServiceException;
+import com.amazonaws.ClientConfiguration;
 import com.amazonaws.auth.AWSCredentials;
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
@@ -133,9 +134,16 @@ public class DdbEndpoint extends ScheduledPollEndpoint {
     }
 
     AmazonDynamoDB createDdbClient() {
-        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(),
-                configuration.getSecretKey());
-        AmazonDynamoDB client = new AmazonDynamoDBClient(credentials);
+        AmazonDynamoDB client = null;
+        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(),
configuration.getSecretKey());
+        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort()))
{
+            ClientConfiguration clientConfiguration = new ClientConfiguration();
+            clientConfiguration.setProxyHost(configuration.getProxyHost());
+            clientConfiguration.setProxyPort(configuration.getProxyPort());
+            client = new AmazonDynamoDBClient(credentials, clientConfiguration);
+        } else {
+            client = new AmazonDynamoDBClient(credentials);
+        }
         return client;
     }
 


Mime
View raw message