OSGi

Last updated
OSGi
OSGi Logo.png
OSGi Alliance logo
Year started1999
Latest version8.0
October 2020 (2020-10) [1]
OrganizationOSGi Alliance
Domain Java
License OSGi Specification License, Version 2.0
Website www.osgi.org

OSGi is an open specification and open source project under the Eclipse Foundation.

Contents

It is a continuation of the work done by the OSGi Alliance (formerly known as the Open Services Gateway initiative), which was an open standards organization for software founded in March 1999. The foundation originally specified and maintained the OSGistandard. The alliance transferred its work to the Eclipse Foundation at the end of 2020.

The OSGi specification describes a modular system and a service platform for the Java programming language that implements a complete and dynamic component model, something that does not exist in standalone Java or VM environments. It has a service-oriented architecture based on micro services each implemented as an extended Java class file archive (JAR (file format)).

Description

OSGi is built around a service-oriented architecture. Applications or components, come in the form of bundles for deployment, can be remotely installed, started, stopped, updated, and uninstalled without requiring a reboot. Management of Java packages/classes is specified in great detail. Application life cycle management is implemented via APIs that enable remote downloading of management policies. The service registry enables bundles to detect the addition of new services or the removal of services, and adapt accordingly.

The OSGi specifications have evolved beyond the original focus of service gateways, and are now used in applications ranging from mobile phones to the open-source Eclipse IDE. Other application areas include automobiles, industrial automation, building automation, PDAs, grid computing, entertainment, fleet management and application servers.

In October 2020, the OSGi Alliance announced the transition of the standardization effort to the Eclipse Foundation, subsequent to which it would shut down. [2] All artifacts have been transferred to the Eclipse Foundation, where an “OSGi Working Group" continues to maintain and evolve the specification.

Specification process

The OSGi specification is developed by the members in an open process and made available to the public free of charge under the OSGi Specification License. [3] The OSGi Alliance has a compliance program that is open to members only. As of November 2010, there are seven certified OSGi framework implementations. [4] A separate page lists both certified and non-certified OSGi Specification Implementations, which include OSGi frameworks and other OSGi specifications.

Architecture

OSGi Service Gateway Architecture Osgi framework.svg
OSGi Service Gateway Architecture

OSGi is a Java framework for developing and deploying modular software programs and libraries. Each bundle is a tightly coupled, dynamically loadable collection of classes, jars, and configuration files that explicitly declare their external dependencies (if any).

The framework is conceptually divided into the following areas:

Bundles
Bundles are normal JAR components with extra manifest headers.
Services
The services layer connects bundles in a dynamic way by offering a publish-find-bind model for plain old Java interfaces (POJIs) or plain old Java objects (POJOs).
Services Registry
The application programming interface for management services.
Life-Cycle
The application programming interface for life cycle management (install, start, stop, update, and uninstall) for bundles.
Modules
The layer that defines encapsulation and declaration of dependencies (how a bundle can import and export code).
Security
The layer that handles the security aspects by limiting bundle functionality to pre-defined capabilities.
Execution Environment
Defines what methods and classes are available in a specific platform. There is no fixed list of execution environments, since it is subject to change as the Java Community Process creates new versions and editions of Java. However, the following set is currently supported by most OSGi implementations:

Bundles

Classification: OSGi Osgi-system-layering.svg
Classification: OSGi

A bundle is a group of Java classes and additional resources equipped with a detailed manifest MANIFEST.MF file on all its contents, as well as additional services needed to give the included group of Java classes more sophisticated behaviors, to the extent of deeming the entire aggregate a component.

Below is an example of a typical MANIFEST.MF file with OSGi Headers:

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

The meaning of the contents in the example is as follows: [5]

  1. Bundle-Name: Defines a human-readable name for this bundle, Simply assigns a short name to the bundle.
  2. Bundle-SymbolicName: The only required header, this entry specifies a unique identifier for a bundle, based on the reverse domain name convention (used also by the java packages).
  3. Bundle-Description: A description of the bundle's functionality.
  4. Bundle-ManifestVersion: Indicates the OSGi specification to use for reading this bundle.
  5. Bundle-Version: Designates a version number to the bundle.
  6. Bundle-Activator: Indicates the class name to be invoked once a bundle is activated.
  7. Export-Package: Expresses which Java packages contained in a bundle will be made available to the outside world.
  8. Import-Package: Indicates which Java packages will be required from the outside world to fulfill the dependencies needed in a bundle.

Life-cycle

