HFactory Tools is the set of tools that we developed at Ubeeko to ease the development of HBase applications, from backend to fronted. We use it everyday in our projects and it does make modeling of project domains and development much easier.
While extremely powerful, HBase is a low-level system that only knows byte arrays, requires distributed engineering and NoSQL data modeling expertise.
HFactory solves that problem by offering:
- HTalk, a dev-friendly HBase DSL able to handle strongly-typed data;
- HFactory Mapper, a macro-based ORM built on top of that DSL that provides entity-oriented modeling and automatic generation of the backend code required to persist these entities; and
- HServer, a server that exposes an automatically generated REST API for these entities.
At the lowest level, HFactory Tools offsers a DSL delivering a high-level, expressive interface to HBase CRUD operations. Contrast HTalk’s strongly-typed single line expression
"user".put("ProjectX", "number", 10).execute
vs raw HBase’s
Table table = connection.getTable(TableName.valueOf("user")); Put p = new Put(Bytes.toBytes("ProjectX")); p.add(Bytes.toBytes("d"), Bytes.toBytes("number"), Bytes.toBytes(10));
Building on HTalk, HFactory Mapper relies on metaprogramming techniques using Scala macros to enable the strongly-typed, high-level modeling of business objects and their manipulation.
All the code required for the serialization a high level entity in an HBase table (column families, fields, byte array conversions) is automatically generated by the HFactory macros.
Going one step further, HServer leverages the HFactory macro system to generate a REST API that exposes entities in JSON format. From an application developer perspective, this makes developping on HBase as simple as working with MongoDB while retaining the scalability of HBase. The strongly-typed entities can also be used to perform analytics in Spark.
Overall, HFactory Tools delivers full backend coverage, on the backend within Scala (with the DSL and ORM) and on the frontend as JSON entities in a REST API for use by web apps.