runtime support for multiple version of the same library

Project:JNode Core
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I have just fixed the build system to support multiple versions of the same library.

JNode should also support multiple versions of the same library at runtime.

When I try to have both junit 3.8 and junit 4, I have that exception :

[exec] org.jnode.plugin.PluginException: Duplicate plugin org.junit
[exec] at org.jnode.plugin.model.PluginRegistryModel.registerPlugin(PluginRegistryModel.java:214)
[exec] at org.jnode.plugin.model.PluginDescriptorModel.resolve(PluginDescriptorModel.java:641)
[exec] at org.jnode.plugin.model.PluginRegistryModel.resolveDescriptors(PluginRegistryModel.java:154)
[exec] at org.jnode.plugin.manager.DefaultPluginManager.startSystemPlugins(DefaultPluginManager.java:114)
[exec] at org.jnode.boot.Main.vmMain(Main.java:74)
[exec] org.jnode.plugin.PluginException: Duplicate plugin org.junit
[exec] at org.jnode.plugin.model.PluginRegistryModel.registerPlugin(PluginRegistryModel.java:214)
[exec] at org.jnode.plugin.model.PluginDescriptorModel.resolve(PluginDescriptorModel.java:641)
[exec] at org.jnode.plugin.model.PluginRegistryModel.resolveDescriptors(PluginRegistryModel.java:154)
[exec] at org.jnode.plugin.manager.DefaultPluginManager.startSystemPlugins(DefaultPluginManager.java:114)
[exec] at org.jnode.boot.Main.vmMain(Main.java:74)

A temporary workaround is simply to change one of the plugin ids, for example "org.junit" -> "org.junit4".

The first thing to do is to review the PluginRegistry interface and its implementation (PluginRegistryModel) to add the version where only the pluginId is used.
Note that there is the PluginReference class, which contains the pluginId and the pluginVersion : you get it by calling PluginDescriptor.getPluginReference().