diff --git a/README.markdown b/README.markdown index cc0b0a0..03674f0 100644 --- a/README.markdown +++ b/README.markdown @@ -25,7 +25,11 @@ This project is currently actively developed and maintained. It is used in a la ## Installation -This project uses [Maven](http://maven.apache.org/ "Apache Maven"). To use HPaste in your own maven project, simply add it as a dependency: +This project uses [Maven](http://maven.apache.org/ "Apache Maven") but is usable from [SBT](http://www.scala-sbt.org/) too. + +### Maven + +To use HPaste in your own Maven project, simply add it as a dependency: ```xml @@ -35,6 +39,15 @@ This project uses [Maven](http://maven.apache.org/ "Apache Maven"). To use HPast ``` +### SBT + +To use HPaste in your own SBT project: + +```scala +// Dependency +val hpaste = "com.gravity" %% "gravity-hpaste" % "0.1.24" +``` + ## Quickstart Here's some quick code examples to give you a sense of what you're getting into. All of the examples in the sections below come from the HPaste unit tests. Specifically the file [WebCrawlSchemaTest.scala](https://github.com/GravityLabs/HPaste/blob/master/src/test/scala/com/gravity/hbase/schema/WebCrawlSchemaTest.scala). If you go to that file and follow along with the explanations below, things will make more sense. @@ -50,7 +63,9 @@ The classic case for HBase and BigTable is crawling and storing web pages. You * SearchMetrics is a column family that contains searches your users have made that have sent them to that page, organized by day. ```scala -class WebTable extends HbaseTable[WebTable, String, WebPageRow](tableName = "pages", rowKeyClass = classOf[String]) { +object WebCrawlingSchema extends Schema { + + class WebTable extends HbaseTable[WebTable, String, WebPageRow](tableName = "pages", rowKeyClass = classOf[String]) { def rowBuilder(result: DeserializedResult) = new WebPageRow(this, result) val meta = family[String, String, Any]("meta") @@ -62,8 +77,6 @@ class WebTable extends HbaseTable[WebTable, String, WebPageRow](tableName = "pag val attributes = column(content, "attrs", classOf[Map[String, String]]) val searchMetrics = family[String, DateMidnight, Long]("searchesByDay") - - } class WebPageRow(table: WebTable, result: DeserializedResult) extends HRow[WebTable, String](result, table) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 7cf996c..ffc11a2 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -21,28 +21,30 @@ object Dependencies { object V { // Java + val hadoop = "0.20.2" val jodaTime = "1.6.1" - val hadoopCore = "0.20.2" val hbase = "0.90.4" val asyncHbase = "1.4.0" val trove4j = "3.0.3" // Java (test only) val junit = "4.8.1" - val hadoopTest = "0.20.2" + val junitInt = "0.10" } object Libraries { // Java - val jodaTime = "joda-time" % "joda-time" % V.jodaTime - val hadoopCore = "org.apache.hadoop" % "hadoop-core" % V.hadoopCore - val hbase = "org.apache.hbase" % "hbase" % V.hbase - val asyncHbase = "org.hbase" % "asynchbase" % V.asyncHbase - val trove4j = "net.sf.trove4j" % "trove4j" % V.trove4j + val jodaTime = "joda-time" % "joda-time" % V.jodaTime + val hadoopCore = "org.apache.hadoop" % "hadoop-core" % V.hadoop + val hbase = "org.apache.hbase" % "hbase" % V.hbase + val asyncHbase = "org.hbase" % "asynchbase" % V.asyncHbase + val trove4j = "net.sf.trove4j" % "trove4j" % V.trove4j // Java (test only) - val junit = "junit" % "junit" % V.junit % "test" - val hadoopTest = "org.apache.hadoop" % "hadoop-test" % V.hadoopTest % "test" - val hbaseTests = "org.apache.hbase" % "hbase" % V.hbase classifier "tests" - // To exclude. TODO: not yet implemented + val junit = "junit" % "junit" % V.junit % "test" + val junitInt = "com.novocode" % "junit-interface" % V.junitInt % "test" + val hadoopTest = "org.apache.hadoop" % "hadoop-test" % V.hadoop % "test" + val hbaseTest = "org.apache.hbase" % "hbase" % V.hbase classifier "tests" + + // To exclude. TODO: not yet used in HPasteBuild val exclusions = List( "org.apache.thrift" , "thrift" , "org.jruby" , "jruby-complete" , diff --git a/project/HPasteBuild.scala b/project/HPasteBuild.scala index 1290ef5..d87e21a 100644 --- a/project/HPasteBuild.scala +++ b/project/HPasteBuild.scala @@ -39,7 +39,9 @@ object HPasteBuild extends Build { Libraries.asyncHbase, Libraries.trove4j, Libraries.junit, - Libraries.hbaseTests + Libraries.junitInt, + Libraries.hadoopTest, + Libraries.hbaseTest ).map(_.exclude("org.apache.thrift", "thrift")) // TODO: use full list ) }