camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-8753: camel-twitter allow to configure http proxy on component level. Remove not in use options. Component docs.
Date Thu, 07 May 2015 08:14:06 GMT
CAMEL-8753: camel-twitter allow to configure http proxy on component level. Remove not in use
options. Component docs.


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

Branch: refs/heads/master
Commit: 2b12e0c1de4005c0d92e2362913dc251b41ec394
Parents: 6d96d68
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu May 7 10:16:50 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu May 7 10:16:50 2015 +0200

----------------------------------------------------------------------
 .../apache/camel/component/fop/FopEndpoint.java |   9 +
 .../component/twitter/TwitterComponent.java     |  66 ++++++
 .../component/twitter/TwitterConfiguration.java | 203 ++++++++-----------
 .../twitter/TwitterEndpointDirect.java          |  10 -
 .../twitter/TwitterEndpointPolling.java         |  10 -
 5 files changed, 162 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2b12e0c1/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
index 898d6af..1ea5823 100644
--- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
+++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
@@ -65,6 +65,9 @@ public class FopEndpoint extends DefaultEndpoint {
         return outputFormat;
     }
 
+    /**
+     * The primary output format is PDF but other output formats are also supported.
+     */
     public void setOutputFormat(String outputFormat) {
         this.outputFormat = outputFormat;
     }
@@ -73,6 +76,9 @@ public class FopEndpoint extends DefaultEndpoint {
         return userConfigURL;
     }
 
+    /**
+     * The location of a configuration file which can be loaded from classpath or file system.
+     */
     public void setUserConfigURL(String userConfigURL) {
         this.userConfigURL = userConfigURL;
     }
@@ -81,6 +87,9 @@ public class FopEndpoint extends DefaultEndpoint {
         return fopFactory;
     }
 
