OSGi + Azureus Torrent Bundle

TLDR) I have been pulling apart the code of the Azureus Torrent Client to create a Torrent Bundle and Service in OSGi. It is more difficult than I first though it would be.
If you would like to see such a bundle, please let me know, this would encourage my efforts.

I have been working on it for a while now, and this is the first post that is describing my process, and the problems I faced.

I chose Azureus because it was my old client, it has alot of functionality that basic torrent clients dont, like selecting files within the torrent to download and others not to. And because I assumed moving it from the Azureus plugin model to OSGi would be trivial.

Here is what I learnt

First 1) No matter how modular you think your code is, forcing it into OSGi shows you all the dependencies errors caused by hacks.

This was obvious for Azureus when pulling out the SWT packages. I wanted a core package that depended on no external UI bundles, like SWT, or Apcahe CLI.
The problem is that some of Azureus's Table classes, that are abstract UI classes organizing information and handling the internationalization, depended on SWT listeners by using instance of a UI util to check weather it is SWT then adding the correct listener. This then caused a core dependency on SWT interface, SE 101 bad.


Second 2) Before OSGi people solved the problems it addresses in a custom manner, making it difficult to learn and build extensions for those models.

Azureus uses its own plugin model to create and deploy plugins, for this it then creates its own class loader, its own life cycle handlers, update managers, version comparitors, a way of creating and inserting plugins, and a whole lot of code that replicates functionality.

This model does not easily break down into OSGi modules which I thought it would.
It is not an easy process taking legacy code and moving it to OSGi bundles.
Dependencies on the plugin model is tight.

A side project that I would like to see is a set of refactoring tools to break legacy java code into OSGi bundles. If they exist please contact me, anything that would help. One such project I tried was Barrio plugin for Eclipse, this is beta and did not work, for unknown reasons.

0 comments:

Newer Post Older Post Home