|
[
Permlink
| « Hide
]
Robert Kasanicky added a comment - 30/Jul/08 09:53 AM
commited first attempt - simply moved everything into the FlatFileItemReader class (looks OK this way I think).
the open question now is how to deal with the duplications in FFIR and ResourceLineReader - I'd vote for making RLR forward-only and have FFIR delegate to it again. This means RLR wouldn't implement ItemReader interface anymore (mark + reset).
I've noticed a design issue in FFIR - it reads 'lines' until end of 'record' which is then transformed into FieldSet and mapped to item using map(fieldSet, lineNumber). The issue is that fieldSet is a tokenized 'record' (not line) so it doesn't make sense to associate a lineNumber with it in FieldSetMapper.
I see two ways to go: 1.) remove RecordSeparatorPolicy and simply process flat files line by line (use composite reader for multi-line records). 2.) remove lineNumber from FieldSetMapper.mapLine(..) and rename Line* classes to Record* or simply String* I think we might as well keep the int parameter in FieldSetMapper, since it was specifically requested by a couple of users. In most cases it corresponds to a line, but as you noticed, it would be more accurate to call it a recordNumber or itemNumber. But I don't really have a problem with Line* in class names, since most of the time it is a line, and the rest of the time the usual behaviour of LineReader is to provide a string without the line separators. So it's still alogical line. RecordSeparator is important though IMO.
No changes to the logic how FFIR works, removed now redundant ResourceLineReader
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||