Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 97966 invoked from network); 30 Nov 2010 13:57:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Nov 2010 13:57:14 -0000 Received: (qmail 44599 invoked by uid 500); 30 Nov 2010 13:57:13 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 44204 invoked by uid 500); 30 Nov 2010 13:57:12 -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 44192 invoked by uid 99); 30 Nov 2010 13:57:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Nov 2010 13:57:11 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [69.147.96.246] (HELO web63104.mail.re1.yahoo.com) (69.147.96.246) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 30 Nov 2010 13:57:05 +0000 Received: (qmail 68109 invoked by uid 60001); 30 Nov 2010 13:56:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1291125403; bh=pPiM5WHBqptDRGRjkk36L/QNHBz0mNiltZUYv15HmA4=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=PcrSe1oiPKWUoqIt/H1P9lLBNtpeYGtBxlS4C7FgsdbHhBJhKiYVWYSFTTxPOidsqCTTwJ3iW4kA552gq40ykJ+j2qxLVmJPNFsWbTzAqYtS+PiE/clbzl8CyyzDmIgvEuT8/I37iUVV/TR+rda5MHWTiWY0rymT5cQpAFy6mNo= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2nm6aBKztE1dEOl94tfzVd6v4/Ko84sq9x09becc7CaKATKgenJ0/2AjSyhHJdcuq+MxPe2K9QET3YQZfKVccciLQVamCr5pmC+GPJmkZANU6j0blGceq5Yn0UkTpeNOJ3SPzx26BT8jLs9Zmzqbsyl+TJBurk5097uqwZETzpM=; Message-ID: <810797.68101.qm@web63104.mail.re1.yahoo.com> X-YMail-OSG: jrSyUu0VM1naL20M8OvydDwcLsLVIFb60wCrjitMP3MKZ1H oV3YY_0oqm9m5B_WUDNheUuDTOOcVy2MY1_TVMtX6dxrJ86aDqnZNbDBTTRk Chrt3XhZer0HICjILq0aaMY3cemK0Y62N0EPfjls2QnfNMGQlh5bYVv.nyOm kLvAcfxbuaPy5g9Qb4xtSeGomGme.lye9XvcB7_Ge.9hWwMalBsaZkToRpA5 AqYd_iYsRcSFZ3GoKJccx5hsTUJk23uwaUyEanncxFXDwsw0DtwET8PPv1tT y_OGV0mpmKJzUXbwukcTAVhqN9W5JJ94pPlwqk8WB8znMrMXl_OxSLufiVVf m2b6__E8AOGy3A0ntuOx_mbXEUsXmIg-- Received: from [71.165.63.226] by web63104.mail.re1.yahoo.com via HTTP; Tue, 30 Nov 2010 05:56:43 PST X-Mailer: YahooMailClassic/11.4.9 YahooMailWebService/0.8.107.285259 Date: Tue, 30 Nov 2010 05:56:43 -0800 (PST) From: Adrian Crum Subject: Re: [digester] keeping parsing logic out of the data model To: Commons Users List In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable You could put the parsing helper code in a separate class:=0A=0Apublic clas= s ParserUtil {=0A=0A public static boolean isFullDuplex(String hardwareDep= endentString) {=0A return hardwareDependentString.equalsIgnoreCase("FULL= -DUPLEX");=0A }=0A}=0A=0A-Adrian=0A=0A--- On Tue, 11/30/10, Pau Minoves wrote:=0A> Hi all,=0A> =0A> We have some doubts here = on how apache digester (2.1) is=0A> meant to be=0A> used. I don't think we = are on a strange scenario so there=0A> is probably=0A> something we are mis= sing.=0A> =0A> In our case, we have a (bean) data model that we need to=0A>= create from a=0A> series of xmls. This data model represents network=0A> c= onfiguration and=0A> we have xml's that come from different network devices= .=0A> Each network=0A> device produces different XMLs so we use a set of di= gester=0A> rules to=0A> parse that into the data model.=0A> =0A> So digeste= r rules are device specific while our data model=0A> (wants to=0A> be) is d= evice agnostic.=0A> =0A> The problem we see is that the digester forces us = (via=0A> rules as=0A> CallMethodRule) to include parsing logic in methods= =0A> *inside* the data=0A> model and that kind of breaks our hardware abstr= ation=0A> layer.=0A> =0A> I can illustrate this with an example. In one of = the=0A> devices, a string=0A> comes stating if an interface is "HALF-DUPLEX= " or=0A> "FULL-DUPLEX", in=0A> our data model, we have a boolean for that. = We have this=0A> logic:=0A> =0A> void bool isFullDuplex(String hardwareDepe= ndentString)=0A> {=0A> =A0=A0=A0if(=0A> hardwareDependentString.equalsIgnor= eCase("FULL-DUPLEX")=0A> =A0 =A0 =A0=A0=A0return true;=0A> =A0=A0=A0else=0A= > =A0 =A0 =A0=A0=A0return false;=0A> }=0A> =0A> Using basic digester rules = we have to create this method in=0A> the data=0A> model while i would like = to keep it next to the parser, as=0A> it is where=0A> this kind of logic be= longs.=0A> =0A> Are we missing something? This is something that is=0A> hap= pening all the=0A> time to us (XMLs are quite hardware dependent) so we are= =0A> open to=0A> proposals :)=0A> =0A> Any help is very much appreciated. T= hanks,=0A> Pau=0A=0A=0A=0A --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org