Upload
codecampiasi
View
663
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
Solving the PuzzleJava Modularity
George Alin CosteaSynygy
March 10th, 2012
Complexity
One of the most difficult challenges to overcome in any large engineering project
The Boeing 747-400 “Jumbo Jet” has 6 million parts
Linux kernel 2.6.35 has
13.5 millions lines of code
Medium size Java Application
The Problem
● No way to specify jar versions● No way to specify dependencies● Multiple versions of the same jar
cannot co-exist peacefully● No runtime and life-cycle control
The Problem
The Java Platform does not (yet) provide a standard module and service system
The Problem
Jar Hell
OSGi – A simple idea
The module system for Java.
It defines a way to create modules and how those modules interact at runtime.
Bundles
OSGi modules are called Bundles,
they are nothing more than plain old Jar files with additional meta-data.
The OSGi runtime handles their lifecycle, dependencies and services.
Bundle Anatomy
Bundle Anatomy - ManifestBundle-Name: Hello World
Bundle-SymbolicName: ro.codecamp.helloworld
Bundle-Description: A Hello World bundle
Bundle-Version: 1.0.0
Bundle-Activator: ro.codecamp.helloworld.Activator
Export-Package: ro.codecamp.helloworld;version="1.0.0"
Import-Package: org.osgi.framework;version="1.3.0"
Bundle Anatomy - Activator
Demo
Modular application with dynamic behaviour – plug-in system
Drawbacks
● OSGi is not a panacea
● Shift in application design
● Learning curve
● Not all applications require dynamic loading
of modules
● Bad code becomes modular bad code
Successful projects
Future: Project Jigsaw
● Standard module system● Planned for inclusion in Java 8● Subject of flaming discussions● Should be inter-operable with OSGi
Questions?
Thank you!
Please fill out the evaluation forms!