Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Peter Kriens | OSGi Evangelist/Director
OSGi R4.3 //
Next Release Overview
Agenda
• Framework & ServiceTracker update to Java 5 generics
• A replacement for Package Admin and Start Level
• A Shell ...
Framework & ServiceTracker update
to Java 5 generics
• Current API feels “old-fashioned”
– Lack of generics
– Uses of arra...
JSR 14!
• Developed to run Java 5 code on 1.4
VMs
• All compilers recognize the
– source 5 -target jsr14 switches
• Output...
Generic Services
ServiceReference<LogService> lr =
context.getServiceReference( LogService.class );
LogService log = conte...
Adapt Method
• Package Admin and Start Level were
cumbersome to use
– Bundle was almost always
parameter
– Not very OO
• T...
A Replacement for Package Admin
and Start Level Service
• Package Admin and Start Level now
use the adapt() method.
• Pack...
Bundle Wiring
Bundle
Bundle
Revision
Bundle
Wiring
Bundle
Wirings
adapt to:
adapt to
current:
adapt to
current:
get
Bundle...
Start Level
Bundle
Start Level
Framework
Start Level
adapt to:
adapt to:
0..1
1
1
0..n
(for system bundle id=0)
(for non-s...
Shell
• Uses reflection to provide the
commands
– Aligns commands with the
specified API
• Optimizes for typing
• Has closur...
A Shell
Command
Processor
Aggregate
Converter
Thread IO
Aggregate
Formatter
Formatter
Converter
…
Handler
…
Commands
Threa...
An OSGi Shell
$ bundles | grep eclipse
000000 ACT org.eclipse.osgi-3.3.1.R33x_v20070828
000001 ACT org.eclipse.osgi.util-3...
Managing System.out. System.err, and
System.in per thread
• System.out, System.in, and
System.err are singletons
• The Thr...
Formatting and Conversion
• Formatter formats an object to a
string
– PART, LINE, INSPECT
• Converter converts an object t...
Coordination Service
• Allow multiple parties to collaborate
by signalling the end of a work item
– ended(Coordination)
– ...
Coordination Service
Coordinator
Some Task
Task
Initiator
TaskTask Coordination
Coordination Service
Coordination c = coordinator.begin();
try {
… do work
c.end();
} catch( FailedCoordinatioNfinally {
}
Resolver Hook
• Allows interception of resolver
• Deny certain dependencies
– Provide context
• Replaces nested frameworks...
Generic Capabilities and
Requirements
• Package-Import, Require-Bundle,
and Bundle-Host are requirements
• Bundle-Symbolic...
Configuration Admin Overhaul
• Security
– Segmentation
• Allow a service to register under multiple
pids
– Use aspects: web...
An Easier Way to Receive
Configuration Updates
• Configuration Admin uses
properties
– Hard to use in Java
• Would be nice t...
An Easier Way to Receive
Configuration Updates
• Works for Managed Services and
Managed Service Factories
• Data Validation...
An Easier Way to Receive
Configuration Updates
public interface WebConf {
String host();
@Default(80) int port();
}
public ...
Bytecode weaving
• Bytecode weaving very popular in
enterprise applications
• Needs to changes the bytes loaded
by the cla...
Byte Code Weaving
Framework
Weaver
WeavingHook
Minor Updates
• Event Admin
– Reusing properties
• Classpath scanning
– Following the bundle class path
Q&A
Upcoming SlideShare
Loading in …5
×

OSGi Community Event 2010 - OSGi Technical Update

804 views

Published on

OSGi Community Event 2010 - OSGi Technical Update (Peter Kriens - OSGi Alliance)

Published in: Technology
  • Be the first to comment

  • Be the first to like this

OSGi Community Event 2010 - OSGi Technical Update

  1. 1. Peter Kriens | OSGi Evangelist/Director OSGi R4.3 // Next Release Overview
  2. 2. Agenda • Framework & ServiceTracker update to Java 5 generics • A replacement for Package Admin and Start Level • A Shell standard • Managing System.out and System.in per thread • Formatting and Conversion • Coordination Service • Resolver Hook • Generic Capabilities and Requirements • Configuration Admin Overhaul • An easier way to receive configuration updates • Bytecode weaving • Minor parts
  3. 3. Framework & ServiceTracker update to Java 5 generics • Current 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 on Java 1.4
  4. 4. JSR 14! • Developed to run Java 5 code on 1.4 VMs • All compilers recognize the – source 5 -target jsr14 switches • Output class format 48 (1.4) – stores generics in skippable attributes • Works like a charm – No annotatons – No enums
  5. 5. Generic Services ServiceReference<LogService> lr = context.getServiceReference( LogService.class ); LogService log = context.getService(lr); Collection<EventAdmin> rs = context.getServiceReference(EventAdmin.class); ServiceRegistration<ConfigurationListener> sr = context.registerService(ConfigurationListener.class) ServiceTracker<EventListener> st = new ServiceTracker<EventListener>( context, EventListener.class, null);
  6. 6. Adapt Method • Package Admin and Start Level were cumbersome to use – Bundle was almost always parameter – Not very OO • The adapt method converts an object another type (if supported) public <T> T adapt( Class<T> clazz );
  7. 7. A Replacement for Package Admin and Start Level Service • Package Admin and Start Level now use the adapt() method. • Package Admin translated to BundleWiring, BundleRevision, and BundleWirings • Start Level Service translated to Start Level and Framework Start Level
  8. 8. Bundle Wiring Bundle Bundle Revision Bundle Wiring Bundle Wirings adapt to: adapt to current: adapt to current: get BundleVersion get BundleWirings 1 0..n0..1 11 0..1 11 1 1
  9. 9. Start Level Bundle Start Level Framework Start Level adapt to: adapt to: 0..1 1 1 0..n (for system bundle id=0) (for non-system bundles id!=0)
  10. 10. Shell • Uses reflection to provide the commands – Aligns commands with the specified API • Optimizes for typing • Has closures • Methods are commands • Very easy to provide commands • Terminal abstraction
  11. 11. A Shell Command Processor Aggregate Converter Thread IO Aggregate Formatter Formatter Converter … Handler … Commands ThreadIO osgi.command.scope=… osgi.command.function=... Command Processor Aggregate Converter Aggregate Formatter Formatter Converter
  12. 12. An OSGi Shell $ bundles | grep eclipse 000000 ACT org.eclipse.osgi-3.3.1.R33x_v20070828 000001 ACT org.eclipse.osgi.util-3.1.200.v20070605 ... 000002 ACT org.eclipse.osgi.services-3.1.200.v20070605 $ <bundle 6> headers Tool Bnd-0.0.169 ... Bundle-SymbolicName biz.aQute.fileinstall $ <<bundle 6> headers> get Tool Bnd-0.0.169 $ fi = bundle 6 RegisteredServices [ManagedServiceFactory] ... StateChanging null $ $fi stop $ $fi location initial@reference:file:biz.aQute.fileinstall_1.3.jar/
  13. 13. Managing System.out. System.err, and System.in per thread • System.out, System.in, and System.err are singletons • The ThreadIO service turns them into thread specific streams • The shell allows commands to output to System.out
  14. 14. Formatting and Conversion • Formatter formats an object to a string – PART, LINE, INSPECT • Converter converts an object to another type • Uses whiteboard pattern • Aggregates provided to simplify normal usage and simple cases
  15. 15. Coordination Service • Allow multiple parties to collaborate by signalling the end of a work item – ended(Coordination) – failed(Coordination) • Thread based or specifically passed as parameter • Nested
  16. 16. Coordination Service Coordinator Some Task Task Initiator TaskTask Coordination
  17. 17. Coordination Service Coordination c = coordinator.begin(); try { … do work c.end(); } catch( FailedCoordinatioNfinally { }
  18. 18. Resolver Hook • Allows interception of resolver • Deny certain dependencies – Provide context • Replaces nested frameworks – Went through nested frameworks, virtual bundles, and now hooks • Allows scoping – Needed for subsystems
  19. 19. Generic Capabilities and Requirements • Package-Import, Require-Bundle, and Bundle-Host are requirements • Bundle-SymbolicName and Package-Export are capabilities • Requirements are filter expressions • Capabilities are sets of properties • Pioneered in OBR • Screen size, certificate, etc.
  20. 20. Configuration Admin Overhaul • Security – Segmentation • Allow a service to register under multiple pids – Use aspects: web config, system config • Coordinated Update • Version count on Configuration object • Extension PIDs – Target a single bundle • com.example.WebConf-com.bundle.foo-1.2.3-123
  21. 21. An Easier Way to Receive Configuration Updates • Configuration Admin uses properties – Hard to use in Java • Would be nice to use Java type … • Schema of properties defined in a Java Interface – PID is classname – Interfaces can extend other interfaces
  22. 22. An Easier Way to Receive Configuration Updates • Works for Managed Services and Managed Service Factories • Data Validation a la Meta Type using annotations – mandatory/default – options – size • Implemented in Apache Cade already (Karaf)...
  23. 23. An Easier Way to Receive Configuration Updates public interface WebConf { String host(); @Default(80) int port(); } public class X implements Configurable<WebConf> { public void updated( WebConf web ) { setPort( web.port() ); }} public interface MyConf extends WebConf, SysConf { } PID
  24. 24. Bytecode weaving • Bytecode weaving very popular in enterprise applications • Needs to changes the bytes loaded by the class loader • Introduces the service: org.osgi.framework.weaving.WeavingHook • Ordering defined by ranking • Can add additional requirements
  25. 25. Byte Code Weaving Framework Weaver WeavingHook
  26. 26. Minor Updates • Event Admin – Reusing properties • Classpath scanning – Following the bundle class path
  27. 27. Q&A

×