practical osgi subsystems · practical osgi subsystems glyn normington. agenda • background •...

32
Practical OSGi Subsystems Glyn Normington

Upload: others

Post on 22-May-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Practical OSGi Subsystems

Glyn Normington

Page 2: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Agenda

• Background

• Subsystem types

• Nested subsystems

• Subsystem content and dependencies

• Getting started

Page 3: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Subsystems

• New in OSGi Enterprise 5.0 spec

• Implementation underway in Apache Aries

• Based on input from several projects

• Aries, Geronimo, Glassfish, Karaf, Paremus Service Fabric, Virgo, WebSphere

• Best practices...

Page 4: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Why Subsystems?

• Many bundles

• Named, versioned grouping

• Management

• Scoping

Page 5: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Scoping

• Bundles

• Packages

• Capabilities

• Services

Page 6: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Subsystem Types

Page 7: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Feature Subsystems

Feature

bundle

bundle bundle

bundle

Scoping:

• None

Page 8: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Application Subsystems

Application

bundle

bundle

bundle

bundle

Scoping:

• No exports

• Automatic imports

Page 9: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Composite Subsystems

Composite

bundle

bundle bundle

bundle

Scoping:

• Configurable exports

• Configurable imports

Page 10: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Subsystem Types in Practice

Page 11: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Feature Subsystems• Useful for grouping dependencies

• More controlled than auto-detection

• Helps avoid uses constraint failures

• Useful for:

• Common infrastructure

• Shared bundles

Feature

bundle

bundle bundle

bundle

Page 12: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Application Subsystems• Useful for top layer of the system

• Application or independent parts of an app

• Avoid including infrastructure bundles

• Reduces sharing

• Makes update more difficult

• Can lead to resolution failures

Application

bundlebundle

Feature

bundlebundle

Application

bundlebundle

Page 13: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Composite Subsystems• Essentially a systems programming feature

• Useful for kernels and special infrastructure

• Not recommended for general, widespread application use

• Complex

• Can duplicate infrastructure

• extenders

• management bundles

Composite

bundle

bundle bundle

bundle

Page 14: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Composite Subsystems: Kernels

Root (kernel)

Composite (user region)

servicespackagesbundles

Page 15: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Subsystem Content and Dependencies

Page 16: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Subsystem Content

• By value in a subsystem archive

• By reference to a repository

Page 17: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Dependencies

• Satisfy the requirements of a subsystem

• But not included in the subsystem content

• Automatically installed from a repository

Page 18: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Subsystem Content and Dependencies in

Practice

Page 19: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Use of Repositories• Subsystem archive content

• Easy to deploy

• May limit sharing

• Harder to update

• Repository content

• Convenient during development

• Avoids bloated archives

• Generally preferable

Page 20: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems

Page 21: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems• So far all subsystems have been children of

the root subsystem

Root

Application

bundlebundle

Feature

bundlebundle

Application

bundlebundle

Page 22: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems

• Subsystems can be nested to any depth

• Sharing between parent and child is controlled by the child

Page 23: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems in Practice

Page 24: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems• Features useful for grouping other subsystems

Root

Feature

Application

bundle

bundle

bundle

Application

bundle

bundle

bundle

bundle

Page 25: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems• Nested features useful for logical grouping

Root

Application

bundlebundle

Feature

bundlebundle

Root

Feature

bundlebundle

Feature

bundlebundle

Page 26: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Nested Subsystems• Nested applications useful for scoping

Root

Application

bundlebundle

Application

bundlebundle

bundle

Page 27: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Getting Started

Page 28: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Trying it out

• Apache Aries support in development

• Some Virgo equivalents available

Page 29: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Aries Subsystems

• This example runs on Virgo Kernel

• (Live demo)

• You can run it yourself in 5 minutes

• https://github.com/glyn/aries-subsystems-on-virgo-kernel

• README.md contains full instructions

Page 30: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Virgo EquivalentsStandard Function Virgo Equivalent

Feature Unscoped plan

Application - scoped using a region

PAR or scoped plan - scoped using metadata rewriting

Composite - scoped using a region

User region

Nesting Nested plansPARs, plans, user region

Repository Repository

Deployment Contexts -

Page 31: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

ThanksI am indebted to John Ross for his help with Aries Subsystems

Page 32: Practical OSGi Subsystems · Practical OSGi Subsystems Glyn Normington. Agenda • Background • Subsystem types • Nested subsystems • Subsystem content and dependencies •

Further Information

• OSGi R5 Enterprise Specification

• http://www.osgi.org/Download/Release5

• Aries Subsystems on Virgo Kernel

• https://github.com/glyn/aries-subsystems-on-virgo-kernel

• Virgo User & Programmer Guides

• http://www.eclipse.org/virgo/documentation/