Chapter 1. Quick Intro to Felix and OSGi

In the current fast evolving market, service providers need a way to quickly deploy new services over their networks in a managed manner. The challenge is to deliver new and updated services to devices over the network, with little or no disruption to other services provided by those devices.

Furthermore, services may be required to run on a multitude of potential targets such as embedded systems, home electronics, cable modems, set-top boxes, media gateways, and so on. A different delivery of this service per target environment constitutes an expensive overhead that is not necessary.

A universal platform with a common framework and a minimal execution environment would allow a faster time to market, reducing the component development and testing time, and thus allowing providers to quickly react to changes in the market needs.

The OSGi service platform specification aims to address this need by providing a universal platform on which applications (or bundles) can be downloaded and plugged into its base framework.

In this book, we will focus on OSGi in the context of the enterprise. Although all of the concepts introduced also apply to the other environments where OSGi is used, some of the additional discussions will be more appropriate for an enterprise service platform.

In this chapter, we will take a quick overview of the OSGi service platform and how it addresses the current market needs. We will also have a first look at the Apache Felix implementation and how it fits into the OSGi world.

You will:

  • Take a quick overview of OSGi
  • Understand the OSGi service platform, its functional layers, and their interaction
  • Take a deep dive into OSGi bundles, their manifest headers
  • Understand how bundles are activated on an OSGi platform
  • Learn about bundle start levels and how they can be used in start-up schema
  • Get an introduction to the Felix framework

What is OSGi?

Started in 1999 as the Open Services Gateway initiative, the OSGi alliance initially targeted embedding Java technology for networked home gateways. It has grown into a cross-market framework for the delivery of services onto a wide variety of devices ranging from customer premise equipments to cars and mobile phones, and from backend servers to home PCs.

With a widespread adoption by the Open Source community and constant improvement brought by the big market players that make up the alliance, the applications of this flexible framework has gained a fast momentum and was greatly improved in the last few releases of its specifications.

The main benefits of the OSGi framework is the standardized means of deploying and maintaining its modular system over the network; a modular system that is based on a non-intrusive, yet powerful set of specifications.

Among the many adopters of OSGi as an application framework in the Open Source community are Knopflerfish, Equinox (Eclipse), and Felix. We will be working with the Apache Felix OSGi service platform implementation.

The OSGi Service Platform's Core Specification documents the framework's expected behavior and also specifies the way its different parts interact, and react to external requests in order to offer its managed services.

This Core Specification is augmented with a set of service specifications, grouped by target market, and includes the definition of service interfaces for the common services in that market, along with specifications on how those services are to behave. Those include:

  • The Service Compendium, which contains the specifications of OSGi services such as:
    • The Preferences service, which holds bundles' preferences in a persistent manner
    • The Event Admin service, which helps bundles communicate through the exchange of events
  • The Enterprise Specification focuses on the enterprise side of things such as distribution, scalability, and so on. The Enterprise expert group is supported by many of the major players in the Java enterprise market such as IBM, Oracle, and SAP, to name a few. For more on this, please refer to http://www.osgi.org/Markets/Enterprise.

We will look more closely at the Log Service and HTTP Service from the Service Compendium in Chapter 10, Improve the Logging and Chapter 11, How about a Graphical Interface? respectively.

Moreover, the applications of OSGi extend into other market segments in addition to the enterprise with the following expert groups:

  • The Mobile market, which focuses on building a robust and secure platform for mobile phones, with implementations available for the major mobile operating systems (such as Android, Windows Mobile, Symbian, Brew, and Linux). For more on this, please refer to http://www.osgi.org/Markets/Mobile
  • The Telematics market, which focuses on automotive, railway systems, shipment tracking, and so on. For more on this, please refer to http://www.osgi.org/Markets/Telematics
  • The Smart Home market, which focuses on the adaptation and uses of this universal platform in the residential context. Applications range from the streaming of audio and video for entertainment and education, to the monitoring and management of energy consumption. For more on this, please refer to http://www.osgi.org/Markets/SmartHome
  • The E-Health market, which focuses on applications in the field of health services, with applications in areas such as hospitalization, personal training programs, or assisted living. For more on this, please refer to http://www.osgi.org/Markets/EHealth

In short, the applications of OSGi are limitless and with a wide involvement from many disparate parties. Do you think you can contributing? If yes, you can consider following one of the previous groups and contribute your experience!

Let's take a look at the layout of an OSGi service platform and understand the way it works.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.151.220