21
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

Easy-peasy OSGi Development with Bndtools - Neil Bartlett

Embed Size (px)

DESCRIPTION

Developing OSGi bundles is just too hard! That gnarly old manifest; listing all the imported packages (again!); writing all those XML files... who needs that kind of hassle? My goal when I began development of Bndtools was to change this picture drastically: to make it actually _easier_ to develop and test OSGi applications, composed of high quality reusable bundles, than it is to develop "traditional" non-modular Java applications. Now with the help of a growing community of contributors and brave alpha testers, that vision is beginning to come true. Bndtools is an Eclipse IDE for OSGi development, based on bnd. In this talk I will demonstrate the features of Bndtools that help to make it fun and easy to build bundles. I will also talk about: Declarative Services with Java annotations; OBR for release management and provisioning; and integration testing strategies.

Citation preview

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