[digester] call-method-rule

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[digester] call-method-rule

Markos Charatzas
Hi there,

Is it possible to make a call to 2 different methods under the same pattern?

Thanks in advance,
Markos

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [digester] call-method-rule

Simon Kitching
Hi Markos,

On Mon, 2005-05-16 at 14:01 +0300, Markos Charatzas wrote:
> Is it possible to make a call to 2 different methods under the same pattern?

It depends. The *calls* will be made, but there is a design flaw in the
way that CallMethodParam interacts with CallMethodRule that makes things
tricky when using multiple "interlaced" CallMethodRules.

If one of the calls is made using no parameters, or just one parameter
being the body of the method, ie
  digester.addCallMethod(pattern, methodname)
or
  digester.addCallMethod(pattern, methodname, 0)
then I *think* the answer is yes (because no CallParamRule is being used
for that call).

If both calls have associated CallMethodRule instances, then I *think*
you'll find that the params get mixed up. The problem is that there is
just one "param stack", and that CallParamRule objects always work on
the set of params on top of the param stack, rather than knowing which
CallMethodRule they are supposed to be associated with.

Please note that I'm not absolutely certain on this; it's been a while
since I looked at CallMethodRule/CallParamRule.

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [digester] call-method-rule

Markos Charatzas
Hey Simon,

Thanks for the detailed response.
I was afraid that a CallMethodParam and a CallMethodRule are associated the
way you described.

Unfortunately (to me that is), I must have a CallMethodParam since the param
derives from a pattern associated with an object-create-rule.

see,
<digester-rules>
                <object-create-rule pattern="routes" classname="java.util.ArrayList" />
                <pattern value="routes/route">
                        <object-create-rule
classname="gr.forthnet.enosis.oli.pojos.ScheduledRoute" />
      <call-method-rule methodname="setStart" paramcount="1" />
      <call-param-rule pattern="from/departure/long" paramnumber="0" />
            <set-next-rule methodname="add" />
                </pattern>
                               
         <pattern value="routes/route/from">
      <object-create-rule classname="gr.forthnet.enosis.oli.pojos.OLIPort" />
                        <bean-property-setter-rule pattern="code" />
      <set-next-rule methodname="setFrom" />
   </pattern>
....


Thanks again,
Markos

On Monday 16 May 2005 16:08, Simon Kitching wrote:

> Hi Markos,
>
> On Mon, 2005-05-16 at 14:01 +0300, Markos Charatzas wrote:
> > Is it possible to make a call to 2 different methods under the same
> > pattern?
>
> It depends. The *calls* will be made, but there is a design flaw in the
> way that CallMethodParam interacts with CallMethodRule that makes things
> tricky when using multiple "interlaced" CallMethodRules.
>
> If one of the calls is made using no parameters, or just one parameter
> being the body of the method, ie
>   digester.addCallMethod(pattern, methodname)
> or
>   digester.addCallMethod(pattern, methodname, 0)
> then I *think* the answer is yes (because no CallParamRule is being used
> for that call).
>
> If both calls have associated CallMethodRule instances, then I *think*
> you'll find that the params get mixed up. The problem is that there is
> just one "param stack", and that CallParamRule objects always work on
> the set of params on top of the param stack, rather than knowing which
> CallMethodRule they are supposed to be associated with.
>
> Please note that I'm not absolutely certain on this; it's been a while
> since I looked at CallMethodRule/CallParamRule.
>
> Regards,
>
> Simon
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]