OSGi Subsystems from theory to practice Glyn Normington Eclipse Virgo Project Lead SpringSource/VMware 1
OSGi Subsystemsfrom theory to practiceGlyn NormingtonEclipse Virgo Project LeadSpringSource/VMware
1
@glynnormingtonOSGi Subsystems
Software rots
2
@glynnormingtonOSGi Subsystems
modularity helps
3
@glynnormingtonOSGi Subsystems
but ...
4
@glynnormingtonOSGi Subsystems 5
A clean design
@glynnormingtonOSGi Subsystems 6
without enforcement
@glynnormingtonOSGi Subsystems 7
works fine for a while
@glynnormingtonOSGi Subsystems 8
then starts to decay
@glynnormingtonOSGi Subsystems 9
and soon
@glynnormingtonOSGi Subsystems 10
the rot sets in
@glynnormingtonOSGi Subsystems 11
and spreads
@glynnormingtonOSGi Subsystems 12
and worsens
@glynnormingtonOSGi Subsystems 13
until the original design
@glynnormingtonOSGi Subsystems 14
has gone.
@glynnormingtonOSGi Subsystems
OSGi Subsystems to the rescue
15
@glynnormingtonOSGi Subsystems
Subsystem: identified manageable optionally scopedgroup of bundles
16
@glynnormingtonOSGi Subsystems
subsystemsspec
17
@glynnormingtonOSGi Subsystems
subsystemsreference
implementation
18
@glynnormingtonOSGi Subsystems
subsystemsreference
implementation
18
@glynnormingtonOSGi Subsystems
Now some theory
19
@glynnormingtonOSGi Subsystems
and practice
20
@glynnormingtonOSGi Subsystems
followed by
21
•getting started• the future
@glynnormingtonOSGi Subsystems
TheorySubsystem Types
22
@glynnormingtonOSGi Subsystems
Feature Subsystems
Feature
bundle
bundle bundle
bundle
Scoping:•None
23
@glynnormingtonOSGi Subsystems
Feature Subsystems
Feature
bundle
bundle bundle
bundle
24
A depends on B
bundle Bbundle A
• bundle• package• capability• service
Notation
@glynnormingtonOSGi Subsystems
Feature Subsystems
Feature
bundle
bundle bundle
bundle
Scoping:•None
25
@glynnormingtonOSGi Subsystems
Application Subsystems
int x;{ int y;}
26
@glynnormingtonOSGi Subsystems
Application Subsystems
Application
bundle
bundle
bundle
bundle
Scoping:•No exports•Automatic
imports
27
{ }
@glynnormingtonOSGi Subsystems
Composite Subsystems
Composite
bundle
bundle bundle
bundle
Configurablescoping
28
@glynnormingtonOSGi Subsystems
PracticeSubsystem Types
29
@glynnormingtonOSGi Subsystems
Feature Subsystems
Useful for:
• Grouping dependencies
• Sharing infrastructure
• Avoiding uses constraint failures
Feature
bundle
bundle bundle
bundle
30
@glynnormingtonOSGi Subsystems
Application Subsystems
Useful for top layer of the system
Avoid duplicating contents
• Reduces sharing
• Complicates update
• Leads to resolution errors
Application
bundlebundle
Feature
bundlebundle
Application
bundlebundle
31
@glynnormingtonOSGi Subsystems
Composite SubsystemsUseful for special infrastructure
Not for general use
• Complex
• Can duplicate infrastructure
• extenders
• management bundles
Composite
bundle
bundle bundle
bundle
32
@glynnormingtonOSGi Subsystems 33
bundlespackages
capabilitiesservices
services
kernel
user region compositesubsystem
@glynnormingtonOSGi Subsystems
TheorySubsystem Content and
Dependencies
34
@glynnormingtonOSGi Subsystems
Subsystem Content• By value in a subsystem archive
or
• By reference to a repository
35
@glynnormingtonOSGi Subsystems
Dependencies
• Subsystem content dependencies
• Installed from repository
36
@glynnormingtonOSGi Subsystems
PracticeSubsystem Content and
Dependencies
37
@glynnormingtonOSGi Subsystems
Subsystem Content (by value)
• Easy to deploy
• Limits sharing
• Harder to update
38
@glynnormingtonOSGi Subsystems
Repository Content
• Convenient during development
• Avoids bloat
• Generally preferable
39
@glynnormingtonOSGi Subsystems
TheoryNested
Subsystems
40
@glynnormingtonOSGi Subsystems
Nested Subsystems• So far all subsystems have been
children of the ‘root’ subsystem
Root
Application
bundlebundle
Feature
bundlebundle
Application
bundlebundle
41
@glynnormingtonOSGi Subsystems
Nested Subsystems
• Unlimited nesting
• Sharing determined by the child
42
@glynnormingtonOSGi Subsystems
PracticeNested Subsystems
43
@glynnormingtonOSGi Subsystems
Nested Subsystems• Features useful for grouping other subsystems
Root
Feature
Application
bundle
bundle
bundle
Application
bundle
bundle
bundle
bundle
44
@glynnormingtonOSGi Subsystems
Nested Subsystems• Nested features useful for logical grouping
Root
Application
bundlebundle
Feature
bundlebundle
Root
Feature
bundlebundle
Feature
bundlebundle
45
@glynnormingtonOSGi Subsystems
Nested Subsystems• Nested applications useful for scoping
Root
Application
bundlebundle
Application
bundlebundle
bundle
46
@glynnormingtonOSGi Subsystems
More Theory
47
@glynnormingtonOSGi Subsystems
Subsystem States
48
installing
installed uninstalling
resolving resolved
starting stopping
active
uninstalled
install failed
install
start
start
stop
uninstall
uninstall
@glynnormingtonOSGi Subsystems
RegionsRegion, group of bundles:
• scoped subsystems
• root subsystem
Directed graph; arcs are filters
Region context bundle
49
@glynnormingtonOSGi Subsystems
Getting Started
50
@glynnormingtonOSGi Subsystems
Aries Subsystems
on Virgo kernel
https://github.com/glyn
51
@glynnormingtonOSGi Subsystems
Feature
52
Subsystem-SymbolicName: hello.feature.subsystem
Subsystem-Type: osgi.subsystem.feature
Subsystem-Content: hello
@glynnormingtonOSGi Subsystems
Application
53
Subsystem-SymbolicName: hello.application.subsystem
Subsystem-Type: osgi.subsystem.application
Subsystem-Content: hello
@glynnormingtonOSGi Subsystems
Composite
54
Subsystem-SymbolicName: hello.composite.subsystem
Subsystem-Type: osgi.subsystem.composite
Subsystem-Content: hello;version="[1,1]"
Import-Package: org.osgi.framework
@glynnormingtonOSGi Subsystems
Nested Subsystem
55
Subsystem-SymbolicName: hello.nested.composite.subsystem
Subsystem-Type: osgi.subsystem.composite
Subsystem-Content: hello;version="[1,1]",
hello.application.subsystem;
type="osgi.subsystem.application";
version="[0,0]"
Import-Package: org.osgi.framework
@glynnormingtonOSGi Subsystems
Region Digraph
56
kernel
user region
application composite nested composite
application
@glynnormingtonOSGi Subsystems
Alternatives
57
@glynnormingtonOSGi Subsystems
Technology Stack
58
Equinox region bundle
Aries Subsystems Virgo Kernel
@glynnormingtonOSGi Subsystems
VirgoStandard Virgo Equivalent
Feature Unscoped plan
Application Scoped plan or PAR
Composite User region
Nesting Nested plans
Repository Repository
59
@glynnormingtonOSGi Subsystems
Equinox Region Support• org.eclipse.equinox.region
• RegionDigraph service
• Persistence
• JMX mxbeans
60
@glynnormingtonOSGi Subsystems
Back to software rot
61
@glynnormingtonOSGi Subsystems
Subsystems
62
@glynnormingtonOSGi Subsystems
guide evolution
63
@glynnormingtonOSGi Subsystems
and discourage rot.
64
@glynnormingtonOSGi Subsystems
The Future
65
@glynnormingtonOSGi Subsystems
Future Work Items
66
Spec topics
•Extenders•Weaving and dynamic imports•Service dependency determination•Thread context class loaders•Config Admin
Tooling support
@glynnormingtonOSGi Subsystems 67
ThanksJohn Ross - Aries SubsystemsGraham Charters - Subsystems spec
@glynnormingtonOSGi Subsystems
OSGi R5 Enterprise Specificationhttp://www.osgi.org/Download/Release5
Arieshttp://aries.apache.org/
Aries Subsystems on Virgo Kernelhttps://github.com/glyn
Virgohttp://www.eclipse.org/virgo
Equinox Region Bundlegit://git.eclipse.org/gitroot/equinox/rt.equinox.bundles.git
68
@glynnormingtonOSGi Subsystems
Questions?
69