Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.0.0.M2
    • Component/s: HBase
    • Labels:
      None

      Description

      HBase is an open source implementation of the BigTable - Google's column store. It's an Apache project and is the integral part of the hadoop family of projects.
      (http://hadoop.apache.org/hbase/)

      Hbase is gaining popularity very fast. Like we have DataSources, Connection Pools and Templates for other persistence technologies, we have written similar classes for Hbase.
      HBaseConfigurationFactoryBean
      HBaseCallback
      HBaseTemplate

      (I am attaching the files with this issue. I can create patch if required.)

      Here is how one would configure HBase data access beans in their applicationContext-hbase.xml

          <bean id="hbaseTemplate" class="com.gumgum.hbase.HBaseTemplate">
              <constructor-arg ref="hTablePool"/>
          </bean>
      
          <bean id="hbaseConfiguration" class="com.gumgum.hbase.HBaseConfigurationFactoryBean">
              <property name="hbaseMaster" value="${hbase.master}"/>
          </bean>
      
          <bean id="hTablePool" class="org.apache.hadoop.hbase.client.HTablePool">
              <constructor-arg ref="hbaseConfiguration"/>
              <constructor-arg value="${hbase.htable.pool.size}"/>
          </bean>
      

      It will be nice if you could include these classes in Spring-DA so that all the spring community using hbase will be benefited.

      These classes are based on Hbase 0.20 which is about to release soon.

      1. HBaseCallback.java
        0.6 kB
        Vaibhav Puranik
      2. HBaseConfigurationFactoryBean.java
        2 kB
        Vaibhav Puranik
      3. HBaseConfigurationFactoryBean.java
        2 kB
        Vaibhav Puranik
      4. HBaseConfigurationFactoryBean.java
        1 kB
        Vaibhav Puranik
      5. HBaseTemplate.java
        2 kB
        Vaibhav Puranik
      6. HBaseTemplate.java
        2 kB
        Vaibhav Puranik
      7. HBaseTemplate.java
        1 kB
        Vaibhav Puranik
      8. RowCallback.java
        0.6 kB
        Vaibhav Puranik
      9. TableCallback.java
        0.6 kB
        Vaibhav Puranik
      10. TableCallback.java
        0.6 kB
        Vaibhav Puranik

        Activity

        Hide
        Vaibhav Puranik added a comment -

        Updated version of HBaseConfigurationFactoryBean.java attached. The bean configuration class is rewritten in a way that will allow developers to set any property.

        Here is the changed configuration:

        <bean id="hbaseConfiguration" class="com.gumgum.hbase.HBaseConfigurationFactoryBean">
        <property name="hbaseProperties">
        <props>
        <!-- hbase.zookeeper.quorum must be specified. Other properties are optional-->
        <prop key="hbase.zookeeper.quorum">$

        {hbase.zookeeper.quorum}

        </prop>
        </props>
        </property>
        </bean>

        Show
        Vaibhav Puranik added a comment - Updated version of HBaseConfigurationFactoryBean.java attached. The bean configuration class is rewritten in a way that will allow developers to set any property. Here is the changed configuration: <bean id="hbaseConfiguration" class="com.gumgum.hbase.HBaseConfigurationFactoryBean"> <property name="hbaseProperties"> <props> <!-- hbase.zookeeper.quorum must be specified. Other properties are optional--> <prop key="hbase.zookeeper.quorum">$ {hbase.zookeeper.quorum} </prop> </props> </property> </bean>
        Hide
        Jay Sellers added a comment -

        This task is referenced on the "Supporting Projects" page for hadoop: http://wiki.apache.org/hadoop/SupportingProjects

        Is there any update on this, I don't see any activity since 2009.

        Show
        Jay Sellers added a comment - This task is referenced on the "Supporting Projects" page for hadoop: http://wiki.apache.org/hadoop/SupportingProjects Is there any update on this, I don't see any activity since 2009.
        Hide
        Asif Akhtar added a comment -

        Is there any update on this?? I was looking to create a HBaseTemplate Spring set of classes and stumbled across this.

        Show
        Asif Akhtar added a comment - Is there any update on this?? I was looking to create a HBaseTemplate Spring set of classes and stumbled across this.
        Hide
        Vaibhav Puranik added a comment -

        Attaching latest code. I have made some changes to make it compatible with latest Hbase versions. The code is tested with HBase 0.90.3

        Show
        Vaibhav Puranik added a comment - Attaching latest code. I have made some changes to make it compatible with latest Hbase versions. The code is tested with HBase 0.90.3
        Hide
        Vaibhav Puranik added a comment -

        Here is some sample code on how to use the templates:
        http://pastebin.com/q4KbB3Yk

        Show
        Vaibhav Puranik added a comment - Here is some sample code on how to use the templates: http://pastebin.com/q4KbB3Yk
        Hide
        Alex Vasilenko added a comment -

        Vaibhav, why do you use HTable instead HTableInterface? And I think TableCallback can be generic interface

        Show
        Alex Vasilenko added a comment - Vaibhav, why do you use HTable instead HTableInterface ? And I think TableCallback can be generic interface
        Hide
        Vaibhav Puranik added a comment -

        Adding modified HBaseTemplate and TableCallback classes. They now use HTableInterface instead of HTable. Thanks for pointing out Alex. (Actually funny thing is that, we contributed HTableInterface to HBase code!)

        Show
        Vaibhav Puranik added a comment - Adding modified HBaseTemplate and TableCallback classes. They now use HTableInterface instead of HTable. Thanks for pointing out Alex. (Actually funny thing is that, we contributed HTableInterface to HBase code!)
        Hide
        Deejay added a comment -

        What's the status of this work? Spring Data HBase would be incredibly useful for my organisation!

        Show
        Deejay added a comment - What's the status of this work? Spring Data HBase would be incredibly useful for my organisation!
        Hide
        Vaibhav Puranik added a comment - - edited

        Deejay, you can download the files attached to this issue and start using them. I am going to put them on github in a week or two. if you have any questions, feel free to comment this issue. We are using that code in production and it works fine.

        Show
        Vaibhav Puranik added a comment - - edited Deejay, you can download the files attached to this issue and start using them. I am going to put them on github in a week or two. if you have any questions, feel free to comment this issue. We are using that code in production and it works fine.
        Hide
        Deejay added a comment -

        Thanks!

        Show
        Deejay added a comment - Thanks!
        Hide
        Vaibhav Puranik added a comment -

        I have made the code open source at https://github.com/vpuranik/SpringHBase. Please feel free to use it. It will work with HBase 0.92.x.

        Show
        Vaibhav Puranik added a comment - I have made the code open source at https://github.com/vpuranik/SpringHBase . Please feel free to use it. It will work with HBase 0.92.x.
        Hide
        Costin Leau added a comment -

        Guys, support for HBase has been added to Spring for Hadoop project - initially on a branch which has been merged into main some days ago [1]. It covers the areas mentioned in this issue and more.
        Do take a look, take it for a spin and let us know what missing - feedback and contributions welcome.

        Cheers,

        [1] https://github.com/SpringSource/spring-hadoop/tree/master/src/main/java/org/springframework/data/hadoop/hbase

        Show
        Costin Leau added a comment - Guys, support for HBase has been added to Spring for Hadoop project - initially on a branch which has been merged into main some days ago [1] . It covers the areas mentioned in this issue and more. Do take a look, take it for a spin and let us know what missing - feedback and contributions welcome. Cheers, [1] https://github.com/SpringSource/spring-hadoop/tree/master/src/main/java/org/springframework/data/hadoop/hbase
        Hide
        Costin Leau added a comment -

        Everyone, I've moved the issue under Spring for Apache Hadoop project.

        Show
        Costin Leau added a comment - Everyone, I've moved the issue under Spring for Apache Hadoop project.
        Hide
        Mark Pollack added a comment -

        Few comments on the code as it now sits in spring-hadoop

        1. Change the name to use HBaseTemplate and not with lowercase 'b'. This agrees with API naming of HBase itself in http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/util/package-summary.html
        2. Add an interface, HBaseOperations, as with other templates to support easier mocking
        3. Naming of methods, 'execute' methods should take a callback, but in there are a few in this class that take ResultsExtractor. I think a series of method naming conventions such as findWithRowMapper or findWithResultsExtractor would make the API easier to navigate I think.

        Show
        Mark Pollack added a comment - Few comments on the code as it now sits in spring-hadoop 1. Change the name to use HBaseTemplate and not with lowercase 'b'. This agrees with API naming of HBase itself in http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/util/package-summary.html 2. Add an interface, HBaseOperations, as with other templates to support easier mocking 3. Naming of methods, 'execute' methods should take a callback, but in there are a few in this class that take ResultsExtractor. I think a series of method naming conventions such as findWithRowMapper or findWithResultsExtractor would make the API easier to navigate I think.
        Hide
        Deejay added a comment -

        Are there any plans to write a supporting blog post explaining how to use this?

        Show
        Deejay added a comment - Are there any plans to write a supporting blog post explaining how to use this?
        Hide
        Costin Leau added a comment -

        Support available in M2. Docs available at
        http://static.springsource.org/spring-hadoop/docs/snapshot/reference/html/hbase.html (note this is the current shapshot of the upcoming 1.0 M2).

        Show
        Costin Leau added a comment - Support available in M2. Docs available at http://static.springsource.org/spring-hadoop/docs/snapshot/reference/html/hbase.html (note this is the current shapshot of the upcoming 1.0 M2).

          People

          • Assignee:
            Costin Leau
            Reporter:
            Vaibhav Puranik
          • Votes:
            13 Vote for this issue
            Watchers:
            16 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: