You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/12/14 11:00:17 UTC

[1/3] camel git commit: CS validation with "mvn -Psourcecheck clean install"

Repository: camel
Updated Branches:
  refs/heads/master c2c2cdd4e -> 0890e8f28


CS validation with "mvn -Psourcecheck clean install"


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

Branch: refs/heads/master
Commit: 57b85fa47ff5e0f53bd748a891f9980f53a17298
Parents: 6092045
Author: gautric <ga...@redhat.com>
Authored: Mon Dec 14 10:53:11 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Dec 14 10:59:32 2015 +0100

----------------------------------------------------------------------
 .../camel/component/paho/PahoEndpoint.java      | 48 +++++++++-----------
 1 file changed, 21 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/57b85fa4/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 319ae15..c329c28 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
@@ -18,8 +18,6 @@ package org.apache.camel.component.paho;
 
 import java.util.Set;
 
-import static java.lang.System.nanoTime;
-
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
@@ -39,11 +37,6 @@ import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.camel.component.paho.PahoPersistence.MEMORY;
-import static org.apache.camel.component.paho.PahoConstants.DEFAULT_BROKER_URL;
-import static org.apache.camel.component.paho.PahoConstants.DEFAULT_QOS_STRING;
-import static org.apache.camel.component.paho.PahoConstants.DEFAULT_QOS;
-import static org.apache.camel.component.paho.PahoConstants.DEFAULT_RETAINED_STRING;
 
 
 @UriEndpoint(scheme = "paho", title = "Paho", consumerClass = PahoConsumer.class, label = "messaging", syntax = "paho:topic")
