Almost all karaf modules use this.

As an example look at this:
https://git-wip-us.apache.org/repos/asf?p=karaf.git;a=blob;f=bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/osgi/Activator.java;h=c5c765b18d006a4053a0a66c5d02600259ab94dd;hb=HEAD

I have condensed the code a bit:
BundlesMBeanImpl bundlesMBeanImpl = new BundlesMBeanImpl(bundleContext, bundleService);
Hashtable<String, Object> props = new Hashtable<>();
props.put("jmx.objectname", "org.apache.karaf:type=bundle,name=" + System.getProperty("karaf.name"));
bundleContext.registerService(getInterfaceNames(mbean), mbean, props);

Also see:
http://aries.apache.org/modules/jmx.html

Christian

On 27.01.2015 13:32, Prithviraj wrote:
Do we have any sample example of it , which i can follow ?




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Need-to-execute-code-while-uninstalling-application-on-Karaf-tp4038037p4038045.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to