Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 64C00200BBF for ; Mon, 14 Nov 2016 22:51:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 63447160B06; Mon, 14 Nov 2016 21:51:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 869CA160AF4 for ; Mon, 14 Nov 2016 22:51:45 +0100 (CET) Received: (qmail 17968 invoked by uid 500); 14 Nov 2016 21:51:44 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 17955 invoked by uid 99); 14 Nov 2016 21:51:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2016 21:51:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9181BC1BC3 for ; Mon, 14 Nov 2016 21:51:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.48 X-Spam-Level: ** X-Spam-Status: No, score=2.48 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gadberry-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Cnb6ETgV1h13 for ; Mon, 14 Nov 2016 21:51:39 +0000 (UTC) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 2AAE15F24C for ; Mon, 14 Nov 2016 21:51:39 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id g23so125530798wme.1 for ; Mon, 14 Nov 2016 13:51:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gadberry-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=3+PrdVK7ZLFBcWpu2LoXXLg5NULdbX7BNa5edqwnNgo=; b=EB+bVJCSj2JD2HR6p7U0YC5kk1LPPtRH4OxlfBqFJ5Gc4av57j+t7FctXAvJ9G7k2S wyxjd1yXsI52aH5kHNL+4JDZ0+khyuE2LAOAWM6G754HDHEHFJa4UDIg0DdeEUACUkSk SsxTb8MLFHLqWpx7vBdVVkBWhZdF2nhR/iU5Rzc/dbGvDJRSUl1iEhiHnEPHYS9IqZuj DNOOlAEOdbtcfSsiPtl+cfH9H4xPG9tOx9TfqInBu+9NfqVA5PPxyynhU9bb0ykmYRnm p/hD41P6rlW7MHPSCKHjG+0YO+5f19De3OK15tCCGLN9OASTwpHunkN40b7mre/sn0MI 2Vmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=3+PrdVK7ZLFBcWpu2LoXXLg5NULdbX7BNa5edqwnNgo=; b=H/9qrLtQ5efGHw74CwNnnXbgRvgKB/p+FxoiCTO29oXtG1zNyKmL7C1rknmT++oqJ5 GpJUZp6/gkyqQI+nuDFbeMXzaGKJxuHD/GuKij02AX/mBhI9CXGQ6SpYGnF/rtDgZ3nA OmLa3PylwtyM/uI8o+e7TUVC1PbggnmZmvs5266UOtftZeKSU6N1CnbIdHq4N++y1rC3 nQqNjPnF5U61RgbFW63HkhXz+vvD4Lp+Qi4FiH+hVoM1TOKFyJJWbAZN/lqC6SE7PFKh Vz8lBGGBOz71cxyRpiXncT/ZjVwnKvMYIDiYJl6NW+cvtjDkOANgkvafJLIwUR/KD8AN Eirg== X-Gm-Message-State: ABUngvfhKH6HnHMpbXSwFzS3bTzR4RVzU1UguJYyPADxF32xd5MHYIETFYbVPDBrpiDAnmXpyhhbi94MaqYKQA== X-Received: by 10.28.211.72 with SMTP id k69mr442966wmg.138.1479160298464; Mon, 14 Nov 2016 13:51:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.180.195 with HTTP; Mon, 14 Nov 2016 13:51:17 -0800 (PST) In-Reply-To: <1c5e5908-ca90-9753-e03b-4b95e17216cf@oliver-heger.de> References: <915346ba-ce6e-866b-c9ad-67b82785a672@oliver-heger.de> <0e1b158f-f97b-e2b1-8d48-672e6409c7e4@pobox.com> <1c5e5908-ca90-9753-e03b-4b95e17216cf@oliver-heger.de> From: Aaron Gadberry Date: Mon, 14 Nov 2016 15:51:17 -0600 Message-ID: Subject: Re: [configuration] Combined Configuration examples To: Commons Users List Content-Type: multipart/alternative; boundary=001a114701062802f0054149d88e archived-at: Mon, 14 Nov 2016 21:51:46 -0000 --001a114701062802f0054149d88e Content-Type: text/plain; charset=UTF-8 Thanks Oliver! On Mon, Nov 14, 2016 at 3:24 PM, Oliver Heger wrote: > Hi Aaron, > > Am 14.11.2016 um 18:38 schrieb Aaron Gadberry: > > Hi All, > > > > A follow up question. Is there a way to view the combined XML? I am > > constantly missing elements not knowing if it is my paths or my original > > files or the combiner. > > what you could do is to copy the combined configuration into a > XMLConfiguration and save this to a file. XMLConfiguration has a > constructor that accepts a hierarchical configuration; so you pass in > the combined configuration. Then the configuration can be saved to file > or dumped to an output stream: > > XMLConfiguration copy = new XMLConfiguration(combined); > FileHandler handler = new FileHandler(copy); > handler.save(new File("target.xml")); > > Oliver > > > > > Thanks, > > > > > > > > On Sun, Nov 13, 2016 at 2:54 PM, Greg Torrance > > wrote: > > > >> Thanks Oliver. > >> > >> I think I understand what you're saying about why Channel 4 would not be > >> included with the OverrideCombiner (if it doesn't exist in > testfile1.xml). > >> I am sorry to hear, though, that attributes are not used at all for > >> matching with OverrideCombiner. If I'm understanding it correctly, that > >> means it can't really be used for overriding just specific list items, > as > >> the entire list would have to be represented, in the same order, in both > >> primary and overriding files, or the wrong list item might be > overridden. > >> (For example, if the primary list had Channels 1, 2, and 3, and the > >> override list had only Channel 2, then it would attempt to override > Channel > >> 1 with the info from Channel 2.) Is my understanding correct? > >> > >> Anyway, I'm going to experiment a bit and try to make sure I have a good > >> understanding of how this works. > >> > >> Thanks again for the help. > >> > >> Greg > >> > >> > >> On 11/13/2016 01:51 PM, Oliver Heger wrote: > >> > >>> Hi Greg, > >>> > >>> Am 13.11.2016 um 18:41 schrieb Greg Torrance: > >>> > >>>> Hi Oliver, > >>>> > >>>> Thanks for the reply. That is helpful! > >>>> > >>>> Hm, it looks as if the examples are partly incorrect. I assume that > >>>>> > >>>> the channel with id="4" should not be part of testfile1.xml, but only > be > >>>> contained in the second file. It should appear in the results of union > >>>> and merge combiner. Does that make sense? > >>>> > >>>> I'm not clear why -- if the channel with id="4" is not contained in > >>>> testfile1.xml -- why it will not end up in the results from all three > >>>> combiners. Why just union and merge and not override, too? > >>>> > >>> On a higher level, OverrideCombiner detects that both files have a list > >>> of channels. Therefore, it copies the first list and ignores the second > >>> one. So the channels element in the first file overrides the one in the > >>> second file. > >>> > >>> As for the attributes, do I understand correctly that the attribute > >>>> values for elements are used, essentially, as "key" values to > >>>> distinguish the various elements for combining purposes? And if the > >>>> values of any attributes of two elements differ, then the elements > would > >>>> be considered different elements for combining purposes? (Said another > >>>> way, if two elements have a set of attributes in common, if the values > >>>> for those common attributes are the same, the elements will be > >>>> considered to match.) Does that make sense? Is that correct? > >>>> > >>> This is true only for MergeCombiner. The other combiners do not try to > >>> match nodes in both configurations based on their attribute values; > they > >>> take two source nodes at the same position in the hierarchy and produce > >>> a result node that has all the attributes of the two source nodes. > >>> > >>> Oliver > >>> > >>> Thanks again for the reply. > >>>> > >>>> Greg > >>>> > >>>> On 11/13/2016 12:05 PM, Oliver Heger wrote: > >>>> > >>>>> Hi Greg, > >>>>> > >>>>> Am 13.11.2016 um 15:07 schrieb Greg Torrance: > >>>>> > >>>>>> Hi all, > >>>>>> > >>>>>> I am trying to work out the precise differences between > >>>>>> OverrideCombiner, UnionCombiner, and MergeCombiner. However, the > >>>>>> examples on this page > >>>>>> (https://commons.apache.org/proper/commons-configuration/use > >>>>>> rguide/howto_combinedconfiguration.html) > >>>>>> > >>>>>> are confusing to me. > >>>>>> > >>>>>> testfile1.xml and testfile2.xml both contain Channels with id="4", > >>>>>> however none of the Combiner Results shows any Channels with id="4". > >>>>>> And the Notes on the right-hand side of the page contain no mention > of > >>>>>> Channel 4. > >>>>>> > >>>>>> Am I missing something? Are the examples correct? > >>>>>> > >>>>> Hm, it looks as if the examples are partly incorrect. I assume that > the > >>>>> channel with id="4" should not be part of testfile1.xml, but only be > >>>>> contained in the second file. It should appear in the results of > union > >>>>> and merge combiner. Does that make sense? > >>>>> > >>>>> What I'm really trying to understand is the impact of attributes in > the > >>>>>> way the various combiners choose to combine elements. (Any pointers > to > >>>>>> further documentation on this would be appreciated.) > >>>>>> > >>>>> Some more information can be found in the Javadocs of the combiner > >>>>> classes: > >>>>> - UnionCombiner states: "Another limitation is the handling of > >>>>> attributes: Attributes can only have a single value. So if two nodes > are > >>>>> to be combined which both have an attribute with the same name, it is > >>>>> not possible to construct a proper union attribute. In this case, the > >>>>> attribute value from the first node is used." > >>>>> > >>>>> - OverrideCombiner has an addAttributes() method with the following > >>>>> documentation: "Handles the attributes during a combination process. > >>>>> First all attributes of the first node are added to the result. Then > all > >>>>> attributes of the second node, which are not contained in the first > >>>>> node, are also added." > >>>>> > >>>>> - The merging behavior of MergeCombiner is also described in its > class > >>>>> documentation. > >>>>> > >>>>> Does this help? > >>>>> Oliver > >>>>> > >>>>> Thoughts? > >>>>>> > >>>>>> Thanks, > >>>>>> Greg > >>>>>> > >>>>>> > >>>>>> ------------------------------------------------------------ > --------- > >>>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >>>>>> For additional commands, e-mail: user-help@commons.apache.org > >>>>>> > >>>>>> ------------------------------------------------------------ > --------- > >>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >>>>> For additional commands, e-mail: user-help@commons.apache.org > >>>>> > >>>>> > >>>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >>>> For additional commands, e-mail: user-help@commons.apache.org > >>>> > >>>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >>> For additional commands, e-mail: user-help@commons.apache.org > >>> > >>> > >>> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >> For additional commands, e-mail: user-help@commons.apache.org > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --001a114701062802f0054149d88e--