Re: One application, multiple models

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jul 15 2006 - 23:51:43 EDT

  • Next message: Jean T. Anderson: "Re: Web site update"

    Runtime stack supports what you are describing, but the stack loading
    mechanism (Configuration, ConfigLoaderDelegate, RuntimeLoadDelegate)
    does not at the moment. We are planning to improve this soon [1]. But
    you can still achieve this in a number of ways.

    For instance you can subclass DefaultConfiguration, overriding
    "initialize" to load multiple cayenne.xml files available on
    classpath (ClassLoader.getResources("cayenne.xml")) and merging them
    together by domain name.

    Now answering your specific questions...

    > 1. Is there only one cayenne.xml file permitted per executable?

    Yes, only if you use DefaultConfiguration, but you can subclass it
    and override the loading logic (see above).

    > 2. Can I hand-edit cayenne.xml to reference various nodes and maps
    > in various projects?

    Absolutely.

    > 3. What will happen if cayenne.xml references 5 nodes in 5 distinct
    > projects, but only 3 of those projects are linked into an application?

    IIRC failed pieces do not generate an exception. They are simply
    logged and can be accessed via Configuration.getLoadStatus().

    Andrus

    [1] http://objectstyle.org/confluence/display/CAY/3.0+Wish+List

    On Jul 15, 2006, at 4:13 PM, Randy Leonard wrote:

    > It seems Cayenne requires one holistic model for an application
    > (e.g. one Cayenne.xml file). Is this true? Can I break up the
    > model into multiple sub-models (e.g. nodes and maps) and distribute
    > throughout my class library?
    >
    > For example, my architecture consists of multiple Eclipse projects
    > (e.g. foundation, various business logic domains, user interface,
    > etc.), most of which require their own model. These projects are
    > subsequently combined as required to form executables.
    >
    > EOF had let me divide my model as required, and it would be
    > dynamically combine the sub-models into a larger holistic models as
    > it located them within the runtime. I would like to do something
    > similar here.
    >
    > So some questions:
    > 1. Is there only one cayenne.xml file permitted per executable?
    > 2. Can I hand-edit cayenne.xml to reference various nodes and maps
    > in various projects?
    > 3. What will happen if cayenne.xml references 5 nodes in 5 distinct
    > projects, but only 3 of those projects are linked into an application?
    >
    > On the latter point, I understand the need to ensure cross-model
    > relationships do not introduce "class not found" errors. But any
    > other concerns?
    >
    > Thanks,
    > Randy
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Jul 15 2006 - 23:52:23 EDT