Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aperi-dev] Fw: jndi


This is the pertinent analysis for the JNDI item on today's design meeting agenda...

Dave Wolfe/Portland/IBM (dwolfe@xxxxxxxxxx) TL: 775-3376 Office: 503-578-3376 Personal: 503-329-3960

UI Technical Lead, Aperi Open Source Storage Management http://www.eclipse.org/aperi

"A good composer does not imitate; he steals." - Igor Stravinsky

 
----- Forwarded by Dave Wolfe/Portland/IBM on 04/25/2007 05:26 AM -----

Rodica Ciurea/Romania/Contr/IBM@IBMRO

04/25/2007 05:06 AM

To
Dave Wolfe/Portland/IBM@IBMUS
cc
Subject
jndi






Hello Dave,

I configured the embedded Jetty to use jndi by using classes from the org.mortbay.jetty.plus jar created from jetty-5.1.11.jar and xapool.jar that contains some org.enhydra.jdbc.* packages:

                        DefaultDataSourceService dss = new DefaultDataSourceService();
                        dss.setName("DataSourceService");
                        //StandardConnectionPoolDataSource cpds = new StandardConnectionPoolDataSource();
                        //cpds.setUrl(url);
                        //cpds.setUser(user);
                        //cpds.setPassword(password);
                        DBConnPoolDataSource cpds = DBConnPoolDataSource.getInstance();
                        cpds.initialize(driver, url, schema, user, password, poolMax);
                        DataSource ds =dss.addConnectionPoolDataSource("jdbc/aperi", cpds);
                        server.addService(dss);

We can use the defined data source for BIRT, for ReportManager and for the login module and take the db parameters from a single properties file.

This is the setup for using the data source from an application:
                                ncontext = new InitialContext();
                                pooledDataSource = (DataSource)ncontext.lookup("java:comp/env/jdbc/aperi");

I tested first using org.enhydra.jdbc.standard.StandardConnectionPoolDataSource. Then I replaced this class by org.eclipse.aperi.infrastructure.database.DBConnPoolDataSource and it worked. We have still to write our own DataSourceService in order not to use the xapool.jar
From org.mortbay.jetty.plus we can select only the packages we need.

For jndi we work with org.mortbay.jetty.plus.Server that extends org.mortbay.jetty.Server

The web.xml from both aperi-reports and birt-viewer should contain:
<resource-ref>
    <description>
      DataSource (pooling)
    </description>
    <res-ref-name>
      jdbc/aperi
    </res-ref-name>
    <res-type>
      javax.sql.DataSource
    </res-type>
    <res-auth>
      Application
    </res-auth>
  </resource-ref>

The users who create reports have to add the following info into the jndi url field: java:comp/env/jdbc/aperi
and can use any db, user and password during the design. At runtime the jndi parameters configured on the report server will be used.

A power failure occured after our discussion and I could not save the exact items to send. If I missed something, please tell me.

Regards,
Rodica  

Back to the top