SlideShare a Scribd company logo
1 of 32
Introduction to OSGi
Kishanthan Thangarajah
The Problem ?
Typical Java Systems
What we need is … Modular Systems
Dividing a complex software system into small
parts/modules.
Allows us to understand the system easily.
Allows us to develop part by part by different team.
Allows us to reuse already developed modules.
Can we build a pure modular system
with Java?
What are the limitations?
âž” Runtime vs Compile time difference.
â—Ź Flat, single classpath.
âž” No standard way of building a modular system.
â—Ź Class loader based techniques.
Runtime vs Compile Time
Runtime vs Compile Time
JAR (Java Archive)
âž” JAR is unit of deployment in Java.
âž” Typical Java application consists a set of JAR files.
âž” No runtime representation for a JAR.
âž” At runtime contents of all JAR files are treated as a
single, ordered and global list which is called the class
path
Problem with JAR
âž” Multiple versions of JAR files cannot be loaded
simultaneously
âž” A JAR cannot declare dependencies on other JARs.
âž” No mechanism for information hiding
âž” Hence, JARs cannot be considered as modules
Java for Modular System
âž” Can you update a part(can be a JAR file) of a
running Java application?
âž” Can you add new functionality to a new Java
application at runtime?
âž” If you need to add new functionality or update
existing functionality, JVM needed to be
restarted.
âž” Java lacks dynamism
What’s Next?
âž” How about an abstraction where you can work at
the package level as opposed to class/object level?
â—† Importing packages.
â—† Exporting packages.
â—† A way to have private packages.
âž” Can we achieve the limitations that we discussed
in Java from this model?
Next Level of Modularity
âž” Separate class loader per module.
â—† creating a class-space per module.
â—† delegate class loading to other modules when necessary.
âž” Solves the single class path problem.
âž” Now you have a class loader network formed from
classloader delegation.
âž” This network is formed with import/export
package restrictions.
âž” Now we have modularity at runtime as well as
compile time.
Next level of Modularity
What is OSGi?
"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 as of 2012 does
not exist in standalone Java/VM environments."
--Wikipedia
What is OSGi?
âž” Widely accepted specification which introduces a
standard way of building dynamic, modular
systems with Java.
âž” OSGi framework implementations.(Open source)
â—† Eclipse Equinox.
â—† Apache Felix.
â—† Knopflerfish.
OSGi Layered Model
OSGi Layered Model
âž” Bundles
â—† Bundles are the OSGi components made by the
developers.
âž” Services
â—† The services layer connects bundles in a dynamic
way by offering a publish-find-bind model for plain
old Java objects.
âž” Life-Cycle
â—† The API to install, start, stop, update, and uninstall
bundles.
OSGi Layered Model
âž” Modules
â—† The layer that defines how a bundle can import and
export code.
âž” Security
â—† The layer that handles the security aspects.
âž” Execution Environment
â—† Defines what methods and classes are available in
a specific platform.
Bundles
âž” Bundle is the unit of modularization in OSGi
âž” OSGi based application can be considered as a
collection of Bundle
âž” Bundles can share packages with other bundles
and hide packages from other bundles
âž” How does a bundle differs from a normal jar file ?
MANIFEST.MF
Bundle States
Demo
Dynamism
Modularity achieved. But what about dynamism?
Can bundle alone solve the big problem?
Dynamism
âž” The moment your instantiate a new object tight
coupling among modules occurs.
âž” What if I want to update the platform or part of
the platform during runtime.
OSGi Services
âž” In-VM SOA model.
âž” Introduces the OSGi service registry.
âž” A service is Java object published in the framework
service registry.
âž” Bundles can publish/lookup services using interface
names
Registering a Service
public class Activator implements BundleActivator {
public void start(BundleContext bc) {
Hashtable props = new Hashtable();
props.put("language", "en");
//Registering the HelloWorld service
bc.registerService(HelloService.class.getName(),
new HelloServiceImpl(), props);
}
}
Acquiring Services
public void start(BundleContext bc) {
//Get the service reference for HelloService
serviceRef = bc.getServiceReference(HelloService.class. getName());
//service reference can be null, if the service is not registered.
if(serviceRef != null) {
helloService = (HelloService)bc.getService(serviceRef);
} else {
System.err.println("service reference not found.");
}
}
Demo
Services are Dynamic
âž” A service can register/unregister itself at any time.
âž” Bundle can decide to withdraw its service from the
registry while other bundles are still using this
service.
âž” A Service may not be registered when the other
bundles trying to use it.
â—† this depends on the start order of bundles.
âž” Bundle developer should write code to handle this
dynamic behavior of services.
Monitoring Services
➔Bundle Listeners
➔Service Listeners
➔Service Trackers
➔Declarative Services
Questions?

