Más contenido relacionado Similar a Subsystems: For those occasions where bundles are just too small... - Graham Charters (20) Subsystems: For those occasions where bundles are just too small... - Graham Charters1. Subsystems:
for those occassions where bundles are just too small
Graham Charters
IBM
21st September 2011
OSGi Alliance Marketing © 2008-2010 . 1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved, © IBM Corp. 2011
All Rights Reserved
2. Disclaimer
• Subsystems is an in-progress RFC. What follows is a
snapshot in time of the expert group thinking and is
subject to change.
Page 2 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
3. Agenda
• Motivation
• Model
• Development Meta-data
• Deployment Meta-data
• Packaging
• Life-cycle
• API
Page 3 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
4. 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 4 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
5. Subsystems Model: Hierarchy
• Most common model is subsystem
hierarchy and so
Subsystems are no subsystem
different
• Each has 1 parent subsystem
• Each can have many children
subsystem subsystem
• Children of the same parent
are siblings
• Visually represented by subsystem subsystem
containment
Page 5 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
6. Subsystem Model: Sharing Policies
• Subsystems may provide and consume capabilities
• E.g. packages, services, etc…
• Different subsystem types have different default sharing
policies
• E.g. share everything, share nothing, provide nothing
• Subsystem types that provide isolation may also have
affinity – i.e. prefer the capabilities of their contents
Page 6 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
7. Feature Subsystems
feature
bundle
• Collection of Resources
(e.g. Bundles) feature
• Shared life-cycle bundle
• Can be nested
• No isolation or affinity bundle
• Repository-based bundle
provisioning
• Examples: Karaf
Features, Virgo unscoped
Plans bundle bundle
Page 7 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
8. Composite Subsystems
• Coarse-grained sub- bundle
assembly module
• Isolated composite
• Explicit share in/out
bundle
• Affinity
bundle
• Repository-based
provisioning bundle
• Examples: RFC 138
Composite Bundles*,
WebSphere Composite
bundle bundle
Bundles
Page 8 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
*old design prior to resolver hooks
9. Application Subsystems
• Model for hosted
applications
• Isolated application
bundle
• No sharing out, implicit
sharing in bundle
• Affinity
bundle
• Repository-based
provisioning
• Examples: Aries
bundle bundle
Application, Virgo Scoped
Plans, Virgo PARs
Page 9 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
10. Example Combination
• Subsystem Types can be
mixed ‘n’ matched framework
• Example shows: application application
• Features used to assemble a
Composite
• Composite providing a ‘platform’ to
composite
Applications
feature feature
feature
Page 10 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
11. Developer Headers
• Manifest format with relaxed rules
• Common concepts use same headers
• Some headers unique to Subsystem type
• Headers cover:
• Identity
• Content
• Isolation policy
• Human readable information
Page 11 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
12. Identity Headers
• Identified by symbolic
name and version Manifest-Version: 1.0
Subsystem-ManifestVersion: 1.0
• All subsystem types Subsystem-SymbolicName:
my.first.subsystem
live in the same Subsystem-Version: 1.0.0
namespace so type
not part of the identity
Page 12 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
13. Type Header
• Type governs the sharing policy
• Standard Types:
Manifest-Version: 1.0
• osgi.application (the default) Subsystem-ManifestVersion: 1.0
• osgi.composite Subsystem-SymbolicName:
my.first.subsystem
• osgi.feature Subsystem-Version: 1.0.0
Subsystem-Type:
• All subsystem types live in osgi.application;
same resource type provision-policy:=acceptTransitive
(osgi.subsystem), so their
subsystem type is not part of
their identity
• One directive used in
provisioning (see later)
Page 13 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
14. 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 Subsystem-Type:
versions osgi.application;
provision-policy:=acceptTransitive
• Standard types Subsystem-Content:
an.osgi.bundle1;version="[1.0, 1.1)",
• osgi.bundle (default) an.osgi.subsystem;
• osgi.subsystem type:=osgi.subsystem;
version="[1.2, 1.3)",
• osgi.configuration* an.osgi.config;
• Can be optional type:=osgi.configuration;
version="[1.0, 1.1)";
resolution:=optional
*if we get there…
Page 14 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
15. Informational
Manifest-Version: 1.0
• Headers for humans Subsystem-ManifestVersion: 1.0
Subsystem-Name: First Subsystem
• Localized just like bundles 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.application;
provision-policy:=acceptTransitive
Subsystem-Content:
an.osgi.bundle;version="[1.0, 1.1)",
an.osgi.subsystem;
type:=osgi.subsystem;
version="[1.2, 1.3)",
an.osgi.config;
type:=osgi.configuration;
version="[1.0, 1.1)"
Page 15 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
16. 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
• Composite subsystems Subsystem-Type: osgi.composite
Subsystem-Content:
share nothing unless an.osgi.bundle1;version="[1.0, 1.0]",
explicitly stated an.osgi.bundle2;version="[1.0, 1.0]"
Subsystem-ExportService:
• Re-use existing bundle exported.service.Interface;
headers where applicable filter:="(color=blue)"
Subsystem-ImportService:
• Not applicable for implicitly imported.service.Interface
isolated subsystems (i.e. Export-Package:
an.exported.pkg;version="1.0"
Features and Import-Package:
Applications) an.imported.pkg;version="[1.0, 2.0)"
Require-Bundle:
a.required.bundle;
bundle-version="[1.0, 2.0)"
Page 16 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
17. Locking down deployment
• Subsystem manifest allows version variability
• Enables flexibility during development
• Bounds operational upgrade
• Desirable to lock down versions during QA
• Carry same deployment from testing to production
• Deployment Manifest
• Locks down contents to specific versions
• Identifies supporting transitive dependencies
• Describes package/service import/export details
Page 17 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
18. Deployment Manifest
DESCRIPT’N SUBSYSTEM.MF DEPLOYMENT.MF
Boilerplate Manifest-Version: 1.0 Manifest-Version: 1.0
Subsystem-ManifestVersion: 1.0 Deployment-ManifestVersion: 1.0
Identity + Subsystem-SymbolicName: Subsystem-SymbolicName:
Subsystype my.first.subsystem my.first.subsystem
Subsystem-Version: 1.0.0 Subsystem-Version: 1.0.0
Subsystem-Type: osgi.application
Content Subsystem-Content: Deployed-Content:
an.osgi.bundle;version="[1.0, 1.1)", an.osgi.bundle;type:=osgi.bundle;
an.osgi.subsystem;type:=osgi.subsystem; deployed-version=1.0.0,
version="[1.2, 1.3)", an.osgi.subsystem;type:=osgi.subsystem;
an.osgi.config;type:=osgi.configuration; deployed-version=1.2.0,
version="[1.0, 1.1)"; an.osgi.config;type:=osgi.configuration;
resolution:=optional deployed-version=1.0.5
Transitive <Only part of the deployment> Provision-Resource:
Dependencies an.osgi.bundle2;type:=osgi.bundle;
deployed-version=1.0.0
an.osgi.bundle3;type:=osgi.bundle;
deployed-version=1.0.0
Sharing Policy <Implicit for Application Subsystems> Deployed-ServiceImport:
(objectClass=an.osgi.Service)
Import-Package:
a.pkg;version="1.0.0",
a.pkg2;version="1.4"
Page 18 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
19. Manifest-Version: 1.0
Example
Deployment-ManifestVersion: 1.0
Subsystem-SymbolicName:
my.first.subsystem
Subsystem-Version: 1.0.0
Deployed-Content:
an.osgi.bundle;type:=osgi.bundle;
deployed-version=1.0.0, application
an.osgi.subsystem;type:=osgi.subsystem;
deployed-version=1.2.0,
an.osgi.config; config subsystem
type:=osgi.configuration;
deployed-version=1.0.5
Provision-Resource:
an.osgi.bundle2;type:=osgi.bundle; bundle
deployed-version=1.0.0
an.osgi.bundle3;type:=osgi.bundle;
deployed-version=1.0.0 Service pkg pkg2
Deployed-ServiceImport:
(objectClass=an.osgi.Service)
Import-Package:
a.pkg;version="1.0.0", bundle3 bundle2
a.pkg2;version="1.4"
Page 19 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
20. Transitive
Subsystem-Type: osgi.composite;
Dependencies provision-policy:=acceptTransitive
Subsystem-Type:
• Provision-Resource identifies osgi.application
resources to be provisioned in
Subsystem-Type:
support of a Subsystem config osgi.composite
• A Subsystem can choose to accept
transitive dependencies from itself
and its children bundle
Subsystem-Type: osgi.composite;
provision-policy:=acceptTransitive
Service pkg pkg2
• The Root Subsystem always
accepts transitive dependencies
• Sharing policies need to be correct bundle3 bundle2
to ensure children can see their
transitive dependencies
Transitive Dependencies
Page 20 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
21. Portability
• Subsystem Manifests are
portable to a point
• Target Environment +
Subsystem Definition
Transitive Dependencies must
support the required resource
implementation types (e.g. Transitive
Blueprint, WAB, DS, etc) Dependencies
• Deployment manifests may
be portable Target Environment
• Different Target Environments
likely to require different
Transitive Dependencies
Page 21 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
22. Packaging
• Packaged in a Subsystem my.first.subsystem.ssa
Archive
• A zip file with .ssa OSGI-INF/SUBSYSTEM.MF
extension: OSGI-INF/DEPLOYMENT.MF
• Subsystem Manifest
(optional)
an.osgi.bundle-1.0.0.jar
• Deployment Manifest
(optional) an.osgi.bundle2-1.0.0.jar
• Resources
(optional)
Page 22 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
23. Life-cycle
install
INSTALLING
• Life-cycle similar to that of
INSTALLED UPDATING
bundles update
resolve
• Adds ‘transitional states’
uninstall
to reflect periods where RESOLVING
STARTING
contents are in process of
changing state RESOLVED ACTIVE
uninstall
• E.g. INSTALLING, stop
RESOLVING, …
STOPPING
UNINSTALLIN
G
UNINSTALLED
Page 23 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
24. Shared resource life-cycle
• Resources may be shared
between Subsystems
• Intersecting Features
ACTIVE
• Common transitive
dependencies
• Shared resource states
determined by states of RESOLVED
Subsystems that depend on
them
• State precedence used to INSTALLED
determine shared resource state
• Highest state wins
• All uninstalled == garbage
UNSTALLED
collection
Page 24 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
25. Application Subsystem
Example installed and resolved
Composite ACTIVE
Application RESOLVED
bundle
RESOLVED
transitive bundle
RESOLVED
Page 25 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
26. Second Application
Example Subsystem installed and
started
Composite ACTIVE
Application RESOLVED Application ACTIVE
bundle bundle
RESOLVED ACTIVE
transitive bundle transitive bundle
ACTIVE ACTIVE
Page 26 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
27. Second Application
Example Subsystem uninstalled
Composite ACTIVE
Application RESOLVED Application UNINSTALLED
bundle bundle
RESOLVED UNINSTALLED
transitive bundle transitive bundle
RESOLVED UNINSTALLED
Page 27 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
28. First Application Subsystem
Example uninstalled
Composite ACTIVE
Application UNINSTALLED Application UNINSTALLED
bundle bundle
UNINSTALLED UNINSTALLED
transitive bundle transitive bundle
UNINSTALLED UNINSTALLED
Page 28 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
29. Subsystem Service
• Each subsystem framework
logically has it’s own application
Subsystem service
• An environment can choose to
hide for certain subsystems
composite
• Life-cycle management
• Install, start, stop, uninstall, feature feature
cancel
• Navigation feature
• getParent, getChildren,
getConstituents
• Introspection
• getHeaders, getState,
getSymbolicName, getVersion,
getLocation
Page 29 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
30. Summary
• Subsystems are the standard way to manage groups of
resources
• Version ranges allow flexibility in resource selection
• Subsystem types define sharing semantics
• Deployment definition
• locks down versions and sharing
• Identifies transitive dependencies
• API enables management of Subsystem life-cycle
Page 30 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011
31. Trademarks
IBM and WebSphere are trademarks or registered trademarks of
International Business Machines Corp., registered in many
jurisdictions worldwide.
Java and all Java-based trademarks and logos are trademarks or
registered trademarks of Oracle and/or its affiliates.
Other product and service names might be trademarks of IBM or other
companies. A current list of IBM trademarks is available on the Web at
“Copyright and trademark information” at
www.ibm.com/legal/copytrade.shtml.
Page 31 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, 26.09.2011
© IBM Corp. 2011