You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by Apache Wiki <wi...@apache.org> on 2012/01/04 22:02:59 UTC
[Hadoop Wiki] Trivial Update of "Hbase/Scala" by Joe Stein
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The "Hbase/Scala" page has been changed by Joe Stein:
http://wiki.apache.org/hadoop/Hbase/Scala?action=diff&rev1=2&rev2=3
ps auwx|grep java|grep org.apache.hadoop.hbase.master.HMaster|perl -pi -e "s/.*classpath //"
}}}
+ == Using SBT ==
+
+ Your build.sbt file will need this inside of it for your Scala client to work
+
+ {{{
+
+ resolvers += "Apache HBase" at "https://repository.apache.org/content/repositories/releases"
+
+ resolvers += "Thrift" at "http://people.apache.org/~rawson/repo/"
+
+ libraryDependencies ++= Seq(
+ "org.apache.hadoop" % "hadoop-core" % "0.20.2",
+ "org.apache.hbase" % "hbase" % "0.90.4"
+ )
+
+ }}}
== The Code ==
Please look at the Java API. Adaptation to scala should be relatively easy. The example below shows part of the sample Java code adapted to scala:
@@ -20, +36 @@
{{{
import org.apache.hadoop.hbase.HBaseConfiguration
- import org.apache.hadoop.hbase.client.HBaseAdmin
+ import org.apache.hadoop.hbase.client.{HBaseAdmin,HTable,Put,Get}
- import org.apache.hadoop.hbase.client.HTable
- import org.apache.hadoop.hbase.client.Put
- import org.apache.hadoop.hbase.client.Get
import org.apache.hadoop.hbase.util.Bytes
-
val conf = new HBaseConfiguration()