<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/rhino/interface/base.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/Hbase.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/base.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/gen/Hbase.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/gen/Hbase_constants.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/gen/Hbase_types.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/scanner.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase-thrift/table.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase/hbase.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase/htable.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/hbase/scanner.rb</filename>
    </added>
    <added>
      <filename>lib/rhino/interface/table.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -9,16 +9,16 @@ require 'active_support/core_ext/class/attribute_accessors.rb'
 class Array; include ActiveSupport::CoreExtensions::Array::ExtractOptions; end
 
 
-require 'rhino/interface/hbase'
-require 'rhino/interface/htable'
+require 'rhino/interface/base'
+require 'rhino/interface/table'
 require 'rhino/interface/scanner'
 
 require 'thrift/transport/tsocket.rb'
 require 'thrift/protocol/tbinaryprotocol.rb'
-require 'rhino/thrift/gen/Hbase'
-require 'rhino/thrift/hbase'
-require 'rhino/thrift/htable'
-require 'rhino/thrift/scanner'
+require 'rhino/interface/hbase-thrift/gen/Hbase'
+require 'rhino/interface/hbase-thrift/base'
+require 'rhino/interface/hbase-thrift/table'
+require 'rhino/interface/hbase-thrift/scanner'
 
 
 require 'rhino/debug'</diff>
      <filename>lib/rhino.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,7 +46,7 @@ module Rhino
     # Writes this cell's data to the row and saves only this cell.
     def save(timestamp=nil)
       write
-      row.class.htable.put(row.key, {attr_name=&gt;contents}, timestamp)
+      row.class.table.put(row.key, {attr_name=&gt;contents}, timestamp)
     end
     
     # TODO: update to destroy the cell without re-saving the row</diff>
      <filename>lib/rhino/cell.rb</filename>
    </modified>
    <modified>
      <diff>@@ -92,7 +92,7 @@ module Rhino
       # so this accomplishes both
       data.delete('timestamp')
       
-      self.class.htable.put(key, data, with_timestamp)
+      self.class.table.put(key, data, with_timestamp)
       if new_record?
         @opts[:new_record] = false
         @opts[:was_new_record] = true
