You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by he...@apache.org on 2015/03/17 15:54:35 UTC

camel git commit: Refactoring.

Repository: camel
Updated Branches:
  refs/heads/master 0dedb66da -> fc3d9f223


Refactoring.


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

Branch: refs/heads/master
Commit: fc3d9f22350723afd254bea51fee0351a059ab8e
Parents: 0dedb66
Author: Henryk Konsek <he...@gmail.com>
Authored: Tue Mar 17 15:54:29 2015 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Tue Mar 17 15:54:29 2015 +0100

----------------------------------------------------------------------
 .../camel/component/paho/PahoEndpoint.java       | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fc3d9f22/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
index f2b634e..a83380d 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.paho;
 
+import static java.lang.System.nanoTime;
+
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
@@ -31,22 +33,29 @@ import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
 import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
 import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
 
-import static java.lang.System.nanoTime;
 import static org.apache.camel.component.paho.PahoPersistence.MEMORY;
 
 @UriEndpoint(scheme = "paho", consumerClass = PahoConsumer.class, label = "messaging", syntax = "paho:topic")
 public class PahoEndpoint extends DefaultEndpoint {
 
+    // Constants
+
+    private static final String DEFAULT_BROKER_URL = "tcp://localhost:1883";
+
+    private static final int DEFAULT_QOS = 2;
+
+    private static final String DEFAULT_QOS_STRING = DEFAULT_QOS + "";
+
     // Configuration members
 
     @UriPath @Metadata(required = "true")
     private String topic;
     @UriParam
     private String clientId = "camel-" + nanoTime();
-    @UriParam(defaultValue = "tcp://localhost:1883")
-    private String brokerUrl = "tcp://localhost:1883";
-    @UriParam(defaultValue = "2")
-    private int qos = 2;
+    @UriParam(defaultValue = DEFAULT_BROKER_URL)
+    private String brokerUrl = DEFAULT_BROKER_URL;
+    @UriParam(defaultValue = DEFAULT_QOS_STRING)
+    private int qos = DEFAULT_QOS;
     @UriParam(defaultValue = "MEMORY")
     private PahoPersistence persistence = MEMORY;