Answers inline below. Would you mind if I used your question and
sample use case for entry on the wiki?
Sumit Verma said the following on 09/12/2009 11:12 PM:
No, plugins are a cross-cutting concern and it would be imprudent (and
really messy) to allow some plugins to run in certain circumstances and
not in others. However, there is a solution to the use case you
describe.
First, there is a known defect right now that stopping the solution I
will outline below from working:
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/ticket/194
This will be fixed in Mach-II 1.8 soon (it affects 1.5, 1.6.0 and
1.6.1).
Basically, you will set the runParent="none" and pull in the plugin you
want using the overrideAction and/or mapping attribute. These
attributes are documented in the XML Configuration File reference entry
on the wiki.
Snip in module:
<plugins runParent="none">
<plugin name="security" type="MachII.plugins.SimplePlugin />
... other plugins...
</plugins>
In parent using override XML when defining the module:
<module name="foo" file="./path/to/mach-ii_foo.xml">
<mach-ii>
<plugins>
<plugin name="security" overrideAction="addFromParent"/>
</plugins>
</mach-ii>
</module>
This adds the "security" plugin from the parent into the module with
the name of "security". Remember that plugins are run in the order
they are defined, since I want my "security" plugin to be run first --
I added a placeholder in the module to replace. Otherwise you could do
away with that "SimplePlugin" placeholder and the override XML will
append the plugin -- therefore the security plugin would be the last
plugin to run in the module. Of course, you still have to have the
"security" plugin defined in the base application so you can use the
overrideAction to add it to the module.
If you want to use a plugin with different name in the parent, that is
fine but you need to use the mapping attribute:
Snip in module:
<plugins runParent="none">
<plugin name="security" type="MachII.plugins.SimplePlugin />
... other plugins...
</plugins>
In parent using override XML:
<module name="foo" file="./path/to/mach-ii_foo.xml">
<mach-ii>
<plugins>
<plugin name="security" overrideAction="addFromParent"
mapping="crazyFooBarName" />
</plugins>
</mach-ii>
</module>
This pulls in a plugin named "crazyFooBarName" from the parent into the
module and replaces "security" plugin placeholder. Of course, you
still have to a plugin named "crazyFooBarName" in the base application
(parent).
Again, there is a known ticket right now that stops this from working
right now and this will be fixed soon.
Best,
.Peter