Tuesday, May 5

Distributed OSGi with Newton + peaberry

Last week I finally got around to testing peaberry with the Newton distributed OSGi framework from Paremus. It was surprisingly easy to use peaberry with Newton, I only had to make a couple of changes to support native LDAP filter strings when querying the OSGi service registry:

   http://code.google.com/p/peaberry/issues/detail?id=34

These changes are now available in the 1.1.1 release of peaberry. I've also written up a distributed OSGi example based on the existing Spring example.

The new example unpacks on top of a binary installation of Newton 1.3.2 and shows how you can use property files to switch between local and remote services without changing your compiled Guice bindings.

While writing the example I realized that there are a lot of cool abstractions we can build on top of the basic peaberry API. I'm trying to follow the model used in both Guice and OSGi and keep the core API as simple, lean, and mean as possible while providing ways for others to build even more user-friendly layers, such as BindForge, on top.

There are two essential layers I would like to add in the next peaberry release:
  • Configuration - but not tied directly to the OSGi CM service

  • Lifecycle - but again, not tied directly to Bundles and Activators
which will hopefully make it really easy to configure and tie services together.

I'm also considering adding extender bundles to scan for service annotations or scrape 'blueprint' XML and dynamically configure the relevant bindings at runtime, but that would be more of a 1.3 feature. If you're interested in building on top of peaberry, or you have an interesting idea for a new feature, please let me know.

Until then take a look at Newton+peaberry and see distributed OSGi in action!

Saturday, March 28

peaberry - EclipseCon slides now available

My EclipseCon talk on peaberry seems to have been well received, although I think it would have been even better if I'd reduced the technical content to allow time for more questions. I always find short talks harder to plan than long talks, and this was a good learning experience.

If you missed the talk you can either view it on gPublication or download the original presentation.

Of course hearing from my boss that he was closing our company the night before didn't really help. But I'm glad I got the chance to visit EclipseCon one more time and expand my network, which will come in useful for my upcoming job search.

So if you know of any companies interested in hiring someone with good Java, OSGi, and Maven skills... let me know :)

Thursday, March 5

maven-bundle-plugin 2.0.0 released!

The Apache Felix team is pleased to announce the release of maven-bundle-plugin 2.0.0

This release uses the latest bndlib (0.0.311) which requires you to build with a Java5 JDK. You can continue to target earlier JVMs while building with a Java5 or later JDK by setting the source and target levels in the maven-compiler-plugin configuration.

Here is the list of issues fixed in this release:

Bug

  • [FELIX-545] - Export-Package version inconsistencies.
  • [FELIX-546] - Import-Package version inconsistencies.
  • [FELIX-549] - Import-Package should not include "snapshot" from snapshot dependencies
  • [FELIX-660] - "Class in different directory than declared" error when bundle classes in a directory other than bundle root
  • [FELIX-677] - Parser throws error when DynamicImport-Package contains attributes
  • [FELIX-699] - manifest goal does not interprete _include instruction correctly
  • [FELIX-782] - Manifest goal ignores version attribute specified in _exportcontents
  • [FELIX-807] - conversion of JAR into bundle fails if there are classes is the default name space
  • [FELIX-831] - bndlib unnecessary modifies valid OSGi Bundle-Version numbers (update to bndlib 0.0.293)
  • [FELIX-843] - Regression: BND 0.0.295 does not augment Ignore-Package with excluded import packages
  • [FELIX-850] - Wrong symbolic name computed when groupId is a single segment string.
  • [FELIX-864] - A wrong symbolic name is calculated if artifactId starts with lastGroupIdSegment-.
  • [FELIX-899] - Version attribute missing from Import-Package on provided dependencies
  • [FELIX-907] - Regression in latest BND code: negated exports are applied to private packages

Improvement

  • [FELIX-684] - Enable excludeDependencies to check groupId, version, etc. rather than only artifactId
  • [FELIX-806] - changing the internal configuration of the archive plugin doesn't seem to be possible
  • [FELIX-941] - Support singleton & fragment-attachment directive generation

New Feature

  • [FELIX-912] - Improve default Export-Package / Private-Package settings by scanning the project source
A quick bundle example using the classic Maven quickstart project:

  mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app

# edit the pom.xml, change packaging from jar to bundle and add:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.0.0</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>

  mvn clean install
# you should now have a valid OSGi bundle

plugin docs: http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
plugin FAQ: http://felix.apache.org/site/apache-felix-bundle-plugin-faq.html
bnd docs: http://www.aqute.biz/Code/Bnd

--
Regards, the Apache Felix team

Friday, February 27

maven-bundle-plugin 2.0.0 coming soon

Just started a vote for the next major release of the maven-bundle-plugin, if all goes well it will be published to Maven central next Wednesday (4th March).

Sunday, February 22

Guice feature comparison

Yesterday Jesse added this table to the Optional AOP page of the Guice wiki:

Guice 1.0 Guice 2.0 Guice+AOP 2.0 GIN
Library size 544Kb 420Kb 640Kb 0Kb (code gen)
High performance
Binding EDSL
Scopes
Typesafe
Fast reflection ✔ (cglib) ✔ (cglib) ✔ (code gen)
Line numbers in error messages
Method interceptors
Provider Methods
Binding overrides
Tool-friendly SPI
Child Injectors
Servlet Support Scopes Only
Error Reporting Good Better Best Best

I think it's a great summary and shows how flexible the new release will be.

Tuesday, January 13

Guice-Peaberry vs Spring-DM

six times as fast, half the size!

Of course it's never that simple, these are just some fun measurements I took today using a trivial testcase that injects an OSGi service. They completely ignore functionality, flexibility, usability, and many other *bilities... flame-on!

Wednesday, January 7

Happy new year!

Just completed one of my new year resolutions and uploaded a release candidate of peaberry. See my message on the Guice-OSGi group for a few more details.

OK onto my next resolution, back to writing more chapters for OSGi in Action...

Thursday, December 18

Want to hear the latest on Guice and OSGi?

Then you'll want to attend EclipseCon 2009, where you can hear me talk about using Guice and the peaberry extension to blend OSGi services with Eclipse extensions:

http://www.eclipsecon.org/2009/sessions?id=315

I'll also be running through some of the design decisions behind peaberry which I think are pretty neat - like the recent work on "outjection" that lets you share services between registries and watch for service updates. If I have time I'll also discuss some thoughts about lifecycle support (for some background see Todor's recent request).

I'm going to be around for the whole conference, so you'll have plenty of opportunities to ask me questions about peaberry, Pax-Construct, the maven-bundle-plugin, or the "OSGi in Action" book :)