Java Reference
In-Depth Information
<beans:bean id="customerLineTokenizer"
<beans:property name="names" value="prefix,firstName,middleInitial,
<beans:property name="delimiter" value=","/>
<beans:bean id="transactionLineTokenizer"
<beans:property name="names"
<beans:property name="delimiter" value=","/>
<beans:bean id="customerFieldSetMapper"
<beans:property name="prototypeBeanName" value="customer"/>
<beans:property name="strict" value="false"/>
<beans:bean id="transactionFieldSetMapper"
<beans:bean id="customer" class="com.apress.springbatch.chapter7.Customer"
The other change you need to make is to the CustomerFileReader code. Previously, you were able to
use the ItemStreamReader interface as what you implemented and the delegate's type. However, that
won't be specific enough this time around. Instead, you are going to need to use one of the
ItemStreamResource's sub interfaces. The ResourceAwareItemReaderItemStream interface is for any
ItemReader that reads its input from resources. The reason you will want to make the two changes is that
you will need to be able to inject multiple Resources into the ItemReader.
By implementing org.springframework.batch.item.file.ResourceAwareItemStreamItemReader , you
will be required to add one additional method: setResource . Like the open , close and update methods of
the ItemStreamReader interface, you will just be calling the setResource method on the delegate in your
implementation. The other change you need to make is to have your delegate be of the type
ResourceAwareItemStreamItemReader. Since you are using the FlatFileItemReader as your delegate,
you won't need to use a different ItemReader as the delegate. The updated code is listed in Listing 7-32.
Search WWH ::

Custom Search