Friday, March 27, 2009

JBossOSGi - Provided Services

This is the last of a the current series of three blogs on JBossOSGi
  1. Getting Started
  2. Service Provider Interface
  3. Provided Services
Logging Service

The JBossOSGi jboss-osgi-service-logging.jar bundle contains a simple Logging Bridge Service to JBoss Logging. It registers a trivial LogListener with the LogReaderService in case that service is registered with the Framework.

The LogReaderService is part of the standard OSGi Compendium Services. JBossOSGi currently uses the (not yet released) LogService from Apache Felix, which gets deployed as Bundle org.apache.felix.log.jar

The LogListener itself logs messages under the Bundle's symbolic name.

You can therefore change the logging for specific Bundles by setting the respective logging level.

Microcontainer Service

JBossOSGi SPI comes with a service that give access to the JBoss Microcontainer Kernel and the JMX MBeanServer. The service is registered with the Framework under the name

org.jboss.osgi.service.MicrocontainerService

Here is an example of how an OSGi component can register an arbitrary MBean with the MBeanServer.

String sname = MicrocontainerService.class.getName();
ServiceReference sref = context.getServiceReference(sname);
MicrocontainerService service = context.getService(sref);
MBeanServer server = service.getMbeanServer();
server.registerMBean(new Foo(), OBJECT_NAME);


What is there to come?

The intention of this post was to give information on the JBossOSGi Provided Services. This concludes this series of three blogs. I look forward to your feedback on the JBossOSGi User Forum

In my next post I'm hopefully going to write about the JBossOSGi integration for Equniox and Knopflerfish - stay tuned.

No comments:

Post a Comment