cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <>
Subject RE: [PROPOSAL] mulitple actions per class
Date Tue, 12 Feb 2002 15:27:21 GMT
> >   <map:act type="usermanager-add">
> >  ...
> >
> I really like the idea of your proposal and agree that the above is too
> verbose and complicated.

Cool :)

> > I think this is much to complicated and verbose for the
> > sitemap. I see no benefit over:
> >
> >   <map:actions>
> >     <map:action name="usermanager" src="org.apache..UserManagerAction"/>
> >   </map:actions>
> > ...
> >
> >   <map:act type="usermanager.add">
> >  ...
> >
> > Isn't this simple and straight forward?
> >
> This is simple, but how do I know which methods are available with this
> action? And how do I know that this is a "multiple action class"?

This is easy... you could simply know because there is a dot in the
name:) But I would do a bit more elegant.

We could define an interface e.g. SelfReflective, ReflectionObject or
someting general providing cached information about the class itself.
(at least up to jdk 1.3 this speeds up reflection a LOT!!)

 interface ReflectionObject {
    public Object call(String key, Object[] parameter)
          throws IllegalAccessException,

Or use a more specific interface

 interface ReflectionAction {
   public Map act( String method,
                   Redirector redirector,
                   SourceResolver resolver,
                   Map objectModel,
                   String source,
                   Parameters params ) throws Exception

We should provide a default implementation. On configure the action
uses the reflect API to go through it's public methods and will add
the ones starting with a given prefix (e.g. "do") to a HashMap holding
the Method objects. That's almost about it :)

The sitemap then can only call act on the ReflectionAction which
in turn will call the appropriate method.

> The verbose solution from above has the advantage that the sitemap editor
> (the person writing the pipelines) sees which actions are available.

Hm... that's true. But I guess these actions are would be mainly used for
webapp purposes and will be used with the cocoon-action parameter anyway.
Not inside the sitemap. ...but maybe we could provide both syntaxes?

Although this might be confusing for some users... :-/

To unsubscribe, e-mail:
For additional commands, email:

View raw message