B
Bent C Dalager
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If I wanted to build an application that had pluggable modules, how
would I go about doing this?
I've thought a bit about it and the idea that comes to me is:
1. Have a jar file for each module.
2. When the application starts, check for the possible jar files - these
must be known prior to deployment of course.
3. If the modules exist, build menu's based on what exists.
Is this logical, or is there a standard way to handle this type of problem?
Typically, you have a config file somewhere that lists all the modules
you should be looking for. It tends to do this by listing the name of
an entry point into each module, e.g., its main factory class.
So I could have a myapp.properties file that says:
com.company.app.modules=com.company.app.module1.FooFactory,com.company.app.module2.BarFactory
The question then becomes: where do you put this config file and how,
if at all, do you give the user access to it for editing?
If you intend for the user to modify the list, you might want to have
only a default list in the config file and access the user's own
preferences about the matter through the preferences API. You'd then
just put the defaults config file into your app's JAR and have that
happen as part of your regular build job.
Cheers
Bent D