JBoss.orgCommunity Documentation

Chapter 3. JBoss OSGi Runtime

3.1. Overview
3.2. Features
3.3. Runtime Profiles

The JBoss OSGi Runtime is an OSGi container onto which components, services and applications can be deployed.

Preconfigured profiles, contain OSGi bundles that logically work together. A profile can be bootstrapped either as a standalone server or embedded in some other environment. With a startup time of less than 600ms, the runtime can be easily be bootstrapped from within plain JUnit4 test cases.

The JBoss OSGi Runtime has an integration layer for the underlying OSGi framework.

Through local and remote management capabilities the JBoss OSGi Runtime can be provisioned with new or updated bundles. Similar to JBossAS it supports hot-deployment by dropping bundles into the 'deploy' folder. Management of the runtime is provided through a Web Console

Integration of the JBoss Microcontainer as an OSGi service allows you to write your applications in a POJO programming model without much "pollution" of OSGi specific API - the MC will do the wiring for you. JBoss OSGi also comes with an implementation of Blueprint Service (RFC-124), which standardizes this idea and takes it further.

Great care has been taken about testability of deployed components and services. The Husky Test Framework allows you to write plain JUnit tests that do not have a requirement on a specific test runner nor need to extend any specific test base class. Access to the Runtime has been abstracted sufficiently that you can run the same test case against an embedded (bootstrapped from within the test case) as well as a remote instance of the Runtime. You can run your OSGi tests from Maven, Ant, Eclipse or any other test runner that supports JUnit4.

JBoss OSGi Runtime can be installed as a JBossAS service with abstractions of the available OSGi services. The JBoss OSGi testsuite in fact runs the same set of tests against the embedded, standalone and AS integrated instance of the Runtime

The current JBoss OSGi Runtime feature set includes

  • Embedded and Standalone usage - The runtime can be bootstrapped as standalone container with a startup time of less than 2 sec in its default configuration or embedded in some other container environment.
  • Various Runtime Profiles - It comes with the preconfigured profiles 'Minimal', 'Default', 'Web', 'All'. Setting up a new profile is a mater of creating a new directory and putting some bundles in it.
  • Hot Deployement - Similar to JBossAS there is a deployment scanner that scans the 'deploy' folder for new or removed bundles.
  • Local and Remote JMX Support - There is local as well as remote JSR160 support for JMX.
  • JNDI Support - Components can access the JNDI InitialContext as a service from the registry.
  • JTA Support - Components can interact with the JTA TransactionManager and UserTransaction service.
  • SAX/DOM Parser Support - The Runtime comes with an implementation of an XMLParserActivator which provides access to a SAXParserFactory and DocumentBuilderFactory.
  • JAXB Support - There is a bundle that provides JAXB support.
  • HttpService and WebApp Support - HttpService and WebApp support is provided by Pax Web.
  • ConfigAdmin Support - ConfigAdmin support is provided by the Apache Felix Configuration Admin Service.
  • EventAdmin Support - EventAdmin support is provided by the Apache Felix Event Admin Service.
  • Provisioning - Bundle provisioning can be done through the JMX based Runtime Managment Interface.
  • Logging System - The logging bridge writes OSGi LogEntries to the configured logging framework (e.g. Log4J).
  • Microcontainer Support - The Microcontainer service allows bundles to contain a *-beans.xml descriptor, which can be used for component wiring and injection of base services. It also comes with a set of deployers - so instead of simply installing a bundle to the underlying OSGi framework it passes to the chain of deployers which each deal with a specific aspect of bundle deployment.
  • Blueprint Container Support - 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.

A runtime profile is a collection bundles that logically work together. The OSGi runtime configuration contains the list of bundles that are installed/started automatically. You can start create you own profile by setting up a new directory with your specific set of bundles.

A runtime profile can be started using the -c comand line option.

$ bin/run.sh -c minimal
=========================================================================

  JBossOSGi Bootstrap Environment

  OSGI_HOME: /home/tdiesler/jboss-osgi-1.0.0.Beta8/runtime

  JAVA: /usr/java/jdk1.6/bin/java

  JAVA_OPTS: -Dprogram.name=run.sh ...

=========================================================================

12:10:48,713 INFO  JBossOSGi Core Framework - 1.0.0.Alpha4
12:10:49,089 INFO  Bundle INSTALLED: Bundle{osgi.cmpn:4.2.0.200908310645}
12:10:49,188 INFO  Bundle INSTALLED: Bundle{org.apache.felix.log:1.0.0}
12:10:49,282 INFO  Bundle INSTALLED: Bundle{jboss-osgi-common:1.0.2}
12:10:49,313 INFO  Bundle INSTALLED: Bundle{jboss-osgi-hotdeploy:1.0.2}
12:10:50,047 INFO  Bundle STARTED: Bundle{jboss-osgi-hotdeploy:1.0.2}
12:10:50,050 INFO  Bundle STARTED: Bundle{system.bundle:0.0.0}
12:10:50,076 INFO  JBossOSGi Runtime booted in 1.357sec
    
Minimal Profile

The 'minimal' profile provides logging and hot-deployment.

The following bundles are installed:

  • jboss-osgi-common.jar - JBoss OSGi common services
  • jboss-osgi-hotdeploy.jar - JBoss OSGi hot deployment service
  • org.apache.felix.log.jar - Apache LogService
  • org.osgi.compendium.jar - OSGi compendium API
Default Profile

The 'default' profile extends the 'minimal' profile by JNDI and JMX

These additional bundles are installed:

  • jboss-osgi-common-core.jar - JBoss Common Core functionality
  • jboss-osgi-jmx.jar - JBoss OSGi JMX service
  • jboss-osgi-jndi.jar - JBoss OSGi JNDI service
  • org.apache.aries.jmx.jar - Apache Aries JMX services
  • org.apache.felix.configadmin.jar - Apache Config Admin service
  • org.apache.felix.eventadmin.jar - Apache Event Admin service
Web Profile

The 'web' profile extends the 'default' profile by HttpService and ConfigAdmin

These additional bundles are installed:

  • jboss-osgi-http.jar - JBoss OSGi HttpService
  • jboss-osgi-webapp.jar - JBoss OSGi WebApp Support
  • jboss-osgi-webconsole.jar - JBoss OSGi Web Console
All Profile

The 'all' profile extends the 'web' profile by SAX/DOM, JAXB, JBossXB and Microcontainer

These additional bundles are installed:

  • jboss-osgi-jaxb.jar - JAXB support
  • jboss-osgi-jta.jar - JTA support
  • jboss-osgi-xerces.jar - Apache Xerces support
  • jboss-osgi-xml-binding.jar - XML Binding (JBossXB) support
  • jboss-osgi-blueprint.jar - Blueprint Container support