EclipseCon 2010


                 Isolating Applications in a
                 Collaborative OSGi World
                 ...
Warning!


                                     Not for the faint of heart!
                                          Lots...
OSGi R4.2 Review
   ●    New Enterprise Specifications
          –    Remote Services
          –    Blueprint
   ●    And...
Forget the High-Level Stuff!
   ●    R4.2 Core framework changes
          –    Service registry hooks
          –    Secu...
What can we expect from R4.3 Core?
   ●    Still early in the process
   ●    Early access to draft RFCs
          ●    OS...
What can we expect from R4.3 Core?
   ●    Still early in the process
   ●    Early access to draft RFCs
          ●    OS...
Standard Launching & Embedding




© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
Framework Implementations
   ●    Bundles are portable
   ●    What about the framework?
          –    Launching and conf...
Standard Launching & Embedding
   ●    Seems like a slam dunk
   ●    What does it give us?
          –    A standard way ...
Standard Launching & Embedding
   ●    Seems like a slam dunk
   ●    What does it give us?
          –    A standard way ...
Standard Interfaces


                   public interface FrameworkFactory {
                     Framework newFramework(M...
Standard Interfaces


                   public interface FrameworkFactory {
                     Framework newFramework(M...
Standard Configuration Properties
   ●    org.osgi.framework.bootdelegation
   ●    org.osgi.framework.system.packages
   ...
Out Of Scope
   ●    Multiple framework instances
          –    e.g., no support for sharing/collaboration among
        ...
Multiple Instances
   ●    Pose interesting challenges
   ●    Promise potentially interesting capabilities
   ●    This u...
Composite Bundles




© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
Framework Limitations
   ●    Applications are either all bundles collaborating
        or an individual bundle
          ...
Framework Limitations




                                                                                  Where is the
 ...
Framework Limitations


                                                                                           A3



 ...
Framework Limitations


                                                                                          A3



  ...
Framework Limitations


                                                                                          A3



  ...
Framework Limitations


                                                                                          A3



  ...
Framework Limitations


                                                                                           A3



 ...
Framework Limitations


                                                                                           A3



 ...
Framework Limitations


                                                                                          A3



  ...
Framework Limitations


                                                                                          A3



  ...
Framework Limitations


                                                                                            A3



...
Framework Limitations


                                                                                           A3



 ...
Implementing Composites




© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
Composites are composed of
              bundles with resolved states




© 2010 by IBM Corp.; Licensed under the Creative...
Importing and Exporting Packages

                                                                 Export

               ...
Importing and Exporting Packages

                                                                 Import

               ...
Importing and Exporting Packages

                                                               Resolve
                 ...
Composites are composed of
          bundles that publish and bind to
                     services




© 2010 by IBM Corp...
Publish and Consume Services

                                                                Publish

                   ...
Publish and Consume Services

                                                                  Bind

                    ...
This looks very similar to a
                            Framework!




© 2010 by IBM Corp.; Licensed under the Creative C...
Implementing Composites


                                                                                             A3
...
Implementing Composites
        How are
     imports, exports
       and services
        handled?                        ...
Defining a Sharing Policy




© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
Implementing Composites
       To the outside
      this looks like a
       normal bundle                                ...
Implementing Composites
  A representation is
 needed inside for the
   exports, imports                                  ...
Implementing Composites

  A surrogate bundle can
provide this representation                                             ...
Implementing Composites

 The surrogate imports
  packages exported
   by the composite
                                  ...
Implementing Composites

                                                                                          A3
The ...
Implementing Composites

                                                                                          A3

   ...
Implementing Composites

                                                                                          A3




...
Implementing Composites
   ●    Issues with modeling composites as real
        bundles with nested frameworks




© 2010 ...
Implementing Composites
   ●    Issues with modeling composites as real
        bundles with nested frameworks
          ●...
Implementing Composites

                                                                                          A3

   ...
Implementing Composites

                                                                                          A3

   ...
Implementing Composites


                                                                                         But C i...
Implementing Composites
   ●    Issues with modeling composites as real
        bundles with nested frameworks
          ●...
Implementing Composites
   ●    Issues with modeling composites as real
        bundles with nested frameworks
          ●...
Implementing Composites
       Composite and
       Surrogate must
       proxy all shared                                ...
Implementing Composites
       Difficulties with
      proxying service
     factories. No way
        to guarantee       ...
Implementing Composites

                                                                                                 ...
Transparent Sharing Policy




© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
Virtualizing Framework Isolation
   ●    Model isolation in a single framework instance




© 2010 by IBM Corp.; Licensed ...
Virtualizing Framework Isolation
   ●    Model isolation in a single framework instance
          ●    Each composite has ...
Virtualizing Framework Isolation
   ●    Model isolation in a single framework instance
          ●    Each composite has ...
Implementing Composites
      A Sharing Policy
         controls the
     visibility of shared                            ...
Implementing Composites
        What is visible
       from the point of
       view of a bundle                          ...
Implementing Composites

       What is visible
      from the point of                                                   ...
Virtualizing Framework Isolation
   ●    Model isolation in a single framework instance
          ●    Each composite has ...
Virtualizing Framework Isolation
   ●    Model isolation in a single framework instance
          ●    Each composite has ...
Installing a Composite


                                                                        Configure?




© 2010 by ...
Installing a Composite


                                                                        Configure?




          ...
Installing a Composite


                                                                        Configure?




          ...
Configure

          String location = “myComposite; composite=true”;
          Map config = HashMap();
          config.p...
Configure

          String location = “myComposite; composite=true”;
          Map config = HashMap();
          config.p...
Configure

          String location = “myComposite; composite=true”;
          Map config = HashMap();
                  ...
Configure

          String location = “myComposite; composite=true”;
          Map config = HashMap();
          config.p...
Configure

          String location = “myComposite; composite=true”;
          Map config = HashMap();
          config.p...
Configure

          String location = “myComposite; composite=true”;
          Map config = HashMap();
          config.p...
Installing a Composite

                                                        String location = “myComposite”;
         ...
Installing a Composite

                                                        String location = “myComposite”;
         ...
Installing a Composite

                                                        String location = “myComposite”;
         ...
Empty Installed Composite


Sharing Policy




                                                  Composite Bundle: myCompo...
Managing a Composite


                                         Access?




© 2010 by IBM Corp.; Licensed under the Creati...
Managing a Composite


                                         Access?                                  Install?




© 20...
Managing a Composite


                                         Access?                                  Install?




    ...
Managing a Composite


BundleContext ctxt =
 comp.getSystemBundleContext();                                               ...
Managing a Composite
                                                                           Bundle a =
               ...
Managing a Composite
                                                                           Bundle a =
               ...
Resolved Composite

    Sharing Policy



                Import
                  b
                                     ...
Active Composite

    Sharing Policy



                                                                                  ...
Demo




© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
Isolating SWT and e4 applications

                                              e4                               e4      ...
Isolating SWT and e4 applications

                                              e4                               e4      ...
Isolating SWT and e4 applications

                                              e4                               e4      ...
Benefits of Composites
   ●    Composite Bundles are persistent
          –    Content of composite is reified when the pa...
Benefits of Composites
   ●    Composite Bundles are persistent
          –    Content of composite is reified when the pa...
Benefits of Composites
   ●    Composite Bundles are persistent
          –    Content of composite is reified when the pa...
Difficulties with Composites
   ●    Low-level API for installing content into
        composites
          –    Equivalen...
Difficulties with Composites
   ●    Low-level API for installing content into
        composites
          –    Equivalen...
Difficulties with Composites
   ●    Low-level API for installing content into
        composites
          –    Equivalen...
Difficulties with Composites
   ●    Low-level API for installing content into
        composites
          –    Equivalen...
Conclusion
   ●    OSGi R4.3 is shaping up to be a big release
          –    Still early, but some interesting things are...
Legal Notices
   ●    Java and all Java-based trademarks are
        trademarks of Sun Microsystems, Inc. in the
        U...
Upcoming SlideShare
Loading in …5
×

Eclipse Con2010 Composites

2,469 views

Published on

A presentation on OSGi Composite Bundles.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,469
On SlideShare
0
From Embeds
0
Number of Embeds
1,294
Actions
Shares
0
Downloads
44
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Eclipse Con2010 Composites

  1. 1. EclipseCon 2010 Isolating Applications in a Collaborative OSGi World Composite Bundles Thomas Watson © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  2. 2. Warning! Not for the faint of heart! Lots of details. No fancy slides. (What would you expect from a framework implementer?) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  3. 3. OSGi R4.2 Review ● New Enterprise Specifications – Remote Services – Blueprint ● And more on the way ... – Remote Services Admin – JTA, JMX, JDBC, JNDI, JPA – Web Applications – etc. © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  4. 4. Forget the High-Level Stuff! ● R4.2 Core framework changes – Service registry hooks – Security enhancements ● Ordered conditions ● Fine-grained service and package permissions based on identity of the provider – Bundle tracker – Standard launching and embedding – Composite bundles (provisional spec.) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  5. 5. What can we expect from R4.3 Core? ● Still early in the process ● Early access to draft RFCs ● OSGi API update (RFC 151) – Use of generics and adaptor patterns ● Composite Bundles (RFC 138) – Much has changed since the R4.2 provisional spec. ● Generic capabilities and requirements (RFC 154) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  6. 6. What can we expect from R4.3 Core? ● Still early in the process ● Early access to draft RFCs ● OSGi API update (RFC 151) – Use of generics and adaptor patterns ● Composite Bundles (RFC 138) – Much has changed since the R4.2 provisional spec. ● Generic capabilities and requirements (RFC 154) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  7. 7. Standard Launching & Embedding © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  8. 8. Framework Implementations ● Bundles are portable ● What about the framework? – Launching and configuring – Controlling its life cycle – Externally interacting with bundles, services, and state © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  9. 9. Standard Launching & Embedding ● Seems like a slam dunk ● What does it give us? – A standard way to create framework instances – A standard API for controlling and interacting with framework instances ● What does this help? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  10. 10. Standard Launching & Embedding ● Seems like a slam dunk ● What does it give us? – A standard way to create framework instances – A standard API for controlling and interacting with framework instances ● What does this help? – Portable scripts and launchers © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  11. 11. Standard Interfaces public interface FrameworkFactory { Framework newFramework(Map config); } © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  12. 12. Standard Interfaces public interface FrameworkFactory { Framework newFramework(Map config); } public interface Framework extends Bundle { void init() throws BundleException; FrameworkEvent waitForStop(long timeout) throws InterruptedException; } © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  13. 13. Standard Configuration Properties ● org.osgi.framework.bootdelegation ● org.osgi.framework.system.packages ● org.osgi.framework.system.packages.extra ● org.osgi.framework.startlevel.beginning ● org.osgi.framework.storage ● org.osgi.framework.storage.clean ● And others... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  14. 14. Out Of Scope ● Multiple framework instances – e.g., no support for sharing/collaboration among instances or multiplexing of VM singletons – May or may not work, but implementation dependent © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  15. 15. Multiple Instances ● Pose interesting challenges ● Promise potentially interesting capabilities ● This use case uncovers potential framework issues © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  16. 16. Composite Bundles © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  17. 17. Framework Limitations ● Applications are either all bundles collaborating or an individual bundle ● All global or completely local ● No application/subsystem concept ● Isolation/protection (bundles, services, packages) ● Visibility (bundles, services, packages) ● Grouping (lifecycle) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  18. 18. Framework Limitations Where is the Framework application? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  19. 19. Framework Limitations A3 A2 A1 Assume these belong to an Framework application © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  20. 20. Framework Limitations A3 A2 A1 What if they are Framework subsystems? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  21. 21. Framework Limitations A3 A2 A1 Maybe they want private Framework packages © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  22. 22. Framework Limitations A3 A2 A1 And private Framework services © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  23. 23. Framework Limitations A3 A2 A1 Need subsystem Framework encapsulation © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  24. 24. Framework Limitations A3 A2 A1 Private details Framework are hidden © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  25. 25. Framework Limitations A3 A2 A1 Public packages Framework are exposed © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  26. 26. Framework Limitations A3 A2 A1 External packages Framework are imported © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  27. 27. Framework Limitations A3 A2 A1 Public services Framework are exposed © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  28. 28. Framework Limitations A3 A2 A1 This blob is a composite Framework bundle © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  29. 29. Implementing Composites © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  30. 30. Composites are composed of bundles with resolved states © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  31. 31. Importing and Exporting Packages Export export org.foo.c C A B export org.foo.b Composite Bundle © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  32. 32. Importing and Exporting Packages Import export org.foo.c C A B import org.foo.b export import org.foo.b org.foo.c Composite Bundle © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  33. 33. Importing and Exporting Packages Resolve export org.foo.c C A B import org.foo.b export import org.foo.b org.foo.c Composite Bundle © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  34. 34. Composites are composed of bundles that publish and bind to services © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  35. 35. Publish and Consume Services Publish org.foo.c.CService C org.foo.b.BService A B Composite Bundle © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  36. 36. Publish and Consume Services Bind org.foo.c.CService C org.foo.b.BService A B Composite Bundle © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  37. 37. This looks very similar to a Framework! © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  38. 38. Implementing Composites A3 A2 A1 Can this blob be a nested Framework framework? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  39. 39. Implementing Composites How are imports, exports and services handled? A3 A2 A1 Nested Framework Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  40. 40. Defining a Sharing Policy © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  41. 41. Implementing Composites To the outside this looks like a normal bundle A3 A2 C A1 Bundle Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  42. 42. Implementing Composites A representation is needed inside for the exports, imports A3 and services A2 C A1 Nested Framework Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  43. 43. Implementing Composites A surrogate bundle can provide this representation A3 Surrogate Bundle A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  44. 44. Implementing Composites The surrogate imports packages exported by the composite A3 Surrogate Bundle A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  45. 45. Implementing Composites A3 The surrogate exports packages imported Surrogate Bundle by the composite A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  46. 46. Implementing Composites A3 The surrogate consumes Surrogate Bundle services published outside by the composite A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  47. 47. Implementing Composites A3 Surrogate Bundle The surrogate registers services A2 consumed by the composite from C the outside A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  48. 48. Implementing Composites ● Issues with modeling composites as real bundles with nested frameworks © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  49. 49. Implementing Composites ● Issues with modeling composites as real bundles with nested frameworks ● Sharing everything through a surrogate creates lifecycle issues © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  50. 50. Implementing Composites A3 What happens if Surrogate Bundle the composite is stopped – the A2 composite framework is C shutdown A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  51. 51. Implementing Composites A3 What happens if Surrogate Bundle the composite is stopped – the A2 composite framework is C shutdown A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  52. 52. Implementing Composites But C is still A3 resolved and expecting to be able to load Surrogate Bundle classes from the exported package A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  53. 53. Implementing Composites ● Issues with modeling composites as real bundles with nested frameworks ● Sharing everything through a surrogate creates lifecycle issues © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  54. 54. Implementing Composites ● Issues with modeling composites as real bundles with nested frameworks ● Sharing everything through a surrogate creates lifecycle issues ● Consumers and Providers loose their identity to the composite and surrogate – No support for Require-Bundle – ServiceFactory support is limited – Introspecting system dependencies is combersome. © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  55. 55. Implementing Composites Composite and Surrogate must proxy all shared A3 resources Surrogate Bundle A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  56. 56. Implementing Composites Difficulties with proxying service factories. No way to guarantee A3 unique locations or bundle IDs Surrogate Bundle A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  57. 57. Implementing Composites A3 Surrogate Bundle A2 C Exports loose the identity of their A1 exporting symbolic name. Require- Composite not Bundle is possible Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  58. 58. Transparent Sharing Policy © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  59. 59. Virtualizing Framework Isolation ● Model isolation in a single framework instance © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  60. 60. Virtualizing Framework Isolation ● Model isolation in a single framework instance ● Each composite has a virtual framework that hides outside bundles, services, and packages. © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  61. 61. Virtualizing Framework Isolation ● Model isolation in a single framework instance ● Each composite has a virtual framework that hides outside bundles, services, and packages. ● A sharing policy can be declared – What is visible to the inside from the outside (imported) – What is visible to the outside from the inside (exported) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  62. 62. Implementing Composites A Sharing Policy controls the visibility of shared A3 resources A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  63. 63. Implementing Composites What is visible from the point of view of a bundle A3 in a composite A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  64. 64. Implementing Composites What is visible from the point of A3 view of a bundle in the parent A2 C A1 Composite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  65. 65. Virtualizing Framework Isolation ● Model isolation in a single framework instance ● Each composite has a virtual framework that hides outside bundles, services, and packages. ● A sharing policy can be declared – What is visible to the inside from the outside (imported) – What is visible to the outside from the inside (exported) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  66. 66. Virtualizing Framework Isolation ● Model isolation in a single framework instance ● Each composite has a virtual framework that hides outside bundles, services, and packages. ● A sharing policy can be declared – What is visible to the inside from the outside (imported) – What is visible to the outside from the inside (exported) ● Enforce rules to ensure unique bundle identification ● All bundle locations and bundle IDs must be unique ● Important for supporting shared service factories © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  67. 67. Installing a Composite Configure? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  68. 68. Installing a Composite Configure? Create? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  69. 69. Installing a Composite Configure? Reference? Create? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  70. 70. Configure String location = “myComposite; composite=true”; Map config = HashMap(); config.put(“...startlevel.beginning”, “25”); Map manifest = HashMap(); manifest.put(“Bundle-SymbolicName”, location); manifest.put(“Composite-PackageExportPolicy”, “b”); manifest.put(“Composite-PackageImportPolicy”, “c”); manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”); manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  71. 71. Configure String location = “myComposite; composite=true”; Map config = HashMap(); config.put(“...startlevel.beginning”, “25”); Map manifest = HashMap(); manifest.put(“Bundle-SymbolicName”, location); manifest.put(“Composite-PackageExportPolicy”, “b”); manifest.put(“Composite-PackageImportPolicy”, “c”); manifest.put(“Composite-ServiceImportPolicy”, Framework launching configuration “(objectClass=c.CService)”); manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  72. 72. Configure String location = “myComposite; composite=true”; Map config = HashMap(); Specify the package export policy config.put(“...startlevel.beginning”, “25”); Map manifest = HashMap(); manifest.put(“Bundle-SymbolicName”, location); manifest.put(“Composite-PackageExportPolicy”, “b”); manifest.put(“Composite-PackageImportPolicy”, “c”); manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”); manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  73. 73. Configure String location = “myComposite; composite=true”; Map config = HashMap(); config.put(“...startlevel.beginning”, “25”); Specify the package import policy Map manifest = HashMap(); manifest.put(“Bundle-SymbolicName”, location); manifest.put(“Composite-PackageExportPolicy”, “b”); manifest.put(“Composite-PackageImportPolicy”, “c”); manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”); manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  74. 74. Configure String location = “myComposite; composite=true”; Map config = HashMap(); config.put(“...startlevel.beginning”, “25”); Map manifest = HashMap(); manifest.put(“Bundle-SymbolicName”, location); service import policy Specify the manifest.put(“Composite-PackageExportPolicy”, “b”); manifest.put(“Composite-PackageImportPolicy”, “c”); manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”); manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  75. 75. Configure String location = “myComposite; composite=true”; Map config = HashMap(); config.put(“...startlevel.beginning”, “25”); Map manifest = HashMap(); manifest.put(“Bundle-SymbolicName”, location); manifest.put(“Composite-PackageExportPolicy”, “b”); manifest.put(“Composite-PackageImportPolicy”, service filters to publish Specify “c”); manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”); manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  76. 76. Installing a Composite String location = “myComposite”; Map config = HashMap(); Map manifest = HashMap(); ... Reference? Create? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  77. 77. Installing a Composite String location = “myComposite”; Map config = HashMap(); Map manifest = HashMap(); ... Obtained from the service registry. Reference? CompositeAdmin. installCompositeBundle( location, manifest, config); © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  78. 78. Installing a Composite String location = “myComposite”; Map config = HashMap(); Map manifest = HashMap(); ... CompositeBundle extends Bundle CompositeBundle comp CompositeAdmin. installCompositeBundle( location, manifest, config); © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  79. 79. Empty Installed Composite Sharing Policy Composite Bundle: myComposite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  80. 80. Managing a Composite Access? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  81. 81. Managing a Composite Access? Install? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  82. 82. Managing a Composite Access? Install? Start? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  83. 83. Managing a Composite BundleContext ctxt = comp.getSystemBundleContext(); Install? ... Start? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  84. 84. Managing a Composite Bundle a = ctxt.installBundle( “file:a.jar”); BundleContext ctxt = Bundle b = comp.getSystemBundleContext(); ctxt.installBundle( ... “file:b.jar”); ... Start? © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  85. 85. Managing a Composite Bundle a = ctxt.installBundle( “file:a.jar”); BundleContext ctxt = Bundle b = comp.getSystemBundleContext(); ctxt.installBundle( ... “file:b.jar”); ... a.start(); b.start(); comp.start(); ... © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  86. 86. Resolved Composite Sharing Policy Import b export b B C export Import A c c Composite Bundle: myComposite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  87. 87. Active Composite Sharing Policy b.BService B C A c.CService Composite Bundle: myComposite Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  88. 88. Demo © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  89. 89. Isolating SWT and e4 applications e4 e4 App Photo Contacts Console Demo Demo Web UI Each Composite contains their own stack of bundles which are isolated from each other SWT Root Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  90. 90. Isolating SWT and e4 applications e4 e4 App Photo Contacts Console Demo Demo Web UI SWT is installed in the root framework and shared with the composites which require SWT SWT Root Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  91. 91. Isolating SWT and e4 applications e4 e4 App Photo Contacts Console Demo Demo Web UI Application Descriptor and Handle services are shared with the Web UI SWT Root Framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  92. 92. Benefits of Composites ● Composite Bundles are persistent – Content of composite is reified when the parent framework restarts – Like a normal bundle, the active state is persisted © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  93. 93. Benefits of Composites ● Composite Bundles are persistent – Content of composite is reified when the parent framework restarts – Like a normal bundle, the active state is persisted ● Bundles can be grouped together into one executable unit – Stopping a composite stops all constituent bundles – Starting a composite starts the constituent bundles (which are marked for start) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  94. 94. Benefits of Composites ● Composite Bundles are persistent – Content of composite is reified when the parent framework restarts – Like a normal bundle, the active state is persisted ● Bundles can be grouped together into one executable unit – Stopping a composite stops all constituent bundles – Starting a composite starts the constituent bundles (which are marked for start) ● High level of isolation – Strict control over what is imported to and exported from the composite. – Sharing is fine grained and transparent © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  95. 95. Difficulties with Composites ● Low-level API for installing content into composites – Equivalent to managing a complete framework © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  96. 96. Difficulties with Composites ● Low-level API for installing content into composites – Equivalent to managing a complete framework ● Limitations for sharing resources – Extenders do not understand composites (DS, Spring, Blueprint, Extension Registry, iPOJO) © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  97. 97. Difficulties with Composites ● Low-level API for installing content into composites – Equivalent to managing a complete framework ● Limitations for sharing resources – Extenders do not understand composites (DS, Spring, Blueprint, Extension Registry, iPOJO) – Transparent sharing policy ● Simplifies most things © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  98. 98. Difficulties with Composites ● Low-level API for installing content into composites – Equivalent to managing a complete framework ● Limitations for sharing resources – Extenders do not understand composites (DS, Spring, Blueprint, Extension Registry, iPOJO) – Transparent sharing policy ● Simplifies most things ● But violates academic notion of a composite © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  99. 99. Conclusion ● OSGi R4.3 is shaping up to be a big release – Still early, but some interesting things are far along – OSGi API Updates – Composite Bundles ● Composite Bundles – A powerful way to establish application isolation – Provides a basis for defining subsystems © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license
  100. 100. Legal Notices ● Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both ● Other company, product, or service names may be trademarks or service marks of others © 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

×