rtbkit/rtbkit — pull request #107 by daedric (2013-11-26 11:38:14+00:00)
Title: Add generic component to handle Creative configuration

This component takes as template parameter a class that'll hold the creative
configuration. The connector is free to store and fetch whatever it needs.

For example, if a X connector needs the providerConfig to have the
advertiser name, it can configure the CreativeConfiguration class to
look for it. If not found, depending whether the connector requires this
configuration, the creative can be marked as "no compatible".

Snippet expander has also been implemented. For example, if a variable
fetched from the configuration is said to be a snippet, the value will
be looked up for variable between two markers, by default
${this.is.a.variable}.

A variable represents a path to a value. This path can start from 3
distinct locations: the bidrequest, the meta information and the
creative.
Examples:

creative.width
bidrequest.publisher.id
meta.companyUserId

During the initialization, the CreativeConfiguration class will do its
best to optimize the expander:

* it will compute the list of variables;
* then it will get the offset of the part to replace in the snippet;
* it will also check that if the variable has a "fast" lookup (see later)
* and finally a functor will be computed.

When a variable is looked up, there is 2 possibilities:

* the variable exists in the expander dictionary;
* it does not.

If it does, the value can be fetched directly, otherwise, the expander
will encode back the bidrequest or the creative to fetch the needed
value. About the meta information, this transformation will always be
performed.

It is also possible to filter the value before injecting them into the
final snippet.
For example:

${meta.companyUserId#upper}

It upper the whole string.

There are 2 existing filters:

* upper
* lower

Filters can be stacked:

${meta.companyUserId#upper#urlencode}

urlencode is an useful filter no provided here.