OSGi 4.3 Technical Update:
What's 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 Services

ServiceReference lr =
context.getServiceReference(LogService.class.getName());
LogService log = (LogService)context.getService(lr);


becomes


ServiceReference<LogService> lr =
context.getServiceReference(LogService.class);
LogService log = context.getService(lr);
Type Safe use of Services

ServiceReference[] rs =
 context.getServiceReferences(EventAdmin.class.getName(),
 …);


becomes


Collection<ServiceReference<EventAdmin>> rs =
 context.getServiceReferences(EventAdmin.class, …);


There can be some source incompatibilities since using null for the service
type argument is now ambiguous.
Type Safe use of Services

ServiceRegistration sr =
context.registerService(
 ConfigurationListener.class.getName(), …)


becomes


ServiceRegistration<ConfigurationListener> sr =
context.registerService(ConfigurationListener.class, …)
Type Safe use of Services

ServiceTracker st = new ServiceTracker(
  context, EventListener.class, null);
st.open();
EventListener el = (EventListener)st.getService();


becomes


ServiceTracker<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%*15'D;./3"+'&,.').31'(#)$%/"'*4"%#'&,(,:%3%*%"+'94".'*4"%#'
                     #"?;%#"7".*+',#"'+,*%+-%"/2'*4,*'%+2'#"?;%#"7".*+',#"'*#,.+%*%$"5'
             G4"'H"?;%#"@E,(,:%3%*1',./'I#)$%/"@E,(,:%3%*1'4",/"#+',#"'7,.%-"+*'4",/"#+'*4,*''&-0"(&'F"."#%&'
             #"?;%#"7".*+',./'&,(,:%3%*%"+'%.',.1'.,7"'+(,&"5'J)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,;+"5'G4%+'+("&%-%&,*%).'*4"#"-)#"'&).*,%.+','.;7:"#')-'.,7"'+(,&"+'-)#'*4"+"'C!K%'7,.%@
             -"+*'4",/"#+M'+1&$23$#$%&245%6,-2'+1&$23$#$%&278.98&-2',./'+1&$23$#$%&2:+1"5'G4"+"'.,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"5'G4"'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"#"-)#"'%*+'/"("./".&%"+',#"'+,*%+-%"/5'G4"'#"+)3$"#'&#",*"+'6$(&!':"*9"".'*4"'#"?;%#"@
               7".*+',./'&,(,:%3%*%"+O'*4"'/"&3,#%.F':;./3"'%+'.)*',39,1+'*4"'+,7"',+'*4"'4)+*%.F':;./3"5'G4"'#"+)3$@
               %.F'(#)&"++'%+'/"+&#%:"/'%.'7&!304$,518(3-&!!').'(,F" PQ5'G4"'/%,F#,77%.F'*"&4.%?;"')-'*4"'
 •   Visible in the wiring of the bundles
               H"?;%#"7".*RE,(,:%3%*1'7)/"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 Event
Hook

• 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 has
achieved perfection not
when there is nothing left to
add, but when there is
nothing 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
OSGi 4.3 Technical Update: What's New?
OSGi 4.3 Technical Update: What's New?

