cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: Implemented merging multiple configurations into a single runtime stack
Date Mon, 16 May 2011 12:59:09 GMT
It sounds like the configurations need to be known up-front?  So you
can't do a runtime.addConfiguration(...) later?  Otherwise, sounds
nice!

Thanks,

mrg


On Sun, May 15, 2011 at 7:04 AM, Andrus Adamchik <andrus@objectstyle.org> wrote:
> It took a few years of pondering and a few hours to write the actual code. So now a use
can do something like this:
>
> String[] configs = new String[] { "cayenne-x.xml", "cayenne-y.xml", "cayenne-z.xml"};
> ServerRuntime runtime = new ServerRuntime(configs);
>
> The merge rules, as documented in Javadocs for DefaultDataChannelDescriptorMerger are:
>
> The general rule of merge is that the order of descriptors on the merge list matters.
If there are two conflicting metadata objects belonging to two descriptors, an object from
the last descriptor takes precedence over the object from the first one. This way it is easy
to override pieces of metadata. This is also similar to how DI modules are merged in Cayenne.
So this is how the merge works:
>  * Merged descriptor name is the same as the name of the last descriptor on the merge
list.
>  * 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.
>  * If there are two or more DataMaps with the same name, only one DataMap is placed
in the merged descriptor, the rest are discarded. DataMap with highest index in the descriptor
array is chosen per precedence rule above.
>  * If there are two or more DataNodes with the same name, only one DataNodes is placed
in the merged descriptor, the rest are discarded. DataNodes with highest index in the descriptor
array is chosen per precedence rule above.
>
> Of course none of that would have been easy without DI container and simplifying the
project structure to just one domain per project. Anyways, time for 3.1M3, and IMO the Beta
is already on the horizon.
>
> Andrus

Mime
View raw message