OSGi Bundle Life-Cycle OSGi Bundle Life-Cycle.svg
OSGi Bundle Life-Cycle

A Life Cycle layer adds bundles that can be dynamically installed, started, stopped, updated and uninstalled. Bundles rely on the module layer for class loading but add an API to manage the modules in run time. The life cycle layer introduces dynamics that are normally not part of an application. Extensive dependency mechanisms are used to assure the correct operation of the environment. Life cycle operations are fully protected with the security architecture.

Bundle StateDescription
INSTALLEDThe bundle has been successfully installed.
RESOLVEDAll Java classes that the bundle needs are available. This state indicates that the bundle is either ready to be started or has stopped.
STARTINGThe bundle is being started, the BundleActivator.start method has been called but the start method has not yet returned. When the bundle has an activation policy, the bundle will remain in the STARTING state until the bundle is activated according to its activation policy.
ACTIVEThe bundle has been successfully activated and is running; its Bundle Activator start method has been called and returned.
STOPPINGThe bundle is being stopped. The BundleActivator.stop method has been called but the stop method has not yet returned.
UNINSTALLEDThe bundle has been uninstalled. It cannot move into another state.

Below is an example of a typical Java class implementing the BundleActivator interface:

packageorg.wikipedia;importorg.osgi.framework.BundleActivator;importorg.osgi.framework.BundleContext;publicclassActivatorimplementsBundleActivator{privateBundleContextcontext;@Overridepublicvoidstart(BundleContextcontext)throwsException{System.out.println("Starting: Hello World");this.context=context;}@Overridepublicvoidstop(BundleContextcontext)throwsException{System.out.println("Stopping: Goodbye Cruel World");this.context=null;}}

Services

Standard services

The OSGi Alliance has specified many services. Services are specified by a Java interface. Bundles can implement this interface and register the service with the Service Registry. Clients of the service can find it in the registry, or react to it when it appears or disappears.

The table below shows a description of OSGi System Services:

System ServicesDescription
LoggingThe logging of information, warnings, debug information or errors is handled through the Log Service. It receives log entries and then dispatches these entries to other bundles that subscribed to this information.
Configuration AdminThis service allows an operator to set and get the configuration information of deployed bundles.
Device AccessFacilitates the coordination of automatic detection and attachment of existing devices. This is used for Plug and Play scenarios.
User AdminThis service uses a database with user information (private and public) for authentication and authorization purposes.
IO ConnectorThe IO Connector Service implements the CDC/CLDC javax.microedition.io package as a service. This service allows bundles to provide new and alternative protocol schemes.
PreferencesOffers an alternative, more OSGi-friendly mechanism to using Java's default Properties for storing preferences.
Component RuntimeThe dynamic nature of services—they can come and go at any time—makes writing software harder. The Component Runtime specification can simplify handling these dynamic aspects by providing an XML based declaration of the dependencies.
Deployment AdminStandardizes access to some of the responsibilities of the management agent.
Event AdminProvides an inter-bundle communication mechanism based on a publish-and-subscribe model.
Application AdminSimplifies the management of an environment with many different types of applications that are simultaneously available.

The table below shows a description of OSGi Protocol Services:

Protocol ServicesDescription
HTTP ServiceAllows information to be sent and received from OSGi using HTTP.
UPnP Device ServiceSpecifies how OSGi bundles can be developed to interoperate with Universal Plug and Play (UPnP) devices.
DMT AdminDefines an API for managing a device using concepts from the Open Mobile Alliance (OMA) device management specifications.

The table below shows a description of OSGi Miscellaneous Services:

Miscellaneous ServicesDescription
Wire AdminAllows the connection between a Producer service and a Consumer service.
XML ParserThe XML Parser service allows a bundle to locate a parser with desired properties and compatibility with JAXP.
Measurement and StateThe Measurement and State service allows and simplifies the correct handling of measurements in an OSGi service platform.

Organization

The OSGi Alliance was founded by Ericsson, IBM, Motorola, Sun Microsystems and others in March 1999. Before incorporating as a nonprofit corporation, it was called the Connected Alliance.

Among its members are (as of February 2015) more than 35 companies from quite different business areas, for example Adobe Systems, Deutsche Telekom, Hitachi, IBM, Liferay, Makewave, NEC, NTT, Oracle, Orange SA, ProSyst, Salesforce, Siemens, Software AG and TIBCO Software. [6]