More Related Content

What's hot

Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platformSreenivas Kappala
 
Java programming and security
Java programming and securityJava programming and security
Java programming and securityUmeshchandraYadav5
 
Node js Global Packages
Node js Global PackagesNode js Global Packages
Node js Global Packagessanskriti agarwal
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web DevelopersAmr Fawzy
 
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...Anant Corporation
 
Node.js an introduction
Node.js   an introductionNode.js   an introduction
Node.js an introductionMeraj Khattak
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpackNodeXperts
 
Why we need container in Software
Why we need container in SoftwareWhy we need container in Software
Why we need container in SoftwareThach Nguyen
 
Docker 101
Docker 101 Docker 101
Docker 101 Kevin Nord
 
WSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product OverviewWSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product OverviewWSO2
 
Mastering KVM Virtualization - Overview
Mastering KVM Virtualization - OverviewMastering KVM Virtualization - Overview
Mastering KVM Virtualization - OverviewAnil Vettathu
 
Uploading Shell or Backdoor
Uploading Shell or BackdoorUploading Shell or Backdoor
Uploading Shell or BackdoorSurabaya Blackhat
 
Basic Thread Knowledge
Basic Thread KnowledgeBasic Thread Knowledge
Basic Thread KnowledgeShipra Roy
 
Design Patterns para Microsserviços com MicroProfile
 Design Patterns para Microsserviços com MicroProfile Design Patterns para Microsserviços com MicroProfile
Design Patterns para Microsserviços com MicroProfileVíctor Leonel Orozco López
 

What's hot (20)

Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platform
 
OCI Support in Mesos
OCI Support in MesosOCI Support in Mesos
OCI Support in Mesos
 
Java programming and security
Java programming and securityJava programming and security
Java programming and security
 
Node js Global Packages
Node js Global PackagesNode js Global Packages
Node js Global Packages
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
 
Node js
Node jsNode js
Node js
 
Node.js an introduction
Node.js   an introductionNode.js   an introduction
Node.js an introduction
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
 
Node js projects
Node js projectsNode js projects
Node js projects
 
Why we need container in Software
Why we need container in SoftwareWhy we need container in Software
Why we need container in Software
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Rethinking the OS
Rethinking the OSRethinking the OS
Rethinking the OS
 
Docker 101
Docker 101 Docker 101
Docker 101
 
WSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product OverviewWSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product Overview
 
Mastering KVM Virtualization - Overview
Mastering KVM Virtualization - OverviewMastering KVM Virtualization - Overview
Mastering KVM Virtualization - Overview
 
Node js
Node jsNode js
Node js
 
Uploading Shell or Backdoor
Uploading Shell or BackdoorUploading Shell or Backdoor
Uploading Shell or Backdoor
 
Basic Thread Knowledge
Basic Thread KnowledgeBasic Thread Knowledge
Basic Thread Knowledge
 
Design Patterns para Microsserviços com MicroProfile
 Design Patterns para Microsserviços com MicroProfile Design Patterns para Microsserviços com MicroProfile
Design Patterns para Microsserviços com MicroProfile
 

Viewers also liked

Presentacion reconocimiento r diaz
Presentacion reconocimiento r diazPresentacion reconocimiento r diaz
Presentacion reconocimiento r diazRICARDO
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi WebinarWSO2
 
Introduction To OSGi
Introduction To OSGiIntroduction To OSGi
Introduction To OSGiccustine
 
Intro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T WardIntro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T Wardmfrancis
 
OSGi overview
OSGi overviewOSGi overview
OSGi overviewAlex Proca
 

Viewers also liked (6)

Presentacion reconocimiento r diaz
Presentacion reconocimiento r diazPresentacion reconocimiento r diaz
Presentacion reconocimiento r diaz
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
Introduction To OSGi
Introduction To OSGiIntroduction To OSGi
Introduction To OSGi
 
OSGi tech session
OSGi tech sessionOSGi tech session
OSGi tech session
 
Intro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T WardIntro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T Ward
 
OSGi overview
OSGi overviewOSGi overview
OSGi overview
 

