Java Reference
In-Depth Information
from chapter 1. In the second part of the chapter, we show how to test our OSG i calcu-
lator bundle by introducing the JU nit4 OSG i framework.
16.1
Introducing OSGi
The term OSG i 2 usually refers to two things: the OSG i alliance ( http://osgi.org/) an d
the OSG i service platform.
The OSG i alliance is an organization of companies started in late March 1999. The
initial companies involved in the alliance included Sun Microsystems, Ericsson, IBM ,
and others. The idea was to create a standards organization for defining specifications
for a Java-based service platform, which could also be remotely managed. This plat-
form consists of multiple bundles (aka modules) that can be installed, started,
stopped, updated, and uninstalled remotely and dynamically. These operations can be
performed at runtime without an application restart.
The specification this alliance deals with is the OSG i service platform, which
defines a component and service model. All implementations of the OSG i framework
need to provide an environment for the applications to run in. Applications comprise
smaller components called bundles. A bundle is the smallest organization unit in
OSG i—a collection of classes, resources, and configuration files, in which the bundle
declares its dependencies. The key mission of a bundle is to declare and use services.
The OSG i service platform provides a context where all the running services are regis-
tered. This bundle context is injected into every bundle during its startup.
The lifecycle of a given OSG i service is shown in figure 16.1.
Figure 16.1
Lifecycle phases of an
OSGi bundle
2
For a complete reference to OSGi we recommend OSGi in Action , by Richard S. Hall, Karl Pauls, Stuart
McCulloch, and David Savage (Manning Publications, 2010).
 
 
 
 
 
 
Search WWH ::




Custom Search