I don't understand how to make <call-param-rule> work for parsing a
simple set of properties in to a Hashtable. Here's an example of my
data:
<environment>
<property name="prop1" value="value1"/>
<property name="prop2" value="value2"/>
</environment>
I have tried two approaches to push the parameters on to the stack, but
logger output shows that <call-param-rule> is never fired. Instead
<call-method-rule> is fired and it calls the put( ) method with two
nulls!
Approach 1:
<pattern value="property">
<call-method-rule methodname="put" paramcount="2">
<call-param-rule param-index="0" attribute-name="name"/>
<call-param-rule param-index="1" attribute-name="value"/>
</call-method-rule>
</pattern>
Approach 2:
<pattern value="property">
<call-param-rule param-index="0" attribute-name="name"/>
<call-param-rule param-index="1" attribute-name="value"/>
<call-method-rule methodname="put" paramcount="2"/>
</pattern>
Looking at the DigesterRuleParser source code (release 1.3), I don't see
how <call-param-rule> will ever be called. Note below that
CallParamRuleFactory never returns a CallParamRule - it always returns a
CallMethodRule!
protected class CallParamRuleFactory extends
AbstractObjectCreationFactory {
public Object createObject(Attributes attributes) {
// create callmethodrule
int paramNumber =
Integer.parseInt(attributes.getValue("paramnumber"));
String methodName = attributes.getValue("attrname");
Rule callMethodRule = new CallMethodRule(targetDigester,
methodName,
paramNumber);
return callMethodRule;
}
}
Please help
Naresh Bhatia