Permalink
Browse files

Using Base.establish connection to make connection

  • Loading branch information...
sjagadee
sjagadee committed Mar 12, 2009
1 parent b033f73 commit 3dc587f52a1431a91ff98e875b1bbe54c8b1d855
View
@@ -0,0 +1,7 @@
+#This will be used as a default server
+default:
+ adapter: mysql
+ database: wisdomize_dev
+ username: wisdomize_user
+ password: wisdomize_in
+ host: localhost
@@ -21,7 +21,7 @@ def self.establish_connection(spec = nil)
configuration.setInt("hbase.client.retries.number", 5)
configuration.setInt("ipc.client.connect.max.retries", 3)
- HbaseConnection.new
+ HbaseConnection.new(configuration)
end
end
@@ -1,7 +1,7 @@
class HbaseAdmin
def initialize()
- hbase_connection = HbaseConnection.new
+ hbase_connection = HbaseRecord::Base.establish_connection
@admin = HBaseAdmin.new(hbase_connection.configuration)
end
@@ -3,10 +3,8 @@
class HbaseConnection
attr_accessor :configuration
- def initialize
- @configuration = org.apache.hadoop.hbase.HBaseConfiguration.new()
- @configuration.setInt("hbase.client.retries.number", 5)
- @configuration.setInt("ipc.client.connect.max.retries", 3)
+ def initialize(confirguration)
+ @configuration = confirguration
end
def current_schema_version(user,env)
@@ -26,8 +24,6 @@ def initialize_schema_information(user,env)
table = HbaseTable.new(@configuration,'schema_versions')
table.put("#{user}:#{env}", "version:", '0') if table.get("#{user}:#{env}").empty?
-
- admin.flush('schema_versions')
end
end
@@ -28,7 +28,7 @@ def current_version(user,env)
end
def hbase_connection
- HbaseConnection.new
+ HbaseRecord::Base.establish_connection
end
end

0 comments on commit 3dc587f

Please sign in to comment.