Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'release/0.90.5-3'

  • Loading branch information...
commit 003240d9697f3a90fafa0d725fdba395a45e8247 2 parents dc62420 + ef4dc03
@davidsantiago authored
Showing with 36 additions and 38 deletions.
  1. +2 −0  README.markdown
  2. +3 −12 project.clj
  3. +31 −26 src/clojure_hbase/admin.clj
View
2  README.markdown
@@ -160,6 +160,8 @@ Basic unit tests passing. No known bugs. Bug reports and input welcome.
## Lately...
+- Update to version 0.90.5-3, which makes the HBaseAdmin object rebindable. Work by [Ryan Senior](https://github.com/senior).
+
- Update to version 0.90.5-2, with the addition of set-config and default-config, to programmatically chanage HBase's configuration. Work by [Robert Levy](https://github.com/rplevy-draker).
- Update to version 0.90.5-1, with a race condition fix from [Homer
View
15 project.clj
@@ -1,4 +1,4 @@
-(defproject clojure-hbase "0.90.5-2"
+(defproject clojure-hbase "0.90.5-3"
:description "A convenient Clojure interface to HBase."
:dependencies [[org.clojure/clojure "1.2.0"]
[org.apache.hadoop/hadoop-core "0.20.205.0"]
@@ -9,14 +9,5 @@
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]
[org.clojure/tools.logging "0.2.3"]]
- :multi-deps {"1.2" [[org.clojure/clojure "1.2.0"]]
- "1.3" [[org.clojure/clojure "1.3.0"]]
- :all [[org.apache.hadoop/hadoop-core "0.20.205.0"]
- [org.apache.hbase/hbase "0.90.5"]
- [org.apache.zookeeper/zookeeper "3.3.2"]
- [log4j/log4j "1.2.16" :exclusions [javax.mail/mail
- javax.jms/jms
- com.sun.jdmk/jmxtools
- com.sun.jmx/jmxri]]
- [org.clojure/tools.logging "0.2.3"]]}
- :dev-dependencies [])
+ :profiles {:clojure1.2 [[org.clojure/clojure "1.2.0"]]
+ :clojure1.3 [[org.clojure/clojure "1.3.0"]]})
View
57 src/clojure_hbase/admin.clj
@@ -8,8 +8,13 @@
[org.apache.hadoop.hbase.util Bytes]
[org.apache.hadoop.hbase.io.hfile Compression]))
-(def ^{:tag HBaseAdmin :dynamic true :private true} *admin*
- (HBaseAdmin. (HBaseConfiguration/create)))
+(def ^{:tag HBaseAdmin :dynamic true} *admin*
+ (atom nil))
+
+(defn hbase-admin []
+ (when-not @*admin*
+ (swap! *admin* #(or % (HBaseAdmin. (HBaseConfiguration/create)))))
+ @*admin*)
;;
;; HColumnDescriptor
@@ -72,7 +77,7 @@
(defn add-column-family
[table-name ^HColumnDescriptor column-descriptor]
- (.addColumn *admin* (to-bytes table-name) column-descriptor))
+ (.addColumn (hbase-admin) (to-bytes table-name) column-descriptor))
(defn hbase-available?
[]
@@ -80,93 +85,93 @@
(defn compact
[table-or-region-name]
- (.compact *admin* (to-bytes table-or-region-name)))
+ (.compact (hbase-admin) (to-bytes table-or-region-name)))
(defn create-table
[table-descriptor]
- (.createTable *admin* table-descriptor))
+ (.createTable (hbase-admin) table-descriptor))
(defn create-table-async
[^HTableDescriptor table-descriptor split-keys]
- (.createTableAsync *admin* table-descriptor split-keys))
+ (.createTableAsync (hbase-admin) table-descriptor split-keys))
(defn delete-column-family
[table-name column-name]
- (.deleteColumn *admin* (to-bytes table-name) (to-bytes column-name)))
+ (.deleteColumn (hbase-admin) (to-bytes table-name) (to-bytes column-name)))
(defn delete-table
[table-name]
- (.deleteTable *admin* (to-bytes table-name)))
+ (.deleteTable (hbase-admin) (to-bytes table-name)))
(defn disable-table
[table-name]
- (.disableTable *admin* (to-bytes table-name)))
+ (.disableTable (hbase-admin) (to-bytes table-name)))
(defn enable-table
[table-name]
- (.enableTable *admin* (to-bytes table-name)))
+ (.enableTable (hbase-admin) (to-bytes table-name)))
(defn flush
[table-or-region-name]
- (.flush *admin* (to-bytes table-or-region-name)))
+ (.flush (hbase-admin) (to-bytes table-or-region-name)))
(defn cluster-status
[]
- (.getClusterStatus *admin*))
+ (.getClusterStatus (hbase-admin)))
(defn get-connection
[]
- (.getConnection *admin*))
+ (.getConnection (hbase-admin)))
(defn get-master
[]
- (.getMaster *admin*))
+ (.getMaster (hbase-admin)))
(defn get-table-descriptor
[table-name]
- (.getTableDescriptor *admin* (to-bytes table-name)))
+ (.getTableDescriptor (hbase-admin) (to-bytes table-name)))
(defn master-running?
[]
- (.isMasterRunning *admin*))
+ (.isMasterRunning (hbase-admin)))
(defn table-available?
[table-name]
- (.isTableAvailable *admin* (to-bytes table-name)))
+ (.isTableAvailable (hbase-admin) (to-bytes table-name)))
(defn table-disabled?
[table-name]
- (.isTableDisabled *admin* (to-bytes table-name)))
+ (.isTableDisabled (hbase-admin) (to-bytes table-name)))
(defn table-enabled?
[table-name]
- (.isTableEnabled *admin* (to-bytes table-name)))
+ (.isTableEnabled (hbase-admin) (to-bytes table-name)))
(defn list-tables
[]
- (seq (.listTables *admin*)))
+ (seq (.listTables (hbase-admin))))
(defn major-compact
[table-or-region-name]
- (.majorCompact *admin* (to-bytes table-or-region-name)))
+ (.majorCompact (hbase-admin) (to-bytes table-or-region-name)))
(defn modify-column-family
[table-name column-name ^HColumnDescriptor column-descriptor]
- (.modifyColumn *admin* (to-bytes table-name) (to-bytes column-name)
+ (.modifyColumn (hbase-admin) (to-bytes table-name) (to-bytes column-name)
column-descriptor))
(defn modify-table
[table-name table-descriptor]
- (.modifyTable *admin* (to-bytes table-name) table-descriptor))
+ (.modifyTable (hbase-admin) (to-bytes table-name) table-descriptor))
(defn shutdown
[]
- (.shutdown *admin*))
+ (.shutdown (hbase-admin)))
(defn split
[table-or-region-name]
- (.split *admin* (to-bytes table-or-region-name)))
+ (.split (hbase-admin) (to-bytes table-or-region-name)))
(defn table-exists?
[table-name]
- (.tableExists *admin* (to-bytes table-name)))
+ (.tableExists (hbase-admin) (to-bytes table-name)))
Please sign in to comment.
Something went wrong with that request. Please try again.