Skip to main content

Plugin-API wanted

11 replies [Last post]
chaose71
Offline
Joined: 2008-04-15
Points: 0

Hi,

can any one recommend a open source plugin API? I am currently developing a program to visualize medical data, that became somewhat big. Some modules are definitely specialized and do not need to be part of the "main" release. It would be great to have some kind of plugin management, e.g. where the user of the main version can download a .jar file, click on "install plugin" and the program gets some new features. This would also make the developement much easier as soon as the program goes open source ...

Has someone experience with a free plugin-management API? Or do I have to start from scratch ... ?

Best Regards;
ChaosE71

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chaose71
Offline
Joined: 2008-04-15
Points: 0

Hello there,

thank you both. Most likely my need is more low level, so OSGi might be the best option to start with. But I will look at both.

Thanks!
ChaosE71

maxnitribitt
Offline
Joined: 2006-11-27
Points: 0

Eclipse and NetBeans RCP are the best choices when looking at a framework. I can highly recommend using a RCP platform, because it frees you from infrastructural plumbing and gives you a lot more in addition to plugins. One of the most important benefits is a infrastructure for creating extension points for your API/SPI. For example central registries for adding actions to global Menu bars, toolbars popupmenus, etc.. When you modularize your application without such a framework, you need to implement stuff like that yourself. Also a Window System with persistence management, selection management and lots of APIs that make it easier to have a consistent UI (Wizards, Options & Settings, Dialogs) are a great benefit.
NB RCP is the best choice for Swing applications.
Eclipse RCP is the best choice for SWT applications.
Eclipse uses OSGi with some extensions (buddy-policy registered) as the base. NetBeans uses a Module System that is very similar to (and interoperable with) OSGi with some additional features (token based dependency management) for plugin management. I like the NB UI for Update Management better, because it's more user friendly, but that's my personal opinion. I've been involved in porting several applications from small (5-10 Developers) to large (> 100 Developers) to the NB Platform. I can highly recommend it.

Cheers
Toni

chaose71
Offline
Joined: 2008-04-15
Points: 0

Hello Toni,

that was really helpful! Sadly I am quite unexperienced with plugin/module strategies until now. In our application it will be necessary that external modules can integrate with own GUI elements into the main package, as you described in your post. A concrete example: the program has currently build in support for haptic input devices. However, this is only usefull for a small user group, since most people dont have a Phantom Omni (or similiar) available. The haptic interaction module is currently part of the main package and is linked into several places; segment registration, seed selection etc., with additional buttons, sliders and menu entries. A second example could be highly specialized segmentation modules developed by external partners that are using model based approaches for, lets say neuroanatomical structures, which are hardly usefull for non-neuroanatomists. Both examples contain GUI elements and need interfaces to the global data storage (voxels, triangulated surfaces, gradients, etc).

Key idea is that the main application is turned into a platform with (plenty) build in general components. More specialized modules should become external/optional. As the program GUI is completely swing based, I will have a closer look at NB RCP.

Thanks a lot!
Ingo

maxnitribitt
Offline
Joined: 2006-11-27
Points: 0

Hi Ingo,

right, that's exactly where a RCP framework can help. In NetBeans every Module has a special registry file (layer.xml) where actions and gui components can be registered. At runtime those registries are merged and the GUI is constructed from the merged hierarchy.

The nice thing is, that you can design your Menus and toolbars via drag & drop, because the IDE already merges everything during development, so you can define the order of menu items or make sure that the same keyboard shortcuts isn't used more than once.

So Module A can add a new Button to a toolbar that is supplied by Module B. If Module A is disabled (e.g. when no Phantom Omni is available), then the button and GUI elements won't be added.

You can even hide or rebrand actions or menu entries provided by other modules via this mechanism (which is sometimes very useful).

One additional benefit of the plugin approach is that you can control the visibility of your packages in a more fine-grained way than standard Java allows you by declaring "public packages". This is especially useful in your case, where third-parties will develop modules:

Without a module system other developers can access most parts of your application. Even parts that are not intended to be part of the API, but part of the implementation. But as soon as someone relies on these parts you need to support them since they unintentionally "leaked" into your API. In case you change something third-party modules will break.With a Module system you have explicit control over what parts of your modules can be used by third-parties. If you keep these parts (the official API) stable, you can change the implementation details without affecting your users. The benefts of this kind of defensive API design are not so obvious in the beginning, but your project looks quite mature, so it will probably and hopefully have many releases. In that case you can do yourself a favour by using this defensive style. I know what I'm talking about: Once bitten, twice shy ;-).

There are some nice tutorials for getting started :

http://www.netbeans.org/kb/trails/platform.html

If you have further questions about NetBeans feel free to ask.

cheers,
Toni

Message was edited by: maxnitribitt

dkkopp
Offline
Joined: 2003-06-14
Points: 0

Let me just chime in to recommend the book I listed in my earlier post. It provides a very good overview of how to do things the NetBeans way. It has saved me from a lot of frustration.

Also, NetBeans has built in tools for building NetBeans modules, which will make your life much easider.

maxnitribitt
Offline
Joined: 2006-11-27
Points: 0

I agree, it's a very good book. Since you seem to be from Germany I can also highly recommend this one from Heiko Böck:

http://www.galileocomputing.de/katalog/buecher/titel/autoren/gp/titelID-...

Toni

davideraccagni
Offline
Joined: 2007-01-29
Points: 0

Hi,
It's all depending upon the level of the API. High level? Netbeans OR Eclipse. Low level? OSGi Technology (the core of Eclipse, Glassfish, JBoss, ecc).

Regards,
Davide Raccagni

rogyeu
Offline
Joined: 2006-07-30
Points: 0

To avoid any confusion, I would suggest you to contact Sun's Trademark and Marketing Legal Department if you don't find your information in the above link.

-- RY

chaose71
Offline
Joined: 2008-04-15
Points: 0

> To avoid any confusion, I would suggest you to
> contact Sun's Trademark and Marketing Legal
> Department if you don't find your information in the
> above link.

Now I am confused; who should contact the marketing/legal departmenet and what for? And which link are you refering to ;) ?

ChaosE71

rogyeu
Offline
Joined: 2006-07-30
Points: 0

Sorry, wrong thread.

-- RY

dkkopp
Offline
Joined: 2003-06-14
Points: 0

I would highly recommend using the NetBeans platform for this. Get the Rich Client Programming - Plugging Into the NetBeans Platform book.

We are currently transitioning an existing product over to the NetBeans platform at my workplace, and I am very impressed with the NetBeans platform.