<?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">


	<bean class="org.springframework.batch.sample.dao.JdbcTradeDao"
		id="tradeDao" p:jdbcTemplate-ref="jdbcTemplate">
		<property name="incrementer">
			<bean parent="incrementerParent">
				<property name="incrementerName" value="TRADE_SEQ" />
			</bean>
		</property>
	</bean>

	<bean
		class="org.springframework.batch.sample.dao.JdbcCustomerDebitDao"
		id="customerDao" p:jdbcTemplate-ref="jdbcTemplate" />

	<bean
		class="org.springframework.batch.sample.dao.FlatFileCustomerCreditDao"
		id="customerReportOutputSource">
		<property name="outputSource">
			<bean
				class="org.springframework.batch.item.file.FlatFileItemWriter"
				id="customerFlatFileOutputSource">
				<property name="resource" ref="customerFileLocator" />
				<property name="fieldSetCreator">
					<bean
						class="org.springframework.batch.item.file.mapping.PassThroughFieldSetMapper" />
				</property>
			</bean>
		</property>
	</bean>

	<bean class="org.springframework.batch.item.file.FlatFileItemReader"
		id="fileInputTemplate">
		<property name="resource" ref="fileLocator" />
		<property name="lineTokenizer" ref="tradeFileDescriptor" />
		<property name="fieldSetMapper">
			<bean
				class="org.springframework.batch.sample.mapping.TradeFieldSetMapper" />
		</property>
	</bean>

	<bean id="tradeFileDescriptor"
		class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
		<property name="names" value="ISIN, Quantity, Price, Customer" />
	</bean>

	<bean id="tradeValidator"
		class="org.springframework.batch.item.validator.SpringValidator">
		<property name="validator">
			<bean
				class="org.springmodules.validation.valang.ValangValidator">
				<property name="valang">
					<value>
						<![CDATA[
										      { isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12}
										    ]]>
					</value>
				</property>
			</bean>
		</property>
	</bean>

</beans>