+    /**
+     * Allows to use a custom configured or implementation of org.apache.fop.apps.FopFactory.
+     */
     public void setFopFactory(FopFactory fopFactory) {
         this.fopFactory = fopFactory;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/2b12e0c1/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
index 72005df..dc32675 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
@@ -20,6 +20,7 @@ import java.util.Map;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.spi.UriParam;
 
 /**
  * Twitter component
@@ -30,6 +31,10 @@ public class TwitterComponent extends UriEndpointComponent {
     private String consumerSecret;
     private String accessToken;
     private String accessTokenSecret;
+    private String httpProxyHost;
+    private String httpProxyUser;
+    private String httpProxyPassword;
+    private Integer httpProxyPort;
 
     public TwitterComponent() {
         super(TwitterEndpointEvent.class);
@@ -44,6 +49,10 @@ public class TwitterComponent extends UriEndpointComponent {
         properties.setConsumerSecret(consumerSecret);
         properties.setAccessToken(accessToken);
         properties.setAccessTokenSecret(accessTokenSecret);
+        properties.setHttpProxyHost(httpProxyHost);
+        properties.setHttpProxyUser(httpProxyUser);
+        properties.setHttpProxyPassword(httpProxyPassword);
+        properties.setHttpProxyPort(httpProxyPort);
 
         // and then override from parameters
         setProperties(properties, parameters);
@@ -68,6 +77,9 @@ public class TwitterComponent extends UriEndpointComponent {
         return accessToken;
     }
 
+    /**
+     * The access token
+     */
     public void setAccessToken(String accessToken) {
         this.accessToken = accessToken;
     }
@@ -76,6 +88,9 @@ public class TwitterComponent extends UriEndpointComponent {
         return accessTokenSecret;
     }
 
+    /**
+     * The access token secret
+     */
     public void setAccessTokenSecret(String accessTokenSecret) {
         this.accessTokenSecret = accessTokenSecret;
     }
@@ -84,6 +99,9 @@ public class TwitterComponent extends UriEndpointComponent {
         return consumerKey;
     }
 
+    /**
+     * The consumer key
+     */
     public void setConsumerKey(String consumerKey) {
         this.consumerKey = consumerKey;
     }
@@ -92,7 +110,55 @@ public class TwitterComponent extends UriEndpointComponent {
         return consumerSecret;
     }
 
+    /**
+     * The consumer secret
+     */
     public void setConsumerSecret(String consumerSecret) {
         this.consumerSecret = consumerSecret;
     }
+
+    /**
+     * The http proxy host which can be used for the camel-twitter.
+     */
+    public void setHttpProxyHost(String httpProxyHost) {
+        this.httpProxyHost = httpProxyHost;
+    }
+
+    public String getHttpProxyHost() {
+        return httpProxyHost;
+    }
+
+    /**
+     * The http proxy user which can be used for the camel-twitter.
+     */
+    public void setHttpProxyUser(String httpProxyUser) {
+        this.httpProxyUser = httpProxyUser;
+    }
+
+    public String getHttpProxyUser() {
+        return httpProxyUser;
+    }
+
+    /**
+     * The http proxy password which can be used for the camel-twitter.
+     */
+    public void setHttpProxyPassword(String httpProxyPassword) {
+        this.httpProxyPassword = httpProxyPassword;
+    }
+
+    public String getHttpProxyPassword() {
+        return httpProxyPassword;
+    }
+
+    /**
+     * The http proxy port which can be used for the camel-twitter.
+     */
+    public void setHttpProxyPort(int httpProxyPort) {
+        this.httpProxyPort = httpProxyPort;
+    }
+
+    public int getHttpProxyPort() {
+        return httpProxyPort;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/2b12e0c1/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
index 1a7a621..413c47f 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
@@ -16,10 +16,6 @@
  */
 package org.apache.camel.component.twitter;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
 import org.apache.camel.component.twitter.data.EndpointType;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
@@ -35,15 +31,8 @@ import twitter4j.conf.ConfigurationBuilder;
 @UriParams
 public class TwitterConfiguration {
 
-    /**
-     * Defines the Twitter API endpoint.
-     */
     @UriPath(description = "What kind of type to use") @Metadata(required = "true")
     private EndpointType type = EndpointType.DIRECT;
-
-    /**
-     * OAuth
-     */
     @UriParam
     private String consumerKey;
     @UriParam
@@ -52,85 +41,32 @@ public class TwitterConfiguration {
     private String accessToken;
     @UriParam
     private String accessTokenSecret;
-
-    /**
-     * Polling delay.
-     */
     @UriParam(defaultValue = "60")
     private int delay = 60;
-
-    /**
-     * Username -- used for searching, etc.
-     */
     @UriParam
     private String user;
-
-    /**
-     * Keywords used for search and filters.
-     */
     @UriParam
     private String keywords;
-
-    /**
-     * Lon/Lat bounding boxes used for filtering.
-     */
     @UriParam
     private String locations;
-
-    /**
-     * List of userIds used for searching, etc.
-     */
     @UriParam
     private String userIds;
-
-    /**
-     * Filter out old tweets that have been previously polled.
-     */
     @UriParam(defaultValue = "true")
     private boolean filterOld = true;
-
-    /**
-     * Used for time-based endpoints (trends, etc.)
-     */
-    @UriParam
-    private String date;
-    
-    /**
-     * Used to set the sinceId from pulling
-     */
     @UriParam(defaultValue = "1")
     private long sinceId  = 1;
-
-    /**
-     * Used to set the preferred language on which to search
-     */
     @UriParam
     private String lang;
-
-    /**
-     * Used to set the maximum tweets per page (max = 100)
-     */
     @UriParam
     private Integer count;
-
-    @UriParam
-    private Date parsedDate;
-
-    /**
-     * Number of page to iterate before stop (default is 1)
-     */
     @UriParam(defaultValue = "1")
     private Integer numberOfPages = 1;
-    
     @UriParam
     private String httpProxyHost;
-
     @UriParam
     private String httpProxyUser;
-
     @UriParam
     private String httpProxyPassword;
-
     @UriParam
     private Integer httpProxyPort;
     
@@ -182,10 +118,41 @@ public class TwitterConfiguration {
         return confBuilder.build();
     }
 
+
+    public Twitter getTwitter() {
+        if (twitter == null) {
+            twitter = new TwitterFactory(getConfiguration()).getInstance();
+        }
+        return twitter;
+    }
+
+    public void setTwitter(Twitter twitter) {
+        this.twitter = twitter;
+    }
+
+    public TwitterStream getTwitterStream() {
+        return twitterStream;
+    }
+
+    public void setTwitterStream(TwitterStream twitterStream) {
+        this.twitterStream = twitterStream;
+    }
+
+    public TwitterStream createTwitterStream() {
+        if (twitterStream == null) {
+            twitterStream = new TwitterStreamFactory(getConfiguration()).getInstance();
+        }
+
+        return twitterStream;
+    }
+
     public String getConsumerKey() {
         return consumerKey;
     }
 
+    /**
+     * The consumer key. Can also be configured on the TwitterComponent level instead.
+     */
     public void setConsumerKey(String consumerKey) {
         this.consumerKey = consumerKey;
     }
@@ -194,10 +161,16 @@ public class TwitterConfiguration {
         return consumerSecret;
     }
 
+    /**
+     * The consumer secret. Can also be configured on the TwitterComponent level instead.
+     */
     public void setConsumerSecret(String consumerSecret) {
         this.consumerSecret = consumerSecret;
     }
 
+    /**
+     * The access token. Can also be configured on the TwitterComponent level instead.
+     */
     public String getAccessToken() {
         return accessToken;
     }
@@ -206,6 +179,9 @@ public class TwitterConfiguration {
         this.accessToken = accessToken;
     }
 
+    /**
+     * The access secret. Can also be configured on the TwitterComponent level instead.
+     */
     public String getAccessTokenSecret() {
         return accessTokenSecret;
     }
@@ -218,6 +194,9 @@ public class TwitterConfiguration {
         return user;
     }
 
+    /**
+     * Username, used for user timeline consumption, direct message production, etc.
+     */
     public void setUser(String user) {
         this.user = user;
     }
@@ -226,6 +205,9 @@ public class TwitterConfiguration {
         return keywords;
     }
 
+    /**
+     * Can be used for search and streaming/filter. Multiple values can be separated with
comma.
+     */
     public void setKeywords(String keywords) {
         this.keywords = keywords;
     }
@@ -234,6 +216,9 @@ public class TwitterConfiguration {
         return delay;
     }
 
+    /**
+     * Delay in seconds between polling from twitter.
+     */
     public void setDelay(int delay) {
         this.delay = delay;
     }
@@ -250,6 +235,9 @@ public class TwitterConfiguration {
         return locations;
     }
 
+    /**
+     * Bounding boxes, created by pairs of lat/lons. Can be used for streaming/filter. A
pair is defined as lat,lon. And multiple paris can be separated by semi colon.
+     */
     public void setLocations(String locations) {
         this.locations = locations;
     }
@@ -258,6 +246,9 @@ public class TwitterConfiguration {
         return userIds;
     }
 
+    /**
+     * To filter by user ids for streaming/filter. Multiple values can be separated by comma.
+     */
     public void setUserIds(String userIds) {
         this.userIds = userIds;
     }
@@ -266,59 +257,21 @@ public class TwitterConfiguration {
         return filterOld;
     }
 
+    /**
+     * Filter out old tweets, that has previously been polled.
+     * This state is stored in memory only, and based on last tweet id.
+     */
     public void setFilterOld(boolean filterOld) {
         this.filterOld = filterOld;
     }
 
-    public Twitter getTwitter() {
-        if (twitter == null) {
-            twitter = new TwitterFactory(getConfiguration()).getInstance();
-        }
-        return twitter;
-    }
-
-    public void setTwitter(Twitter twitter) {
-        this.twitter = twitter;
-    }
-
-    public TwitterStream getTwitterStream() {
-        return twitterStream;
-    }
-
-    public void setTwitterStream(TwitterStream twitterStream) {
-        this.twitterStream = twitterStream;
-    }
-
-    public String getDate() {
-        return date;
-    }
-
-    public Date parseDate() {
-        return parsedDate;
-    }
-
-    public void setDate(String date) {
-        this.date = date;
-        try {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-            parsedDate = sdf.parse(date);
-        } catch (ParseException e) {
-            throw new IllegalArgumentException("date must be in yyyy-mm-dd format!");
-        }
-    }
-
-    public TwitterStream createTwitterStream() {
-        if (twitterStream == null) {
-            twitterStream = new TwitterStreamFactory(getConfiguration()).getInstance();
-        }
-
-        return twitterStream;
-    }
-    
     public long getSinceId() {
         return sinceId;
     }
 
+    /**
+     * The last tweet id which will be used for pulling the tweets. It is useful when the
camel route is restarted after a long running.
+     */
     public void setSinceId(long sinceId) {
         this.sinceId = sinceId;
     }
@@ -327,6 +280,9 @@ public class TwitterConfiguration {
         return lang;
     }
 
+    /**
+     * The lang string ISO_639-1 which will be used for searching
+     */
     public void setLang(String lang) {
         this.lang = lang;
     }
@@ -335,6 +291,9 @@ public class TwitterConfiguration {
         return count;
     }
 
+    /**
+     * Limiting number of results per page.
+     */
     public void setCount(Integer count) {
         this.count = count;
     }
@@ -343,10 +302,16 @@ public class TwitterConfiguration {
         return numberOfPages;
     }
 
+    /**
+     * The number of pages result which you want camel-twitter to consume.
+     */
     public void setNumberOfPages(Integer numberOfPages) {
         this.numberOfPages = numberOfPages;
     }
-    
+
+    /**
+     * The http proxy host which can be used for the camel-twitter. Can also be configured
on the TwitterComponent level instead.
+     */
     public void setHttpProxyHost(String httpProxyHost) {
         this.httpProxyHost = httpProxyHost;
     }
@@ -354,7 +319,10 @@ public class TwitterConfiguration {
     public String getHttpProxyHost() {
         return httpProxyHost;
     }
-    
+
+    /**
+     * The http proxy user which can be used for the camel-twitter. Can also be configured
on the TwitterComponent level instead.
+     */
     public void setHttpProxyUser(String httpProxyUser) {
         this.httpProxyUser = httpProxyUser;
     }
@@ -362,7 +330,10 @@ public class TwitterConfiguration {
     public String getHttpProxyUser() {
         return httpProxyUser;
     }
-    
+
+    /**
+     * The http proxy password which can be used for the camel-twitter. Can also be configured
on the TwitterComponent level instead.
+     */
     public void setHttpProxyPassword(String httpProxyPassword) {
         this.httpProxyPassword = httpProxyPassword;
     }
@@ -370,7 +341,10 @@ public class TwitterConfiguration {
     public String getHttpProxyPassword() {
         return httpProxyPassword;
     }
-    
+
+    /**
+     * The http proxy port which can be used for the camel-twitter. Can also be configured
on the TwitterComponent level instead.
+     */
     public void setHttpProxyPort(int httpProxyPort) {
         this.httpProxyPort = httpProxyPort;
     }
@@ -379,6 +353,3 @@ public class TwitterConfiguration {
         return httpProxyPort;
     }
 }
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/2b12e0c1/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
index 592f12e..2c6103f 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
@@ -126,16 +126,6 @@ public class TwitterEndpointDirect extends DirectEndpoint implements
TwitterEndp
     }
 
     @ManagedAttribute
-    public void setDate(String date) {
-        getProperties().setDate(date);
-    }
-
-    @ManagedAttribute
-    public String getDate() {
-        return getProperties().getDate();
-    }
-
-    @ManagedAttribute
     public void setSinceId(long sinceId) {
         getProperties().setSinceId(sinceId);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/2b12e0c1/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
index c818d52..e1e8309 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
@@ -129,16 +129,6 @@ public class TwitterEndpointPolling extends DefaultPollingEndpoint implements
Tw
     }
 
     @ManagedAttribute
-    public void setDate(String date) {
-        getProperties().setDate(date);
-    }
-
-    @ManagedAttribute
-    public String getDate() {
-        return getProperties().getDate();
-    }
-
-    @ManagedAttribute
     public void setSinceId(long sinceId) {
         getProperties().setSinceId(sinceId);
     }


Mime
View raw message