camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hekon...@apache.org
Subject camel git commit: [CAMEL-9256] Paho file persistence store should be configurable
Date Mon, 26 Oct 2015 11:01:44 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x e791fc277 -> 8ad367357


[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/8ad36735
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ad36735
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ad36735

Branch: refs/heads/camel-2.16.x
Commit: 8ad3673577846167376a6fe18d7fec853ec4e703
Parents: e791fc2
Author: Henryk Konsek <hekonsek@gmail.com>
Authored: Mon Oct 26 12:01:37 2015 +0100
Committer: Henryk Konsek <hekonsek@gmail.com>
Committed: Mon Oct 26 12:01:37 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/8ad36735/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 2b38b2e..08b55f4 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
@@ -64,6 +64,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
@@ -116,7 +118,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() {
@@ -194,6 +204,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;
     }


Mime
View raw message