OSGi 4.3 Technical Update: What's New?

  • 1.
    OSGi 4.3 TechnicalUpdate: What's New? BJ Hargrave, IBM
  • 2.
    Generics • Framework APIfeels “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.
    -target jsr14 • Developedto compile Java 5 code for 1.4 JREs
  • 4.
    -target jsr14 • Developedto compile Java 5 code for 1.4 JREs • All compilers recognize the • -source 1.5 -target jsr14 switches
  • 5.
    -target jsr14 • Developedto 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.
    -target jsr14 • Developedto 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.
    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.
    Type Safe useof Services ServiceReference lr = context.getServiceReference(LogService.class.getName()); LogService log = (LogService)context.getService(lr); becomes ServiceReference<LogService> lr = context.getServiceReference(LogService.class); LogService log = context.getService(lr);
  • 9.
    Type Safe useof Services ServiceReference[] rs = context.getServiceReferences(EventAdmin.class.getName(), …); becomes Collection<ServiceReference<EventAdmin>> rs = context.getServiceReferences(EventAdmin.class, …); There can be some source incompatibilities since using null for the service type argument is now ambiguous.
  • 10.
    Type Safe useof Services ServiceRegistration sr = context.registerService( ConfigurationListener.class.getName(), …) becomes ServiceRegistration<ConfigurationListener> sr = context.registerService(ConfigurationListener.class, …)
  • 11.
    Type Safe useof Services ServiceTracker st = new ServiceTracker( context, EventListener.class, null); st.open(); EventListener el = (EventListener)st.getService(); becomes ServiceTracker<EventListener,EventListener> st = new ServiceTracker<EventListener,EventListener>( context, EventListener.class, null); st.open(); EventListener el = st.getService();
  • 12.
    Capabilities • A capabilityis a set of attributes in a namespace
  • 13.
    Capabilities • A capabilityis 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.
    Capabilities • A capabilityis 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.
    Requirements • A requirementis a filter expression over the attribute set of a capability
  • 16.
    Requirements • A requirementis 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.
    Requirements • A requirementis 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.
    7,*&4%.F','#"?;%#"7".*'*)','&,(,:%3%*15'D;./3"+'&,.').31'(#)$%/"'*4"%#'&,(,:%3%*%"+'94".'*4"%#' #"?;%#"7".*+',#"'+,*%+-%"/2'*4,*'%+2'#"?;%#"7".*+',#"'*#,.+%*%$"5' G4"'H"?;%#"@E,(,:%3%*1',./'I#)$%/"@E,(,:%3%*1'4",/"#+',#"'7,.%-"+*'4",/"#+'*4,*''&-0"(&'F"."#%&' #"?;%#"7".*+',./'&,(,:%3%*%"+'%.',.1'.,7"'+(,&"5'J)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,;+"5'G4%+'+("&%-%&,*%).'*4"#"-)#"'&).*,%.+','.;7:"#')-'.,7"'+(,&"+'-)#'*4"+"'C!K%'7,.%@ -"+*'4",/"#+M'+1&$23$#$%&245%6,-2'+1&$23$#$%&278.98&-2',./'+1&$23$#$%&2:+1"5'G4"+"'.,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"5'G4"'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"#"-)#"'%*+'/"("./".&%"+',#"'+,*%+-%"/5'G4"'#"+)3$"#'&#",*"+'6$(&!':"*9"".'*4"'#"?;%#"@ 7".*+',./'&,(,:%3%*%"+O'*4"'/"&3,#%.F':;./3"'%+'.)*',39,1+'*4"'+,7"',+'*4"'4)+*%.F':;./3"5'G4"'#"+)3$@ %.F'(#)&"++'%+'/"+&#%:"/'%.'7&!304$,518(3-&!!').'(,F" PQ5'G4"'/%,F#,77%.F'*"&4.%?;"')-'*4"' • Visible in the wiring of the bundles H"?;%#"7".*RE,(,:%3%*1'7)/"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.
    osgi.ee Capabilities andRequirements • Replacement for org.osgi.framework.executionenvironment and Bundle-RequiredExecutionEnvironment
  • 20.
    osgi.ee Capabilities andRequirements • 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.
    osgi.ee Capabilities andRequirements • 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.
    adapt • Replacing Frameworkservices • Bundle was almost always parameter, not very OO
  • 23.
    adapt • Replacing Frameworkservices • 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.
    adapt • Replacing Frameworkservices • 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.
    Replacements • PackageAdmin service Bundle Wiring API • BundleWiring wiring = bundle.adapt(BundleWiring.class) <A>
  • 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.
    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.
  • 29.
    Bundle Wiring API Bundle adapt Bundle Revision
  • 30.
    Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability
  • 31.
    Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring
  • 32.
    Bundle Wiring API Bundle adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring Bundle Wire
  • 33.
    Bundle Wiring API Bundle Bundle Revisions adapt Bundle Bundle Bundle Requirement Revision Capability Bundle Wiring Bundle Wire
  • 34.
    Updating a Bundle Bundle Revision Bundle (host)
  • 35.
    Updating a Bundle Bundle Bundle Revision Revision Bundle Bundle (host) (fragment)
  • 36.
    Updating a Bundle Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle (host) (fragment)
  • 37.
    Updating a Bundle Current Bundle Bundle Bundle Bundle Bundle Revision Wiring Wire Wiring Revision Bundle Bundle Bundle Revisions (host) (fragment)
  • 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.
    Framework Wiring • SystemBundle can be adapted to control framework wide actions Framework • refresh Wiring • resolve adapt System • dependency closure Bundle
  • 40.
    StartLevel API • BundleStart Level controls start level information for an individual bundle Bundle Start Level • get/set bundle start level adapt Bundle
  • 41.
    StartLevel API • BundleStart 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.
    Bytecode Weaving • Verypopular in enterprise applications • Need an OSGi standard way to allow weaving classes when loading • Introducing the WeavingHook service
  • 43.
    Weaving Hook • WeavingHookis 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.
    Composite Bundles • Rememberthe session on Composite Bundles from last year?
  • 45.
    Composite Bundles • Rememberthe session on Composite Bundles from last year? • Or the year before?
  • 46.
    Composite Bundles • Rememberthe 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.
    Composite Bundles • Rememberthe 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.
    Resolver Hook • Replacesnested 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.
    Resolver Hook • Visitorpattern • 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.
    Bundle Hooks • ResolverHooks 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.
    Find Hook andEvent Hook • 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.
    BSN/Version Pair • In4.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.
    Launching Property • Launchingframework 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.
    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.
    A designer knowshe has achieved perfection not when there is nothing left to add, but when there is nothing left to take away. - Antoine de Saint-Exupéry
  • 56.
    Next Releases • Residential4.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