Practical OSGi Subsystems

2,166 views

Published on

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.

1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total views
2,166
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
51
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Practical OSGi Subsystems

    1. 1. Practical OSGi Subsystems Glyn Normington
    2. 2. Agenda• Background• Subsystem types• Nested subsystems• Subsystem content and dependencies• Getting started
    3. 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...
    4. 4. Why Subsystems?• Many bundles• Named, versioned grouping• Management• Scoping
    5. 5. Scoping• Bundles• Packages• Capabilities• Services
    6. 6. Subsystem Types
    7. 7. Feature Subsystems FeatureScoping: bundle bundle• None bundle bundle
    8. 8. Application SubsystemsScoping: Application• No exports bundle bundle• Automatic imports bundle bundle
    9. 9. Composite SubsystemsScoping: Composite• Configurable exports bundle bundle• Configurable imports bundle bundle
    10. 10. Subsystem Types in Practice
    11. 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. 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. 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
    14. 14. CompositeSubsystems: Kernels Root (kernel) Composite (user region) bundles packages services
    15. 15. Subsystem Content and Dependencies
    16. 16. Subsystem Content• By value in a subsystem archive• By reference to a repository
    17. 17. Dependencies• Satisfy the requirements of a subsystem• But not included in the subsystem content• Automatically installed from a repository
    18. 18. Subsystem Content and Dependencies in Practice
    19. 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
    20. 20. Nested Subsystems
    21. 21. Nested Subsystems• So far all subsystems have been children of the root subsystem Root Application Application bundle bundle bundle bundle Feature bundle bundle
    22. 22. Nested Subsystems• Subsystems can be nested to any depth• Sharing between parent and child is controlled by the child
    23. 23. Nested Subsystems in Practice
    24. 24. Nested Subsystems• Features useful for grouping other subsystems Root Feature Application Application bundle bundle bundle bundle bundle bundle bundle
    25. 25. Nested Subsystems• Nested features useful for logical grouping Root Root Feature Application Feature bundle bundle bundle bundle Feature bundle bundle bundle bundle
    26. 26. Nested Subsystems• Nested applications useful for scoping Root bundle Application Application bundle bundle bundle bundle
    27. 27. Getting Started
    28. 28. Trying it out• Apache Aries support in development• Some Virgo equivalents available
    29. 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. 30. Virgo Equivalents Standard Function Virgo Equivalent Feature Unscoped planApplication - scoped using a PAR or scoped plan - scoped region using metadata rewritingComposite - scoped using a User region region Nested plans Nesting PARs, plans, user region Repository Repository Deployment Contexts -
    31. 31. ThanksI am indebted to John Ross for his help withAries Subsystems
    32. 32. 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/

    ×