Jump to content

OSGi

From Alfawiki
OSGi Alliance
Company typeNonprofit organization (formerly)
IndustrySoftware standards, Java technology
FoundedMarch 1999; 27 years ago (1999-03)
FateTransferred operations to Eclipse Foundation in 2020; dissolved
SuccessorEclipse Foundation OSGi Working Group
Key people
Board of directors
ProductsOSGi specification, compliance program
OwnerMember organizations (consortium)
Websitewww.osgi.org

OSGi represents an open specification and open source initiative overseen by the Eclipse Foundation. This project continues the legacy of the OSGi Alliance—initially known as the Open Services Gateway initiative—an open standard organization established in 1999 responsible for defining and maintaining the OSGi standard. At the close of 2020, the alliance transferred its operations to the Eclipse Foundation.

The OSGi specification outlines a modular framework and a service-oriented architecture platform tailored for the Java ecosystem, introducing a dynamic component model that is not present in standalone Java or typical virtual machine setups. It leverages microservices, each encapsulated within enhanced Java archive files (JAR (file format)).

Description

Built upon a service-oriented architecture, OSGi applications or modules—referred to as bundles—can be installed, started, stopped, updated, or removed remotely without requiring a system reboot. The specification offers fine-grained control over Java packages and classes, supported by APIs that facilitate remote lifecycle management. Its service registry enables bundles to detect changes in available services and adjust accordingly.

While initially designed for service gateways, OSGi specifications have expanded to encompass a broad array of sectors such as mobile phones, the open-source Eclipse IDE, automotive systems, industrial automation, building automation, PDAs, grid computing, entertainment systems, fleet management, and application server environments.

In October 2020, the OSGi Alliance declared it would transfer its standardization responsibilities to the Eclipse Foundation and subsequently dissolve. All related assets were moved to Eclipse, where an “OSGi Working Group” now oversees ongoing maintenance and development of the specification.

Specification process

The development of the OSGi specification occurs transparently with contributions from members and is freely accessible under the OSGi Specification License. The OSGi Alliance administers a compliance program limited to its members. As of November 2010, seven different OSGi framework implementations had achieved certification. Additionally, there exists a comprehensive listing that includes both certified and uncertified implementations of OSGi specifications, encompassing frameworks and other related specifications.

Architecture

OSGi constitutes a Java-based framework designed for modular software creation and deployment. Each bundle comprises a dynamically loadable set of classes, JAR files, and configuration resources that explicitly state their external dependencies.

The framework is structured into several key components:

Bundles
JAR-based modules enhanced with additional manifest headers.
Services
Facilitate dynamic inter-bundle connections through a publish-find-bind pattern for Java interfaces or plain old Java objects (POJOs).
Services Registry
Provides an API dedicated to service management.
Life-Cycle
Offers APIs to handle bundle lifecycle operations including installation, startup, stopping, updating, and uninstallation.
Modules
Establishes encapsulation rules and dependency declarations such as import/export of code.
Security
Enforces restrictions on bundle capabilities based on predefined permissions.
Execution Environment
Defines the methods and classes available on each platform. Supported environments include:
  • CDC-1.0/Foundation-1.0
  • CDC-1.1/Foundation-1.1
  • OSGi/Minimum-1.0 and 1.1
  • JRE-1.1
  • J2SE versions 1.2 through 1.6

Bundles

A bundle encapsulates Java classes and resources, accompanied by a comprehensive MANIFEST.MF manifest file that outlines its role as a modular component.

Sample MANIFEST.MF including OSGi-specific headers: <syntaxhighlight lang="properties" line>

Bundle-Name: Hello World
Bundle-SymbolicName: org.wikipedia.helloworld
Bundle-Description: A Hello World bundle
Bundle-ManifestVersion: 2
Bundle-Version: 1.0.0
Bundle-Activator: org.wikipedia.Activator
Export-Package: org.wikipedia.helloworld;version="1.0.0"
Import-Package: org.osgi.framework;version="1.3.0"

</syntaxhighlight>

