JBoss.orgCommunity Documentation

Chapter 7. Provided Bundles and Services

7.1. XML Parser Services
7.2. JAXB Service
7.3. JMX Service
7.4. JNDI Service
7.5. Microcontainer Service
7.6. Blueprint Container Service
7.7. HttpService
7.8. WebApp Extender

The JBoss OSGi jboss-osgi-apache-xerces.jar bundle provides services from DOM and SAX parsing.

The services are registered with the Framework under the name

Please see XMLParserActivator for details.

The JBoss OSGi jboss-osgi-jaxb.jar bundle provides a service to create JAXBContext instances.

The service is registered with the Framework under the name

The JBoss OSGi jboss-osgi-jmx.jar bundle activator discovers and registers the MBeanServer with the framework. It also tracks the naming service and binds the RMIAdaptor into JNDI for remote JMX access

The JMX Service is configured with these properties.

KeyValueDescription
org.jboss.osgi.jmx.host localhost The property that sets the host that the RMIAdaptor binds to
org.jboss.osgi.jmx.port 1098 The property that sets the port that the RMIAdaptor binds to
org.jboss.osgi.jmx.rmi.adaptor jmx/invoker/RMIAdaptor The property that sets the JNDI name the RMIAdaptor binds to

Here is the complete list of services that this bundle provides

The JBoss OSGi jboss-osgi-jndi.jar bundle activator creates and registers the InitialContext with the framework.

The JNDI Service is configured with these properties.

KeyValueDescription
org.jboss.osgi.jndi.host localhost The property that sets the naming server host
org.jboss.osgi.jndi.rmi.port 1098 The property that sets the naming server RMI port
org.jboss.osgi.jndi.port 1099 The property that sets the naming server port

Here is the complete list of services that this bundle provides

The JBoss OSGi jboss-osgi-microcontainer.jar bundle provides a service that give access to the JBoss Microcontainer Kernel. The service is registered with the Framework under the name

Here is an example of how an OSGi component can access an arbitrary MC bean.



    public class SomeService
    {
       public String callSomeBean(String msg)
       {
          ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
          MicrocontainerService mcService = (MicrocontainerService)context.getService(sref);
          SomeBean bean = (SomeBean)mcService.getRegisteredBean("SomeBean");
          return bean.echo(msg);
       }
    }
    

The JBoss OSGi jboss-osgi-blueprint.jar bundle provides an early access of a Blueprint extender service.

The Blueprint Container service allows bundles to contain standard blueprint descriptors, which can be used for component wiring and injection of blueprint components. The idea is to use a plain POJO programming model and let Blueprint do the wiring for you. There should be no need for OSGi API to "pollute" your application logic.

The Blueprint API is divided into the Blueprint Container and Blueprint Reflection packages.

The pax-web-jetty-bundle.jar bundle from the OPS4J Pax Web project provides access to the HttpService.

An example of how a bundle uses the HttpService to register servlet and resources is given in HttpService Example.

The pax-web-extender-war.jar bundle from the OPS4J Pax Web project provides WAR processing functionality.

Deploying a WAR onto JBoss OSGi

You should have a war file compliant with Servlet specs. Additionally, the war file must have the necessary OSGi manifest headers.

  • Bundle-ManifestVersion: 2 - This header defines that the bundle follows the rules of R4 specification.
  • Bundle-SymbolicName - This header specifies a unique, non-localizable name for this bundle.

There are also a number of other OSGi manifest headers that are processed by the WAR Extender. Please have a look at OSGify your WAR for details.

An example of how a bundle uses the WAR Extender to register servlet and resources is given in WebApp Example.