<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
       	http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       	http://www.springframework.org/schema/aop
 		http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

	<bean id="multilineJob" parent="simpleJob">
		<property name="steps">
			<bean id="step1" parent="simpleStep">
				<property name="streams" ref="fileItemReader"/>
				<property name="itemReader">
					<bean
						class="org.springframework.batch.item.support.AggregateItemReader">
						<property name="itemReader"
							ref="fileItemReader" />
					</bean>
				</property>
				<property name="itemWriter">
					<bean
						class="org.springframework.batch.item.file.FlatFileItemWriter">
						<property name="resource"
							value="file:target/test-outputs/20070122.testStream.multilineStep.txt" />
							<property name="fieldSetCreator">
								<bean class="org.springframework.batch.item.file.mapping.PassThroughFieldSetMapper"/>
							</property>
					</bean>
				</property>
			</bean>
		</property>
	</bean>

	<bean id="fileItemReader"
		class="org.springframework.batch.item.file.FlatFileItemReader">
		<property name="resource"
			value="classpath:data/multilineJob/input/20070122.teststream.multilineStep.txt" />
		<property name="lineTokenizer" ref="fixedFileDescriptor" />
		<property name="fieldSetMapper" ref="tradeLineMapper" />
		<!-- <property name="validator" ref="fixedValidator" /> -->
	</bean>

	<bean id="tradeLineMapper"
		class="org.springframework.batch.sample.mapping.TradeFieldSetMapper" />

	<bean id="fixedFileDescriptor"
		class="org.springframework.batch.item.file.transform.PrefixMatchingCompositeLineTokenizer">
		<property name="tokenizers">
			<map>
				<entry key="BEGIN" value-ref="beginRecordTokenizer" />
				<entry key="END" value-ref="endRecordTokenizer" />
				<entry key="" value-ref="tradeRecordTokenizer" />
			</map>
		</property>
	</bean>

	<bean id="beginRecordTokenizer"
		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
		<property name="columns" value="1-5" />
	</bean>

	<bean id="endRecordTokenizer"
		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
		<property name="columns" value="1-3" />
	</bean>

	<bean id="tradeRecordTokenizer"
		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
		<property name="names" value="ISIN,Quantity,Price,Customer" />
		<property name="columns" value="1-12, 13-15, 16-20, 21-29" />
	</bean>

</beans>