5. Planning 4.2
• Core released for approval June 10
• Working on the final draft for
Compendium as we speak
• Compendium : July 10
• Enterprise Release Autumn
• Residential Release Spring 2010
vrijdag 26 juni 2009
8. Legend
Bundle
A
Service
Bundle
B
vrijdag 26 juni 2009
9. Legend
Bundle
A
getService
Service
registerService
Bundle
B
vrijdag 26 juni 2009
10. Legend
Bundle
A
getService
Bundle
Service C
registerService
Bundle
B
vrijdag 26 juni 2009
11. Legend
Bundle
A
getService
Bundle
Service addServiceListener
C
registerService
Bundle
B
vrijdag 26 juni 2009
12. Legend
Bundle
A
getService
Call/Dependency
Bundle
Direction
Service addServiceListener
C
registerService
Bundle
B
vrijdag 26 juni 2009
13. Core
• Launching
• Bundle Tracker
• Bundle-License Header
• Service Hooks
• Negative Permissions
vrijdag 26 juni 2009
14. Launching
• To be inside a framework …
• Or outside a framework ...
• That’s the question!
vrijdag 26 juni 2009
15. Launching
• Standardizes launching different
frameworks
• Will enable generic launchers
• Allows you to embed a framework in your
application!
vrijdag 26 juni 2009
16. Launching
Map<String,String> p = new HashMap<String,String>();
List<String> impls = getMetaInfServices(
loader, FrameworkFactory.class.getName());
if (impls.size() != 1)
throw new RuntimeException(
"Too many frameworks: "+ impls);
Class<?> clazz = loader.loadClass(impls.get(0));
FrameworkFactory factory = (FrameworkFactory) clazz
.newInstance();
Framework fw = factory.newFramework(p);
Bundle b = fw.installBundle( “http://.../load/…”);
b.start();
vrijdag 26 juni 2009
17. Bundle Tracker
• Simple tool a la Service Tracker to track
bundles
• Very useful for extenders
• Bundles that provide additional
functionality based on data in a bundle
• Tracks a set of states
• Handles all concurrency issues
vrijdag 26 juni 2009
18. Service Hooks
• FindHook
• Intercept getServiceReference(s)
• EventHook
• Intercept Service Event delivery
• ListenerHook
• Find out who is listening to what
vrijdag 26 juni 2009
19. Service Hooks
Bundle
A
Bundle
B
vrijdag 26 juni 2009
20. Service Hooks
Bundle
A
Proxy
Bundle
Bundle
B
vrijdag 26 juni 2009
21. Service Hooks
Bundle
A
FindHook Proxy
EventHook Bundle
Bundle
B
vrijdag 26 juni 2009
22. Service Hooks
Bundle
A
FindHook Proxy
EventHook Bundle
Bundle
B
vrijdag 26 juni 2009
23. Service Hooks
Bundle
A
ListenerHook
FindHook Proxy
EventHook Bundle
Bundle
B
vrijdag 26 juni 2009
24. Service Hooks
Bundle
A
ListenerHook
FindHook Proxy
EventHook Bundle
Bundle
B
vrijdag 26 juni 2009
25. Negative Permissions
• Java 2 Permissions are only positive
• That is, you grant a permission P
• PackagePermission(com.acme,IMPORT)
• Very hard to say, all permissions except P
• Lack of deny permissions
vrijdag 26 juni 2009
28. Remote Services
• RFC 119
• Formerly Distributed OSGi
• Distribution Software uses services to:
• Maps a service to/from a remote system
• Uses a service to abstract a
communication endpoint
vrijdag 26 juni 2009
29. Remote Services
Distribution Distribution
Provider Provider
X’
Bundle
B
vrijdag 26 juni 2009
30. Remote Services
Distribution Distribution
X Provider Provider
X’
Bundle
B
vrijdag 26 juni 2009
31. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
X’
Bundle
B
vrijdag 26 juni 2009
32. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
X’
Bundle
B
vrijdag 26 juni 2009
33. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
X’
Bundle
B
vrijdag 26 juni 2009
34. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports
X’
Bundle
B
vrijdag 26 juni 2009
35. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports
X’
Bundle
B
vrijdag 26 juni 2009
36. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports
X’
Bundle
B
vrijdag 26 juni 2009
37. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports
X’
Bundle
B
vrijdag 26 juni 2009
38. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports imports
X’
Bundle
B
vrijdag 26 juni 2009
39. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports imports
X’
Bundle
B
vrijdag 26 juni 2009
40. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports imports
X’
Bundle
B
vrijdag 26 juni 2009
41. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports imports
X’
Bundle
B
vrijdag 26 juni 2009
42. Remote Services
Bundle
A
Distribution Distribution
X Provider Provider
exports imports
X’
Bundle
B
Framework 1 Framework 2
vrijdag 26 juni 2009
43. Remote Services
• Service Properties define the interaction
• Intents specify the required/provided
capabilities
• Filters used to match
• Service Component Architecture (SCA)
• Interaction specified, not mandated
• Flexible configuration options
vrijdag 26 juni 2009
44. Service Properties
Distribution Provider
<other properties> <other properties>
service.exported.intents
service.intents service.exported.intents
service.exported.intents.extra service.imported
service.exported.interfaces objectClass
service.exported.configs service.imported.configs
remote.intents.supported
remote.configs.supported
Framework 1 Framework 2
vrijdag 26 juni 2009
45. Service Properties
Distribution Provider
<other properties> <other properties>
service.exported.intents
service.intents service.exported.intents
service.exported.intents.extra service.imported
service.exported.interfaces objectClass
service.exported.configs service.imported.configs
remote.intents.supported
remote.configs.supported
Framework 1 Framework 2
vrijdag 26 juni 2009
46. Service Properties
Distribution Provider
<other properties> <other properties>
service.exported.intents
service.intents service.exported.intents
service.exported.intents.extra service.imported
service.exported.interfaces objectClass
service.exported.configs service.imported.configs
endpoint
remote.intents.supported
remote.configs.supported
Framework 1 Framework 2
vrijdag 26 juni 2009
47. Service Properties
Distribution Provider
<other properties> <other properties>
service.exported.intents
service.intents service.exported.intents
service.exported.intents.extra service.imported
service.exported.interfaces objectClass
service.exported.configs service.imported.configs
endpoint
remote.intents.supported
remote.configs.supported
Framework 1 Framework 2
vrijdag 26 juni 2009
48. Blueprint Extender
• RFC 124
• Provides Spring DM Functionality
• Blueprint Extender uses XML definitions in
bundle to create & wire application objects
• Namespace Handler services, not yet :-(
• Provides damping
• Proxies services
vrijdag 26 juni 2009
74. TSL
• A Tiny Script Language
• Feels like a shell
• Acts like a script language
• Uses reflection, but simplifies syntax
• No new commands
• Will become Felix project
vrijdag 26 juni 2009
78. TSL
$ help={each <<$it class> declaredmethods> {$it name }}
aQute.shell.runtime.Closure@90a284
$ help <bundle 6>
loadClass
getResource
...
checkLoader
closeBundleLoader
getLoaderProxy
$ echo $exception
E: java.lang.NullPointerException
$ echo $exception
java.lang.NullPointerException
$ $exception printstacktrace
$ // the output is temporarily on reall stderr ...
vrijdag 26 juni 2009
79. Nested Frameworks
• Application Server Vendors want scoping of
applications …
• Basic Idea OSGi is:
• The Application == the set of installed
bundles
• Compromise:
• All Frameworks to be nested
vrijdag 26 juni 2009
81. Nested Frameworks
System
Bundle
Composite
Bundle
Framework P
vrijdag 26 juni 2009
82. Nested Frameworks
Framework C
System
Bundle
Composite
Bundle
Framework P
vrijdag 26 juni 2009
83. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite
Bundle
Framework P
vrijdag 26 juni 2009
84. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle
Framework P
vrijdag 26 juni 2009
85. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle
Framework P
vrijdag 26 juni 2009
86. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle
App
Bundle
A
Framework P
vrijdag 26 juni 2009
87. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle
App
Bundle
A
Framework P
vrijdag 26 juni 2009
88. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle
App
Bundle
A
Framework P
vrijdag 26 juni 2009
89. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle App
Bundle
B
App
Bundle
A
Framework P
vrijdag 26 juni 2009
90. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle App
Bundle
B
App
Bundle
A
Framework P
vrijdag 26 juni 2009
91. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle App
Bundle
B
App
Bundle
A
Framework P
vrijdag 26 juni 2009
92. Nested Frameworks
Framework C
System
Bundle System
Bundle
Composite Surrogate
Bundle Bundle App
Bundle
B
App
Bundle
A
Framework P
vrijdag 26 juni 2009