JMX management of OSGi gateways

In this project we have made an implementation that automatically builds mbeans from services. This implementation has two parts : the first one is a simple Mbean that represents the gateway, the second part automates mbeans from osgi services introspection and observation. The remaining part of the document supposes that you have a running jmx agent. (see insajmx)

OSGi MBean

The OSGi MBean is a simple bundle that register an MBean that represents the current OSGi running gateway.
  -> obr start "OSGi MBean"
  ...
You can now start either a remote console (rmi connector) or an http client (http connector) on http://localhost:8082, and see an OSGi JMX domain with informations comming from the gateway.

Services MBean

This part of the project automatically builds service from what is available on the gateway. Each time a new service is register the service builds an MBean that wraps access to it.

The service relies on an Introspector that can introspect services, an MBean factory that build a Dynamic MBean from a service introspection, a Service Notifier that listens to services activities and registers/deregisters MBeans acordingely. Two services are annexed to the system : the "Shell MBean" provides an interface to the oscar shell that enables Shell remoting through JMX; the MBeanPsCommand is an OSGi command that can be used to get the number of deployed mbeans from OSGi shell.

  -> obr start "MBean Factory"
  ...
The service builds an MBean for each service present on the gateway. Then you should install the Service Notifier bundle.
  -> obr start "Service Notifier"
  ...
The services lifecycle is now observed. Each time a new service is registered or deriegistered the MBean is added or removed.

You can now install the two annexed bundles (MBeanPsCommand and ShellMBean)

  -> obr start "Shell MBean"
  ...
  -> obr start "MBeanPsCommand"
  ...