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/10/26 11:58:53 UTC

camel git commit: [CAMEL-9256] Paho file persistence store should be configurable

Repository: camel
Updated Branches:
  refs/heads/master b45652154 -> 0f393b668


[CAMEL-9256] Paho file persistence store should be configurable


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

Branch: refs/heads/master
Commit: 0f393b668ee87961d3f66bf300eb4ffcfb9c49ea
Parents: b456521
Author: Henryk Konsek <he...@gmail.com>
Authored: Mon Oct 26 11:58:47 2015 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Mon Oct 26 11:58:47 2015 +0100

----------------------------------------------------------------------
 .../camel/component/paho/PahoEndpoint.java      | 23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0f393b66/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 bc6ee97..0527306 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
@@ -62,6 +62,8 @@ public class PahoEndpoint extends DefaultEndpoint {
     private int qos = DEFAULT_QOS;
     @UriParam(defaultValue = "MEMORY")
     private PahoPersistence persistence = MEMORY;
+    @UriParam(description = "Base directory used by file persistence.", defaultValue = "Current directory")
+    private String filePersistenceDirectory;
 
     // Collaboration members
     @UriParam
@@ -114,7 +116,15 @@ public class PahoEndpoint extends DefaultEndpoint {
     // Resolvers
 
     protected MqttClientPersistence resolvePersistence() {
-        return persistence == MEMORY ? new MemoryPersistence() : new MqttDefaultFilePersistence();
+        if (persistence == MEMORY) {
+            return new MemoryPersistence();
+        } else {
+            if (filePersistenceDirectory != null) {
+                return new MqttDefaultFilePersistence(filePersistenceDirectory);
+            } else {
+                return new MqttDefaultFilePersistence();
+            }
+        }
     }
 
     protected MqttConnectOptions resolveMqttConnectOptions() {
@@ -203,6 +213,17 @@ public class PahoEndpoint extends DefaultEndpoint {
         this.persistence = persistence;
     }
 
+    public String getFilePersistenceDirectory() {
+        return filePersistenceDirectory;
+    }
+
+    /**
+     * Base directory used by the file persistence provider.
+     */
+    public void setFilePersistenceDirectory(String filePersistenceDirectory) {
+        this.filePersistenceDirectory = filePersistenceDirectory;
+    }
+
     public MqttClient getClient() {
         return client;
     }