[DOSGI-229] Refactor api and fix some issues
28 files changed