JBoss.orgCommunity Documentation

Chapter 7. Provided Bundles and Services

7.1. Blueprint Container Service
7.2. HttpService
7.3. JAXB Service
7.4. JMX Service
7.5. JNDI Service
7.6. JTA Service
7.7. Microcontainer Service
7.8. ServiceLoader Interceptor
7.9. WebApp Extender
7.10. XML Parser Services
7.11. XML Binding Services

The JBoss OSGi jboss-osgi-blueprint.jar bundle provides together with org.apache.aries.blueprint.jar access to the 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 HttpService is configured with these properties.

KeyValueDescription
org.osgi.service.http.port 8090 The property that sets the port the HttpService binds to

The service is registered with the Framework under the name

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. By default, it also sets up a remote connector at:

service:jmx:rmi://localhost:1198/jndi/rmi://localhost:1090/osgi-jmx-connector

The JMX Service is configured with these properties.

KeyValueDescription
org.jboss.osgi.jmx.host localhost The property that sets the host that the JMXConnector binds to
org.jboss.osgi.jmx.rmi.port 1198 The property that sets the port that the JMXConnector binds to
org.jboss.osgi.jmx.rmi.registry.port 1090 The property that sets the port that the RMI Registry 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-jta.jar bundle registers two services with framework.

Among others the JTA Service can be configured with these properties.

KeyValueDescription
com.arjuna.ats.arjuna.objectstore.objectStoreDir ${server.data.dir}/tx-object-store The property that sets the transaction object store directory

For details please refer to the JBossTM documentation.

The JBoss OSGi Microcontainer Service gives 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 ServiceLoader, deployed as jboss-osgi-serviceloader.jar bundle, is a Lifecycle Interceptor that automatically registers services declared in META-INF/services.

For more information, please hava a look at ServiceLoader and how it relates to OSGi.

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.

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

The services are registered with the Framework under the name

Please see XMLParserActivator for details.

The JBoss OSGi jboss-osgi-xml-binding.jar bundle provides an JBossXB unmarshaller service.

The service is registered with the Framework under the name