Re: Extrapolation of DB structure analisys

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Nov 20 2003 - 13:04:58 EST

  • Next message: Andrus Adamchik: "New feature - Distributed Events [Was: EventSubject implementation]"

    On Nov 20, 2003, at 4:55 AM, antonio-petrell..libero..it wrote:

    > I noticed that inside Cayenne Modeler there is a powerful mechanism to
    > capture
    > the database schema. I would like to extrapolate this feature into a
    > separate
    > library to be used in other cases (i.e. I need to write an XML file
    > that
    > represents the captured schema) and then submit it to you.
    > Have you got anything to tell about this, such as package names,
    > reccomendations, etc.? Everything is appreciated.
    > Regards
    > Antonio Petrelli

    Hi Antonio,

    On Cayenne side of things the API to get DB metadata is fairly
    straightforward. Look at DbLoader class:

         
    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    access/DbLoader.html

    It has no UI dependencies and can be embedded in other applications. In
    constructor it requires access to Cayenne DbAdapter which abstracts the
    differences in metadata handling between the databases. Also it takes a
    DbLoaderDelegate parameter that is being notified of the reverse
    engineering process, and is consulted about certain steps:

        
    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    access/DbLoaderDelegate.html

    The only currently existing delegate implementation is an inner class
    of GUI ImportDBAction (writing your own should be very easy):

        
    http://objectstyle.org/cayenne/api/modeler/org/objectstyle/cayenne/
    modeler/action/ImportDbAction.html

    When you do reverse engineering, DbLoader produces an instance of
    DataMap - a Cayenne representation of the schema. This is just a tree
    of objects, so it should be easy to save in whatever format you desire.
    Cayenne saves it to the XML format you may have seen already. If you
    need another format, you can implement it too.

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu Nov 20 2003 - 13:05:08 EST