OSGi 4.3 Technical Update: What's New?
Upcoming SlideShare
Loading in...5
×
 

OSGi 4.3 Technical Update: What's New?

on

  • 5,800 views

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 ...

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.

Statistics

Views

Total Views
5,800
Views on SlideShare
5,311
Embed Views
489

Actions

Likes
6
Downloads
307
Comments
0

8 Embeds 489

http://www.eclipsecon.org 459
http://eclipsecon.org 21
http://www.linkedin.com 3
http://twitter.com 2
http://static.slidesharecdn.com 1
http://translate.googleusercontent.com 1
https://www.eclipsecon.org 1
https://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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? OSGi 4.3 Technical Update: What's New? Presentation Transcript

  • 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 been held back because the embedded world is still still based upon Java 1.4
  • -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 switches
  • -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
  • -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
  • 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);
  • 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);
  • 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.
  • Type Safe use of ServicesServiceRegistration sr =context.registerService( ConfigurationListener.class.getName(), …)becomesServiceRegistration<ConfigurationListener> sr =context.registerService(ConfigurationListener.class, …)
  • 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();
  • 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-Package • osgi.wiring.bundle: Bundle-SymbolicName • osgi.wiring.host: Bundle-SymbolicName
  • 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
  • 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.wiring.package: Import-Package • osgi.wiring.bundle: Require-Bundle • osgi.wiring.host: Fragment-Host
  • 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
  • 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.*$
  • osgi.ee Capabilities and Requirements• Replacement for org.osgi.framework.executionenvironment and Bundle-RequiredExecutionEnvironment
  • 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"
  • 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))"
  • 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 adapts a Bundle object to another type (if supported) • <A> A adapt( Class<A> type ) <A>
  • 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.
  • Replacements• PackageAdmin service Bundle Wiring API • BundleWiring wiring = bundle.adapt(BundleWiring.class) <A>
  • Replacements• PackageAdmin service Bundle Wiring API • BundleWiring wiring = bundle.adapt(BundleWiring.class)• StartLevel service Start Level API • BundleStartLevel bsl = <A> bundle.adapt(BundleStartLevel.class)
  • 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
  • Bundle Wiring API Bundle
  • Bundle Wiring API Bundle adapt Bundle Revision
  • Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability
  • Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring
  • Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring Bundle Wire
  • Bundle Wiring API Bundle Bundle Revisions adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring Bundle Wire
  • Updating a Bundle Bundle Revision Bundle (host)
  • Updating a Bundle Bundle Bundle Revision Revision Bundle Bundle (host) (fragment)
  • Updating a Bundle Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle (host) (fragment)
  • Updating a Bundle Current Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle Bundle Revisions (host) (fragment)
  • 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)
  • Framework Wiring• System Bundle can be adapted to control framework wide actions Framework • refresh Wiring • resolve adapt System • dependency closure Bundle
  • StartLevel API• Bundle Start Level controls start level information for an individual bundle Bundle Start Level • get/set bundle start level adapt Bundle
  • 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
  • Bytecode Weaving• Very popular in enterprise applications• Need an OSGi standard way to allow weaving classes when loading• Introducing the WeavingHook service
  • 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
  • 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 attend those sessions, you can forget what you heard
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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