You may like to use OSGi as a plugin loading mechanism.
The Eclipse Virgo project provides an OSGi runtime suitable for your project since it has Spring built-in. Virgo offers Tomcat and Jetty servers and a standalone kernel that can be used independently or to create other types of servers. See Virgo Website for features and benefits .
OSGi has a completely different design point than you can use in Java. This gives you controlled isolation between plugins known as bundles, as opposed to a linear class. Bundles are linked together in a dependency graph and support version control and dynamic life-cycle operations.
The preferred tool for a package to take advantage of other packages is the OSGi registry. The Spring DM project allows you to publish normal Spring beans in the service registry and look for it from the service registry. Spring DM is also built into Virgo. Spring DM was donated by Eclipse as a Twins project.
To use Virgo, you would add the Spring DM configuration for each of your plugins to the META-INF / spring directory. This configuration, which is a regular Spring XML configuration file, can refer to beans in your other Spring files and publish these beans to the service registry, or it can provide beans for services viewed by the service registry, which can then be referenced and pasted into beans in your other Spring files.
Then you placed your plugins in Virgo using any of the supported mechanisms. You can simply drop them in the dependency order into the pickup catalog. Or you can use the web admin console or the console console for deployment.
Alternatively, and this seems to fit your requirement quite well, you can place plugins that provide packages for other plugins in the Virgo repository, drop them into the / usr repository, and then deploy plugins that depend (transitively) on repository plugins through the pickup folder or web admin console. Virgo automatically deploys dependencies from the repository as dependent plugins are deployed.
You can also group plugins together in an archive known as PAR, or save them in the Virgo repository, and then refer to them in an XML file known as a plan. You will then deploy PAR or plan as described above. You can even put some of the dependencies in the Virgo repository and reduce PAR or plan to contain only dependent plugins.
If you want more information about Virgo, just ask the Virgo community forum .
Glyn normington
source share