Important manifest headers:

  1. Bundle-Name: A user-friendly name for the bundle.
  2. Bundle-SymbolicName: A unique identifier formatted in reverse domain notation.
  3. Bundle-Description: Provides a summary of the bundle’s purpose.
  4. Bundle-ManifestVersion: Indicates the applicable OSGi specification version.
  5. Bundle-Version: The version identifier of the bundle.
  6. Bundle-Activator: Specifies the class triggered during activation.
  7. Export-Package: Lists Java packages made accessible to other bundles.
  8. Import-Package: Enumerates external Java packages required to satisfy dependencies.

Life-cycle

The Life Cycle layer facilitates dynamic operations on bundles, including their installation, activation, deactivation, updating, and removal. It builds upon the module layer’s class loading capabilities by introducing an API for managing modules at runtime, allowing for dynamic behavior rarely seen in conventional applications. Robust dependency management ensures reliability, while security mechanisms safeguard life cycle operations.

Bundle State Description
INSTALLED The bundle has been placed into the system successfully.
RESOLVED All necessary Java classes are present; the bundle is prepared to start or has ceased operation.
STARTING The bundle is in the process of starting; the BundleActivator.start method has been invoked but not completed. Bundles with lazy activation remain in this state until triggered.
ACTIVE The bundle is fully operational; its start method has finished without error.
STOPPING The bundle is halting; the BundleActivator.stop method has been called but not yet returned.
UNINSTALLED The bundle has been removed and cannot transition to any other state.

Illustration of a Java class implementing the BundleActivator interface: <syntaxhighlight lang="java"> package org.wikipedia;

import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator { private BundleContext context;

@Override public void start(BundleContext context) throws Exception { System.out.println("Starting: Hello World"); this.context = context; }

@Override public void stop(BundleContext context) throws Exception { System.out.println("Stopping: Goodbye Cruel World"); this.context = null; } } </syntaxhighlight>

Standard services

The OSGi Alliance specifies numerous services through Java interfaces. Bundles implement these interfaces and register their services with the Service Registry, allowing clients to find or monitor service availability dynamically.

Prominent OSGi System Services include:

System Services Description
Logging Manages logging of informational messages, warnings, debugging details, and errors via the Log Service, distributing entries to subscribed bundles.
Configuration Admin Provides operators with capabilities to configure and retrieve settings for deployed bundles.
Device Access Facilitates automatic detection and integration of devices for Plug and Play scenarios.
User Admin Oversees user authentication and authorization using a user database.
IO Connector Implements the CDC/CLDC javax.microedition.io package as a service, enabling bundles to introduce new protocol schemes.
Preferences Supplies an OSGi-compliant alternative to Java’s standard properties mechanism for preference storage.
Component Runtime Assists in managing dynamic service dependencies through XML-based declarations.
Deployment Admin Standardizes deployment management tasks performed by agents.
Event Admin Enables inter-bundle communication by employing a publish-subscribe architecture.
Application Admin Simplifies administration of environments supporting multiple concurrent application types.

OSGi Protocol Services:

Protocol Services Description
HTTP Service Supports transmission and reception of data over HTTP within the OSGi framework.
UPnP Device Service Establishes interoperability between OSGi bundles and Universal Plug and Play (UPnP) devices.
DMT Admin Offers an API for device management adhering to Open Mobile Alliance (OMA) standards.

Additional OSGi Services:

Miscellaneous Services Description
Wire Admin Connects Producer and Consumer services across the platform.
XML Parser Enables bundles to discover XML parsers compatible with JAXP specifications.
Measurement and State Provides precise measurement handling within the OSGi service environment.


Organization

The OSGi Alliance was established in March 1999 by a group of companies including Ericsson, IBM, Motorola, and Sun Microsystems. Originally called the Connected Alliance, it subsequently became a nonprofit entity.

By 2015, the Alliance had expanded to encompass more than 35 organizations from various industries, such as Adobe Systems, Deutsche Telekom, Hitachi, IBM, Liferay, Makewave, NEC, NTT, Oracle, Orange SA, ProSyst, Salesforce, Siemens, Software AG, and TIBCO Software.

A board of directors governs the Alliance and sets its strategic direction. The technical development is conducted by Expert Groups (EGs) appointed by the board; these groups focus on producing specifications, reference implementations, and compliance testing. Non-technical activities are handled by multiple working groups and committees. By 2012, these EGs had released five significant OSGi specification versions.

