More Related Content Similar to Subsystems for those occasions where bundles are just too small... - Tom Watson (20) Subsystems for those occasions where bundles are just too small... - Tom Watson1. Subsystems:
for those occasions where bundles are just too small
Tom Watson
IBM
March 27st 2012
OSGi Alliance Marketing © 2008-2010 . All Rights 1
Page Reserved
COPYRIGHT © 2008-2012 OSGi Alliance. All Rights Reserved, © IBM Corp. 2012
3. Motivation
Enterprise Java platforms are awash with bundle
collections
Apache Aries – Applications
Apache Geronimo - Applications
Apache Karaf – Features
Eclipse Virgo – Plans, PARs
IBM WebSphere Application Server – Applications and
Composite
Oracle GlassFish – Applications
Paremus Service Fabric – Systems
Crying out for standardization
Portability
Tools
Ecosystem
Page 3 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
4. Subsystem Model: Hierarchy
Subsystem Hierarchy
Each has 1 or more parents (except
root)
subsystem
root
Page 4 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
5. Subsystem Model: Hierarchy
Subsystem Hierarchy
Each has 1 or more parents (except
root)
Each can have many children subsystem
root
S1 S2
S3
S4 S5
Page 5 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
6. Subsystem Model: Hierarchy
Subsystem Hierarchy
Each has 1 or more parents (except
root)
Each can have many children subsystem
Each is contained in a Region region
root
Regions
Provides isolation for a group of one S1 S2
or more subsystems
Defined by a scoped subsystem S3
S4 S5
Page 6 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
7. Subsystem Model: Sharing Policies
Scoped subsystems control
the sharing policy bundle
requirement
capability
root
A B
Y Y
S1 S2
Page 7 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
8. Subsystem Model: Sharing Policies
Scoped subsystems control
the sharing policy bundle
A region provides isolation requirement
capability
root
A X B
Y Y
S1 S2
Page 8 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
9. Subsystem Model: Sharing Policies
Scoped subsystems control
the sharing policy bundle
A region provides isolation requirement
Selectively export capabilities to the capability
parent
root
exports Y
A B
Y Y
S1 S2
Page 9 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
10. Subsystem Model: Sharing Policies
Scoped subsystems control
the sharing policy bundle
A region provides isolation requirement
Selectively export capabilities to the capability
parent
root
Selectively import capabilities from the
parent
imports Y exports Y
A B
Y Y
S1 S2
Page 10 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
11. Subsystem Model: Sharing Policies
Scoped subsystems control
the sharing policy bundle
A region provides isolation requirement
Selectively export capabilities to the capability
parent
root
Selectively import capabilities
from the parent
Unscoped subsystems
share everything with other imports Y exports Y
subsystems contained in the same A B
region Y Y
S1 S2
U1 C
Y
Page 11 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
13. Subsystem Types: Features
Collection of Resources (e.g.
Bundles)
Shared life-cycle
A C
B D
F1 F2
Page 13 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
14. Subsystem Types: Features
Collection of Resources (e.g.
Bundles)
Shared life-cycle
Can have children
A C
B D
F1 F2
F
F3
Page 14 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
15. Subsystem Types: Features
Collection of Resources (e.g.
Bundles)
Shared life-cycle
Can have children
A C
No scoping, able to share
B D
resources shared
E resource E
F1 F2
F
F3
Page 15 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
16. Subsystem Types: Features
Collection of Resources (e.g.
Bundles)
Shared life-cycle S1
Can have children
A C
No scoping, able to share
B D
resources shared
E resource E
Must be contained within a F1 F2
region
F
F3
Page 16 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
17. Subsystem Types: Features
Collection of Resources (e.g.
Bundles)
Shared life-cycle S1
Can have children
A C
No scoping, able to share
B D
resources shared
E resource E
Must be contained within a F1 F2
region
F
Examples: Karaf Features, F3
Virgo unscoped Plans
Page 17 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
19. Subsystem Types: Composite
Coarse-grained sub-assembly
module
Explicit export and import of
capabilities (e.g. packages, Root
services)
Import X Import Y
Export Y Export X
X X
Y Y
C1 C2
Page 19 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
20. Subsystem Types: Composite
Coarse-grained sub-assembly
module
Explicit export and import of
capabilities (e.g. packages, Root
services)
Composed of Resources (e.g.
Bundles) Import X Import Y
Export Y Export X
A C
X X
B D
Y Y
C1 C2
Page 20 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
21. Subsystem Types: Composite
Coarse-grained sub-assembly
module
Explicit export and import of
capabilities (e.g. packages, Root
services)
Composed of Resources (e.g.
Bundles) Import X Import Y
Export Y Export X
Scoped
A C
X X
B D
Y Y
E E
C1 C2
Page 21 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
22. Subsystem Types: Composite
Coarse-grained sub-assembly
module
Explicit export and import of
capabilities (e.g. packages, Root
services)
Composed of Resources (e.g.
Bundles) Import X Import Y
Export Y Export X
Scoped
A C
Examples: RFC 138 Composite X X
Bundles*, WebSphere B D
Y Y
Composite Bundles E E
C1 C2
*old design prior to resolver hooks
Page 22 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
23. Subsystem Types: Application
Used for composing hosted
applications using
Resources (e.g. Bundles)
A C
X X
B E E B
Y Y Y Y
Page 23 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
24. Subsystem Types: Application
Used for composing hosted
applications using
Resources (e.g. Bundles)
Scoped
A C
X X
B E E B
Y Y Y Y
A1 A2
Page 24 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
25. Subsystem Types: Application
Used for composing hosted
applications using
Resources (e.g. Bundles) C Root
Scoped
No exporting capabilities,
implicit imports of
dependencies A
X X
C
B E E B
Y Y Y Y
A1 A2
Page 25 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
26. Subsystem Types: Application
Used for composing hosted
applications using
Resources (e.g. Bundles) C Root
Scoped
No exporting capabilities,
implicit imports of
dependencies A
X X
C
Examples: Aries Application, B E E B
Virgo Scoped Plans,
Virgo PARs Y
A1
Y Y
A2
Y
Page 26 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
27. Example Combination
Subsystem Types can be A1 A2
G H
mixed ‘n’ matched X X
F F
Example shows:
Features used to assemble a Composite
C1
Composite providing a ‘platform’ to
Applications
A C
X X
B D
Y Y
E E
F1 F2
Root
Page 27 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
28. Subsystem Meta-data
Manifest format with relaxed rules
OSGI-INF/SUBSYSTEM.MF
Some headers unique to Subsystem type
Common concepts use same headers
Headers cover:
Identity and type
Content
Sharing policy
Human readable information
Page 28 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
29. Subsystem Meta-data: Identity Headers
Identified by
symbolic name Manifest-Version: 1.0
Subsystem-ManifestVersion: 1.0
version Subsystem-SymbolicName:
my.first.subsystem
Subsystem-Version: 1.0.0
Page 29 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
30. Subsystem Meta-data: Type Header
Type governs the sharing policy
Standard Types:
Manifest-Version: 1.0
osgi.subsystem.application Subsystem-ManifestVersion: 1.0
osgi.subsystem.composite Subsystem-SymbolicName:
my.first.subsystem
osgi.subsystem.feature Subsystem-Version: 1.0.0
Subsystem-Type:
One directive specified for osgi.subsystem.application;
controlling where dependencies provision-policy:=acceptDependencies
are installed
Page 30 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
31. Content
Identifies the resources contained
in the Subsystem Manifest-Version: 1.0
Subsystem-ManifestVersion: 1.0
Resources identified by name, Subsystem-SymbolicName:
my.first.Subsystem
version (range) and type Subsystem-Version: 1.0.0
Composites only allow fixed versions Subsystem-Type:
osgi.subsystem.application;
Standard types provision-policy:=acceptDependencies
Subsystem-Content:
osgi.bundle (default) an.osgi.bundle1;version="[1.0, 1.1)",
osgi.fragment an.osgi.subsystem;
type=osgi.subsystem.application;
subsystem types version="[1.2, 1.3)"
Can be optional
Page 31 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
32. Explicit Sharing Manifest-Version: 1.0
Subsystem-ManifestVersion: 1.0
Subsystem-Name: A Composite Subsystem
Subsystem-Description:
This is a Composite Subsystem
Subsystem-SymbolicName: my.first.composite
Subsystem-Version: 1.0.0
Subsystem-Type: osgi.subsystem.composite
Subsystem-Content:
Composite subsystems share an.osgi.bundle1;version="[1.0, 1.0]",
an.osgi.bundle2;version="[1.0, 1.0]"
nothing unless explicitly Subsystem-ExportService:
stated exported.service.Interface;
filter:="(color=blue)"
Re-use existing bundle Subsystem-ImportService:
headers where applicable imported.service.Interface
Export-Package:
Not applicable for implicitly an.exported.pkg;version="1.0"
isolated subsystems (i.e. Import-Package:
an.imported.pkg;version="[1.0, 2.0)"
Features and Applications) Require-Bundle:
a.required.bundle;
bundle-version="[1.0, 2.0)"
Page 32 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
33. Informational
Headers for humans Manifest-Version: 1.0
Subsystem-ManifestVersion: 1.0
Subsystem-Name: First Subsystem
Subsystem-Description:
This is my first ever Subsystem and
it's sooo cool.
Subsystem-SymbolicName:
my.first.subsystem
Subsystem-Version: 1.0.0
Subsystem-Type:
osgi.subsystem.application;
provision-policy:=acceptDependencies
Subsystem-Content:
an.osgi.bundle;version="[1.0, 1.1)",
an.osgi.subsystem;
type:=osgi.subsystem.application;
version="[1.2, 1.3)"
Page 33 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
34. Portability
Subsystem Manifests are
portable to a point
Target Environment + Transitive
Dependencies must support the Subsystem Definition
required resource implementation
types (e.g. Blueprint, WAB, DS, etc)
Deployment manifests may be Dependencies
portable
Different Target Environments likely to
require different Transitive Target Environment
Dependencies
Page 34 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
35. Packaging
Packaged in a Subsystem my.first.subsystem.esa
Archive
A zip file with .esa extension: OSGI-INF/SUBSYSTEM.MF
Subsystem Manifest (optional)
OSGI-INF/DEPLOYMENT.MF
Deployment Manifest (optional)
Resources
(optional) an.osgi.bundle-1.0.0.jar
an.osgi.bundle2-1.0.0.jar
Page 35 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
36. Subsystem Service
Life-cycle management A1 A2
Install, start, stop, uninstall
G H
Each subsystem logically F F
has it’s own Subsystem A1 A2
service
Navigation C1
getParents, getChildren, getConstituents
Introspection A C1, F1, F2 C
(A1, A2)
getHeaders, getState, getSymbolicName,
getVersion, getLocation B D
F1 F2
(ALL) Root
Page 36 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
38. Subsystem Lifecycle: Installing
Root Subsystem Service
used to install subsystems
A1
installing
install()
(Subsystem)
Root
Page 38 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
39. Subsystem Lifecycle: Installing
Root Subsystem Service
used to install subsystems
Repository based provisioning
A1
installing
install()
(Subsystem)
Root
A, B, C, D,
E, F, G
Page 39 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
40. Subsystem Lifecycle: Installing
Root Subsystem Service
used to install subsystems
Repository based provisioning
Content Resources (specified by A1
Subsystem-Content header) A
B
installing
install()
(Subsystem)
Root
A, B, C, D,
E, F, G
Page 40 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
41. Subsystem Lifecycle: Installing
Root Subsystem Service
used to install subsystems
Repository based provisioning
Content Resources (specified by A1
Subsystem-Content header) A
Dependencies B
installing
E install()
(Subsystem)
F
Root
A, B, C, D,
E, F, G
Page 41 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
42. Subsystem Lifecycle: Installing
Root Subsystem Service
used to install subsystems
Repository based provisioning
Content Resources (specified by A1
Subsystem-Content header) A
Dependencies B
installed
E
(Subsystem)
F
Root
A, B, C, D,
E, F, G
Page 42 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
43. Subsystem Lifecycle: Installing
Root Subsystem Service
used to install subsystems
Repository based provisioning
Content Resources (specified by A1 A2
Subsystem-Content header) A C
Dependencies B D
Share capabilities installed installed
E G
(Subsystem)
F
Root
A, B, C, D,
E, F, G
Page 43 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
45. Subsystem Lifecycle: Starting
Subsystem Service
used to start subsystems start()
Effect on referenced resources
A1 A2
A C
B D
starting
E G
F
Root
Page 45 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
46. Subsystem Lifecycle: Starting
Subsystem Service
used to start subsystems start()
Effect on referenced resources
Dependencies are started when one A1 A2
subsystem that uses them is
started A C
B D
starting
E G
F
Root
Page 46 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
47. Subsystem Lifecycle: Starting
Subsystem Service
used to start subsystems start()
Effect on referenced resources
Dependencies are started when one A1 A2
subsystem that uses them is
started A C
Content resources are started
B D
starting
E G
F
Root
Page 47 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
48. Subsystem Lifecycle: Starting
Subsystem Service
used to start subsystems start()
Effect on referenced resources
Dependencies are started when one A1 A2
subsystem that uses them is
started A C
Content resources are started
B D
active
E G
F
Root
Page 48 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
49. Subsystem Lifecycle: Starting
Subsystem Service
used to start subsystems
Effect on referenced resources
Dependencies are started when one A1 A2
subsystem that uses them is
started A C
Content resources are started
B D
active active
E G
F
Root
Page 49 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
50. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem stop()
A1 A2
A C
B D
active active
E G
F
Root
Page 50 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
51. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem stop()
Effect on referenced resources
A1 A2
A C
B D
stopping started
E G
F
Root
Page 51 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
52. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem stop()
Effect on referenced resources
Content resources are stopped A1 A2
A C
B D
stopping started
E G
F
Root
Page 52 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
53. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem stop()
Effect on referenced resources
Content resources are stopped A1 A2
Dependencies are stopped when no
subsystems that use them are A C
active
B D
stopping started
E G
F
Root
Page 53 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
54. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem
Effect on referenced resources
Content resources are stopped A1 A2
Dependencies are stopped when no
subsystems that use them are A C
active
B D
resolved started
E G
F
Root
Page 54 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
55. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem stop()
Effect on referenced resources
Content resources are stopped A1 A2
Dependencies are stopped when no
subsystems that use them are A C
active
B D
resolved started
E G
F
Root
Page 55 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
56. Subsystem Lifecycle: Stopping
Subsystem Service
used to stop a subsystem
Effect on referenced resources
Content resources are stopped A1 A2
Dependencies are stopped when no
subsystems that use them are A C
active
B D
resolved resolved
E G
F
Root
Page 56 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
57. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem uninstall()
A1 A2
A C
B D
resolved resolved
E G
F
Root
Page 57 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
58. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem uninstall()
Effect on referenced resources
A1 A2
A C
B D
uninstalling resolved
E G
F
Root
Page 58 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
59. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem uninstall()
Effect on referenced resources
Content resources are uninstalled A1 A2
A C
B D
uninstalling resolved
E G
F
Root
Page 59 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
60. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem uninstall()
Effect on referenced resources
Content resources are uninstalled A1 A2
Dependencies are uninstalled when
no subsystem is installed that uses C
them
D
uninstalling resolved
E G
F
Root
Page 60 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
61. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem
Effect on referenced resources
Content resources are uninstalled A1 A2
Dependencies are uninstalled when
no subsystem is installed that uses C
them
D
uninstalled resolved
G
F
Root
Page 61 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
62. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem uninstall()
Effect on referenced resources
Content resources are uninstalled A1 A2
Dependencies are uninstalled when
no subsystem is installed that uses C
them
D
uninstalled resolved
G
F
Root
Page 62 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
63. Subsystem Lifecycle: Uninstalling
Subsystem Service
used to uninstall a subsystem
Effect on referenced resources
Content resources are uninstalled A1 A2
Dependencies are uninstalled when
no subsystem is installed that uses
them
uninstalled uninstalled
Root
Page 63 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
64. Summary
Subsystems are the standard way to manage groups of
resources
Repository based provisioning of subsystem content and
dependencies
Subsystem types define sharing semantics
API enables management of Subsystem life-cycle
Standardized meta-data and packaging (.esa file)
Page 64 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012
65. Trademarks
ational Business Machines Corp., registered in many jurisdictions worldwide.
tered trademarks of Oracle and/or its affiliates.
companies. A current list of IBM trademarks is available on the Web at “Copyright
Page 65 OSGi Alliance Marketing © 2008-2012 . All Rights Reserved,
© IBM Corp. 2012