practical osgi subsystems - glyn normington

32
Practical OSGi Subsystems Glyn Normington

Upload: mfrancis

Post on 19-Aug-2015

16 views

Category:

Technology


3 download

TRANSCRIPT

Practical OSGi Subsystems

Glyn Normington

Agenda

• Background

• Subsystem types

• Nested subsystems

• Subsystem content and dependencies

• Getting started

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...

Why Subsystems?

• Many bundles

• Named, versioned grouping

• Management

• Scoping

Scoping

• Bundles

• Packages

• Capabilities

• Services

Subsystem Types

Feature Subsystems

Feature

bundle

bundle bundle

bundle

Scoping:

• None

Application Subsystems

Application

bundle

bundle

bundle

bundle

Scoping:

• No exports

• Automatic imports

Composite Subsystems

Composite

bundle

bundle bundle

bundle

Scoping:

• Configurable exports

• Configurable imports

Subsystem Types in Practice

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

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

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

Composite Subsystems: Kernels

Root (kernel)

Composite (user region)

servicespackagesbundles

Subsystem Content and Dependencies

Subsystem Content

• By value in a subsystem archive

• By reference to a repository

Dependencies

• Satisfy the requirements of a subsystem

• But not included in the subsystem content

• Automatically installed from a repository

Subsystem Content and Dependencies in

Practice

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

Nested Subsystems

Nested Subsystems• So far all subsystems have been children of

the root subsystem

Root

Application

bundlebundle

Feature

bundlebundle

Application

bundlebundle

Nested Subsystems

• Subsystems can be nested to any depth

• Sharing between parent and child is controlled by the child

Nested Subsystems in Practice

Nested Subsystems• Features useful for grouping other subsystems

Root

Feature

Application

bundle

bundle

bundle

Application

bundle

bundle

bundle

bundle

Nested Subsystems• Nested features useful for logical grouping

Root

Application

bundlebundle

Feature

bundlebundle

Root

Feature

bundlebundle

Feature

bundlebundle

Nested Subsystems• Nested applications useful for scoping

Root

Application

bundlebundle

Application

bundlebundle

bundle

Getting Started

Trying it out

• Apache Aries support in development

• Some Virgo equivalents available

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

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 -

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

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/