camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: CAMEL-6923: Polished camel-zookeeper, as some options was not useable at all.
Date Fri, 01 Nov 2013 09:17:10 GMT
CAMEL-6923: Polished camel-zookeeper, as some options was not useable at all.


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

Branch: refs/heads/camel-2.12.x
Commit: 97e33aa3174d2eb2272fd5f32238fc14153ffb75
Parents: 91332f8
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Nov 1 10:17:06 2013 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Nov 1 10:17:33 2013 +0100

----------------------------------------------------------------------
 .../camel/component/zookeeper/ConnectionHolder.java  | 10 +++-------
 .../component/zookeeper/ZooKeeperConfiguration.java  | 15 +++------------
 .../camel/component/zookeeper/ZooKeeperConsumer.java |  7 +++----
 .../camel/component/zookeeper/ZooKeeperEndpoint.java | 14 ++------------
 .../camel/component/zookeeper/ZookeeperProducer.java |  4 ++--
 .../component/zookeeper/ZookeeperProducerTest.java   |  2 +-
 6 files changed, 14 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/97e33aa3/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ConnectionHolder.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ConnectionHolder.java
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ConnectionHolder.java
index 57834a4..68acadc 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ConnectionHolder.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ConnectionHolder.java
@@ -53,13 +53,9 @@ public class ConnectionHolder implements Watcher {
             throw new RuntimeCamelException("Cannot create ZooKeeper connection as connection
string is null. Have servers been configured?");
         }
         try {
-            if (configuration.getSessionId() > 0 && configuration.getSessionPassword()
!= null) {
-                zookeeper = new ZooKeeper(configuration.getConnectString(), configuration.getTimeout(),
this, configuration.getSessionId(), configuration.getSessionPassword());
-            } else {
-                zookeeper = new ZooKeeper(configuration.getConnectString(), configuration.getTimeout(),
this);
-            }
+            zookeeper = new ZooKeeper(configuration.getConnectString(), configuration.getTimeout(),
this);
         } catch (Exception e) {
-            ObjectHelper.wrapRuntimeCamelException(e);
+            throw ObjectHelper.wrapRuntimeCamelException(e);
         }
         awaitConnection();
         return zookeeper;
@@ -76,7 +72,7 @@ public class ConnectionHolder implements Watcher {
         try {
             connectionLatch.await();
         } catch (InterruptedException e) {
-            ObjectHelper.wrapRuntimeCamelException(e);
+            throw ObjectHelper.wrapRuntimeCamelException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/97e33aa3/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
index 6a84a9b..e89d915 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
@@ -30,12 +30,11 @@ import org.apache.camel.RuntimeCamelException;
  */
 public class ZooKeeperConfiguration implements Cloneable {
 
+    private transient boolean changed;
+
     private int timeout = 5000;
     private long backoff = 5000;
     private List<String> servers;
-    private boolean changed;
-    private int sessionId;
-    private byte[] password;
     private String path;
     private boolean awaitExistence = true;
     private boolean repeat;
@@ -69,7 +68,7 @@ public class ZooKeeperConfiguration implements Cloneable {
         changed = true;
     }
 
-    public boolean listChildren() {
+    public boolean isListChildren() {
         return listChildren;
     }
 
@@ -95,14 +94,6 @@ public class ZooKeeperConfiguration implements Cloneable {
 
     }
 
-    public byte[] getSessionPassword() {
-        return password;
-    }
-
-    public int getSessionId() {
-        return sessionId;
-    }
-
     public void setPath(String path) {
         this.path = path;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/97e33aa3/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConsumer.java
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConsumer.java
index f5f7839..8b9be64 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConsumer.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConsumer.java
@@ -88,7 +88,7 @@ public class ZooKeeperConsumer extends DefaultConsumer {
 
     private void initializeConsumer() {
         String node = configuration.getPath();
-        if (configuration.listChildren()) {
+        if (configuration.isListChildren()) {
             initializeChildListingConsumer(node);
         } else {
             initializeDataConsumer(node);
@@ -98,7 +98,7 @@ public class ZooKeeperConsumer extends DefaultConsumer {
     private void initializeDataConsumer(String node) {
         if (!shuttingDown) {
             if (log.isDebugEnabled()) {
-                log.debug(String.format("Initailizing consumption of data on node '%s'",
node));
+                log.debug(String.format("Initializing consumption of data on node '%s'",
node));
             }
             addBasicDataConsumeSequence(node);
         }
@@ -107,7 +107,7 @@ public class ZooKeeperConsumer extends DefaultConsumer {
     private void initializeChildListingConsumer(String node) {
         if (!shuttingDown) {
             if (log.isDebugEnabled()) {
-                log.debug(String.format("Initailizing child listing of node '%s'", node));
+                log.debug(String.format("Initializing child listing of node '%s'", node));
             }
             addBasicChildListingSequence(node);
         }
@@ -160,7 +160,6 @@ public class ZooKeeperConsumer extends DefaultConsumer {
                         try {
                             operations.offer(current.createCopy());
                         } catch (Exception e) {
-                            e.printStackTrace();
                             backoffAndThenRestart();
                         }
                     }

http://git-wip-us.apache.org/repos/asf/camel/blob/97e33aa3/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
index 5b74931..0e26004 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
@@ -66,16 +66,6 @@ public class ZooKeeperEndpoint extends DefaultEndpoint {
         return connectionManager;
     }
 
-    @ManagedAttribute(description = "Session Password", mask = true)
-    public byte[] getSessionPassword() {
-        return getConfiguration().getSessionPassword();
-    }
-
-    @ManagedAttribute
-    public int getSessionId() {
-        return getConfiguration().getSessionId();
-    }
-
     @ManagedAttribute
     public void setPath(String path) {
         getConfiguration().setPath(path);
@@ -117,8 +107,8 @@ public class ZooKeeperEndpoint extends DefaultEndpoint {
     }
 
     @ManagedAttribute
-    public boolean getListChildren() {
-        return getConfiguration().listChildren();
+    public boolean isListChildren() {
+        return getConfiguration().isListChildren();
     }
 
     @ManagedAttribute

http://git-wip-us.apache.org/repos/asf/camel/blob/97e33aa3/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java
index 78fb86a..4edc98e 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java
@@ -77,7 +77,7 @@ public class ZookeeperProducer extends DefaultProducer {
                 }
 
                 OperationResult result = synchronouslyDelete(context);
-                if (configuration.listChildren()) {
+                if (configuration.isListChildren()) {
                     result = listChildren(context);
                 }
                 updateExchangeWithResult(context, result);
@@ -87,7 +87,7 @@ public class ZookeeperProducer extends DefaultProducer {
                 }
 
                 OperationResult result = synchronouslySetData(context);
-                if (configuration.listChildren()) {
+                if (configuration.isListChildren()) {
                     result = listChildren(context);
                 }
                 updateExchangeWithResult(context, result);

http://git-wip-us.apache.org/repos/asf/camel/blob/97e33aa3/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperProducerTest.java
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperProducerTest.java
index 3b2cce6..ee335ad 100644
--- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperProducerTest.java
+++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperProducerTest.java
@@ -31,7 +31,7 @@ import org.junit.Test;
 
 import static org.apache.camel.component.zookeeper.ZooKeeperMessage.ZOOKEEPER_CREATE_MODE;
 import static org.apache.camel.component.zookeeper.ZooKeeperMessage.ZOOKEEPER_NODE;
-import static org.apache.camel.component.zookeeper.ZooKeeperMessage.ZOOKEEPER_OPERATION;;
+import static org.apache.camel.component.zookeeper.ZooKeeperMessage.ZOOKEEPER_OPERATION;
 
 public class ZookeeperProducerTest extends ZooKeeperTestSupport {
 


Mime
View raw message