The OSGi framework is a module system
and service platform for the Java programming language that
implements a complete and dynamic component model, something that does not
exist in standalone Java/VM environments. Applications or components
(coming 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 (start, stop, install, etc.) is
done via APIs that allow for remote downloading of management
policies. The service registry allows bundles to detect the addition of new
services, or the removal of services, and adapt accordingly. (source: Wikipedia)
In 2012, I worked on
OSGi in one of J2EE
project to enforce modularity and initially I used to think I can build the
similar modular architecture without OSGi too. Also at that time sometimes I
found it as an overhead to deliver individual components/modules (jar files
called bundles in OSGi terminology) specifically in time crunch situations,
until I realized the real power of OSGi when again got chance to experience
"OSGi as part of Adobe CQ5" in 2013. Recently as part Liferay Portal 6.2 new
features highlights, I found one of feature is "Liferay as an OSGi container" to support deployment and management of OSGi
components in Liferay.
Looking to continued
adoption of OSGi in Java platform based applications, I thought to publish the
summary of my OSGi mind mapping notes and how I learned it.
Straight from the horse's
mouth
OSGi Alliance - Why OSGi?
- OSGi reduces complexity by providing a modular architecture for today's large-scale distributed systems as well as small, embedded applications. Building systems from in-house and off-the-shelf modules significantly reduces complexity and thus development and maintenance expenses. The OSGi programming model realizes the promise of component-based systems.
- The OSGi modular and dynamic model reduces operational costs and integrates multiple devices in a networked environment, tackling costly application development, maintenance and remote service management.
- The key reason OSGi technology is so successful is that it provides a very mature component system that actually works in a surprising number of environments. The OSGi component system is actually used to build highly complex applications like IDEs (Eclipse), application servers (GlassFish, IBM Websphere, Oracle/BEA Weblogic, Jonas, JBoss), application frameworks (Spring, Guice), industrial automation, residential gateways, phones, and so much more.
Adobe Experience Manager (AEM) - One of real-world example on how OSGi is used effectively in enterprise grade product.
- OSGi is a fundamental element in the technology stack of Adobe Experience Manager (a complete suite of applications that enable organizations to optimize their online communications). It is used to control the composite bundles of AEM and their configuration.
- OSGi defines an architecture for developing and deploying modular applications and libraries (it is also known as the Dynamic Module System for Java). OSGi containers allow you to break your application into individual modules (are jar files with additional meta information and called bundles in OSGi terminology) and manage the cross-dependencies between them with: (1) services implemented within the container (2) a contract between the container and your application. These services and contracts provide an architecture which enables individual elements to dynamically discover each other for collaboration.
- An OSGi framework then offers you dynamic loading/unloading, configuration and control of these bundles - without requiring restarts. This allows easy management of bundles as they can be stopped, installed, started individually. The interdependencies are handled automatically. Each OSGi Component (see the OSGi Specification) is contained in one of the various bundles.
- Below screenshot shows the power of OSGi in administration console of Adobe CQ/AEM product.
Overview of OSGi
Below notes depicts
that OSGi is the specification (not implementation) to solve some of mentioned
challenges in Java. The OSGi container (Eclipse Equinox, Apache Felix and Knopflerfish are open source, but there are
commercial vendors too) provides implementation to deploy bundles (the unit of
deployment of an OSGi service platform). From developer's point of view, it
requires to understand bundle lifecycle, configuration (MENIFEST.MF) and
commands of OSGi. There are also some of OSGi related projects such as SpringDM
/Spring-OSGi, which can be explored once get some OSGi experience.
How to get started with OSGi?
If you can manage to
read "OSGi in Action" book, then nothing like that. Otherwise you can get started
with OSGi as below, which should not take roughly more than 2-3 days depending
on your Java experience.
- Read theory of the OSGi Framework Architecture and below diagram depicts that key responsibilities of the OSGi container.
- Learn to creating, executing, and managing bundles in an OSGi container. As Eclipse IDE is widely used for java development and hence I would strongly recommend to start with Eclipse Equinox tutorial-1 and tutorial-2 (Alternatively you may try tutorial of OSGi for your selected OSGi container type such as Apache Felix or Knopflerfish).
- Learn to build a service-oriented application using Spring and OSGi and then explore Spring DM documentation as applicable in your project.
Also Refer
- http://refcardz.dzone.com/refcardz/equinox
- http://archive.oredev.org/download/18.5bd7fa0510edb4a8ce4800019273/Peter_Kriens_-_Workshop_OSGi_Hands-on.pdf
JAVA Training in Chennai
ReplyDeleteI have read all the articles in your blog; was really impressed after reading it.
The information you have given here are most worthy for me. I have implemented in my training program as well, thanks for sharing.
ReplyDeleteBig Data Training in Chennai
Big Data Course in Chennai
Happy to read this blog very nice, in this technology world
ReplyDeleteAws training chennai | AWS course in chennai
manual testing course chennai | Manual testing class chennai
Looks like an great tutorial microsoft azure training
ReplyDeletevery nice post..
ReplyDeleteinplant training in chennai
inplant training in chennai
inplant training in chennai for it
Australia hosting
mexico web hosting
moldova web hosting
albania web hosting
andorra hosting
australia web hosting
denmark web hosting
perde modelleri
ReplyDeletesms onay
VODAFONE MOBİL ÖDEME BOZDURMA
NFTNASİLALİNİR.COM
Ankara evden eve nakliyat
Trafik Sigortası
dedektor
KURMA.WEBSİTE
Ask Kitaplari
SMM PANEL
ReplyDeleteSMM PANEL
İs İlanlari
İnstagram takipçi satın al
HİRDAVATCİ
HTTPS://WWW.BEYAZESYATEKNİKSERVİSİ.COM.TR/
servis
tiktok jeton hilesi