ballistic_realm,
The way I've done it in the past is this:
Create a wrapper class for your FlatFileItemReader. The wrapper can be used by itself, or set as the delegate of the MultiResourceItemReader.
You'll have to store the resource in the wrapper:
Code:
public void setResource(Resource resource) {
this.resource = resource;
this.delegateReader.setResource(resource);
}
The wrapper's read() will do the following:
Code:
public Object read() throws Exception {
Object o = this.delegateReader.read();
if (o == null) {
//
// After the last item is read
//
this.renameResource(this.resource);
}
return o;
}
If you want to do the renaming afterwards, then you'll store the resource to a list in read(), implement StepExecutionListener, and perform the rename in afterStep().
If you want to do the renaming as a separate step, then you'll store the resource to a list in the stepExecution.getJobExecution().getExecutionContex t() in afterStep(). That way you can access it in a later step.