OSGI Overview

01/07/2020 / BY / IN OSGI Components and Services / 10 Comments

Hello! Welcome to the lesson of OSGI which is part of AEM 6.5 training session. The lecture consist of 8 short part, this is part one.

Objectives

After reading this article you should be able to describe

  • What OSGI is?
  • Name the most important part of OSGI.
  • Name the OSGI implementation that AEM uses.

OSGI

OSGI is a platform for development of modular Java applications. The key feature of OSGI is modularity i.e. Independent module that can be independently developed, deployed executed without conflicts and uninstalled. Will talk about that in next 2 parts. More precisely OSGI is a set of specification they define the organization of application modules and the runtime environment for the module execution, those specifications are maintained by organization called OSGI Alliance.

Many important software companies are members of that Alliance. The top level members include Oracle, IBM and Adobe. The alliance has a website osgi.org there you can find the specification and Java docs for the platform.

The OSGI alliance started its work in 1999 as of now OSGI release 7 is available, we will concentrate on OSGI release 6 as that version is used in AEM 6.4 onwards, but you may also can use OSGI release 7 from AEM 6.4.

OSGI specification defines the API, The API classes and interfaces come as a JAR file and Java doc. To work with OSGI, we need an implementation, there are several API implementations. The most famous are Apache Felix and Eclipse Equinox, Adobe AEM uses Apache Felix.

With an AEM OSGI is used in many well-known product such as JIRA, Confluence, Eclipse IDE and JBoss Application server.

OSGI Core Layers

Just like Java with its Core and Enterprise edition there is Core and Enterprise OSGI. They are described in separate specifications. Enterprise OSGI is built on top of the core.

Let’s look at the core OSGI first – The core specification defines 3 groups of features, the specifications called them Architectural layers. Let me describe them briefly and then we will look at them in detail one by one. 

  1. The first in the lowest is the Module Layer, this layer defines all isolated modules of all bundles.
  2. The second layer is the Life Cycle for bundles, it defines the bundle life cycle, how the bundles are installed, updated, uninstalled, started and stopped.
  3. The third layer is the Service Layer– it defines services that live in bundles and the service registry where those services are listed. The services allow for interaction between bundles. Provider bundle publish their services, consumer bundle reference them, the container find the services and binds the provider and consumer bundles.

Enterprise OSGI

Enterprise OSGI defines the features on top of OSGI the feature, we will be most interested in is called Declarative Services, that feature introduces a concept of a Component.

A Java class that exposes the service interface at the runtime environment. Components are managed by the container, configurable using properties, they obtain references to other services using dependency injection.

The developers declare components in the application code using XML files or annotations that are used to generate those XML files.

Another important feature is Web application support- it specifies how the OSGI container runs web applications which is quite important for us.

Also the enterprise OSGI specification defines various other services such as bundle repository, loggings and several others.

Apache Felix

So OSGI is a standard, several specifications and JAR files with API classes. To use OSGI one needs an implementation. Adobe AEM is built on one of the most widely used implementations- Apache Felix.

Adobe AEM 6.5 uses a branch of Felix 6.0.2, which implements OSGI R6.

Summary

• OSGI is a platform, defined by specifications.

• There are Core and Enterprise OSGI specification.

• Core OSGI specification defines several architectural layers.

• Enterprise OSGI defines components, web application support, and various services.

• Apache Felix is an OSGI implementation. Felix implements both Core and Enterprise OSGI features.

So that’s all for part one, in the next part and it will be more practical we will get familiar the first Architectural Layer of OSGI and the concept of bundles. Click here to visit page!

10 comments on OSGI Overview
  1. Prabhu k Says

    30/06/2020

    Good article santosh. Awaiting for more.

    Reply

  2. Akash Says

    02/07/2020

    Very nice article Santosh.
    Keep it up.

    Reply

  3. Shama Afreen Says

    03/07/2020

    Great Article Santosh..Its very well written and explains in depth the basics of OSGi 👍

    Reply

  4. Anna Says

    03/07/2020

    Thank you, Santosh for this article. All important information about OSGI in one place.

    Reply

  5. Vandana Says

    05/07/2020

    Good work!! You make it look easy

    Reply

  6. Cohen Carryl Says

    07/07/2020

    Great post Santosh. OSGI post was very informative.

    I can learn from your teaching style. Keep up the great work.

    Reply

  7. Sneha Says

    22/07/2020

    Impressive! Thanks for the post.
    Doing great job Santosh, Keep it up. Awaiting for some more articles.

    Reply

  8. Paulina Says

    03/04/2021

    Hello to all, the contents existing at this website are truly awesome for people experience, well, keep up the nice work fellows.

    Reply

  9. Jatan Says

    13/06/2021

    Great Work, keep sharing blogs!

    Reply

Leave a Reply