KARAF-1243 First part. Refactoring on trunk to remove duplicate code on mbeans and shell. Bugfix for delayed update not yet included