The Alliance has a board of directors that provides the organization's overall governance. OSGi officers have various roles and responsibilities in supporting the alliance. Technical work is conducted within Expert Groups (EGs) chartered by the board of directors, and non-technical work is conducted in various working groups and committees. The technical work conducted within Expert Groups include developing specifications, reference implementations, and compliance tests. These Expert Groups have produced five major releases of the OSGi specifications (As of 2012).

Dedicated Expert Groups exist for the enterprise, mobile, vehicle and the core platform areas.

The Enterprise Expert Group (EEG) is the newest EG and is addressing Enterprise / Server-side applications. In November 2007 the Residential Expert Group (REG) started to work on specifications to remotely manage residential/home-gateways. In October 2003, Nokia, Motorola, IBM, ProSyst and other OSGi members formed a Mobile Expert Group (MEG) that will specify a MIDP-based service platform for the next generation of smart mobile phones, addressing some of the needs that CLDC cannot manage other than CDC. MEG became part of OSGi as with R4.

Specification versions

Projects using OSGi

Current framework implementations

NameLicense
Apache Felix Open source
Apache KarafOpen source
Concierge OSGi Open source
Equinox OSGi Open source
Eclipse Gemini Open Source
Knopflerfish Open Source

Related Research Articles

<span class="mw-page-title-main">Jakarta EE</span> Set of specifications extending Java SE

Jakarta EE, formerly Java Platform, Enterprise Edition and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web services. Jakarta EE applications are run on reference runtimes, that can be microservices or application servers, which handle transactions, security, scalability, concurrency and management of the components they are deploying.

A web container is the component of a web server that interacts with Jakarta Servlets. A web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access-rights. A web container handles requests to servlets, Jakarta Server Pages (JSP) files, and other types of files that include server-side code. The Web container creates servlet instances, loads and unloads servlets, creates and manages request and response objects, and performs other servlet-management tasks. A web container implements the web component contract of the Jakarta EE architecture. This architecture specifies a runtime environment for additional web components, including security, concurrency, lifecycle management, transaction, deployment, and other services.

<span class="mw-page-title-main">Eclipse (software)</span> Software development environment

Eclipse is an integrated development environment (IDE) used in computer programming. It contains a base workspace and an extensible plug-in system for customizing the environment. It is the second-most-popular IDE for Java development, and, until 2016, was the most popular. Eclipse is written mostly in Java and its primary use is for developing Java applications, but it may also be used to develop applications in other programming languages via plug-ins, including Ada, ABAP, C, C++, C#, Clojure, COBOL, D, Erlang, Fortran, Groovy, Haskell, JavaScript, Julia, Lasso, Lua, NATURAL, Perl, PHP, Prolog, Python, R, Ruby, Rust, Scala, and Scheme. It can also be used to develop documents with LaTeX and packages for the software Mathematica. Development environments include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++, and Eclipse PDT for PHP, among others.

<span class="mw-page-title-main">JAR (file format)</span> Java archive file format

A JAR file is a package file format typically used to aggregate many Java class files and associated metadata and resources into one file for distribution.

<span class="mw-page-title-main">JOnAS</span>

JOnAS is an open-source implementation of the Java EE application server specification, developed and hosted by the OW2 consortium, having been originally been created by Groupe Bull. JOnAS is released under the LGPL 2.1 open-source license.

WS-Management is a DMTF open standard defining a SOAP-based protocol for the management of servers, devices, applications and various Web services. WS-Management provides a common way for systems to access and exchange management information across the IT infrastructure.

WebSphere Application Server (WAS) is a software product that performs the role of a web application server. More specifically, it is a software framework and middleware that hosts Java-based web applications. It is the flagship product within IBM's WebSphere software suite. It was initially created by Donald F. Ferguson, who later became CTO of Software for Dell. The first version was launched in 1998. This project was an offshoot from IBM HTTP Server team starting with the Domino Go web server.

<span class="mw-page-title-main">GlassFish</span> Application server project

GlassFish is an open-source Jakarta EE platform application server project started by Sun Microsystems, then sponsored by Oracle Corporation, and now living at the Eclipse Foundation and supported by Payara, Oracle and Red Hat. The supported version under Oracle was called Oracle GlassFish Server. GlassFish is free software and was initially dual-licensed under two free software licences: the Common Development and Distribution License (CDDL) and the GNU General Public License (GPL) with the Classpath exception. After having been transferred to Eclipse, GlassFish remained dual-licensed, but the CDDL license was replaced by the Eclipse Public License (EPL).

