tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: context factories
Date Tue, 03 Apr 2001 18:01:25 GMT

On Tue, 3 Apr 2001, Torgeir Veimo wrote:

> I've read in a post by Remy with subject: "Re: <ejb-ref> <ejb-link>
> Implementation in 4.0.b1",
> that the only
> two factories supported in tomcat right now is one for getting Tyrex
> managed data sources & User Transactions.

This message is actually out of date now.  There are also default
factories to create javax.mail.Session and
javax.mail.internet.MimePartDataSource as well.

> I'm interested in getting a resource factory that I've created myself to
> reuse jndi context's to an LDAP database that is used for authentication
> & more.
> I've created a ContextPool that handles this, and I want to retrieve
> this with initCtx.lookup("java:comp/env/jndi/ContextPool");
> How do I create and add the necessary resource factory? Should I modify
> ?

If you don't mind specifying the resource factory class yourself, you
don't need to modify any code at all -- just configure it in server.xml
like this:

  <Context path="/myapp" ... >
    <Resource name="jndi/ContextPool"
    <ResouceParams name="jndi/ContextPool">

where "com.mycompany.ContextPoolFactory" is a class that implements
javax.naming.spi.ObjectFactory.  You can use the existing factories as
examples of how such factories can access the declared resource parameters
and use them to configure the object itself.

> Any hints appreciated.
> -- 
> - Torgeir

Craig McClanahan

View raw message