View
652
Download
4
Category
Preview:
DESCRIPTION
A presentation about OSGi and Java modularity given on DevCon 2009. It lays out what is wrong with Java with respect to modularity and how OSGi fixes these flaws.
Citation preview
OSGi &Java Modularity
Jazoon 2009, Zürich
by Peter Kriens
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
Prod
uctiv
ity
Application Complexity
donderdag 25 juni 2009
Prod
uctiv
ity
Application Complexity
Assembly
donderdag 25 juni 2009
Prod
uctiv
ity
Application Complexity
Assembly
Structured Programming
donderdag 25 juni 2009
Prod
uctiv
ity
Application Complexity
Assembly
Structured Programming
Object Oriented Programming
donderdag 25 juni 2009
Prod
uctiv
ity
Application Complexity
Assembly
Structured Programming
Object Oriented Programming
Service Oriented Programming?
donderdag 25 juni 2009
donderdag 25 juni 2009
Application
donderdag 25 juni 2009
Application
Extensions
Application
Foundation
Java VM
Basic
Convenience
Something
Core
donderdag 25 juni 2009
Application
Extensions
Application
Foundation
Java VM
Basic
Convenience
Something
CoreJava VM
log4j barcode4j axis batik commons
derbyfopezmorphfreemarkerhttpunit
jakarta jcl json jdbm jdom
jenks jpos18 jython looks lucene
mail mx4j naming jetty poi
resolver rome serializer servlets tomcat
velocity
ws-commons
xalan
wsdl4j
xerces
xmlgraphics
xmlrpc
xmlapis
..
geronimo
bsh
bsf
guiapp hhfacility manufact. marketing minerva
accounting assetmaint
base
bi
catalinacommon
oagis order
ebaycontent
datafile
ecommerce
entity
googlebase
Application layer
widget
minilang party pos. product workeffort workflow …
sunjce_prov.pluginjssejcert dnsns ..
…
Libs
donderdag 25 juni 2009
Application
Extensions
Application
Foundation
Java VM
Basic
Convenience
Something
CoreJava VM
log4j barcode4j axis batik commons
derbyfopezmorphfreemarkerhttpunit
jakarta jcl json jdbm jdom
jenks jpos18 jython looks lucene
mail mx4j naming jetty poi
resolver rome serializer servlets tomcat
velocity
ws-commons
xalan
wsdl4j
xerces
xmlgraphics
xmlrpc
xmlapis
..
geronimo
bsh
bsf
guiapp hhfacility manufact. marketing minerva
accounting assetmaint
base
bi
catalinacommon
oagis order
ebaycontent
datafile
ecommerce
entity
googlebase
Application layer
widget
minilang party pos. product workeffort workflow …
sunjce_prov.pluginjssejcert dnsns ..
…
Libs
donderdag 25 juni 2009
by Damoiselle de Pique
donderdag 25 juni 2009
by Damoiselle de Pique
Was Pollock an Early OOProgrammer?
donderdag 25 juni 2009
donderdag 25 juni 2009
modularity
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
low coupling,
donderdag 25 juni 2009
low coupling,high cohesion &
donderdag 25 juni 2009
low coupling,
encapsulationhigh cohesion &
donderdag 25 juni 2009
donderdag 25 juni 2009
How Do WeHandle ThisComplexity
in Java?
donderdag 25 juni 2009
donderdag 25 juni 2009
Visibilityvs
Accessibility
donderdag 25 juni 2009
Visibility
ClassS
ClassT
ClassT
donderdag 25 juni 2009
Visibility
ClassS
ClassT
ClassT
donderdag 25 juni 2009
Visibility
ClassS
ClassT
donderdag 25 juni 2009
Visibility
ClassS
ClassT
donderdag 25 juni 2009
Visibility
ClassS
ClassT
ModuleSystem
donderdag 25 juni 2009
Hierarchical Class Loaders
ext
app app
cust
boot
donderdag 25 juni 2009
Hierarchical Class Loaders
ext
app app
custvisibility
boot
donderdag 25 juni 2009
Context Class Loaders
ext
boot
app app
cust
X {}
Y {}
donderdag 25 juni 2009
Context Class Loaders
ext
boot
app app
cust
X {}
Y {}
Thread -> ContextClassLoader
donderdag 25 juni 2009
Context Class Loaders
ext
boot
app app
cust
X {}
Y {}
Thread -> ContextClassLoader
donderdag 25 juni 2009
Accessibility
public
package
module
private
donderdag 25 juni 2009
module
package
class
Accessibility
ClassS
ClassT
ClassW
Class U
ClassV
donderdag 25 juni 2009
Java VM
log4j
barcode4j
axis
batik
commons
derby
fop
ezmorph
freemarker
httpunit
jakarta
jcl
json
jdbm
jdom
jenks
jpos18
jython
looks
lucene
mx4j
naming
jetty
poi
resolver
rome
serializer
servlets
tomcat
velocity
ws-commons
xalan
wsdl4j
xerces
xmlgraphics
xmlrpc
xmlapis
..
geronimo
bsh
bsf
guiapp
hhfacility
manufact.
marketing
minerva
accounting
assetmaint
base
bi
catalina
common
oagis
order
ebay
content
datafile
ecommerce
entity
googlebase
ofbiz
widget
minilang
party
pos.
product
workeffort
workflow
…
sunjce_prov.
plugin
jsse
jce
rt
dnsns
..
…
BeginHere
donderdag 25 juni 2009
Java VM
log4j
barcode4j
axis
batik
commons
derby
fop
ezmorph
freemarker
httpunit
jakarta
jcl
json
jdbm
jdom
jenks
jpos18
jython
looks
lucene
mx4j
naming
jetty
poi
resolver
rome
serializer
servlets
tomcat
velocity
ws-commons
xalan
wsdl4j
xerces
xmlgraphics
xmlrpc
xmlapis
..
geronimo
bsh
bsf
guiapp
hhfacility
manufact.
marketing
minerva
accounting
assetmaint
base
bi
catalina
common
oagis
order
ebay
content
datafile
ecommerce
entity
googlebase
ofbiz
widget
minilang
party
pos.
product
workeffort
workflow
…
sunjce_prov.
plugin
jsse
jce
rt
dnsns
..
…
ClassNot
FoundException
BeginHere
donderdag 25 juni 2009
import exportprivate
A
B
C
JARs
2
Split Packages
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
import exportprivate
A
B
C
JARs
package com.foo: X, Y, Z
2
Split Packages
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
import exportprivate
A
B
C
JARs
package com.foo: X, Y, Z
2
Split Packages
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
import exportprivate
A
B
C
JARs
package com.foo: X, Y, Z
2
Split Packages
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
2package com.foo: X, Z
import exportprivate
A
B
C
JARs
Versioning
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
2
package com.bar: A,B,C;2.0
package com.bar: A,B,C;1.0
package com.bar: A;2.0
package com.foo: X, Z
import exportprivate
A
B
C
JARs
Versioning
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
2
package com.bar: A,B,C;2.0
package com.bar: A,B,C;1.0
package com.bar: A;2.0
package com.foo: X, Z
import exportprivate
A
B
C
JARs
Versioning
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
2
package com.bar: A,B,C;2.0
package com.bar: A,B,C;1.0
package com.bar: A;2.0
package com.foo: X, Z
import exportprivate
A
B
C
JARs
Private Packages
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
2
package com.bar: A,B,C;2.0
package com.bar: A,B,C;1.0
package com.bar: A;2.0
package com.foo: X, Z
package com.private: G
package com.private: G,H,I
import exportprivate
A
B
C
JARs
Private Packages
donderdag 25 juni 2009
package com.foo: X, Y
package com.foo: X, Y, Z
2
package com.bar: A,B,C;2.0
package com.bar: A,B,C;1.0
package com.bar: A;2.0
package com.foo: X, Z
package com.private: G
package com.private: G,H,I
import exportprivate
A
B
C
JARs
Private Packages
donderdag 25 juni 2009
How Do WeHandle ThisComplexity
in Java?
donderdag 25 juni 2009
We Don’t ...
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
OS + Hardware
Execution Environment
Module
Life Cycle
Service
SECURITY
Applications(bundles)
donderdag 25 juni 2009
Execution Environment
donderdag 25 juni 2009
donderdag 25 juni 2009
CLDC/MIDP
J2SE 1.3, 1.4,
5, 6, ...CDC/FP
OSGiMin.
donderdag 25 juni 2009
Kim Scarborough
donderdag 25 juni 2009
Module Layer
donderdag 25 juni 2009
Import, Export, Private
Bundle A
Bundle B
.
p
r
q-[1.2,1.8)
p
q-1.4
import export
r
private
Bundle A
donderdag 25 juni 2009
Import, Export, Private
Bundle A
Bundle B
.
p
r
q-[1.2,1.8)
p
q-1.4
import
imports
export
r
private
Bundle A
donderdag 25 juni 2009
Import, Export, Private
Bundle A
Bundle B
.
p
r
q-[1.2,1.8)
p
q-1.4
import
imports
exports
export
r
private
Bundle A
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
Uses ConstraintsBundle B
q-[1.2,1.8)
p
q-1.4
Bundle A
Bundle DBundle C
r;2.0r;1.0
r;2.0r;1.0
p
import exportprivate
donderdag 25 juni 2009
Uses ConstraintsBundle B
q-[1.2,1.8)
p
q-1.4
imports
Bundle A
Bundle DBundle C
r;2.0r;1.0
r;2.0r;1.0
p
import exportprivate
donderdag 25 juni 2009
Uses ConstraintsBundle B
q-[1.2,1.8)
p
q-1.4
imports
exports
Bundle A
Bundle DBundle C
r;2.0r;1.0
r;2.0r;1.0
p
import exportprivate
donderdag 25 juni 2009
Uses ConstraintsBundle B
q-[1.2,1.8)
p
q-1.4
imports
exports
Bundle A
Bundle DBundle C
r;2.0r;1.0
r;2.0r;1.0
p
import exportprivate
donderdag 25 juni 2009
SystemLoader
ExtensionLoader
Application BLoader
CustomLoader
donderdag 25 juni 2009
SystemLoader
ExtensionLoader
Application BLoader
CustomLoader
OSGi
donderdag 25 juni 2009
SystemLoader
ExtensionLoader
FrameworkLoader
Application BLoader
CustomLoader
Bundle G
Bundle C
Bundle A
Bundle B
Bundle F
Bundle E
Bundle D
OSGi
donderdag 25 juni 2009
donderdag 25 juni 2009
Life Cycle Layer
donderdag 25 juni 2009
INSTALLED
RESOLVED
UNINSTALLED
ACTIVE
STOPPING
STARTING
donderdag 25 juni 2009
BundleX
BundleX-v2
BundleB
MANAGE-MENT
BUNDLE
BundleA
Systembundle
donderdag 25 juni 2009
Service Layer
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
Services
BundleA
BundleB
register get
notify
defined ininterface/class
donderdag 25 juni 2009
Services
void foo() {…}
…s.foo()…
interface Foo { void foo();}
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
Services Solve Class Loader
Problems!donderdag 25 juni 2009
donderdag 25 juni 2009
Security
donderdag 25 juni 2009
donderdag 25 juni 2009
Real Code!
donderdag 25 juni 2009
donderdag 25 juni 2009
package com.acme;import org.osgi.framework.*;public class HelloWorld extends BundleActivator { public void start(BundleContext context) { System.out.println(“Hello World”); } public void stop(BundleContext context) { System.out.println(“Goodbye World”); }}
---------------------------------------------
Manifest: 1.0Bundle-Activator: com.acme.HelloWorldImport-Package: org.osgi.framework;version=1.3
donderdag 25 juni 2009
Bundles are active entities in runtime
donderdag 25 juni 2009
donderdag 25 juni 2009
294
donderdag 25 juni 2009
2947
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
Is JSR 294 aMeta Module System? (Implemented by OSGi™, Jigsaw, Guice, …)
donderdag 25 juni 2009
Is JSR 294 aMeta Module System? (Implemented by OSGi™, Jigsaw, Guice, …)
No Java™ Standard for
Modules!donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
Legacy
donderdag 25 juni 2009
Class .forName
donderdag 25 juni 2009
Class .forName
donderdag 25 juni 2009
donderdag 25 juni 2009
Bloat?donderdag 25 juni 2009
AccidentalComplexity
donderdag 25 juni 2009
‘97 ‘98 ‘99 ‘00 ‘01 ‘02 ‘03 ‘04 ‘05 ‘06 ‘07 ‘08 ‘09 ‘10
donderdag 25 juni 2009
‘97 ‘98 ‘99 ‘00 ‘01 ‘02 ‘03 ‘04 ‘05 ‘06 ‘07 ‘08 ‘09 ‘10
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
bundleA-1.2
bundleB-4.1
bundleC-1.0
bc
a
donderdag 25 juni 2009
donderdag 25 juni 2009
donderdag 25 juni 2009
The ComponentFramework
donderdag 25 juni 2009
donderdag 25 juni 2009
Q&Adonderdag 25 juni 2009
Thanks!
donderdag 25 juni 2009
Recommended