On 30 Jan, Marc T. Calello wrote:
> 
> Thanks Peter and Toby,
> 
> I am still learning this whole JCA spec, so thanks for bearing with me.  I
> am still bewildered about
> one thing:
> 
>> > What do you mean by "ConnectionFactoryImpl"?
>>
>> He means JdbcDataSource, but has not understod that it is a
>> ConnectionFactory.
> 
> I meant the ResourceAdapter specific implementation of
> javax.resource.cci.ConnectionFactory.
> Shouldn't I be able to cast whatever is returned from JNDI to a
> javax.resource.cci.ConnectionFactory,
> and assume it implements that interface?  ie,


Nop. javax.resource.cci.ConnectionFactory is a generic client api for
clients that wants to follow the javax.resource.cci.ConnectionFactory.
An adapter may chose not to implement it. Since you will allways have to
cast the returned handle, you will have to know whar sort of factory you
are working against, and then you can cast it to the correct one.

If you look into blackbox.xml yoy will see:

This is the one to cast to in jndi:

 <connectionfactory-interface>javax.sql.DataSource</connectionfactory-int
erface>

This is the implementing class:


        <connectionfactory-impl-class>com.sun.connector.blackbox.JdbcDataSource<
/connectionfactory-impl-class>

This is the interface of the returned handle:

        <connection-interface>java.sql.Connection</connection-interface>

This is the implementing class for handle:
        <connection-impl-class>com.sun.connector.blackbox.JdbcConnection</connec
tion-impl-class>


ie:
/ Application Component/Client Code
obtain the initial JNDI context
Context initctx = new InitialContext();
// perform JNDI lookup to obtain connection factory
 javax.sql.DataSource cxf =
        (javax.sql.DataSource)initctx.lookup("java:comp/env/blackbox);
java.sql.Connection cx = cxf.getConnection();

//Peter

> 
> --------------- JCA 1.0 Final Public Draft, section
> 10.5 ---------------------------
> // Application Component/Client Code
> obtain the initial JNDI context
> Context initctx = new InitialContext();
> // perform JNDI lookup to obtain connection factory
> javax.resource.cci.ConnectionFactory cxf =
> (javax.resource.cci.ConnectionFactory)initctx.lookup("java:comp/
> env/eis/MyEIS");
> javax.resource.cci.Connection cx = cxf.getConnection();
> ----------------------------------------------------------------------------
> ----------
> 
> The fact that JdbcDataSource does not implement the ConnectionFactory
> interface is what I do not understand.
> 
> *****************************
> Marc T. Calello
> Momentum Software, Inc.
> 1717 W. 6th Street; Ste. 300
> Austin, TX 78703
> [EMAIL PROTECTED]
> http://www.momentumsoftware.com
> Phone: (512) 236-1517
> Fax: (512) 236-1267
> *****************************
> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]]On Behalf Of Peter Antman
>> Sent: Tuesday, January 30, 2001 2:07 AM
>> To: [EMAIL PROTECTED]
>> Subject: Re: [jBoss-User] RARDeployer and JCA 1.0
>>
>>
>> On 30 Jan, Toby Allsopp wrote:
>> > "Marc T. Calello" wrote:
>> >>
>> >> I believe that the JCA spec changed since the BlackBox sample
>> >> ResourceAdapter
>> >> was implemented.  According to JCA 1.0 section 5.4.1.
>> >> I should deploy and EJB with a ResourceReference tag that
>> >> refers to the specific ConnectionFactory implemetation
>> >> class for my RAR.  Then, I can perform a JNDI lookup on that
>> >> ConnectionFactory, and use it to actually get a connection to
>> >> my EIS.  With that said, will the RARDeployer still behave the same?
>> >
>> > What change are you referring to? When you say JCA 1.0, do you mean the
>> > public final draft?
>> >
>> >> I notice that when I perform a JNDI lookup on java:/BlackBoxDS
>> what I get
>> >> back is
>> >> an instance of a com.sun.connector.blackbox.JdbcDataSource, I
>> was expecting
>> >> to get back
>> >> some sort of ConnectionFactoryImpl.  Or do I get the
>> ConnectionFactoryImpl
>> >> back after
>> >> I have deployed an EJB that references the ConnectionFactory?
>> >
>> > You get back whatever object the resource adapter returns from
>> > ManagedConnection.getConnection(). This should compatible with the type
>> > you specified in your <res-type> tag, but I don't think this is enforced
>> > in JBoss (and you're not using the java:comp/env namespace anyway).
>>
>> That does not sound as correct behaviour. The ConnectionFactory (its
>> implementation, ie JdbcDataSource - which is what you get in the exmple
>> abovem in the case of blackbox) should be bound to JNDI. Basically whats
>> bound in JNDI is what is returned from
>> ManagedConnectionFactory.createConnectionFactory()
>>
>> Toby slipped in his answer, but has made a correct implementation.
>>
>> The client looks up the factory and uses it to get a connection handle,
>> in the case of blackbox this means JdbcConnection.
>>
>>
>> >
>> > What do you mean by "ConnectionFactoryImpl"?
>>
>> He means JdbcDataSource, but has not understod that it is a
>> ConnectionFactory.
>>
>>
>> //Peter
>> >
>> > Toby.
>> >
>> >
>> > --
>> > --------------------------------------------------------------
>> > To subscribe:        [EMAIL PROTECTED]
>> > To unsubscribe:      [EMAIL PROTECTED]
>> > List Help?:          [EMAIL PROTECTED]
>>
>> --
>> Jobba hos oss: http://www.tim.se/weblab
>> ------------------------------------------------------------
>> Peter Antman          Technology in Media, Box 34105 100 26 Stockholm
>> Systems Architect     WWW: http://www.tim.se
>> Email: [EMAIL PROTECTED]       WWW: http://www.backsource.org
>> Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942
>> ------------------------------------------------------------
>>
>>
>>
>> --
>> --------------------------------------------------------------
>> To subscribe:        [EMAIL PROTECTED]
>> To unsubscribe:      [EMAIL PROTECTED]
>> List Help?:          [EMAIL PROTECTED]
>>
>>
> 
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]

-- 
Jobba hos oss: http://www.tim.se/weblab
------------------------------------------------------------
Peter Antman             Technology in Media, Box 34105 100 26 Stockholm
Systems Architect        WWW: http://www.tim.se
Email: [EMAIL PROTECTED]  WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 
------------------------------------------------------------



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to