Re: deployment question

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Nov 02 2005 - 03:26:52 EST

  • Next message: Jürgen Saar: "Re: auto class generated by 1.2M6 gets compile warning"

    Hi Sabiha,

    This advice is obsolete and no longer works, I need to update this
    chapter in the user guide. Currently *.driver.xml file is looked up
    using the same exact algorithm that is used to locate cayenne.xml
    (normally that would be in CLASSPATH).

    While the advice is no longer applicable, its premises are still valid:

    1. Keeping password in a plain-text file shipped with application is
    bad security.
    2. There should be an easy way to point an application to a different
    database during deployment.

    The most straightforward solution for web applications is to use
    JNDI. With standalone GUI applications I usually create a database
    login dialog that is popped up on first attempt to use Cayenne. We
    have a bit of advice on how to implement it:

    http://objectstyle.org/confluence/display/CAY/Setting+Database
    +Connection

    But I usually go with a custom DataSourceFactory (it is mentioned in
    the article above, but with no details). Having your own
    DataSourceFactory to pop up a login dialog guarantees that it will be
    done at the right moment. After first login you may choose to store
    entered information in user preferences on client machine (see
    java.util.pref package) and do automatic login on subsequent logins.

    Whatever way you choose to implement the login ultimately depends on
    your requirements, I am just outlining some of the options. Hope this
    helps.

    Andrus

    On Nov 2, 2005, at 1:29 AM, sabiha wrote:
    > Hello!
    >
    > I have a question about Java standalone application
    > deployment.
    > I created jar file with all configuration xml files in
    > root of this jar and it works fine. But what I want is
    > to create jar file without data source file. I read in
    > Cayenne documentation that it is recommended and easy
    > to do. One of solutions is that location of this file
    > be a file relative to the user HOME directory. So, my
    > question is what I need to do to make this work in
    > this way?
    > (I have any experience in deploying Java applications)
    >
    > Thanks in advance!
    >
    > Sabiha



    This archive was generated by hypermail 2.0.0 : Wed Nov 02 2005 - 03:26:57 EST