Specialized Expert Groups concentrate on areas including enterprise solutions, mobile platforms, vehicle technology, and core platform development. The Enterprise Expert Group (EEG) targets server-side applications. Established in 2007, the Residential Expert Group (REG) is dedicated to managing home gateways remotely. The Mobile Expert Group (MEG), created in 2003 by Nokia, Motorola, IBM, ProSyst, and others, works on a MIDP-based service platform designed for advanced mobile phones exceeding CLDC functionality; MEG was incorporated into OSGi starting with Release 4.

Specification versions

  • OSGi Release 1 (R1): May 2000
  • OSGi Release 2 (R2): October 2001
  • OSGi Release 3 (R3): March 2003
  • OSGi Release 4 (R4): October 2005 / September 2006
    • Core Specification (R4 Core): October 2005
    • Mobile Specification (R4 Mobile / JSR-232): September 2006
  • OSGi Release 4.1 (R4.1): May 2007 (JSR-291)
  • OSGi Release 4.2 (R4.2): September 2009
    • Enterprise Specification (R4.2): March 2010
  • OSGi Release 4.3 (R4.3): April 2011
    • Core: April 2011
    • Compendium and Residential: May 2012
  • OSGi Release 5 (R5): June 2012
    • Core and Enterprise: June 2012
  • OSGi Release 6 (R6): June 2015
    • Core: June 2015
  • OSGi Release 7 (R7): April 2018
    • Core and Compendium: April 2018
  • OSGi Release 8 (R8): December 2020

Related standards

Projects using OSGi

  • Adobe Experience Manager – enterprise Content Management System
  • Apache Aries – Blueprint Container implementations and extensions developed by the OSGi Enterprise Expert Group
  • Apache Sling – an OSGi-based abstraction layer for JCR repositories
  • Atlassian Confluence and JIRA – utilize an OSGi plug-in framework
  • Business Intelligence and Reporting Tools (BIRT) Project – an open source reporting engine
  • Cytoscape – bioinformatics platform available as open source since version 3.0
  • DataNucleus – open source SOA data services and persistence framework
  • DDF – Distributed Data Framework facilitating open-source data integration
  • Dotcms – open source Web Content Management system
  • EasyBeans – open source EJB 3 container implementation
  • Eclipse – open source integrated development environment and rich client platform
  • iDempiere – an open source ERP implementing OSGi; branch of GlobalQSS's Adempiere, initiated by Low Heng Sin
  • Eclipse Virgo – microkernel-based server constructed from OSGi bundles supporting modular applications
  • GlassFish (version 3) – enterprise Java application server
  • Fuse ESB – commercially supported distribution of ServiceMix version 4
  • Integrated Genome Browser – desktop graphical interface for genome visualization and analysis
  • IntelliJ – Java integrated development environment with a free community edition
  • JOnAS 5 – open source Java EE 5 application server
  • JOSSO version 2 – Atricore's standards-compliant Identity and Access Management platform
  • Liferay Dxp – enterprise portal platform available as both open source and commercial editions using OSGi since version 7.x
  • Lucee version 5 – open source CFML web application server
  • NetBeans – open source IDE and rich client platform
  • Nuxeo – open source Enterprise Content Management service platform
  • Open Daylight Project – promotes adoption of software-defined networking technologies
  • OpenEJB – open source EJB 3.0 container with OSGi support; usable standalone or embedded
  • openHAB – open source solution for home automation systems
  • OpenWorm – modular software simulation of C. elegans built on the Geppetto platform
  • Akana – API Gateway, Portal, and Analytics server offered by Akana (formerly SOA Software)
  • Weblogic – Oracle's Weblogic Application Server
  • WebSphere Application Server – IBM's enterprise Java application server offering
  • WebMethods – integration platform from SoftwareAG WebMethods
  • WildFly – Red Hat’s WildFly Application Server previously known as JBoss
  • WSO2 Carbon – foundational platform for WSO2’s enterprise-grade open source middleware suite
  • Pentaho – Business Intelligence software providing data integration, OLAP services, reporting tools, dashboards, data mining, and ETL functions

Current framework implementations

Framework Licensing
Apache Felix Open source
Apache Karaf Open source
Concierge OSGi Open source
Equinox OSGi Open source
Eclipse Gemini Open source
Knopflerfish Open source

Further reading


External links