@@ -102,7 +102,7 @@ module Rhino
     
     def destroy
       debug(&quot;Model#destroy() [key=#{key.inspect}]&quot;)
-      self.class.htable.delete_row(key)
+      self.class.table.delete_row(key)
     end
     
     def data
@@ -208,33 +208,36 @@ module Rhino
     # CLASS METHODS #
     #################
     
-    # Specifies the endpoint URL for the HBase REST API. This URL should end in a slash (e.g., &quot;http://localhost:60010/api&quot;).
-    # The connection is not actually &quot;established&quot;, however, until +connection+ is called.
-    def Model.connect(host, port)
-      debug(&quot;Model.connect(#{host.inspect}, #{port.inspect})&quot;)
-      raise &quot;already connected&quot; if hbase
-      @hbase = Rhino::ThriftInterface::HBase.new(host, port)
+    def Model.connect(host, port, adapter=Rhino::HBaseThriftInterface)
+      debug(&quot;Model.connect(#{host.inspect}, #{port.inspect}, #{adapter.inspect})&quot;)
+      raise &quot;already connected&quot; if connection
+      @adapter = adapter
+      @conn = adapter::Base.new(host, port)
+    end
+    
+    def Model.adapter
+      @adapter
     end
     
     # Returns true if connected to the database, and false otherwise.
     def Model.connected?
-      @hbase != nil
+      @conn != nil
     end
     
-    # Returns the connection to HBase. The connection to HBase is shared across all models and is stored in Rhino::Model,
+    # Returns the connection. The connection is shared across all models and is stored in Rhino::Model,
     # so models retrieve it from Rhino::Table.
-    def Model.hbase
+    def Model.connection
       # uses self.name instead of self.class because in class methods, self.class==Object and self.name==&quot;Rhino::Model&quot;
       if self.name == &quot;Rhino::Model&quot;
-        @hbase
+        @conn
       else
-        Rhino::Model.hbase
+        Rhino::Model.connection
       end
     end
     
-    # Returns the HTable interface.
-    def Model.htable
-      @htable ||= Rhino::ThriftInterface::HTable.new(hbase, table_name)
+    # Returns the table interface.
+    def Model.table
+      @table ||= Rhino::Model.adapter::Table.new(connection, table_name)
     end
     
     cattr_accessor :column_families
@@ -324,16 +327,16 @@ module Rhino
       
       # get the row
       begin
-        data = htable.get(key, :timestamp=&gt;timestamp)
+        data = table.get(key, :timestamp=&gt;timestamp)
         debug(&quot;-&gt; found [key=#{key.inspect}, data=#{data.inspect}]&quot;)
         load(key, data)
-      rescue Rhino::Interface::HTable::RowNotFound
+      rescue Rhino::Interface::Table::RowNotFound
         return nil
       end
     end
     
     def Model.delete_all
-      htable.delete_all_rows
+      table.delete_all_rows
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/rhino/model.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,11 +6,11 @@ module Rhino
     def initialize(model, opts)
       @model = model
       @opts = opts
-      @hscanner = Rhino::ThriftInterface::Scanner.new(@model.htable, self.opts)
+      @scanner = Rhino::Model.adapter::Scanner.new(@model.table, self.opts)
     end
     
     def each
-      while row_data = @hscanner.next_row()
+      while row_data = @scanner.next_row()
         row_key = row_data.delete('key')
         row = @model.load(row_key, row_data)
         yield(row)</diff>
      <filename>lib/rhino/scanner.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
 require 'spec/spec_helper.rb'
 
-describe Rhino::Interface::HBase do
+describe Rhino::Interface::Base do
   describe &quot;when working with tables&quot; do
     before do
       # TODO: this is a hardcoded list of tables in my db - should get real fixtures!!
       @table_names = %w(users pages)
       # TODO: there should be a Rhino-namespace way of getting the hbase object, not just through the model
-      @hbase = Rhino::Model.hbase
+      @hbase = Rhino::Model.connection
     end
     
     it &quot;should return a list of tables&quot; do</diff>
      <filename>spec/interface/hbase_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,42 +1,42 @@
 require 'spec/spec_helper.rb'
 
 # TODO these tests should not be dependent on Rhino::Model (Page is a subclass of Model)
-describe Rhino::Interface::HTable do
+describe Rhino::Interface::Table do
   before do
-    @page_htable = Page.htable
+    @page_table = Page.table
   end
   
   after do
-    @page_htable.delete_all_rows
+    @page_table.delete_all_rows
   end
   
   describe &quot;when getting rows&quot; do
     it &quot;should raise RowNotFound for nonexistent rows&quot; do
-      lambda { @page_htable.get('this row key does not exist') }.should raise_error(Rhino::Interface::HTable::RowNotFound)
+      lambda { @page_table.get('this row key does not exist') }.should raise_error(Rhino::Interface::Table::RowNotFound)
     end
     
     it &quot;should raise ArgumentError if nil or blank key is given&quot; do
-      lambda { @page_htable.get('') }.should raise_error(ArgumentError)
-      lambda { @page_htable.get(nil) }.should raise_error(ArgumentError)
+      lambda { @page_table.get('') }.should raise_error(ArgumentError)
+      lambda { @page_table.get(nil) }.should raise_error(ArgumentError)
     end
     
     it &quot;should get the latest timestamp&quot; do
       ts = (Time.now.to_f * 1000).to_i
-      @page_htable.put('abc', {'title:'=&gt;'hello1', 'contents:'=&gt;'hello there'}, ts)
-      @page_htable.put('abc', {'title:'=&gt;'hello2'}, ts+1000)
-      @page_htable.put('abc', {'title:'=&gt;'hello3'}, ts+5000)
-      @page_htable.get('abc')['timestamp'].should == ts+5000
+      @page_table.put('abc', {'title:'=&gt;'hello1', 'contents:'=&gt;'hello there'}, ts)
+      @page_table.put('abc', {'title:'=&gt;'hello2'}, ts+1000)
+      @page_table.put('abc', {'title:'=&gt;'hello3'}, ts+5000)
+      @page_table.get('abc')['timestamp'].should == ts+5000
     end
     
     it &quot;should get the timestamp&quot; do
-      @page_htable.put('a99', {'title:'=&gt;'hello2'})
-      @page_htable.get('a99')['timestamp'].should be_close((Time.now.to_f * 1000).to_i, 100)
+      @page_table.put('a99', {'title:'=&gt;'hello2'})
+      @page_table.get('a99')['timestamp'].should be_close((Time.now.to_f * 1000).to_i, 100)
     end
     
     it &quot;should retrieve the row&quot; do
       key = 'hello.com'
-      @page_htable.put(key, {'title:'=&gt;'howdy'})
-      row = @page_htable.get(key)
+      @page_table.put(key, {'title:'=&gt;'howdy'})
+      row = @page_table.get(key)
       row.keys.sort.should == %w(timestamp title:)
       row['title:'].should == 'howdy'
     end
@@ -44,46 +44,46 @@ describe Rhino::Interface::HTable do
   
   describe &quot;when deleting all rows&quot; do
     before do
-      @page_htable.put('a', {'title:'=&gt;'abc'})
-      @page_htable.put('b', {'title:'=&gt;'bcd'})
-      @page_htable.put('c', {'title:'=&gt;'cde'})
+      @page_table.put('a', {'title:'=&gt;'abc'})
+      @page_table.put('b', {'title:'=&gt;'bcd'})
+      @page_table.put('c', {'title:'=&gt;'cde'})
     end
     
     it &quot;should remove all rows&quot; do
-      @page_htable.get('a').should_not == nil
-      @page_htable.delete_all_rows
-      lambda { @page_htable.get('a') }.should raise_error(Rhino::Interface::HTable::RowNotFound)
-      @page_htable.scan.collect.should == []
+      @page_table.get('a').should_not == nil
+      @page_table.delete_all_rows
+      lambda { @page_table.get('a') }.should raise_error(Rhino::Interface::Table::RowNotFound)
+      @page_table.scan.collect.should == []
     end
   end
   
   describe &quot;when deleting entire rows&quot; do  
     before do
       @some_key = 'some-key'
-      @page_htable.put(@some_key, {'title:'=&gt;'abc'})
+      @page_table.put(@some_key, {'title:'=&gt;'abc'})
     end
     
     it &quot;should delete the row&quot; do
-      @page_htable.get(@some_key).should_not == nil
-      @page_htable.delete_row(@some_key)
-      lambda { @page_htable.get(@some_key) }.should raise_error(Rhino::Interface::HTable::RowNotFound)
+      @page_table.get(@some_key).should_not == nil
+      @page_table.delete_row(@some_key)
+      lambda { @page_table.get(@some_key) }.should raise_error(Rhino::Interface::Table::RowNotFound)
     end
   end
   
   describe &quot;when putting rows&quot; do
     it &quot;should require that column values be strings&quot; do
-      lambda { @page_htable.put('a', {'title:'=&gt;Object}) }.should raise_error(ArgumentError)
+      lambda { @page_table.put('a', {'title:'=&gt;Object}) }.should raise_error(ArgumentError)
     end
   end
   
   describe &quot;when putting existing rows&quot; do
     it &quot;should delete cells that previously existed if their value is changed to nil&quot; do
       key = 'example.com'
-      @page_htable.put(key, {'title:'=&gt;'howdy', 'links:com.google'=&gt;'Google'})
-      @page_htable.get(key).keys.include?('links:com.google').should == true
+      @page_table.put(key, {'title:'=&gt;'howdy', 'links:com.google'=&gt;'Google'})
+      @page_table.get(key).keys.include?('links:com.google').should == true
       # the cell has been deleted
-      @page_htable.put(key, {'title:'=&gt;'howdy', 'links:com.google'=&gt;nil})
-      @page_htable.get(key).keys.include?('links:com.google').should == false
+      @page_table.put(key, {'title:'=&gt;'howdy', 'links:com.google'=&gt;nil})
+      @page_table.get(key).keys.include?('links:com.google').should == false
     end
   end
   
@@ -94,10 +94,10 @@ describe Rhino::Interface::HTable do
     
     it &quot;should update the values&quot; do
       key = 'hi.example.com'
-      @page_htable.put(key, {'title:'=&gt;'howdy'})
-      @page_htable.get(key)['title:'].should == 'howdy'
-      @page_htable.put(key, {'title:'=&gt;'goodbye'})
-      @page_htable.get(key)['title:'].should == 'goodbye'
+      @page_table.put(key, {'title:'=&gt;'howdy'})
+      @page_table.get(key)['title:'].should == 'howdy'
+      @page_table.put(key, {'title:'=&gt;'goodbye'})
+      @page_table.get(key)['title:'].should == 'goodbye'
     end
   end
 end
\ No newline at end of file</diff>
      <filename>spec/interface/htable_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,20 +2,20 @@ require 'spec/spec_helper.rb'
 
 describe Rhino::Interface::Scanner do
   before do
-    @page_htable = Page.htable
-    @page_htable.put('com.apple', {'title:'=&gt;'apple'})
-    @page_htable.put('com.google', {'title:'=&gt;'google'})
-    @page_htable.put('com.microsoft', {'title:'=&gt;'microsoft'})
-    @page_htable.put('com.yahoo', {'title:'=&gt;'yahoo'})
+    @page_table = Page.table
+    @page_table.put('com.apple', {'title:'=&gt;'apple'})
+    @page_table.put('com.google', {'title:'=&gt;'google'})
+    @page_table.put('com.microsoft', {'title:'=&gt;'microsoft'})
+    @page_table.put('com.yahoo', {'title:'=&gt;'yahoo'})
   end
   
   after do
-    @page_htable.delete_all_rows
+    @page_table.delete_all_rows
   end
   
   describe &quot;scanning all rows&quot; do
     it &quot;should return all rows&quot; do
-      rows = @page_htable.scan.collect
+      rows = @page_table.scan.collect
       rows.collect { |row| row['title:'] }.should == %w(apple google microsoft yahoo)
       rows.collect { |row| row['key'] }.should == %w(com.apple com.google com.microsoft com.yahoo)
     end
@@ -23,36 +23,36 @@ describe Rhino::Interface::Scanner do
   
   describe &quot;when scanning with only a start row specified&quot; do
     it &quot;should return all rows including and after the start row&quot; do
-      rows = @page_htable.scan(:start_row=&gt;'com.google')
+      rows = @page_table.scan(:start_row=&gt;'com.google')
       rows.collect { |row| row['key'] }.should == %w(com.google com.microsoft com.yahoo)
     end
   end
   
   describe &quot;when scanning with a start row and a stop row specified&quot; do
     it &quot;should return all rows between the start row (inclusive) and stop row (exclusive)&quot; do
-      rows = @page_htable.scan(:start_row=&gt;'com.google', :stop_row=&gt;'com.yahoo')
+      rows = @page_table.scan(:start_row=&gt;'com.google', :stop_row=&gt;'com.yahoo')
       rows.collect { |row| row['key'] }.should == %w(com.google com.microsoft)
     end
   end
   
   describe &quot;when scanning with only a stop row specified&quot; do
     it &quot;should return all rows up to but not including the stop row&quot; do
-      rows = @page_htable.scan(:stop_row=&gt;'com.microsoft')
+      rows = @page_table.scan(:stop_row=&gt;'com.microsoft')
       rows.collect { |row| row['key'] }.should == %w(com.apple com.google)
     end
   end
   
   describe &quot;when no rows in the table exist&quot; do
     before do
-      @page_htable.delete_all_rows
+      @page_table.delete_all_rows
     end
     
     it &quot;should not raise an error&quot; do
-      lambda { @page_htable.scan }.should_not raise_error
+      lambda { @page_table.scan }.should_not raise_error
     end
     
     it &quot;should return an empty array&quot; do
-      @page_htable.scan.collect.should == []
+      @page_table.scan.collect.should == []
     end
   end
   
@@ -60,12 +60,12 @@ describe Rhino::Interface::Scanner do
     describe &quot;when many rows exist&quot; do
       before do
         (1..45000).each do |n|
-          @page_htable.put(&quot;item#{n}&quot;, {'title:'=&gt;&quot;title#{n}&quot;})
+          @page_table.put(&quot;item#{n}&quot;, {'title:'=&gt;&quot;title#{n}&quot;})
         end
       end
       
       it &quot;should scan all rows without an error&quot; do
-        lambda { @page_htable.scan.each do |row|
+        lambda { @page_table.scan.each do |row|
           puts row.title
         end }.should_not raise_error
       end</diff>
      <filename>spec/interface/scanner_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/rhino/interface/hbase.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/interface/htable.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/Hbase.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/gen/Hbase.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/gen/Hbase_constants.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/gen/Hbase_types.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/hbase.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/htable.rb</filename>
    </removed>
    <removed>
      <filename>lib/rhino/thrift/scanner.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>3602835f373e43cf557398a0bde323d7bef005d5</id>
    </parent>
  </parents>
  <author>
    <name>Quinn Slack</name>
    <email>qslack@qslack.com</email>
  </author>
  <url>http://github.com/sqs/rhino/commit/3b5b60c8ee15242fbd07be32c3366bc10d6a51dd</url>
  <id>3b5b60c8ee15242fbd07be32c3366bc10d6a51dd</id>
  <committed-date>2008-11-09T22:30:00-08:00</committed-date>
  <authored-date>2008-11-09T22:30:00-08:00</authored-date>
  <message>genericized adapter to get ready for possible cassandra support</message>
  <tree>0b931ca496ce9a81543999451995c500704f22de</tree>
  <committer>
    <name>Quinn Slack</name>
    <email>qslack@qslack.com</email>
  </committer>
</commit>
