Several discussions have begun to brew in
CommonFrontEndCgiScript,
TWikiOO, and elsewhere, around
the subject of coming up with a more generic method of plugin service discovery methods for TWiki.
There are several areas in the TWiki core code, and in
MegaTWiki, which use a custom sort of plugin, service, or extension discovery code.
- PluginsDotPm was the first to use any sort of plugin discovery code, for obvious reasons.
- StoreDotPm now uses a sort of discovery to grab the rest of the code for implementing version controlled storage, so that the administrator may choose which versioning system they know (or like) best.
- MegaTWiki uses code to register it's various mega-services with it's request handler (see MegaTWikiServiceRegistrationMethods)
If
TWikiOO is going to use a
CommonFrontEndCgiScript, it will require the implementation of a request handler which services only those request types which have been registered by some method or another.
The question is, how do
TWikiService objects make themselves known to the request handler in an elegant, extensible fashion?
I have not been able to find a canned solution for this. Perhaps it would be good to break down what occurs in
PluginsDotPm, and go from there.
PluginsDotPm goes thru the following contortions to register a Plugin and the various rendering handlers it supports:
- check the list of disabled plugins
- discover the potential plugins by looking for a file ending in 'Plugin.pm' in the libs/TWiki/Plugins directory.
- attempt to register all plugins which have not been disabled.
- bail out if there is no plugin topic (containing the plugin's settings, etc), and read in the preferences from that topic.
- Attempt to initialize the plugin via it's
initPlugin method, bailing out if it returns 0.
- Register all the rendering handlers provided by the plugin.
I imagine that for
TWikiOO the
TWikiService perl modules may be discovered in the same manner as items 1 and 2 above, after which they may be created and queried for the same type of information (services rendered, etc) before adding them to the list of active TWiki services.
--
PeterNixon - 12 Jul 2002