Similar to Introduction to OSGi - Part-1

Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiToni Epple
 
Eclipse_Building_Blocks
Eclipse_Building_BlocksEclipse_Building_Blocks
Eclipse_Building_BlocksRahul Shukla
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Martin Toshev
 
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...IndicThreads
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Jeffrey Groneberg
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Martin Toshev
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011njbartlett
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJAX London
 
OSGi User Forum US DC Metro
OSGi User Forum US DC MetroOSGi User Forum US DC Metro
OSGi User Forum US DC MetropjhInovex
 
OSGi user forum dc metro v1
OSGi user forum dc metro v1OSGi user forum dc metro v1
OSGi user forum dc metro v1pjhInovex
 
Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGipradeepfn
 
Part 8 - Enforcing modularity of JasForge using OSGI and Futures Evolutions
Part 8 - Enforcing modularity of JasForge using OSGI and Futures EvolutionsPart 8 - Enforcing modularity of JasForge using OSGI and Futures Evolutions
Part 8 - Enforcing modularity of JasForge using OSGI and Futures EvolutionsJasmine Conseil
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaArun Gupta
 
Third party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationshipThird party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationshipSascha Brinkmann
 
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsOSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsArun Gupta
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010Arun Gupta
 

Similar to Introduction to OSGi - Part-1 (20)

OSGi & Blueprint
OSGi & BlueprintOSGi & Blueprint
OSGi & Blueprint
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGi
 
Osgi
OsgiOsgi
Osgi
 
Eclipse_Building_Blocks
Eclipse_Building_BlocksEclipse_Building_Blocks
Eclipse_Building_Blocks
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
 
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
 
Modular Java
Modular JavaModular Java
Modular Java
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
 
OSGi User Forum US DC Metro
OSGi User Forum US DC MetroOSGi User Forum US DC Metro
OSGi User Forum US DC Metro
 
OSGi user forum dc metro v1
OSGi user forum dc metro v1OSGi user forum dc metro v1
OSGi user forum dc metro v1
 
Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGi
 
Part 8 - Enforcing modularity of JasForge using OSGI and Futures Evolutions
Part 8 - Enforcing modularity of JasForge using OSGI and Futures EvolutionsPart 8 - Enforcing modularity of JasForge using OSGI and Futures Evolutions
Part 8 - Enforcing modularity of JasForge using OSGI and Futures Evolutions
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 India
 
Third party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationshipThird party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationship
 
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsOSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worlds
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
 

More from kshanth2101

Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019kshanth2101
 
What is new in java 8 concurrency
What is new in java 8 concurrencyWhat is new in java 8 concurrency
What is new in java 8 concurrencykshanth2101
 
Evolution of Application Development
Evolution of Application DevelopmentEvolution of Application Development
Evolution of Application Developmentkshanth2101
 
WSO2Con Europe 2016 - Extension Points of Carbon Architecture
WSO2Con Europe 2016 - Extension Points of Carbon ArchitectureWSO2Con Europe 2016 - Extension Points of Carbon Architecture
WSO2Con Europe 2016 - Extension Points of Carbon Architecturekshanth2101
 
Basics of Java Concurrency
Basics of Java ConcurrencyBasics of Java Concurrency
Basics of Java Concurrencykshanth2101
 
Introduction to OSGi - Part-2
Introduction to OSGi - Part-2Introduction to OSGi - Part-2
Introduction to OSGi - Part-2kshanth2101
 

More from kshanth2101 (6)

Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019
 
What is new in java 8 concurrency
What is new in java 8 concurrencyWhat is new in java 8 concurrency
What is new in java 8 concurrency
 
Evolution of Application Development
Evolution of Application DevelopmentEvolution of Application Development
Evolution of Application Development
 
WSO2Con Europe 2016 - Extension Points of Carbon Architecture
WSO2Con Europe 2016 - Extension Points of Carbon ArchitectureWSO2Con Europe 2016 - Extension Points of Carbon Architecture
WSO2Con Europe 2016 - Extension Points of Carbon Architecture
 
Basics of Java Concurrency
Basics of Java ConcurrencyBasics of Java Concurrency
Basics of Java Concurrency
 
Introduction to OSGi - Part-2
Introduction to OSGi - Part-2Introduction to OSGi - Part-2
Introduction to OSGi - Part-2
 

Recently uploaded

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

