RE: Configuring Basic Servlet Config

From: Scott Finnerty (scot..odefuey.com)
Date: Tue Nov 18 2003 - 10:55:20 EST

  • Next message: Eric Schneider: "Re: Configuring Basic Servlet Config"

    Actually I was a little off - you can just use the context parameter -
    BasicServletConfiguration will look for that, assuming you provide the
    ServletContext. The listener is good for a Servlets 2.3+ environment (e.g.,
    Tomcat 4.x+) instead of an initialization servlet.

    Scott

    -----Original Message-----
    From: Scott Finnerty [mailto:scot..odefuey.com]
    Sent: Tuesday, November 18, 2003 9:46 AM
    To: cayenne-use..bjectstyle.org
    Subject: RE: Configuring Basic Servlet Config

    You can use org.objectstyle.cayenne.conf.WebApplicationListener as a context
    listener which will look for a context parameter to add to the path for
    configuration files. It will also initialize the configuration when the
    context is started.

    In your web.xml, add

            <context-param>
                    <param-name>cayenne.configuration.path</param-name>
                    <param-value>/working</param-value>
            </context-param>

    and

        <listener>
            <listener-class>
                    org.objectstyle.cayenne.conf.WebApplicationListener
              </listener-class>
        </listener>

    I don't have anything to offer on the JNDI datasource w/o authentication
    credentials... sorry.

    Another question that has been asked on the list (not necessarily in
    relation to web apps) is how to use an existing commons/log4j configuration
    instead of the cayenne canned one. I extended BasicServletConfiguration and
    overrode "configureLogging()" with an empty implementation and then extended
    WebApplicationListener and overrode "newConfiguraton(ServletContext)" to
    return my own BasicServletConfiguration. Then instead of the cayenne
    WebApplicationListener, I configured for my extension.

    Scott

    -----Original Message-----
    From: Kevin Dahlhausen [mailto:kdahlhau..ahoo.com]
    Sent: Tuesday, November 18, 2003 9:02 AM
    To: cayenne-use..bjectstyle.org
    Subject: Configuring Basic Servlet Config

    Cayenne is great! I'm pushing hard to have it replace our in-house
    database abstraction library. One area that is causing trouble though
    is that I'm having trouble configuring a non-default location of
    cayenne.xml. Our standards dictate that the file should be in working:

    webApplication
          |
          |
          +-- WEB-INF
          |
          +-- working
                 |
                 +-- cayenne.xml

    After trying all kinds of permuations of addClassPath and
    FileConfiguration, I've not been able to have cayenne locate the
    file.

    I'm using BasicServletConfiguration.

    in the servlet's init:

            DefaultConfiguration conf =
    BasicServletConfiguration.initializeConfiguration(config.getServletContext()
    );
            conf.addClassPath("../working");

    Could anyone steer me in the right direction on this?

    Also, is there any way to use a JNDI data source that is not
    pre-configured with a username and password? That is to pass the user
    name and password when a connection is created? If not, that is
    something I'll be adding if this goes through.

    Thanks.

    =====
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Kevin Dahlhausen 'Do' or 'do not.' There is no 'Try.'
     http://members.nccw.net/kdahlhaus/ -Yoda

    __________________________________
    Do you Yahoo!?
    Protect your identity with Yahoo! Mail AddressGuard
    http://antispam.yahoo.com/whatsnewfree



    This archive was generated by hypermail 2.0.0 : Tue Nov 18 2003 - 10:55:32 EST