Hi,
According to:
14.4.3 Container provider responsibility
of EJB Spec 1.1,
Container must allow the bean to perform explicit programmatic sign-on
using the resource managers's API.
What does this mean?
As far as I know, if
<resource-ref>
<res-ref-name>jdbc/TestDs</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
is specified for some bean in the deployment descriptor, such a bean is
allowed to use only
DataSource.getConnection(String username, String password)
This means that the bean cannot retrieve the Connection by
DataSource.getConnection()
Assuming that this is true, the current implementation of ObjectFactory
for ConnectionManager (DataSourceFactory) does not comply with the Spec.
It always returns the ConnectionManager with the password.
How DataSourceFactory can return the appropriate ConnectionManager?
In 'preinvoke()' of both JBeanHome and JBean, we have a chance to set
BeanDescriptor as the ThreadLocal variable. Based on the BeanDescriptor,
DataSourceFactory can determine whether to set the password or not.
I attached the source code for this solution.
After extracted, you will find my modified source files under the
directory of 'modified_src'.
The code fragments between:
//Start:Jun Inamori (For authentication of DataSource)
//End:Jun Inamori (For authentication of DataSource)
are required for this.
PS:
I've posted the patch for this problem around 2000/05/24, but at that
time, BeanDescriptor was passed to DataSourceFactory via the Context.
This was not good solution.
--
Happy Java programming!
Jun Inamori
E-mail: [EMAIL PROTECTED]
URL: http://www.oop-reserch.com
jonas_patch.zip