rackerlabs/atom-hopper — pull request #274 by usnavi (2014-05-12 16:17:20+00:00)
Title: B-59299 - Categories Refactoring

This PR maintains backward compatibility for the JDBC adapter.

* Added AbstractJdbcSource & AbstractJdbcPublisher to enable extending the basic JDBC adapter functions.
* Updated SearchToSqlConverter to allow mapping specific category prefixes to specific SQL columns in the datastore.

From the class comments for SearchToSqlConverter:

This class creates the search SQL and corresponding SQL parameters for a given set of query parameters.

By default, this class assumes all categories are treated the same and stored in a single variable-length array.
This class can also be customized to map specific categories to specific columns in the DB, allowing for higher performance when searching on these categories.

To configure this functionality pass in the following:

* Map[String, String] - a map of pairs where the key is the prefix found in the atom category and the value is the name of the SQL text column.
* String - the String which separates the prefix from the value within the atom category. E.g., for the category value of "tid:1234", if ':' is the mark, then "tid" is the prefix.

An example configuration might be:

A map of { "tid" => "tenantid", "type" => "eventype" } with a mark of ":".

This maps the following atom categories:

* "tid:1234" => enter "1234" into the "tenantid" column
* "type:lbaas.usage" => enter "lbaas.usage" into the "eventtype" column