Adding modules to plugin through configuration?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding modules to plugin through configuration?

BramVanOosterhout
This post has NOT been accepted by the mailing list yet.
Dear Foswikiers,

I have developed yet another import export plugin. Originally it was a throw
away bit of code to create bulk test data. But it has proven useful in more
general applications. The current version re-implements some of the
ExcelImportExport plugin, but with a row column data structure as the
interface to specialist upload modules. My temporary name for this plugin is
UploadEmit plugin.

My question here is about the visibility of the various upload or emit
modules. Currently they are all defined as part of the plugin code:
 'text' => 'Foswiki::Plugins::UploadEmitPlugin::TextAgent',
 'xls' => 'Foswiki::Plugins::UploadEmitPlugin::XlsAgent',
(The idea borrowed from Michael Daum's CopyContrib)

However, I have separate applications supported by other plugins that deal
with for instance bridge hands and email. Both have upload and emit
functionality. It seems incongruous to package that functionality with the
UploadEmit plugin. Instead it should be packaged with the Email plugin and
the Bridge plugin. But then the question arises:

How to make the UploadEmit plugin aware that the Email and Bridge extensions
exist when they have been installed.

The config file appears to me an appropriate mechanism. The UploadEmit plugin
could have configuration settings
{UploadEmit}{Text} TextModulePathname
{UploadEmit}{Xls} XlsModulePathname

And the Email and Bridge plugins could add their config settings like:
{UploadEmit}{Email} EmailModulePathname
{UploadEmit}{Bridge} BridgeModulePathname

The UploadEmit plugin can then check the config file for available modules
and act accordingly.

Two specific questions:
1. Is this a sane way to go about addressing the issue? Are there better
alternatives? Are there concerns?
2. Is there an example in an existing plugin where this already has been done
well?

All comments welcome.

--
Bram van Oosterhout