[mule-user] Set properties in connector

0 views
Skip to first unread message

Davide Piazza

unread,
Oct 12, 2007, 6:06:51 AM10/12/07
to us...@mule.codehaus.org
Hi
if I have a property in a Connector that has a public setter method that has a Set as parameter object, how can I set that property in the config file?
for example like public void setQueryValueExtractors(Set queryValueExtractors) in JdbcConnector.
I tried  this config

<connector name="JdbcConnector"
        className="org.mule.providers.jdbc.JdbcConnector">
        <properties>
            <container-property name="dataSource"
                reference="WonderlandDataSource" />
            <list name="queryValueExtractors">
                <entry
                    value="com.omnys.mule.util.SystemPropertyExtractor " />
            </list>
           .....

But I have this exception:

ERROR 2007-10-12 11:05:21,154 [main] org.apache.commons.beanutils.PropertyUtils: Method invocation failed.
java.lang.IllegalArgumentException : argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
    at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty (PropertyUtilsBean.java:1759)
    at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
    at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java :1677)
    at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
    at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:313)
    at org.mule.util.BeanUtils.populateWithoutFail (BeanUtils.java:65)
    at org.mule.config.builders.MulePropertiesRuleSet$1.end(MulePropertiesRuleSet.java:95)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement (Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement (Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse (Unknown Source)
    at org.apache.commons.digester.Digester.parse(Digester.java:1685)
    at org.mule.config.builders.AbstractDigesterConfiguration.process(AbstractDigesterConfiguration.java:101)
    at org.mule.config.builders.MuleXmlConfigurationBuilder.configure (MuleXmlConfigurationBuilder.java:264)
    at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:218)
    at org.mule.MuleServer.initialize(MuleServer.java:287)
    at org.mule.MuleServer.run(MuleServer.java:208)
    at org.mule.MuleServer.start(MuleServer.java:196)
    at org.mule.MuleServer.main(MuleServer.java:166)

Thanks
Davide.

Davide Piazza

unread,
Oct 17, 2007, 10:21:58 AM10/17/07
to us...@mule.codehaus.org
Is there anybody who can help on this?

thanks
Davide

2007/10/12, Davide Piazza <davide...@gmail.com>:

Andrew Perepelytsya

unread,
Oct 17, 2007, 11:07:53 AM10/17/07
to us...@mule.codehaus.org
Davide, probably set is not supported (never tried it). If you don't want to mess with Mule 1.x digester rules, I would suggest 2 possible workarounds:
  1. Change the signature to accept List
  2. Configure it in Spring and inject as a container-property in the connector.
Andrew

Holger Hoffstätte

unread,
Oct 17, 2007, 11:24:45 AM10/17/07
to us...@mule.codehaus.org
Davide Piazza wrote:
> if I have a property in a Connector that has a public setter method that
> has a Set as parameter object, how can I set that property in the config
> file?

Unfortunately you cannot. :/
I don't even know why these get/sett methods are there since they cannot
be used in their current form..

> for example like public void setQueryValueExtractors(Set
> queryValueExtractors) in JdbcConnector.
> I tried this config
>
> <connector name="JdbcConnector"
> className="org.mule.providers.jdbc.JdbcConnector">
> <properties>
> <container-property name="dataSource"
> reference="WonderlandDataSource" />
> <list name="queryValueExtractors">
> <entry
> value="com.omnys.mule.util.SystemPropertyExtractor " />
> </list>
> .....

This should be possible but unfortunately the silly Digester cannot map a
List into a Set and keels over. Since this is not accessible through the
config, using a List as API would likely work fine as well (since there is
still the cache for fast runtime lookups) BUT is not the real solution
since you would now override the built-in queryExtractors. :(
IMHO the real solution would be to have built-in and user-supplied
extractors..or did you really want to override the built-in ones?

-h

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Davide Piazza

unread,
Oct 17, 2007, 11:35:29 AM10/17/07
to us...@mule.codehaus.org
Thanks for the responses.
What I would like to do is to add user-supplied extractors to the biuld-in one. This would help me solve this other issue http://www.nabble.com/passing-properties-to-jdbc-endpoint-tf4601121.html#a13136820. Or at least I hope ;)

I never tried configuration injection through spring, but if this may be a workaround I'll try it.

2007/10/17, Holger Hoffstätte <hol...@wizards.de>:
Reply all
Reply to author
Forward
0 new messages