Monday, July 20, 2009

Completing the JMX service registration and sorting view contents

I spent a little time using the Bundle and Services views today to see how well they worked. It turns out that I had a little problem with the Karaf data feeds not updating properly. The OSGi JMX MBean interfaces do not seem to support the NotificationEmitter interface so there is no way to asynchronously update the data.

This isn't terrible since I just wrapped the data update in an Eclipse system job that runs every 25 seconds. The down side is that the viewer refresh invalidates your selection because it wipes the source data completely. Some day when I am motivated I'll try and fix it.



I also noticed that my JMX services were in the wrong place in the code so I moved them and centralized their registration and maintenance. You can see from the first picture that there are now services for each OSGi JMX MBean and the general MBeanProvider which is part of the EIK tooling. The MBeanProvider is the service that other developers can use to interact with the MBeanServer from a running/debugging Karaf instance in the workbench. All of these services are tagged so that you can easily distinguish between them should there be multiple Karaf instances being run/debugged.

The next thing that I noticed is that the order of the services changed from refresh to refresh which was quite annoying. I decided that I would apply some static sort rules that grouped services together first by the bundle that registered them and then by the sorted list of interfaces. This makes for very stable view contents and is really easy to navigate. I also sorted the service properties so that a quick scan is all you need to see what was registered.

The final item I am working on this evening is getting the FrameworkAdminMBean setup so that bundles can be started, stopped, installed and whatever else that can be done from the view.

I decided that the ConfigAdminMBean is nice but to be useful is going to require a special editor that is fairly robust. I'm going to think about that some more and look for inspiration before I dive off in to the code.

As usual, pictures to show the progress. Only a couple more bugs to work out before a preliminary release.