Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Multi-bundle Scoping in OSGi

2.664 visualizaciones

Publicado el

Publicado en: Tecnología, Educación
  • ...My Scandalous Secret to Crushing The Odds So Effortlessly... ★★★
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • You're Going to Want to Read This Before Tonight 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • This is Amazing! He Won the Lotto Jackpot 7 Times, and Doesn't Mind Revealing His Secrets? ●●●
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • Watch My Free Video Packed with My Best Secrets Here 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí

Multi-bundle Scoping in OSGi

  1. 1. Multi-Bundle Scoping in OSGi Glyn Normington 50 µm lead sulphide assemblies each containing ~108 nanoparticlesCopyright VMware Inc. 2011. Licensed under the Eclipse Public License
  2. 2. Agenda•Modules in Java• Multi-bundle modules• Scoping mechanisms• Subsystems
  3. 3. Modules in Java
  4. 4. Modularitythe degree to which a system’s componentsmay be separated and recombinedthe tightness of coupling between componentsthe degree to which the system architecturecontrols the mixing and matching of components
  5. 5. Modularitythe degree to which a system’s componentsinformationmay be separated and recombinedthe tightness of coupling between componentsthe degree to which the system architecture hidingcontrols the mixing and matching of components
  6. 6. Modules in Java• Class• Package• JAR• Class loader } OSGi bundle• Module - Java 8• Larger scale modules?
  7. 7. Multi-Bundle Modules
  8. 8. Information to Hide• Bundle• Package• Generic capability• Service
  9. 9. Example 1Feature bundle bundle bundle bundle
  10. 10. Example 2Scoped App bundle bundle bundle bundle
  11. 11. Example 3Kernelbundle bundlebundle bundle
  12. 12. Scoping Mechanisms
  13. 13. Scoping Mechanisms• x-internal/x-friends• metadata rewriting• composite bundle• framework hooks• region digraph
  14. 14. Eclipse x-* Directives• Export-Package directives• Enforced by framework• x-internal• x-friends• Non-standard• Naming friends is brittle➡ Standard, maintainable mechanism
  15. 15. Metadata RewritingHide internals: • Decorate referents • Bundles and packages • Generic capabilities • Fix references • Use service registry hooks
  16. 16. Metadata Rewriting in Virgo Demo ...
  17. 17. Metadata RewritingIssues:• Suitable for isolated applications only• Intrusive• Complicates bundle update• Can be coded round• Non-standard➡ Standard scoping in the framework
  18. 18. Composite Bundle• OSGi draft spec• Prototyped in Equinox, deprecated• Uses framework instance• Surrogate bundle represents “parent”• Used in Virgo 2.1 to isolate the kernel
  19. 19. Composite BundleIssues:• Implemented in the framework• Cannot expose constituent bundles• Hard to spec portably➡ Superseded
  20. 20. Framework Hooks• Part of OSGi 4.3 core• Control visibility• Enable framework to be partitioned• 5 main hooks: • resolver hook • bundle find/event hooks • service find/event hooks
  21. 21. Framework HooksIssues:• Low level• Consistency of hooks• Coexistence of sets of hooks➡ Higher level API needed
  22. 22. Region Digraph
  23. 23. Graph Theory Interlude
  24. 24. Tree
  25. 25. DAG
  26. 26. Digraph
  27. 27. Graph
  28. 28. Region Digraph• Framework hook abstraction• Bundles partitioned into regions• Regions connected by filters • Bundles • Packages • Generic capabilities • Services
  29. 29. Example Digraph region A p3 "allow p1" p1, p2 region B
  30. 30. Example Digraph region A visible: p1, p3 p3 "allow p1" p1, p2 visible: p1, p2 region B
  31. 31. Example Digraph 2region X "allow p1, p3" p1, p2 "allow p3, p4" p3, p4region Y region Z
  32. 32. Example Digraph 2 region X visible: p1, p3 "allow p1, p3" p1, p2 "allow p3, p4" p3, p4 region Y region Zvisible: p1, p2, p3, p4
  33. 33. Region Digraph• Equinox bundle• Runs on standard framework hooks• Persistent• JMX
  34. 34. Region Digraph Uses user region• Virgo 3.0 kernel/user region p3 s3, s4 b3• Apache Aries “subsystems” "allow s3" "allow p1, s1, b1" prototype (service of p1 type)• Standalone: p1, p2 s1, s2 b1, b2 “Were using [the region digraph] kernel essentially for a fully multi-tenant plugin system to Web applications.” Robert Sauer
  35. 35. Region Digraph in Virgo Demo ...
  36. 36. Region Digraph APIpublic interface RegionDigraph ... { Region createRegion(String regionName) throws BundleException; RegionFilterBuilder createRegionFilterBuilder(); ...}public interface Region { void connectRegion(Region headRegion, RegionFilter filter) throws BundleException; ...}
  37. 37. Region DigraphIssues:• Too low level for application use• Non-standard➡ Standard, high-level programming model
  38. 38. Subsystems
  39. 39. Why Subsystems?5 projects have multi-bundle constructs• Poor portability• Inconsistent terminology• Diverse function➡ Standard
  40. 40. Subsystems• OSGi Enterprise Expert Group• Scoping based on composite bundles framework hooks• Public draft available (“RFC 152”)
  41. 41. What is a Subsystem?• Group of constituents with dependencies • Constituents: bundles, subsystems, ... • Dependencies: loosely coupled pre-reqs• Named and versioned• Defined lifecycle
  42. 42. Subsystem ScopingSubsystem type Scoping application contents hidden composite configurable feature none
  43. 43. Example 1 Application Feature
  44. 44. Example 2 Feature A Feature C Feature B
  45. 45. Example 3Application AApplication BComposite C
  46. 46. Scoping and RegionsSubsystem scoping can be• defined in terms of• implemented usinga region digraph
  47. 47. Complex Scoping 1 App3 FeatureQ FeatureR FeatureP CompositeC
  48. 48. Region Digraph Region A3 App3 FeatureQ FeatureR FeatureP App3 FeatureQ FeatureRRegion C CompositeC FeatureP CompositeC
  49. 49. Complex Scoping 2 Root Application A Application B Composite C Composite D Application E
  50. 50. Region Digraph RootApp A Comp D App E Root Application A Application BApp V Comp C Composite C Composite D Application E
  51. 51. Dependencies FeatureXApp1 App2 FeatureY CompositeF
  52. 52. Installing Dependencies Root "accepttransitive" CompositeF App1 App2
  53. 53. Installing Dependencies Root "accepttransitive" CompositeFApp1 App2 FeatureX FeatureY
  54. 54. Region DigraphRegion Region F Region A1 A2 FeatureXApp1 App2 FeatureY CompositeF FeatureX App1 App2 FeatureY CompositeF
  55. 55. ConclusionModularity in Java:• Class, package, JAR, class loader• Modules in Java 8• Larger modules?Modularity in OSGi:• Bundles• Multi-bundle modules• Subsystems
  56. 56. Further Information• Public draft of subsystems (RFC 152) •• Region digraph •• Eclipse Virgo and the region digraph •• Apache Aries use of region digraph •• Multi-module modules and Java 8 •
  57. 57. Thanks to...• Wikipedia image courtesy of• Field of Flowers by Paul Podsiadlo and Elena Shevchenko, courtesy of Argonne National Laboratory