Download - Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Transcript
Page 1: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved

Easy-peasy OSGi Development with Bndtools

Neil Bartlett

Paremus Ltd

21 September 2011

OSGi Alliance Marketing © 2008-2010 . All Rights Reserved

Page 1

Page 2: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Good News Everyone!

Hardly any slides!

Page 3: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

My Mission

• To mercilessly destroy sources of OSGi pain and bafflement.

• Make it easy to do the right thing, and hard to do the wrong thing.

• Don’t just talk Best Practices... create them.

Page 4: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Make OSGi Fun!

Page 5: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

“OSGi development cannot be made [...] easy or productive”

– Rod Johnson

(emphasis added for comic effect)

Page 6: Easy-peasy OSGi Development with Bndtools - Neil Bartlett
Page 7: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Bugbear #1

• Require-Bundle is evil

• Import-Package is a nightmare to maintain

Page 8: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

But... The Packages are RIGHT THERE!!!

package org.example.auction.basic;

import org.example.auction.AuctionService;import org.osgi.framework.Constants;import org.osgi.service.event.Event;import org.osgi.service.event.EventAdmin;

Page 9: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

D.R.Y.

Page 10: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Bugbear #2

• The rules of versioning are not hard to understand, but...

• Managing thousands of versioned packages is impossible

• Therefore version only bundles, or ignore versioning entirely

Page 11: Easy-peasy OSGi Development with Bndtools - Neil Bartlett
Page 12: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Bugbear #2

• Managing thousands of versioned packages is impossible... FOR HUMANS

• Use the machine!

Page 13: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Pure API Bundle

api 1.0.0

Page 14: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Service Provider

api 1.0.0api [1.0,1.1)

Page 15: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Service Consumer

api

Page 16: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Without API Bundle

api 1.0.0api [1.0,1.1) api

Page 17: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

With API Bundle

api 1.0.1

api 1.0.0api [1.0,1.1) api

Page 18: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Oops!

api 1.0.1

api 1.0.0 api

Page 19: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

In-Container Testing

AuctionServer

EventAdmin ...

TestBundle 1

TestBundle 2 ...

Bundles Under Test

Test Bundles

OSGi Framework

JUnit Runner

Page 20: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

But I Use Maven!

• Maven and Bndtools, sitting in a tree, k.i.s.s.i.n.g.

Page 21: Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Bndtools:

• Designing Bundles

• Instant Build/Run

• Bundle Analysis

Maven:

• Build dependencies

• Repeatable offline builds

• Reports