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-8496: Added some component level default options.
Date Thu, 09 Jul 2015 10:44:45 GMT
CAMEL-8496: Added some component level default options.


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

Branch: refs/heads/master
Commit: 0b75c4ebffc95fbfdce5dc6462ff935fe8ef6365
Parents: 56f8e3d
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jul 9 12:51:10 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jul 9 12:51:10 2015 +0200

----------------------------------------------------------------------
 .../camel/component/paho/PahoComponent.java     | 54 ++++++++++++++++++--
 1 file changed, 51 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0b75c4eb/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
index 1d69a9b..232d38e 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
@@ -20,18 +20,66 @@ import java.util.Map;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
 
 public class PahoComponent extends UriEndpointComponent {
 
+    private String brokerUrl;
+    private String clientId;
+    private MqttConnectOptions connectOptions;
+
     public PahoComponent() {
         super(PahoEndpoint.class);
     }
 
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object>
parameters) throws Exception {
-        PahoEndpoint pahoEndpoint = new PahoEndpoint(uri, this);
-        setProperties(pahoEndpoint, parameters);
-        return pahoEndpoint;
+        PahoEndpoint answer = new PahoEndpoint(uri, this);
+
+        if (brokerUrl != null) {
+            answer.setBrokerUrl(brokerUrl);
+        }
+        if (clientId != null) {
+            answer.setClientId(clientId);
+        }
+        if (connectOptions != null) {
+            answer.setConnectOptions(connectOptions);
+        }
+
+        setProperties(answer, parameters);
+        return answer;
+    }
+
+    public String getBrokerUrl() {
+        return brokerUrl;
+    }
+
+    /**
+     * The URL of the MQTT broker.
+     */
+    public void setBrokerUrl(String brokerUrl) {
+        this.brokerUrl = brokerUrl;
     }
 
+    public String getClientId() {
+        return clientId;
+    }
+
+    /**
+     * MQTT client identifier.
+     */
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public MqttConnectOptions getConnectOptions() {
+        return connectOptions;
+    }
+
+    /**
+     * Client connection options
+     */
+    public void setConnectOptions(MqttConnectOptions connectOptions) {
+        this.connectOptions = connectOptions;
+    }
 }
\ No newline at end of file


Mime
View raw message