The OSGi Subsystems specification is now published. Subsystems provide a way of structuring large systems comprising many OSGi bundles - a "no brainer" for architects who want to build a modular system. But what are the practical considerations when using Subsystems? We'll look at the trade-offs involved and indicate some patterns and anti-patterns.
Eclipse Virgo was one of the technologies that provided input to the Subsystem specification. We'll use Virgo as a source of examples in discussing the practical trade-offs in the use of Subsystems.
This presentation was given at the OSGi DevCon at EclipseCon Europe 2012.
3. 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...
11. Feature Subsystems
• Useful for grouping dependencies
• More controlled than auto-detection
• Helps avoid uses constraint failures
• Useful for:
• Common infrastructure
Feature
bundle bundle
• Shared bundles
bundle bundle
12. Application Subsystems
• Useful for top layer of the system
• Application or independent parts of an app
• Avoid including infrastructure bundles
• Reduces sharing Application Application
• Makes update more difficult bundle bundle bundle bundle
• Can lead to resolution failures
Feature
bundle bundle
13. Composite Subsystems
• Essentially a systems programming feature
• Useful for kernels and special infrastructure
• Not recommended for general, widespread
application use
• Complex Composite
• Can duplicate infrastructure bundle bundle
• extenders
• management bundles bundle bundle
19. 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
21. Nested Subsystems
• So far all subsystems have been children of
the root subsystem
Root
Application Application
bundle bundle bundle bundle
Feature
bundle bundle
28. Trying it out
• Apache Aries support in development
• Some Virgo equivalents available
29. 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
30. Virgo Equivalents
Standard Function Virgo Equivalent
Feature Unscoped plan
Application - scoped using a PAR or scoped plan - scoped
region using metadata rewriting
Composite - scoped using a
User region
region
Nested plans
Nesting
PARs, plans, user region
Repository Repository
Deployment Contexts -