Issue Details (XML | Word | Printable)

Key: BATCH-662
Type: Refactoring Refactoring
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Robert Kasanicky
Reporter: Robert Kasanicky
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Batch

simplify FlatFileItemReader

Created: 11/Jun/08 06:42 AM   Updated: 23/Sep/08 07:15 PM
Component/s: Infrastructure
Affects Version/s: 1.1.0
Fix Version/s: 2.0.0.M1

Time Tracking:
Original Estimate: 1d
Original Estimate - 1d
Remaining Estimate: 0.5d
Time Spent - 0.5d Remaining Estimate - 0.5d
Time Spent: 0.5d
Time Spent - 0.5d Remaining Estimate - 0.5d


 Description  « Hide
After implementing item buffering in FlatFileItemReader the FlatFileItemReader -> ResourceLineReader -> ResourceLineReader.State -> BufferedReader chain looks like an overkill. Proper cleanup will require removal of methods so scheduling for uncompatible 2.0.

 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
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).

Robert Kasanicky added a comment - 31/Jul/08 06:23 AM
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).

Dave Syer added a comment - 31/Jul/08 07:59 AM
That's how it always was in the early days, and I would prefer it to go back that way. RLR is really an internal interface (hence doesn't matter - although I'm sure someone will complain if we change it).

Robert Kasanicky added a comment - 01/Aug/08 06:41 AM
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*

Dave Syer added a comment - 01/Aug/08 10:20 AM
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.

Robert Kasanicky added a comment - 11/Aug/08 03:11 AM
No changes to the logic how FFIR works, removed now redundant ResourceLineReader