[XWIKI-3544] Fix rendering cache for on-demand extensions

Rewrite of #257 with applied checkstyle and custom component support
There are problems of code style here, see http://dev.xwiki.org/xwiki/bin/view/Community/JavaCodeStyle

for example for methods, the { is on a new line.