You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simon Kitching <si...@ecnetwork.co.nz> on 2002/05/17 08:09:15 UTC
Digester: user(ish) question: how to support plugin classes [dynamic rules]
Hi All,
I would like to use digester in a framework where I have "plug-in"
classes; something like ant's optional tasks..
Example:
<top-level>
<fixed-tag foo="foo">
<fixed-subtag bar="bar"/>
</fixed-tag>
<plugin class="com.acme.plugin1">
<tag-for-plugin1 baz="baz">
</plugin>
<plugin class="com.acme.plugin2">
<tag-for-plugin2 yah="yah">
</plugin>
</top-level>
In this example, any value can be put in the "class" attribute of the
<plugin> tag, and it is this
class that determines the rules for processing any nested tags within
the <plugin> tag. The
first bit is just plain ObjectCreateRule or FactoryCreateRule stuff, but
the second bit I can't
see any obvious solutions for in digester..
I would like plugins to be enabled just by installing one or more new
files and modifying the
configuration file to then *use* the new class.
The xmlrules module is not enough, as the "installer" of the plugin
would need to modify the
master xmlrules config file; even the <include> feature doesn't remove
this need (though it
does make things more modular hence _easier_ to change).
Some kind of xmlrules tag <include plugin-dir="dirname"> might do the
trick; I have been
working on this a bit. I have also been experimenting with requiring the
plugin class to
define a "void addRules(Digester digester)" method that gets invoked to
add any necessary
rules to the digester. I have this running, but it gets messy trying to
avoid possible tag
name collision.
If anyone out there has done this, or tried to do this, I would
appreciate hearing about it
(on this list or directly, as you think appropriate).
Thanks,
Simon
PS: DynaBean: is this implementing dynamically-typed language features
(ruby, perl, etc) in java?
[http://marc.theaimsgroup.com/?l=jakarta-commons-dev
<http://marc.theaimsgroup.com/?l=jakarta-commons-dev&m=100847374827535&w
=2> &m=100847374827535&w=2]
Re: Digester: user(ish) question: how to support plugin classes [dynamic rules]
Posted by robert burrell donkin <ro...@mac.com>.
hi simon
this kind of thing has been in the air before but nothing's been committed.
there are some subtle wrinkles but i don't have the time to go into them
now.
i think that this is a need that digester should address but the reason i
didn't commit the patch we've had already on this issue is that i wasn't
really satisfied with the design. (of course, i can't speak for the other
committers who may have had different reasons.)
as i said, i don't have time now but hang around and hopefully we'll all
be able to put our head together a bit later and some up with a
satisfactory design.
- robert
On Friday, May 17, 2002, at 07:09 AM, Simon Kitching wrote:
> Hi All,
>
> I would like to use digester in a framework where I have "plug-in"
> classes; something like ant's optional tasks..
>
> Example:
> <top-level>
> <fixed-tag foo="foo">
> <fixed-subtag bar="bar"/>
> </fixed-tag>
>
> <plugin class="com.acme.plugin1">
> <tag-for-plugin1 baz="baz">
> </plugin>
>
> <plugin class="com.acme.plugin2">
> <tag-for-plugin2 yah="yah">
> </plugin>
> </top-level>
>
> In this example, any value can be put in the "class" attribute of the
> <plugin> tag, and it is this
> class that determines the rules for processing any nested tags within
> the <plugin> tag. The
> first bit is just plain ObjectCreateRule or FactoryCreateRule stuff, but
> the second bit I can't
> see any obvious solutions for in digester..
>
> I would like plugins to be enabled just by installing one or more new
> files and modifying the
> configuration file to then *use* the new class.
>
> The xmlrules module is not enough, as the "installer" of the plugin
> would need to modify the
> master xmlrules config file; even the <include> feature doesn't remove
> this need (though it
> does make things more modular hence _easier_ to change).
>
> Some kind of xmlrules tag <include plugin-dir="dirname"> might do the
> trick; I have been
> working on this a bit. I have also been experimenting with requiring the
> plugin class to
> define a "void addRules(Digester digester)" method that gets invoked to
> add any necessary
> rules to the digester. I have this running, but it gets messy trying to
> avoid possible tag
> name collision.
>
> If anyone out there has done this, or tried to do this, I would
> appreciate hearing about it
> (on this list or directly, as you think appropriate).
>
> Thanks,
>
> Simon
>
> PS: DynaBean: is this implementing dynamically-typed language features
> (ruby, perl, etc) in java?
> [http://marc.theaimsgroup.com/?l=jakarta-commons-dev
> <http://marc.theaimsgroup.com/?l=jakarta-commons-dev&m=100847374827535&w
> =2> &m=100847374827535&w=2]
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>