You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/03/20 09:22:21 UTC

[1/2] git commit: CAMEL-7296 polish the pom.xml of camel-hbase

Repository: camel
Updated Branches:
  refs/heads/master 6b6a387d8 -> 43c1a5135


CAMEL-7296 polish the pom.xml of camel-hbase


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

Branch: refs/heads/master
Commit: 43c1a5135ce38330a224d2ca150b489f65e80c51
Parents: be1d9e4
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Mar 20 16:20:36 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Mar 20 16:21:19 2014 +0800

----------------------------------------------------------------------
 components/camel-hbase/pom.xml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/43c1a513/components/camel-hbase/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-hbase/pom.xml b/components/camel-hbase/pom.xml
index 56f1a5a..68c59ce 100644
--- a/components/camel-hbase/pom.xml
+++ b/components/camel-hbase/pom.xml
@@ -85,6 +85,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        
         <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
@@ -134,12 +135,18 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
+        <!-- Using a low version of guava could let the server shutdown quickly -->
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>14.0.1</version>
+            <scope>test</scope>
+        </dependency>
         <!-- need to use zookeeper 3.4.x for testing -->
-        <!-- TODO: Can be removed when we upgrade to zookeeper 3.4.6 or better (OSGi fixed) -->
         <dependency>
             <groupId>org.apache.zookeeper</groupId>
             <artifactId>zookeeper</artifactId>
-            <version>3.4.5</version>
+            <version>${zookeeper-version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>


[2/2] git commit: CAMEL-7296 Fixed the hbase consumer issue of pulling the data with family and qualifier options

Posted by ni...@apache.org.
CAMEL-7296 Fixed the hbase consumer issue of pulling the data with family and qualifier options


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

Branch: refs/heads/master
Commit: be1d9e413e7d32f34f3b0945b4959c83111ec592
Parents: 6b6a387
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Mar 20 16:12:02 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Mar 20 16:21:19 2014 +0800

----------------------------------------------------------------------
 .../camel/component/hbase/HBaseConsumer.java    | 32 +++++++++++++++-----
 1 file changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/be1d9e41/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
index 7040072..67a3050 100644
--- a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
+++ b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
@@ -106,15 +106,31 @@ public class HBaseConsumer extends ScheduledBatchPollingConsumer {
 
                 List<KeyValue> keyValues = result.list();
                 if (keyValues != null) {
-                    for (KeyValue keyValue : keyValues) {
-                        String qualifier = new String(keyValue.getQualifier());
-                        String family = new String(keyValue.getFamily());
-                        HBaseCell resultCell = new HBaseCell();
-                        resultCell.setFamily(family);
-                        resultCell.setQualifier(qualifier);
-                        resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(String.class, keyValue.getValue()));
-                        resultRow.getCells().add(resultCell);
+                    Set<HBaseCell> cellModels = rowModel.getCells();
+                    if (cellModels.size() > 0) {
+                        for (HBaseCell modelCell : cellModels) {
+                            HBaseCell resultCell = new HBaseCell();
+                            String family = modelCell.getFamily();
+                            String column = modelCell.getQualifier();
+                            resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(modelCell.getValueType(),
+                                    result.getValue(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column))));
+                            resultCell.setFamily(modelCell.getFamily());
+                            resultCell.setQualifier(modelCell.getQualifier());
+                            resultRow.getCells().add(resultCell);
+                        }
+                    } else {
+                        // just need to put every key value into the result Cells
+                        for (KeyValue keyValue : keyValues) {
+                            String qualifier = new String(keyValue.getQualifier());
+                            String family = new String(keyValue.getFamily());
+                            HBaseCell resultCell = new HBaseCell();
+                            resultCell.setFamily(family);
+                            resultCell.setQualifier(qualifier);
+                            resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(String.class, keyValue.getValue()));
+                            resultRow.getCells().add(resultCell); 
+                        }
                     }
+               
                     data.getRows().add(resultRow);
                     exchange = endpoint.createExchange();
                     // Probably overkill but kept it here for consistency.