2015-01-30 13:51 GMT+03:00  <rj...@apache.org>:
> Author: rjung
> Date: Fri Jan 30 10:51:01 2015
> New Revision: 1655982
>
> URL: http://svn.apache.org/r1655982
> Log:
> Enhance our naming BeanFactory.
>
> If a bean property exists which the Introspector
> presents us with a type that we don't have a
> string conversion for, but the bean actually
> has a method to set the property from a string,
> allow to provide this information to the
> BeanFactory.
>
> New attribute "forceString" taking a comma separated
> list of items as values. Each item is either a bean
> property name (e.g. "foo") meaning that there is a
> setter function "setFoo(String)" for that property.
> Or the item is of the form "foo=method" meaning that
> property "foo" can be set by calling "method(String)".
>
> This should make writing a custom bean factory
> obsolete in quite a few cases.


Maybe do this without any configuration?

It is our own code in org.apache.naming.factory.BeanFactory that
performs the value assignment. There is a case that happens when the
property cannot be assigned,

[[[
                                throw new NamingException
                                    ("String conversion for property "
+ propName +
                                     " of type '" + propType.getName() +
                                     "' not available");
]]]

1) We can look for a java.beans.PropertyEditor
(PropertyEditorManager.findEditor())

2) We can look for setter(String) method, like your new code does.


Your code allows to use any arbitrary method as a setter. I think that
if a custom name is needed, one can just rename the XML attribute one
is using for the property.

Best regards,
Konstantin Kolinko

> Concrete use case was tibco TibjmsConnectionFactory
> which has an attribute SSLIdentity detected by
> Introspector as byte[] but which can be set by
> setSSLIdentity(String). Existing BeanFactory throws
> NamingException.
>
> Backport of r1655312, r1655438, r1655441 and
> r1655454 from trunk resp. r1655445 and r1655467
> from TC8.
>
> Backport slightly adjusted for Java 6 support.
>
> Modified:
>     tomcat/tc7.0.x/trunk/   (props changed)
>     tomcat/tc7.0.x/trunk/java/org/apache/naming/factory/BeanFactory.java
>     tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>     tomcat/tc7.0.x/trunk/webapps/docs/jndi-resources-howto.xml
>

[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to