REVIEW [NX-390] misc refactoring for osgi

Extracted the refactoring changes out of #538 for easier reviewing/integration (plus some follow-up refactoring).

http://bamboo.s/browse/NX-OSSF76-1 :white_check_mark: