From user-return-21473-apmail-commons-user-archive=commons.apache.org@commons.apache.org Tue Jul 08 20:44:38 2008 Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 27048 invoked from network); 8 Jul 2008 20:44:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Jul 2008 20:44:37 -0000 Received: (qmail 48014 invoked by uid 500); 8 Jul 2008 20:44:34 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 47580 invoked by uid 500); 8 Jul 2008 20:44:33 -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 47569 invoked by uid 99); 8 Jul 2008 20:44:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jul 2008 13:44:33 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS,URIBL_WS_SURBL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of vanaja@cisco.com designates 64.104.129.195 as permitted sender) Received: from [64.104.129.195] (HELO ind-iport-1.cisco.com) (64.104.129.195) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jul 2008 20:43:39 +0000 X-IronPort-AV: E=Sophos;i="4.30,326,1212364800"; d="scan'208";a="22841247" Received: from hkg-dkim-2.cisco.com ([10.75.231.163]) by ind-iport-1.cisco.com with ESMTP; 08 Jul 2008 20:42:58 +0000 Received: from hkg-core-1.cisco.com (hkg-core-1.cisco.com [64.104.123.94]) by hkg-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id m68KgvwF010263; Wed, 9 Jul 2008 04:42:57 +0800 Received: from xbh-blr-412.apac.cisco.com (xbh-blr-412.cisco.com [64.104.140.149]) by hkg-core-1.cisco.com (8.13.8/8.13.8) with ESMTP id m68KguN8020284; Tue, 8 Jul 2008 20:42:57 GMT Received: from xmb-blr-417.apac.cisco.com ([64.104.140.146]) by xbh-blr-412.apac.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 9 Jul 2008 02:12:56 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Commons Configuration]Clearing a specific node in XMLConfiguration Date: Wed, 9 Jul 2008 02:13:06 +0530 Message-ID: In-Reply-To: <4873CFA1.5040806@oliver-heger.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Commons Configuration]Clearing a specific node in XMLConfiguration Thread-Index: AcjhOkK3WGkwxB71Rf+8tRl5PSM+9QAAFMgA From: "Vanaja Ravi (vanaja)" To: "Oliver Heger" Cc: X-OriginalArrivalTime: 08 Jul 2008 20:42:56.0932 (UTC) FILETIME=[33DA3E40:01C8E13B] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=3650; t=1215549778; x=1216413778; c=relaxed/simple; s=hkgdkim2001; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=vanaja@cisco.com; z=From:=20=22Vanaja=20Ravi=20(vanaja)=22=20 |Subject:=20RE=3A=20[Commons=20Configuration]Clearing=20a=2 0specific=20node=20in=20XMLConfiguration |Sender:=20; bh=anqnjDkvRjT9VFMQXEacADek9GCNSexi1YspzY5Wwic=; b=H/bPv16BWqEg+CC47OnLEkiz7WsDWwpqBTS9cD4oy+qVsgGl02V2/VKNTU TqHvLzxcgK0mH+UFzLKJbTt66Xdtz3bekJm81qfF2TXe7FsayAz7XouqH1fU RyZNi6wC5HJSGpjQEWME2pzuH21ZArOI3z+QJpFQyIZNUM8iySXK0=; Authentication-Results: hkg-dkim-2; header.From=vanaja@cisco.com; dkim=pass ( sig from cisco.com/hkgdkim2001 verified; ); X-Virus-Checked: Checked by ClamAV on apache.org I will take a look at the XPathExpressionEngine. Thank you for the suggestion and heads up on anticipated changes. thanks, vanaja=20 ps: Since you get a delivery failure when posting, let me see if I have any success archiving this. -----Original Message----- From: Oliver Heger [mailto:oliver.heger@oliver-heger.de]=20 Sent: Tuesday, July 08, 2008 1:36 PM To: Vanaja Ravi (vanaja) Cc: Jakarta Commons Users List Subject: Re: [Commons Configuration]Clearing a specific node in XMLConfiguration Vanaja Ravi (vanaja) schrieb: > Thank you Oliver! >=20 > I did consider using indices but here is the issue - I do not know=20 > upfront the index that I want to delete. I have to now query for all=20 > values of the key and loop through the result to locate the index that > matches the value that I wish to delete and then invoke clearProperty(). > The clearNode() approach seemed to do this for me in 1 step. >=20 > If you do recommend that I use the clearProperty() approach as I=20 > described above for my purpose, then I'd go with it. As an=20 > alternative, I thought of extending the XMLConfiguration and making=20 > clearNode() public for my usage. Do you see any issues with this? >=20 > Thanks! > vanaja Would the XPathExpressionEngine be an option for you? Here you can specify very complex keys with comparisons and other conditions. Your approach with extending XMLConfiguration will certainly work.=20 However, we are currently working on a version 2.0 of the Configuration API, which will differ to some extent from the current API. I cannot guarantee that this solution will still work with the new version (there might be changes in the way nodes are handled). But there is nothing too concrete yet. Oliver >=20 > -----Original Message----- > From: Oliver Heger [mailto:oliver.heger@oliver-heger.de] > Sent: Tuesday, July 08, 2008 1:10 PM > To: Vanaja Ravi (vanaja) > Subject: Re: [Commons Configuration]Clearing a specific node in=20 > XMLConfiguration >=20 > (I tried to send this reply to the commons user list, but always get a > mail delivery failure.) >=20 > Vanaja Ravi (vanaja) schrieb: >> Hi, >> =20 >> I am looking to delete a specific node in a list entry(key being the >> same) and am using XMLConfiguration to read my configuration file. >> clearNode() seems to be appropriate but is protected. Any reason why=20 >> it should not be exposed? >> =20 >> thanks! >> Vanaja >> >=20 > The nodes are more or less an implementation detail and should not be=20 > used directly to modify a configuration. >=20 > You should be able to achieve the same results using the "official" > methods defined by the Configuration interface or by=20 > HierarchicalConfiguration. For instance if you have a structure like > this: >=20 > > http://url1.com > http://url2.com > ... > >=20 >=20 > you can use the clearProperty() method with an index for deleting a=20 > specific element: > config.clearProperty("servers.server(0)"); > This would delete the first element (indices start with 0). >=20 > For complex list structures the clearTree() method can be used.=20 > Consider the following fragment: >=20 > > > user1 > Test user 1 > > > ... > > ... > >=20 > To delete a specific user you can use clearTree() as follows: > config.clearTree("users.user(1)"); > for deleting the second user record in this list. >=20 > HTH > Oliver >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org