Saturday 14 February 2015

What is OSGi? What is the benefit of OSGi? What is Felix?

OSGi is a framework which allows modular development of applications using java.
A large application can be constructed using small reusable components(called bundles in terms of OSGi) each of which can be independently started, stopped, and also can be configured dynamically while running without requiring a restart.
Consider a scenario where you have a large application which uses a logging framework. This logging framework can be deployed as an OSGi Bundle, which can be managed independently. Therefore, it can be started when required by our application and can be stopped when not in use. Also the OSGi container makes these bundles available as services, which can be subsribed by other parts of application.
The main advantages of using OSGi :
1)    reduces the complexity of the system.
2)    Makes the components loosely couples and easy to manage.
3)    Increases the performance of the system, since parts of application which are not in use,need not to be loaded in the memory(although there is not a drastic change in performance and also some people argue that running an OSGi container itself takes huge memory).

The OSGi Framework is made up of three layers -- Module, Lifecycle, and Services -- that define how extensible applications are built and deployed. The responsibilities of the layers are:
Module --- Defines how a module, or a Bundle in OSGi-speak, is defined. Basically, a bundle is just a plain old JAR file, whose manifest file has some defined entries. These entries identify the bundle with a symbolic name, a version and more. In addition there are headers which define what a bundle provides Export-Package and what a bundle requires to be operative Import-Package and Require-Bundle.
Lifecycle --- The lifecycle layer defines the states a bundle may be in and describes the state changes. By providing a class, which implements the BundleActivator interface and which is named in the Bundle-Activator manifest header, a bundle may hook into the lifecycle process when the bundle is started and stopped.
Services --- For the application to be able to interact, the OSGi Core Specification defines the service layer. This describes a registry for services, which may be shared.
 

My Blog List

Who is Online


Site Info

Followers

CQTutorials Copyright © 2009 Blogger Template Designed by Bie Blogger Template