OSGi 4.3 Technical Update:Whats New?BJ Hargrave, IBM
Generics• Framework API feels “old-  fashioned”   • Lack of generics   • Uses of arrays and null     return• Generics have...
-target jsr14• Developed to compile Java 5 code for 1.4 JREs
-target jsr14• Developed to compile Java 5 code for 1.4 JREs• All compilers recognize the    • -source 1.5 -target jsr14 s...
-target jsr14• Developed to compile Java 5 code for 1.4 JREs• All compilers recognize the    • -source 1.5 -target jsr14 s...
-target jsr14• Developed to compile Java 5 code for 1.4 JREs• All compilers recognize the    • -source 1.5 -target jsr14 s...
Framework & ServiceTracker “generified”ServiceReference<S> getServiceReference(Class<S>);Collection<ServiceReference<S>> g...
Type Safe use of ServicesServiceReference lr =context.getServiceReference(LogService.class.getName());LogService log = (Lo...
Type Safe use of ServicesServiceReference[] rs = context.getServiceReferences(EventAdmin.class.getName(), …);becomesCollec...
Type Safe use of ServicesServiceRegistration sr =context.registerService( ConfigurationListener.class.getName(), …)becomes...
Type Safe use of ServicesServiceTracker st = new ServiceTracker(  context, EventListener.class, null);st.open();EventListe...
Capabilities• A capability is a set of attributes in a namespace
Capabilities• A capability is a set of attributes in a namespace• Built-in capabilities   • osgi.wiring.package: Export-Pa...
Capabilities• A capability is a set of attributes in a namespace• Built-in capabilities   • osgi.wiring.package: Export-Pa...
Requirements• A requirement is a filter expression over the attribute set of a capability
Requirements• A requirement is a filter expression over the attribute set of a capability• Built-in requirements   • osgi....
Requirements• A requirement is a filter expression over the attribute set of a capability• Built-in requirements   • osgi....
7,*&4%.F,#"?;%#"7".**),&,(,:%3%*15D;./3"+&,.).31(#)$%/"*4"%#&,(,:%3%*%"+94".*4"%#                     #"?;%#"7".*+,#"+,*%+...
osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and  Bundle-RequiredExecuti...
osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and  Bundle-RequiredExecuti...
osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and  Bundle-RequiredExecuti...
adapt• Replacing Framework services  • Bundle was almost always parameter, not very    OO
adapt• Replacing Framework services   • Bundle was almost always parameter, not very     OO• The Bundle.adapt method adapt...
adapt• Replacing Framework services   • Bundle was almost always parameter, not very     OO• The Bundle.adapt method adapt...
Replacements• PackageAdmin service   Bundle Wiring API  • BundleWiring wiring =    bundle.adapt(BundleWiring.class)       ...
Replacements• PackageAdmin service      Bundle Wiring API   • BundleWiring wiring =     bundle.adapt(BundleWiring.class)• ...
Replacements• PackageAdmin service      Bundle Wiring API   • BundleWiring wiring =     bundle.adapt(BundleWiring.class)• ...
Bundle Wiring API                    Bundle
Bundle Wiring API                    Bundle                    adapt                     Bundle                    Revision
Bundle Wiring API                      Bundle                      adapt          Bundle       Bundle     Bundle        Re...
Bundle Wiring API                      Bundle                      adapt          Bundle       Bundle     Bundle        Re...
Bundle Wiring API                      Bundle                      adapt          Bundle       Bundle     Bundle        Re...
Bundle Wiring API                                  Bundle                      Bundle                                 Revi...
Updating a Bundle       Bundle      Revision                    Bundle                    (host)
Updating a Bundle       Bundle                      Bundle      Revision                    Revision                    Bu...
Updating a Bundle       Bundle       Bundle     Bundle   Bundle         Bundle      Revision      Wiring      Wire    Wiri...
Updating a Bundle                   Current         Bundle              Bundle     Bundle   Bundle         Bundle        R...
Updating a Bundle                     In                    Use         Bundle              Bundle        Revision        ...
Framework Wiring• System Bundle can be  adapted to control framework  wide actions                                 Framewo...
StartLevel API• Bundle Start Level controls  start level information for an  individual bundle                  Bundle    ...
StartLevel API• Bundle Start Level controls  start level information for an  individual bundle                   Bundle   ...
Bytecode Weaving• Very popular in enterprise  applications• Need an OSGi standard way to  allow weaving classes when  load...
Weaving Hook• WeavingHook is passed a  WovenClass object                                          Weaver• WovenClass allow...
Composite Bundles• Remember the session on  Composite Bundles from last  year?
Composite Bundles• Remember the session on  Composite Bundles from last  year?• Or the year before?
Composite Bundles• Remember the session on  Composite Bundles from last  year?• Or the year before?• Well, if you did atte...
Composite Bundles• Remember the session on  Composite Bundles from last  year?• Or the year before?• Well, if you did atte...
Resolver Hook• Replaces nested frameworks and composite bundles proposals• Allows influence over resolver’s decisions   • ...
Resolver Hook• Visitor pattern• Resolver Hook Factory called  to make a Resolver Hook                            Resolver ...
Bundle Hooks• Resolver Hooks alone are not  enough to implement a bundle  scoping solution• Also need to be able to “hide”...
Find Hook and EventHook• Find Hook can hide bundles  from BundleContext  getBundle(long) and  getBundles() methods        ...
BSN/Version Pair• In 4.2, there could only be one  bundle installed with a given  Bundle-SymbolicName and  Bundle-Version ...
Launching Property• Launching framework with the org.osgi.framework.bsnversion property set to multiple   • Will allow the...
Service EventListener Hook• Replaces the Service Event Hook• Allows finer control over event delivery• Hook now has access...
A designer knows he hasachieved perfection notwhen there is nothing left toadd, but when there isnothing left to take away...
Next Releases• Residential 4.3 - Summer 2011    • TR069 support via DMTAdmin enhancements    • Residential DM Tree• Compen...
OSGi 4.3 Technical Update: What's New?
OSGi 4.3 Technical Update: What's New?
Upcoming SlideShare
Loading in...5
×

OSGi 4.3 Technical Update: What's New?

5,673

Published on

The next release of the OSGi specifications are planned for publication at EclipseCon 2011. So what is new? This presentation will provide an overview of the new features in the spec including Java 5 generics for the Framework and ServiceTracker, modern replacement for PackageAdmin and StartLevel, generic capabilities and requirements, resolver hooks, bytecode weaving and many more improvements and new features. The presentation assumes the audience has a basic understanding of OSGi and will focus on the changes in 4.3.

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

No Downloads
Views
Total Views
5,673
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
312
Comments
0
Likes
6
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
  • \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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • OSGi 4.3 Technical Update: What's New?

    1. 1. OSGi 4.3 Technical Update:Whats New?BJ Hargrave, IBM
    2. 2. Generics• Framework API feels “old- fashioned” • Lack of generics • Uses of arrays and null return• Generics have been held back because the embedded world is still still based upon Java 1.4
    3. 3. -target jsr14• Developed to compile Java 5 code for 1.4 JREs
    4. 4. -target jsr14• Developed to compile Java 5 code for 1.4 JREs• All compilers recognize the • -source 1.5 -target jsr14 switches
    5. 5. -target jsr14• Developed to compile Java 5 code for 1.4 JREs• All compilers recognize the • -source 1.5 -target jsr14 switches• Output class format 48 (1.4) • Stores generics in skippable attributes • Avoids Java 5 introduced types/members
    6. 6. -target jsr14• Developed to compile Java 5 code for 1.4 JREs• All compilers recognize the • -source 1.5 -target jsr14 switches• Output class format 48 (1.4) • Stores generics in skippable attributes • Avoids Java 5 introduced types/members• Works like a charm, but … • No annotations • No enums
    7. 7. Framework & ServiceTracker “generified”ServiceReference<S> getServiceReference(Class<S>);Collection<ServiceReference<S>> getServiceReferences( Class<S>, …);ServiceRegistration<S> registerService(Class<S>, …)new ServiceTracker<S,T>(context, Class<S>, null);
    8. 8. Type Safe use of ServicesServiceReference lr =context.getServiceReference(LogService.class.getName());LogService log = (LogService)context.getService(lr);becomesServiceReference<LogService> lr =context.getServiceReference(LogService.class);LogService log = context.getService(lr);
    9. 9. Type Safe use of ServicesServiceReference[] rs = context.getServiceReferences(EventAdmin.class.getName(), …);becomesCollection<ServiceReference<EventAdmin>> rs = context.getServiceReferences(EventAdmin.class, …);There can be some source incompatibilities since using null for the servicetype argument is now ambiguous.
    10. 10. Type Safe use of ServicesServiceRegistration sr =context.registerService( ConfigurationListener.class.getName(), …)becomesServiceRegistration<ConfigurationListener> sr =context.registerService(ConfigurationListener.class, …)
    11. 11. Type Safe use of ServicesServiceTracker st = new ServiceTracker( context, EventListener.class, null);st.open();EventListener el = (EventListener)st.getService();becomesServiceTracker<EventListener,EventListener> st =new ServiceTracker<EventListener,EventListener>( context, EventListener.class, null);st.open();EventListener el = st.getService();
    12. 12. Capabilities• A capability is a set of attributes in a namespace
    13. 13. Capabilities• A capability is a set of attributes in a namespace• Built-in capabilities • osgi.wiring.package: Export-Package • osgi.wiring.bundle: Bundle-SymbolicName • osgi.wiring.host: Bundle-SymbolicName
    14. 14. Capabilities• A capability is a set of attributes in a namespace• Built-in capabilities • osgi.wiring.package: Export-Package • osgi.wiring.bundle: Bundle-SymbolicName • osgi.wiring.host: Bundle-SymbolicName• Generic capabilities: Provide-Capability manifest header
    15. 15. Requirements• A requirement is a filter expression over the attribute set of a capability
    16. 16. Requirements• A requirement is a filter expression over the attribute set of a capability• Built-in requirements • osgi.wiring.package: Import-Package • osgi.wiring.bundle: Require-Bundle • osgi.wiring.host: Fragment-Host
    17. 17. Requirements• A requirement is a filter expression over the attribute set of a capability• Built-in requirements • osgi.wiring.package: Import-Package • osgi.wiring.bundle: Require-Bundle • osgi.wiring.host: Fragment-Host• Generic requirements: Require-Capability manifest header
    18. 18. 7,*&4%.F,#"?;%#"7".**),&,(,:%3%*15D;./3"+&,.).31(#)$%/"*4"%#&,(,:%3%*%"+94".*4"%# #"?;%#"7".*+,#"+,*%+-%"/2*4,*%+2#"?;%#"7".*+,#"*#,.+%*%$"5 G4"H"?;%#"@E,(,:%3%*1,./I#)$%/"@E,(,:%3%*14",/"#+,#"7,.%-"+*4",/"#+*4,*&-0"(&F"."#%& #"?;%#"7".*+,./&,(,:%3%*%"+%.,.1.,7"+(,&"5J)9"$"#2,.;7:"#)-7,.%-"+*4",/"#+%.*4" C!K%+("&%-%&,*%).+,#",&*;,331#"?;%#"7".*+).&,(,:%3%*%"++("&%-%"/:1)*4"#C!K%7,.%-"+*4",/@ Capabilities and Requirements "#+5=)#"<,7(3"2,.67()#*@I,&0,F"&3,;+"%+,#"?;%#"7".*).*4"&,(,:%3%*1+("&%-%"/:1*4"L<()#*@ I,&0,F"&3,;+"5G4%++("&%-%&,*%).*4"#"-)#"&).*,%.+,.;7:"#)-.,7"+(,&"+-)#*4"+"C!K%7,.%@ -"+*4",/"#+M+1&$23$#$%&245%6,-2+1&$23$#$%&278.98&-2,./+1&$23$#$%&2:+1"5G4"+".,7"+(,&"+ %.-3;".&"*4"#"+)3$"#,.//"-%."*4"&3,++3),/%.F(#)&"++5=)#"<,7(3"2,H"?;%#"@D;./3"&3,;+"%+, • Additional resolver constraint #"?;%#"7".**4,*".+;#"+*4,**4""<()#*"/(,&0,F"+)-*4"#"?;%#"/:;./3",#",$,%3,:3"*)*4" #"?;%#"#N+&3,++3),/"#5 H"?;%#"7".*+,./E,(,:%3%*%"+,#"&-0"(&%.,:;./3"5G4"C!K%-#,7"9)#0&,.*4".7,*&4*4" #"?;%#"7".*+*)&,(,:%3%*%"+)-)*4"#:;./3"+%.*4"(&!304$,5(4,+"5>:;./3"&,.).31#;.94".%*%+ • Each non-optional requirement must be satisfied by a capability #"+)3$"/,./*4"#"-)#"%*+/"("./".&%"+,#"+,*%+-%"/5G4"#"+)3$"#&#",*"+6$(&!:"*9"".*4"#"?;%#"@ 7".*+,./&,(,:%3%*%"+O*4"/"&3,#%.F:;./3"%+.)*,39,1+*4"+,7",+*4"4)+*%.F:;./3"5G4"#"+)3$@ %.F(#)&"++%+/"+&#%:"/%.7&!304$,518(3-&!!).(,F" PQ5G4"/%,F#,77%.F*"&4.%?;")-*4" • Visible in the wiring of the bundles H"?;%#"7".*RE,(,:%3%*17)/"3%+/"(%&*"/%.=%F;#"S5T2*4"/"*,%3+)-*4"9%#%.F,#"-;#*4"# "<(3,%."/%.9*,0&1:$($,51;8<1=.&-$%$-"#$3,).(,F" QSU5>$5*(&1?@A 7&)*$(&+&,#!1",1B"."/$0$#$&!1",1#C&$(1:$($,5 <-=5$#->-%" *8784$,$"; A5%6,- <-=5$#->-%"?*8784$,$"; :+1" @#8&>-%" <5%"$>-!"!"+ ,-./%0$12*$13.*$
    19. 19. osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and Bundle-RequiredExecutionEnvironment
    20. 20. osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and Bundle-RequiredExecutionEnvironment• Provide-Capability: osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.2,1.3,1.4,1.5,1.6"
    21. 21. osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and Bundle-RequiredExecutionEnvironment• Provide-Capability: osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.2,1.3,1.4,1.5,1.6"• Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE) (version>=1.6))"
    22. 22. adapt• Replacing Framework services • Bundle was almost always parameter, not very OO
    23. 23. adapt• Replacing Framework services • Bundle was almost always parameter, not very OO• The Bundle.adapt method adapts a Bundle object to another type (if supported) • <A> A adapt( Class<A> type ) <A>
    24. 24. adapt• Replacing Framework services • Bundle was almost always parameter, not very OO• The Bundle.adapt method adapts a Bundle object to another type (if supported) • <A> A adapt( Class<A> type ) <A>• Returned objects match the life cycle of the adapted bundle.
    25. 25. Replacements• PackageAdmin service Bundle Wiring API • BundleWiring wiring = bundle.adapt(BundleWiring.class) <A>
    26. 26. Replacements• PackageAdmin service Bundle Wiring API • BundleWiring wiring = bundle.adapt(BundleWiring.class)• StartLevel service Start Level API • BundleStartLevel bsl = <A> bundle.adapt(BundleStartLevel.class)
    27. 27. Replacements• PackageAdmin service Bundle Wiring API • BundleWiring wiring = bundle.adapt(BundleWiring.class)• StartLevel service Start Level API • BundleStartLevel bsl = <A> bundle.adapt(BundleStartLevel.class)• PackageAdmin and StartLevel are not in Core 4.3 spec but frameworks will still implement them
    28. 28. Bundle Wiring API Bundle
    29. 29. Bundle Wiring API Bundle adapt Bundle Revision
    30. 30. Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability
    31. 31. Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring
    32. 32. Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring Bundle Wire
    33. 33. Bundle Wiring API Bundle Bundle Revisions adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring Bundle Wire
    34. 34. Updating a Bundle Bundle Revision Bundle (host)
    35. 35. Updating a Bundle Bundle Bundle Revision Revision Bundle Bundle (host) (fragment)
    36. 36. Updating a Bundle Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle (host) (fragment)
    37. 37. Updating a Bundle Current Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle Bundle Revisions (host) (fragment)
    38. 38. Updating a Bundle In Use Bundle Bundle Revision Wiring Bundle Wire Current Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle Bundle Revisions (host) (fragment)
    39. 39. Framework Wiring• System Bundle can be adapted to control framework wide actions Framework • refresh Wiring • resolve adapt System • dependency closure Bundle
    40. 40. StartLevel API• Bundle Start Level controls start level information for an individual bundle Bundle Start Level • get/set bundle start level adapt Bundle
    41. 41. StartLevel API• Bundle Start Level controls start level information for an individual bundle Bundle Framework Start Level Start Level • get/set bundle start level adapt adapt• Framework Start Level System controls framework wide start Bundle Bundle level information • get/set framework start level • get/set initial bundle start
    42. 42. Bytecode Weaving• Very popular in enterprise applications• Need an OSGi standard way to allow weaving classes when loading• Introducing the WeavingHook service
    43. 43. Weaving Hook• WeavingHook is passed a WovenClass object Weaver• WovenClass allows weaver to • Mutate class file bytes Weaving Hooks Woven Class • Add dynamic package import Framework• Weaving Hooks called in ranking order
    44. 44. Composite Bundles• Remember the session on Composite Bundles from last year?
    45. 45. Composite Bundles• Remember the session on Composite Bundles from last year?• Or the year before?
    46. 46. Composite Bundles• Remember the session on Composite Bundles from last year?• Or the year before?• Well, if you did attend those sessions, you can forget what you heard
    47. 47. Composite Bundles• Remember the session on Composite Bundles from last year?• Or the year before?• Well, if you did attend those sessions, you can forget what you heard• Replaced by Resolver Hooks
    48. 48. Resolver Hook• Replaces nested frameworks and composite bundles proposals• Allows influence over resolver’s decisions • Hook can prevent a requirement from matching a capability• Primary use case is scoping groups of bundles • But can be used for other purposes• Provide primitives to build different scoping models
    49. 49. Resolver Hook• Visitor pattern• Resolver Hook Factory called to make a Resolver Hook Resolver Hook Impl • Resolver Hook used for one resolve operation Resolver Resolver Hook Factory Hook• Resolver Hook removes candidates to constrain the resolve solution Framework• Resolver Hooks called in ranking order
    50. 50. Bundle Hooks• Resolver Hooks alone are not enough to implement a bundle scoping solution• Also need to be able to “hide” bundles outside a group from bundles “inside” a group• Like Service Hooks for services, Bundle Hooks allow this for bundles
    51. 51. Find Hook and EventHook• Find Hook can hide bundles from BundleContext getBundle(long) and getBundles() methods Bundle Hook Impl• Event Hook can hide bundle events from registered Find Hook Event Hook BundleListener and SynchronousBundleListener objects Framework
    52. 52. BSN/Version Pair• In 4.2, there could only be one bundle installed with a given Bundle-SymbolicName and Bundle-Version pair • Implicit singleton• With scoping via Resolver Hooks and Bundle Hooks • We can allow this invariant to be broken
    53. 53. Launching Property• Launching framework with the org.osgi.framework.bsnversion property set to multiple • Will allow the invariant to be broken • Scoping systems will need to properly handle• By default, or with the property set to single, the invariant is held
    54. 54. Service EventListener Hook• Replaces the Service Event Hook• Allows finer control over event delivery• Hook now has access to ListenerInfo for each listener which can receive the service event
    55. 55. A designer knows he hasachieved perfection notwhen there is nothing left toadd, but when there isnothing left to take away.- Antoine de Saint-Exupéry
    56. 56. Next Releases• Residential 4.3 - Summer 2011 • TR069 support via DMTAdmin enhancements • Residential DM Tree• Compendium 4.3 - Fall 2011 • Updates to some Compendium services • Some new Compendium Services• Enterprise 4.3 - 2012 • Subsystems • OBR
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×