@@ -52,18 +45,19 @@ public class PahoEndpoint extends DefaultEndpoint {
     private static final Logger LOG = LoggerFactory.getLogger(PahoEndpoint.class);
 
     // Configuration members
-    @UriPath @Metadata(required = "true")
+    @UriPath
+    @Metadata(required = "true")
     private String topic;
     @UriParam
-    private String clientId = "camel-" + nanoTime();
-    @UriParam(defaultValue = DEFAULT_BROKER_URL)
-    private String brokerUrl = DEFAULT_BROKER_URL;
-    @UriParam(defaultValue = DEFAULT_QOS_STRING)
-    private int qos = DEFAULT_QOS;
-    @UriParam(defaultValue = DEFAULT_RETAINED_STRING)
-    private boolean retained = false;
+    private String clientId = "camel-" + System.nanoTime();
+    @UriParam(defaultValue = PahoConstants.DEFAULT_BROKER_URL)
+    private String brokerUrl = PahoConstants.DEFAULT_BROKER_URL;
+    @UriParam(defaultValue = PahoConstants.DEFAULT_QOS_STRING)
+    private int qos = PahoConstants.DEFAULT_QOS;
+    @UriParam(defaultValue = PahoConstants.DEFAULT_RETAINED_STRING)
+    private boolean retained;
     @UriParam(defaultValue = "MEMORY")
-    private PahoPersistence persistence = MEMORY;
+    private PahoPersistence persistence = PahoPersistence.MEMORY;
     @UriParam(description = "Base directory used by file persistence.", defaultValue = "Current directory")
     private String filePersistenceDirectory;
 
@@ -112,13 +106,13 @@ public class PahoEndpoint extends DefaultEndpoint {
 
     @Override
     public PahoComponent getComponent() {
-        return (PahoComponent) super.getComponent();
+        return (PahoComponent)super.getComponent();
     }
 
     // Resolvers
 
     protected MqttClientPersistence resolvePersistence() {
-        if (persistence == MEMORY) {
+        if (persistence ==  PahoPersistence.MEMORY) {
             return new MemoryPersistence();
         } else {
             if (filePersistenceDirectory != null) {
@@ -139,8 +133,7 @@ public class PahoEndpoint extends DefaultEndpoint {
             return connectOptions.iterator().next();
         } else if (connectOptions.size() > 1) {
             LOG.warn("Found {} instances of the MqttConnectOptions in the registry. None of these will be used by the endpoint. "
-                            + "Please use 'connectOptions' endpoint option to select one.",
-                    connectOptions.size());
+                     + "Please use 'connectOptions' endpoint option to select one.", connectOptions.size());
         }
         return new MqttConnectOptions();
     }
@@ -201,18 +194,19 @@ public class PahoEndpoint extends DefaultEndpoint {
     public void setQos(int qos) {
         this.qos = qos;
     }
-   
+
     public boolean isRetained() {
-		return retained;
-	}
+        return retained;
+    }
 
     /**
      * Retain option
+     * 
      * @param retained true/false
      */
-	public void setRetained(boolean retained) {
-		this.retained = retained;
-	}
+    public void setRetained(boolean retained) {
+        this.retained = retained;
+    }
 
     // Auto-configuration getters & setters
 
@@ -260,4 +254,4 @@ public class PahoEndpoint extends DefaultEndpoint {
         this.connectOptions = connOpts;
     }
 
-}
\ No newline at end of file
+}


[2/3] camel git commit: [CAMEL-9244] camel-paho - Endpoint must implement publishing of retained messages option

Posted by da...@apache.org.
[CAMEL-9244] camel-paho - Endpoint must implement publishing of retained
messages option


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

Branch: refs/heads/master
Commit: 60920455f6c528decb74de442eb49c747312cf15
Parents: c2c2cdd
Author: gautric <ga...@redhat.com>
Authored: Fri Dec 11 21:15:40 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Dec 14 10:59:32 2015 +0100

----------------------------------------------------------------------
 .../camel/component/paho/PahoConstants.java     |  4 ++++
 .../camel/component/paho/PahoEndpoint.java      | 24 ++++++++++++++++----
 .../camel/component/paho/PahoProducer.java      |  2 ++
 3 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/60920455/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
index 8b6a932..9e45ae5 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
@@ -25,6 +25,10 @@ public final class PahoConstants {
      * Header indicating a topic of a MQTT message.
      */
     public static final String MQTT_TOPIC = "CamelMqttTopic";
+    public static final String DEFAULT_BROKER_URL = "tcp://localhost:1883";
+    public static final int DEFAULT_QOS = 2;
+    public static final String DEFAULT_QOS_STRING = DEFAULT_QOS + "";
+    public static final String DEFAULT_RETAINED_STRING = "false";
 
     @Deprecated
     public static final String HEADER_ORIGINAL_MESSAGE = "PahoOriginalMessage";

http://git-wip-us.apache.org/repos/asf/camel/blob/60920455/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 0527306..319ae15 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
@@ -40,17 +40,17 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.apache.camel.component.paho.PahoPersistence.MEMORY;
+import static org.apache.camel.component.paho.PahoConstants.DEFAULT_BROKER_URL;
+import static org.apache.camel.component.paho.PahoConstants.DEFAULT_QOS_STRING;
+import static org.apache.camel.component.paho.PahoConstants.DEFAULT_QOS;
+import static org.apache.camel.component.paho.PahoConstants.DEFAULT_RETAINED_STRING;
+
 
 @UriEndpoint(scheme = "paho", title = "Paho", consumerClass = PahoConsumer.class, label = "messaging", syntax = "paho:topic")
 public class PahoEndpoint extends DefaultEndpoint {
 
     private static final Logger LOG = LoggerFactory.getLogger(PahoEndpoint.class);
 
-    // 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;
@@ -60,6 +60,8 @@ public class PahoEndpoint extends DefaultEndpoint {
     private String brokerUrl = DEFAULT_BROKER_URL;
     @UriParam(defaultValue = DEFAULT_QOS_STRING)
     private int qos = DEFAULT_QOS;
+    @UriParam(defaultValue = DEFAULT_RETAINED_STRING)
+    private boolean retained = false;
     @UriParam(defaultValue = "MEMORY")
     private PahoPersistence persistence = MEMORY;
     @UriParam(description = "Base directory used by file persistence.", defaultValue = "Current directory")
@@ -199,6 +201,18 @@ public class PahoEndpoint extends DefaultEndpoint {
     public void setQos(int qos) {
         this.qos = qos;
     }
+   
+    public boolean isRetained() {
+		return retained;
+	}
+
+    /**
+     * Retain option
+     * @param retained true/false
+     */
+	public void setRetained(boolean retained) {
+		this.retained = retained;
+	}
 
     // Auto-configuration getters & setters
 

http://git-wip-us.apache.org/repos/asf/camel/blob/60920455/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoProducer.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoProducer.java
index b585831..2369015 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoProducer.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoProducer.java
@@ -32,10 +32,12 @@ public class PahoProducer extends DefaultProducer {
         MqttClient client = getEndpoint().getClient();
         String topic = getEndpoint().getTopic();
         int qos = getEndpoint().getQos();
+        boolean retained = getEndpoint().isRetained();
         byte[] payload = exchange.getIn().getBody(byte[].class);
 
         MqttMessage message = new MqttMessage(payload);
         message.setQos(qos);
+        message.setRetained(retained);
         client.publish(topic, message);
     }
 


[3/3] camel git commit: small typo correction

Posted by da...@apache.org.
small typo correction


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

Branch: refs/heads/master
Commit: 0890e8f285bc12012243ceb8a44428727be059eb
Parents: 57b85fa
Author: gautric <ga...@redhat.com>
Authored: Mon Dec 14 10:57:46 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Dec 14 10:59:33 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/paho/PahoConstants.java | 2 --
 .../main/java/org/apache/camel/component/paho/PahoEndpoint.java  | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0890e8f2/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
index 9e45ae5..453e6bc 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
@@ -27,8 +27,6 @@ public final class PahoConstants {
     public static final String MQTT_TOPIC = "CamelMqttTopic";
     public static final String DEFAULT_BROKER_URL = "tcp://localhost:1883";
     public static final int DEFAULT_QOS = 2;
-    public static final String DEFAULT_QOS_STRING = DEFAULT_QOS + "";
-    public static final String DEFAULT_RETAINED_STRING = "false";
 
     @Deprecated
     public static final String HEADER_ORIGINAL_MESSAGE = "PahoOriginalMessage";

http://git-wip-us.apache.org/repos/asf/camel/blob/0890e8f2/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 c329c28..09665e1 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
@@ -52,9 +52,9 @@ public class PahoEndpoint extends DefaultEndpoint {
     private String clientId = "camel-" + System.nanoTime();
     @UriParam(defaultValue = PahoConstants.DEFAULT_BROKER_URL)
     private String brokerUrl = PahoConstants.DEFAULT_BROKER_URL;
-    @UriParam(defaultValue = PahoConstants.DEFAULT_QOS_STRING)
+    @UriParam(defaultValue = "2")
     private int qos = PahoConstants.DEFAULT_QOS;
-    @UriParam(defaultValue = PahoConstants.DEFAULT_RETAINED_STRING)
+    @UriParam(defaultValue = "false")
     private boolean retained;
     @UriParam(defaultValue = "MEMORY")
     private PahoPersistence persistence = PahoPersistence.MEMORY;