Author: aadamchik
Date: Thu Mar 8 13:01:33 2012
New Revision: 1298377
URL: http://svn.apache.org/viewvc?rev=1298377&view=rev
Log:
docbook - project merge rules
Modified:
cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultDataChannelDescriptorMerger.java
Modified:
cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml?rev=1298377&r1=1298376&r2=1298377&view=diff
==============================================================================
---
cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
(original)
+++
cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
Thu Mar 8 13:01:33 2012
@@ -48,6 +48,46 @@ ServerRuntime runtime =
"org/foo/cayenne-library2.xml"
}
);</programlisting>
+ <para>When the projects are merged, the following rules are
applied:<itemizedlist>
+ <listitem>
+ <para>The order of projects matters
during merge. If there are two conflicting
+ metadata objects belonging to
two projects, an object from the <emphasis
+
role="italic">last</emphasis> project takes precedence over the object
+ from the first one. This makes
possible to override pieces of metadata. This
+ is also similar to how DI
modules are merged in Cayenne.</para>
+ </listitem>
+ <listitem>
+ <para>Runtime DataDomain name is set to
the name of the last project in the
+ list.</para>
+ </listitem>
+ <listitem>
+ <para>Runtime DataDomain properties are
the same as the properties of the last
+ project in the list. I.e.
<emphasis role="italic">properties are not
+ merged</emphasis> to
avoid invalid combinations and unexpected runtime
+ behavior.</para>
+ </listitem>
+ <listitem>
+ <para>If there are two or more DataMaps
with the same name, only one DataMap is
+ used in the merged project, the
rest are discarded. Same precedence rules
+ apply - DataMap from the
project with the highest index in the project list
+ overrides all other DataMaps
with the same name.</para>
+ </listitem>
+ <listitem>
+ <para>If there are two or more
DataNodes with the same name, only one DataNodes
+ is used in the merged project,
the rest are discarded. DataNode coming from
+ project with the highest index
in the project list is chosen per precedence
+ rule above.</para>
+ </listitem>
+ <listitem>
+ <para>There is a notion of "default"
DataNode. After the merge if any DataMaps
+ are not explicitly linked to
DataNodes, their queries will be executed via a
+ default DataNode. This makes it
possible to build mapping "libraries" that
+ are only associated with a
specific database in runtime. If there's only one
+ DataNode in the merged project,
it will be automatically chosen as default.
+ A possible way to explicitly
designate a specific node as default is to
+ override
<code>DataDomainProvider.createAndInitDataDomain()</code>.</para>
+ </listitem>
+ </itemizedlist></para>
</section>
<section xml:id="webapps">
<title>Web Applications</title>
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultDataChannelDescriptorMerger.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultDataChannelDescriptorMerger.java?rev=1298377&r1=1298376&r2=1298377&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultDataChannelDescriptorMerger.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultDataChannelDescriptorMerger.java
Thu Mar 8 13:01:33 2012
@@ -30,9 +30,8 @@ import org.apache.commons.logging.LogFac
* override pieces of metadata. This is also similar to how DI modules are
merged in
* Cayenne. So this is how the merge works:
* <ul>
- * <li></li>
* <li>Merged descriptor name is the same as the name of the last descriptor
on the merge
- * list.</li> *
+ * list.</li>
* <li>Merged descriptor properties are the same as the properties of the last
descriptor
* on the merge list. I.e. properties are not merged to avoid invalid
combinations and
* unexpected runtime behavior.</li>