Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
<dependency>
Expand All @@ -35,6 +39,15 @@ This project uses [Maven](http://maven.apache.org/ "Apache Maven"). To use HPast
</dependency>
```

### 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.
Expand All @@ -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")
Expand All @@ -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)
Expand Down
24 changes: 13 additions & 11 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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" ,
Expand Down
4 changes: 3 additions & 1 deletion project/HPasteBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}