Cayenne configuration (attempt #2)

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Mar 05 2002 - 22:31:06 EST

  • Next message: Shengaout, Michael: "Packages, datamaps and class generation"

    Per our phone discussion with Misha, here is a plan on how Cayenne
    configuration should look like:

    1. Project file - GUI support only, no role in deployment (details to be
    defined)

    2. Domain XML file(s) (see sample in the bottom of this message, and a
    CVS version at cayenne/doc/cayenne.xml) - deployed with the application
    in standard location. File URI is preset : "cayenne.xml". Lookup for
    this file is performed in CLASSPATH (for example it can be in a root of
    a JAR file). No lookup in current directory, or user home directory,
    etc. is performed, since this location must be portable for any kind of
    deployment.

    3. Map XML file(s) - deployed with the application. Location is
    determined from Domain file. Lookup is done the same way domain lookup
    is done (via CLASSPATH using ClassLoader)

    4. Data node XML resource(s) (usually a file) - these are NOT deployed
    with application. Rather an application needs a way to find them. This
    is done using 2 pieces of information - relative location string in
    domain file and factory class name. Instantiated factory class will know
    how to read node configuration using location string. At the moment we
    are planning to implement NodeJNDIFactory (resolves path via JNDI
    context provided by container), and NodeFileFactory (resolves path
    relative to known locations - current directory, user home directory,
    CLASSPATH - good for deployments without a container, like standalone
    applications). Final names and packages of the factory classes are yet
    to be determined.

    This way datanodes (or rather their datasources) will be provided by
    deployment environment (either a webapplication container or just a
    server where the code is deployed). Deployment configuration is minimal,
    and is not affected by development changes and new releases.

    ... finally we got a plan ... :-)

    ======================================
    <?xml version="1.0" encoding="utf-8"?>

    <!-- sample domain config file. -->
    <datadomains>
    <domain name="domain1">
         <map name="m11" location="m11.xml"/>
         <map name="m12" location="dir/m12.xml"/>

         <!-- DataNode connection information is taken from the XML file -->
         <node name="dn11"
               location="n11.xml"
               factory="org.objectstyle.cayenne.access.NodeFileFactory">
             <map name="m11"/>
         </node>

         <!-- DataNode connection information is resolved via JNDI -->
         <node name="dn12"
               location="nodes/n11"
               factory="org.objectstyle.cayenne.access.NodeJNDIFactory">
              <map name="m12"/>
         </node>
    </domain>
    <domain name="domain2">
         <map name="m21" location="m11.xml"/>
         <map name="m22" location="dir/m12.xml"/>

    <!-- DataNode connection information is taken from the XML file -->
        <node name="dn21"
              location="n21.xml"
              factory="org.objectstyle.cayenne.access.NodeFileFactory">
             <map name="m21"/>
        </node>
    <!-- DataNode connection information is resolved via JNDI -->
        <node name="dn22"
              location="nodes/n22"
              factory="org.objectstyle.cayenne.access.NodeJNDIFactory">
             <map name="m22"/>
         </node>
    </domain>
    </datadomains>

    -- 
    ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
    - Andrei (a.k.a. Andrus) Adamchik
    http://objectstyle.org
    email: andrus at objectstyle dot org
    



    This archive was generated by hypermail 2.0.0 : Tue Mar 05 2002 - 22:43:22 EST