Rewritten the openquake validation mechanism; now it is done in commonlib

This closes several bugs. See https://bugs.launchpad.net/oq-engine/+bug/1320125, 
https://bugs.launchpad.net/oq-engine/+bug/1287228, https://bugs.launchpad.net/oq-engine/+bug/1316085
The tests are green: https://ci.openquake.org/job/zdevel_oq-commonlib/83/
Please rename val into validator