Re: Custom Configuration Question

From: Dov Rosenberg (dov.rosenber..onviveon.com)
Date: Mon Jan 16 2006 - 22:41:19 EST

  • Next message: Dov Rosenberg: "Custom Primary Key generation"

    Thanks a lot. When we get our factory done I will post some sample code for
    everyone to see.

    On 1/16/06 10:04 PM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:

    >
    > On Jan 16, 2006, at 9:47 PM, Dov Rosenberg wrote:
    >> Is there some type of delegate class we can register or some type
    >> of event
    >> notification we can react to so that we can set our parameters?
    >
    > DataSourceFactory interface itself can be viewed as such a delegate.
    > Cayenne instantiates concrete implementation specified in the
    > Modeler. It's up to you what this implementation does (e.g.
    > internally it can further delegate to JNDIDataSourceFactory or
    > DriverDataSourceFactory). This is very flexible - my own custom
    > implementations ranged from reading local preferences to popping up
    > Swing authentication dialog.
    >
    > Some more details - as you probably noticed, "DataSource Factory"
    > dropdown in the Modeler allows you to type your own subclass in
    > addition to the two choices. If you do so, a "Location Hint" field
    > appears below - this is the String that will be passed to your custom
    > factory in "getDataSource" method - your custom implementation is
    > free to interpret it.
    >
    >
    >> Question: For the DriverDataSourceFactory is there a way to provide
    >> the
    >> params such as driver class, URL, userid, passwd? It looks like
    >> there is
    >> some sort of XML file but I could not find the required format.
    >
    > Yes, there is an XML file created by the Modeler when you save your
    > project. Here is a sample:
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <driver project-version="1.1" class="org.postgresql.Driver">
    > <url value="jdbc:postgresql://localhost:5432/db"/>
    > <connectionPool min="1" max="4" />
    > <login userName="user" password="pass"/>
    > </driver>
    >
    > But for maximum flexibility I'd go with your own factory to stay
    > independent from possible future Cayenne DTD changes.
    >
    > Andrus
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Jan 16 2006 - 22:41:28 EST