Major rewrite of opencga-adapter.

Not finished.