Introduction to OSGi - Part-1

  • 4. What we need is … Modular Systems Dividing a complex software system into small parts/modules. Allows us to understand the system easily. Allows us to develop part by part by different team. Allows us to reuse already developed modules.
  • 5. Can we build a pure modular system with Java?
  • 6. What are the limitations? âž” Runtime vs Compile time difference. â—Ź Flat, single classpath. âž” No standard way of building a modular system. â—Ź Class loader based techniques.
  • 9. JAR (Java Archive) âž” JAR is unit of deployment in Java. âž” Typical Java application consists a set of JAR files. âž” No runtime representation for a JAR. âž” At runtime contents of all JAR files are treated as a single, ordered and global list which is called the class path
  • 10. Problem with JAR âž” Multiple versions of JAR files cannot be loaded simultaneously âž” A JAR cannot declare dependencies on other JARs. âž” No mechanism for information hiding âž” Hence, JARs cannot be considered as modules
  • 11. Java for Modular System âž” Can you update a part(can be a JAR file) of a running Java application? âž” Can you add new functionality to a new Java application at runtime? âž” If you need to add new functionality or update existing functionality, JVM needed to be restarted. âž” Java lacks dynamism
  • 12. What’s Next? âž” How about an abstraction where you can work at the package level as opposed to class/object level? â—† Importing packages. â—† Exporting packages. â—† A way to have private packages. âž” Can we achieve the limitations that we discussed in Java from this model?
  • 13. Next Level of Modularity âž” Separate class loader per module. â—† creating a class-space per module. â—† delegate class loading to other modules when necessary. âž” Solves the single class path problem. âž” Now you have a class loader network formed from classloader delegation. âž” This network is formed with import/export package restrictions. âž” Now we have modularity at runtime as well as compile time.
  • 14. Next level of Modularity
  • 15. What is OSGi? "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 as of 2012 does not exist in standalone Java/VM environments." --Wikipedia
  • 16. What is OSGi? âž” Widely accepted specification which introduces a standard way of building dynamic, modular systems with Java. âž” OSGi framework implementations.(Open source) â—† Eclipse Equinox. â—† Apache Felix. â—† Knopflerfish.
  • 18. OSGi Layered Model âž” Bundles â—† Bundles are the OSGi components made by the developers. âž” Services â—† The services layer connects bundles in a dynamic way by offering a publish-find-bind model for plain old Java objects. âž” Life-Cycle â—† The API to install, start, stop, update, and uninstall bundles.
  • 19. OSGi Layered Model âž” Modules â—† The layer that defines how a bundle can import and export code. âž” Security â—† The layer that handles the security aspects. âž” Execution Environment â—† Defines what methods and classes are available in a specific platform.
  • 20. Bundles âž” Bundle is the unit of modularization in OSGi âž” OSGi based application can be considered as a collection of Bundle âž” Bundles can share packages with other bundles and hide packages from other bundles âž” How does a bundle differs from a normal jar file ?
  • 23. Demo
  • 24. Dynamism Modularity achieved. But what about dynamism? Can bundle alone solve the big problem?
  • 25. Dynamism âž” The moment your instantiate a new object tight coupling among modules occurs. âž” What if I want to update the platform or part of the platform during runtime.
  • 26. OSGi Services âž” In-VM SOA model. âž” Introduces the OSGi service registry. âž” A service is Java object published in the framework service registry. âž” Bundles can publish/lookup services using interface names
  • 27. Registering a Service public class Activator implements BundleActivator { public void start(BundleContext bc) { Hashtable props = new Hashtable(); props.put("language", "en"); //Registering the HelloWorld service bc.registerService(HelloService.class.getName(), new HelloServiceImpl(), props); } }
  • 28. Acquiring Services public void start(BundleContext bc) { //Get the service reference for HelloService serviceRef = bc.getServiceReference(HelloService.class. getName()); //service reference can be null, if the service is not registered. if(serviceRef != null) { helloService = (HelloService)bc.getService(serviceRef); } else { System.err.println("service reference not found."); } }
  • 29. Demo
  • 30. Services are Dynamic âž” A service can register/unregister itself at any time. âž” Bundle can decide to withdraw its service from the registry while other bundles are still using this service. âž” A Service may not be registered when the other bundles trying to use it. â—† this depends on the start order of bundles. âž” Bundle developer should write code to handle this dynamic behavior of services.
  • 31. Monitoring Services âž”Bundle Listeners âž”Service Listeners âž”Service Trackers âž”Declarative Services