What Osmorc can learn from Bndtools

| | Comments (3) | TrackBacks (0)

On October 1st, I had the pleasure to attend to the 2011 OSGi code camp in Berlin. For a change, I used Eclipse to develop OSGi, so I had a chance to spend a full day using Neil Bartletts bndtools in action. That brought many insights on how to improve Osmorc.

So the next few sections shall put some light on features I very much liked about bndtools. After each section there are some bullet points indicating how these features might be added to Osmorc in the future:

Manifest generation and/or manual editing

From what I saw, bndtools is mostly about code first and generating manifests, which is IMHO the only sane way to develop OSGi. Nevertheless there are many people (also at the Code Camp) who are not happy with manifest generation for various reasons and would prefer to type them manually. So while Osmorc supports the generation aspect quite well (simply because Osmorc uses the same bnd library that bndtools is using), the manifest first approach is not supported very well. Adding in the reports on the Osmorc issue tracker, the following things should be added to Osmorc quickly:

  • Dependencies of modules should be updated automatically to match the imports in the manifest of the module. This is especially true for inter-module-dependencies, which are a pain to set up if you have a bunch of modules. This however is less of a pain point if you use Maven for building, as Osmorc can and does automatically import maven dependencies.
  • The editor should be aware of missing unreachable classes/packages and offer to add them to the manifest.
  • The manifest editor should point out, when importing packages that are not exported by another bundle in your project.

Dependencies

In general dependencies seem to be a major headache. Bndtools uses some kind of repository folder, where dependencies can be put. That means, if I need a new dependency, I need to download a Jar and put it into that repository folder. After that, bndtools can calculate the dependencies from the manifests and automatically update Eclipses project files so the compiler finds it's dependencies. This worked really well. In Osmorc you have to add your dependencies manually by adding the library to the module (which doesn't differ much from the way it's done in bndtools) or use Maven for dependency management (which is the recommended and imho easiest way). Still there is room for improvement:

  • The whole idea of the framework instance (aka target platform) is actually not needed and causes confusion. The idea behind it is, that if you want to build your application on top of an existing OSGi platform (e.g. for Eclipse RCP development), there should be an option to easily add all dependencies for this platform to your project. The "framework instance" concept however does not do this in a very convenient or understandable manner. I'd like to pursue the idea of project level libraries for this. That is, if you want to use the Eclipse RCP framework, you can add a project level library to your project and reference it in your module. If you use Maven, you'll simply add your dependencies to your pom.
  • When you start a new project, you will almost certainly require a dependency to the OSGi core lib. Osmorc should suggest to download it or modify your maven project to include this dependency.

Running and debugging

Running and debugging is done very well in bndtools. I like the hot deployment of changed bundles without the need to restart the whole OSGi runtime. However there were times, when we had wished for more control over when a bundle is hot deployed.

  • Hot deployment should be added to Osmorc. To prevent accidental deployments one could ask the user if the compiled bundle should be redeployed (in a similar fashion the debugger asks to hot-deploy changed classes).

Bundling

Bndtools supports an arbitrary amount of bnd configuration files that can be applied on a project. That way it is possible to create several flavours of the same bundle (e.g. one for the testing environment and one for production).

  • In Osmorc you can currently have only one facet per module. I'd like to keep it that way, because the facet is required to determine your manifest settings and having multiple of them would be confusing at least. However IntelliJ has an artifact facility which allows for building arbitrary artifacts from your project. This facility should be extended to support OSGi bundles, so you can build many different artifacts from the same module, which is just the same thing that bndtools offers. As a bonus, it would be nice if one could launch the artifacts in a run configuration.

So there is lots of work to be done, and I intend to get most of this working with Osmorc's 1.4 release that will ship with IDEA 11. Stay tuned for updates.

0 TrackBacks

Listed below are links to blogs that reference this entry: What Osmorc can learn from Bndtools.

TrackBack URL for this entry: http://www.osmorc.org/mt/mt-tb.cgi/25

3 Comments

Hi Jan,

Thanks for your positive words about Bndtools! I also appreciate your comments about where it could be improved.

I still think it would be great if we could collaborate to ensure some level of compatibility between Bndtools and Osmorc, so that developers could use their personal choice of IDE on the same project. Let me know if there is anything I can do to help in that regard.

Cheers,
Neil

Arik Kfir said:

Hi Neil,

You can take a look at the IntelliJ/Felix plugin at https://github.com/arikkfir/Apache-Felix-IntelliJ-Plugin

It already does hot deployment for bundles. You are free to copy the code and use it in Osmorc if you want (modify as needed). The way it works is to automatically deploy an additional bundle agent in the running container, which listens on a specific socket. The IntelliJ plugin then communicates with that agent for deployment changes.

Jan Thomä said:

Hi Arik,

that's very generous of you, thank you very much. I'll have a look at this when I integrate the hot deployment feature.

Jan

Leave a comment

About this Entry

This page contains a single entry by Jan Thomä published on October 12, 2011 9:14 AM.

Osmorc 1.3.3 in public repository was the previous entry in this blog.

A new release model for Osmorc is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.