Fix checkstyle.
Add tests for role mapper.
Fix NPE and add javadoc.
Add java doc and improver error messages.
Move add URIs to index in initializer method, called once in constructor.