camel-commits mailing list archives

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


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

Branch: refs/heads/master
Commit: 9e9633e35c9c1e6075ce3f72b290e39bcd073afc
Parents: 194fe32
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Sat Aug 1 10:41:28 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Sat Aug 1 10:41:28 2015 +0200

----------------------------------------------------------------------
 .../component/aws/sdb/SdbConfiguration.java     | 27 ++++++++++++++++++++
 .../camel/component/aws/sdb/SdbEndpoint.java    | 12 ++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9e9633e3/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
index 87669b9..30019ff 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.aws.sdb;
 
 import com.amazonaws.services.simpledb.AmazonSimpleDB;
+
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
@@ -41,6 +42,10 @@ public class SdbConfiguration {
     private boolean consistentRead;
     @UriParam(defaultValue = "PutAttributes")
     private SdbOperations operation = SdbOperations.PutAttributes;
+    @UriParam
+    private String proxyHost;
+    @UriParam
+    private Integer proxyPort;
 
     /**
      * The region with which the AWS-SDB client wants to work with.
@@ -129,4 +134,26 @@ public class SdbConfiguration {
     public void setConsistentRead(boolean consistentRead) {
         this.consistentRead = consistentRead;
     }
+    
+    /**
+     * 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/9e9633e3/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
index 1e1785d..3118dd9 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.aws.sdb;
 
+import com.amazonaws.ClientConfiguration;
 import com.amazonaws.auth.AWSCredentials;
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.services.simpledb.AmazonSimpleDB;
@@ -23,6 +24,7 @@ import com.amazonaws.services.simpledb.AmazonSimpleDBClient;
 import com.amazonaws.services.simpledb.model.CreateDomainRequest;
 import com.amazonaws.services.simpledb.model.DomainMetadataRequest;
 import com.amazonaws.services.simpledb.model.NoSuchDomainException;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
@@ -104,8 +106,16 @@ public class SdbEndpoint extends ScheduledPollEndpoint {
     }
 
     AmazonSimpleDB createSdbClient() {
+        AmazonSimpleDB client = null;
         AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(),
configuration.getSecretKey());
-        AmazonSimpleDB client = new AmazonSimpleDBClient(credentials);
+        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort()))
{
+            ClientConfiguration clientConfiguration = new ClientConfiguration();
+            clientConfiguration.setProxyHost(configuration.getProxyHost());
+            clientConfiguration.setProxyPort(configuration.getProxyPort());
+            client = new AmazonSimpleDBClient(credentials, clientConfiguration);
+        } else {
+            client = new AmazonSimpleDBClient(credentials);
+        }
         return client;
     }
 }


Mime
View raw message