Recompiling widgetset at runtime in modular app with osgi

I’m trying (planning at the moment) to implement modular vaadin application which would be able to add and remove plugins at runtime. This will be done with osgi. But I just wonder how to issue widgetset recompilation at runtime. Let’s say I will add plugin which will add new client side controls. How to issue widgetset recompilation from within application to allow new module to work as required?
The recompilation should be done only on install/remove module from main application. On activate/deactivate it just runs routines which integrates new module to app and not recompilation. I am aware, that during the recompilation process, the app will be unusable but that’s ok. After the recompilation will be done I plan to send email to my app administrator to inform him that recompilation is done and now main app is working again or to implement interfaces for jmx console and show the status there.
Simple app demonstrating this functionality would be a great help (if it is possible of course) for me and for other users too.