Thursday, October 22, 2009

OSGi bundles and the Export-Package manifest

I can at times be rather a technology dilettante.

There is so much technology, and so little time, that I am often forced to be hurried in trying to learn just enough about some particular technology to get the job done.

A case in point is DERBY-4120, a request by a user to improve the contents of the derbyclient.jar manifest file so that it can be handled as a OSGi bundle.

I don't use OSGi myself, and don't plan to. But this is a simple request, and I think that it doesn't adversely affect any other uses of derbyclient.jar, and so I'd like to cross this item off the list and go on to the next Derby request.

So I've done just enough reading and searching of the web to make me think that I merely have to ensure that the file contains:

Bundle-SymbolicName: derbyclient
DynamicImport-Package: *
Export-Package: org.apache.derby.jdbc

Unfortunately, since I'm not a OSGi user, it's hard for me to know whether this is correct or not. But still, I can:

  • Make this change and verify that it works as expected

  • Run some tests to ensure that at the very least this doesn't break anything

  • Propose the change and commit it to the trunk, and if it isn't good enough for what the requester needs, hope that they will come back and describe more clearly what is needed

And that's the way that software evolves.

1 comment:

  1. You also need:

    Bundle-ManifestVersion: 2

    and, if you have a version associated with it:

    Bundle-Version: 1.2.3

    Note that the bundle version is [0-9]+.([0-9]+.([0-9]+.([a-zA-Z_--0-9]+)?)?)? so you need to be aware that a 4th field, if present, is sorted alphabetically and not numerically.