Eclipse Jetty is a Java web server and Java Servlet container. While web servers are usually associated with serving documents to people, Jetty is now often used for machine to machine communications, usually within larger software frameworks. Jetty is developed as a free and open source project as part of the Eclipse Foundation. The web server is used in products such as Apache ActiveMQ, Alfresco, Scalatra, Apache Geronimo, Apache Maven, Apache Spark, Google App Engine, Eclipse, FUSE, iDempiere, Twitter's Streaming API and Zimbra. Jetty is also the server in open source projects such as Lift, Eucalyptus, OpenNMS, Red5, Hadoop and I2P. Jetty supports the latest Java Servlet API as well as protocols HTTP/2 and WebSocket.

Apache ServiceMix is an open-source software project to implement a distributed enterprise service bus (ESB).

Jakarta PersistenceAPI is a Jakarta EE application programming interface specification that describes the management of relational data in enterprise Java applications.

<span class="mw-page-title-main">Apache Felix</span> Open-source OSGi framework

Apache Felix is an open source implementation of the OSGi Core Release 6 framework specification. The initial codebase was donated from the Oscar project at ObjectWeb. The developers worked on Felix for a full year and have made various improvements while retaining the original footprint and performance. On June 21, 2007, the project graduated from incubation as a top level project and is considered the smallest size software at Apache Software Foundation.

EclipseLink is the open source Eclipse Persistence Services Project from the Eclipse Foundation. The software provides an extensible framework that allows Java developers to interact with various data services, including databases, web services, Object XML mapping (OXM), and enterprise information systems (EIS). EclipseLink supports a number of persistence standards including:

In computing, Equinox is a sub-project of the Eclipse project that provides a certified implementation of the OSGi R4.x core framework specification. It is a module runtime that allows developers to implement an application as a set of "bundles" using the common services infrastructure.

<span class="mw-page-title-main">Spring Roo</span> Open-source software tool

Spring Roo is an open-source software tool that uses convention-over-configuration principles to provide rapid application development of Java-based enterprise software. The resulting applications use common Java technologies such as Spring Framework, Java Persistence API, Thymeleaf, Apache Maven and AspectJ. Spring Roo is a member of the Spring portfolio of projects.

Virgo is an open source, OSGi-based, Java application server. Virgo supports the deployment of OSGi bundles and unmodified Java web applications as well as OSGi-influenced Shared Libraries WARs and Shared Services WARs.

The OSGi framework is a standardized module system and service platform for the Java programming language. The OSGi standards are defined in the OSGi Specification Project at Eclipse and published in OSGi specification documents such as the Core and Compendium specifications. These specifications contain chapters each of which describe a specific OSGi standard. This article contains a list of available implementations of OSGi standards, both commercial and open source implementations are included.

The JBoss Enterprise Application Platform is a subscription-based/open-source Java EE-based application server runtime platform used for building, deploying, and hosting highly-transactional Java applications and services developed and maintained by Red Hat. The JBoss Enterprise Application Platform is part of Red Hat's Enterprise Middleware portfolio of software. Because it is Java-based, the JBoss application server operates across platforms; it is usable on any operating system that supports Java. JBoss Enterprise Application Platform was originally called JBoss and was developed by the eponymous company JBoss, acquired by Red Hat in 2006.

iDempiere Community Powered Enterprise. Full Open Source Business Suite

iDempiere. Community Powered Enterprise, also known as OSGi + ADempiere, is an open source Enterprise Resource Planning (ERP) software that is fully navigable on PCs, tablets and smartphones, it also has customer relationship management (CRM) and supply chain management (SCM) functions. It is in contrast to proprietary or most other open source ERP solutions driven only by a community of supporters.

References

  1. "OSGi Alliance | Specifications / HomePage". osgi.org. 2020. Retrieved October 3, 2022.
  2. Hargrave, B. J. "Announcement of Transition to Eclipse Foundation".
  3. "OSGi Specification License". Archived from the original on 2015-09-14. Retrieved 2012-05-10.
  4. "OSGi Alliance | Markets / Certified". Archived from the original on 2008-09-25. Retrieved 2017-06-23.
  5. Creating OSGi bundles by Costin Leau
  6. "OSGi Alliance | About / Members".
  7. Hargrave, B. J. "OSGi Core Release 8 is now final and published".
  8. "Forrester Names Web Content Management Leaders". CMSWire. 2018-11-16. Retrieved 5 December 2018.
  9. "Adempiere Branch_GlobalQSS_361". adempiere.com/. Retrieved 27 September 2014.

Further reading