<?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:p="http://www.springframework.org/schema/p"
	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">

	<import resource="tradeJobIo.xml" />

	<bean id="tradeJob" parent="simpleJob">
		<property name="steps">
			<list>
				<bean id="step1" parent="simpleStep">
					<property name="streams" ref="fileItemReader" />
					<property name="itemReader">
						<bean
							class="org.springframework.batch.item.validator.ValidatingItemReader">
							<property name="itemReader"
								ref="fileItemReader" />
							<property name="validator"
								ref="tradeValidator" />
						</bean>
					</property>
					<property name="itemWriter">
						<bean
							class="org.springframework.batch.sample.item.writer.TradeWriter"
							p:dao-ref="tradeDao" />
					</property>
				</bean>
				<bean id="step2" parent="simpleStep">
					<property name="itemReader"
						ref="tradeSqlItemReader" />
					<property name="itemWriter">
						<bean
							class="org.springframework.batch.sample.item.writer.CustomerUpdateWriter"
							p:dao-ref="customerDao" />
					</property>
				</bean>
				<bean id="step3" parent="simpleStep">
					<property name="itemReader"
						ref="customerSqlItemReader" />
					<property name="itemWriter">
						<bean
							class="org.springframework.batch.sample.item.writer.CustomerCreditUpdateWriter"
							p:dao-ref="customerReportItemWriter" />
					</property>
				</bean>
			</list>
		</property>
	</bean>

	<bean id="tradeSqlItemReader"
		class="org.springframework.batch.item.database.JdbcCursorItemReader">
		<property name="dataSource" ref="dataSource" />
		<property name="sql"
			value="SELECT id, quantity, price, customer from TRADE" />
		<property name="mapper">
			<bean
				class="org.springframework.batch.sample.mapping.TradeRowMapper" />
		</property>
	</bean>

	<bean id="customerSqlItemReader"
		class="org.springframework.batch.item.database.JdbcCursorItemReader">
		<property name="dataSource" ref="dataSource" />
		<property name="sql"
			value="SELECT id, name, credit FROM customer " />
		<property name="mapper">
			<bean
				class="org.springframework.batch.sample.mapping.CustomerCreditRowMapper" />
		</property>
	</bean>

	<bean id="fileLocator"
		class="org.springframework.core.io.ClassPathResource">
		<constructor-arg type="java.lang.String"
			value="data/tradeJob/input/20070122.teststream.ImportTradeDataStep.txt" />
	</bean>

	<bean id="customerFileLocator"
		class="org.springframework.core.io.FileSystemResource">
		<constructor-arg type="java.lang.String"
			value="target/test-outputs/20070122.testStream.CustomerReportStep.TEMP.txt" />
	</bean>

</beans>