commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pau Minoves <pau.mino...@i2cat.net>
Subject [digester] keeping parsing logic out of the data model
Date Tue, 30 Nov 2010 10:17:19 GMT
Hi all,

We have some doubts here on how apache digester (2.1) is meant to be
used. I don't think we are on a strange scenario so there is probably
something we are missing.

In our case, we have a (bean) data model that we need to create from a
series of xmls. This data model represents network configuration and
we have xml's that come from different network devices. Each network
device produces different XMLs so we use a set of digester rules to
parse that into the data model.

So digester rules are device specific while our data model (wants to
be) is device agnostic.

The problem we see is that the digester forces us (via rules as
CallMethodRule) to include parsing logic in methods *inside* the data
model and that kind of breaks our hardware abstration layer.

I can illustrate this with an example. In one of the devices, a string
comes stating if an interface is "HALF-DUPLEX" or "FULL-DUPLEX", in
our data model, we have a boolean for that. We have this logic:

void bool isFullDuplex(String hardwareDependentString)
{
   if( hardwareDependentString.equalsIgnoreCase("FULL-DUPLEX")
       return true;
   else
       return false;
}

Using basic digester rules we have to create this method in the data
model while i would like to keep it next to the parser, as it is where
this kind of logic belongs.

Are we missing something? This is something that is happening all the
time to us (XMLs are quite hardware dependent) so we are open to
proposals :)

Any help is very much appreciated. Thanks,
Pau

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message