Finally, we've implemented following schema.
Code:
<beans:bean id="multifileASReader" class="org.springframework.batch.item.file.MultiResourceItemReader" lazy-init="true">
<beans:property name="resources" value="file://${loc.working.directory.appserver}/${appserver.file.1}.*" />
<beans:property name="delegate" ref="proxyFlatFileASItemReader" />
</beans:bean>
<beans:bean id="proxyFlatFileASItemReader" class="foo.bar.LogItemReader">
<beans:property name="delegate" ref="flatFileASItemReader" />
</beans:bean>
<beans:bean id="flatFileASItemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<beans:property name="lineMapper">
<beans:bean class="org.springframework.batch.item.file.mapping.PassThroughLineMapper" />
</beans:property>
</beans:bean>
Code:
public class LogItemReader
implements ItemReader<List<String>>,
ResourceAwareItemReaderItemStream<List<String>> {
public List<String> read() throws Exception, UnexpectedInputException, ParseException {
// Logic...
}
public void setDelegate(FlatFileItemReader<String> delegate) {
this.delegate = delegate;
}
public void setResource(Resource resource) {
delegate.setResource(resource);
}
public void close() throws ItemStreamException {
delegate.close();
}
public void open(ExecutionContext executionContext) throws ItemStreamException {
delegate.open(executionContext);
}
public void update(ExecutionContext executionContext) throws ItemStreamException {
delegate.update(executionContext);
}
}
Maybe it's inelegant, but it works fine.
Thanks both.