geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lasantha Ranaweera <lasan...@opensource.lk>
Subject Re: How to Access Geronimo Resources from a Web Application?
Date Wed, 20 Sep 2006 05:51:15 GMT
Hi Aaron,

I want to test the existing db connections in the Geronimo with the help 
of a web application. Following code  helped me to list the resource 
adapters in the server. Now my problem is how to identify which are the  
db connection adapters and convert them in to javax.sql.DataSource.

Kernel kernel = KernelRegistry.getSingleKernel();
       
        Set list = kernel.listGBeans(new 
AbstractNameQuery(ResourceAdapter.class.getName()));
        for(Iterator iterator = list.iterator();iterator.hasNext();){
            AbstractName name = (AbstractName)iterator.next();
           
            ResourceAdapter ra = 
(ResourceAdapter)(kernel.getProxyManager().createProxy(name, 
ResourceAdapter.class));
           
            //How to indentify is this ra is DataSource or not
           
        }

Any help would be appreciated. If this is can be done better way than 
this please let me know too.
Thanks,
Lasantha Ranaweera

Aaron Mulder wrote:
> In Geronimo 1.1, you can use a gbean-ref to map the J2EEServer into
> the web application's JNDI space.  From the J2EEServer, you can
> navigate to a list of resource adapters (J2EE Connectors), and I think
> there's a way to check which connection factory interface they
> implement (you'd want javax.sql.DataSource).  There's probably a
> method in KernelManagementHelper that more or less does that (given a
> server get database connection pools) if you want something to refer
> to.
>
> Please write back if you need help with the details.
>
> Thanks,
>     Aaron
>
> On 9/18/06, Lasantha Ranaweera <lasantha@opensource.lk> wrote:
>> Hi All,
>>
>> I want get the list of database connections deployed in the Geronimo
>> from a web application. Any help would be appreciated.
>>
>> Thanks,
>> Lasantha Ranaweera
>>
>


Mime
View raw message