BATCH-2131: Removed Spring Modules as a dependency for samples

This commit is contained in:
Michael Minella
2014-02-28 12:40:41 -06:00
parent ff7793cacf
commit 4ff7ae84e2
8 changed files with 56 additions and 101 deletions

View File

@@ -45,45 +45,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-validation</artifactId>
<version>0.8a</version>
<exclusions>
<exclusion>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
</exclusion>
<exclusion>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</exclusion>
<exclusion>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</exclusion>
<exclusion>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
</exclusion>
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>

View File

@@ -0,0 +1,40 @@
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.sample.domain.trade.internal.validator;
import org.springframework.batch.item.validator.ValidationException;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import org.springframework.batch.sample.domain.trade.Trade;
/**
* @author Michael Minella
*/
public class TradeValidator implements Validator {
@Override
public boolean supports(Class<?> clazz) {
return clazz.equals(Trade.class);
}
@Override
public void validate(Object target, Errors errors) {
Trade trade = (Trade) target;
if(trade.getIsin().length() >= 13) {
errors.rejectValue("isin", "isin_length");
}
}
}

View File

@@ -60,15 +60,7 @@
<bean id="fixedValidator" class="org.springframework.batch.item.validator.SpringValidator">
<property name="validator">
<bean id="tradeValidator" class="org.springmodules.validation.valang.ValangValidator">
<property name="valang">
<value>
<![CDATA[
{ isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12}
]]>
</value>
</property>
</bean>
<bean class="org.springframework.batch.sample.domain.trade.internal.validator.TradeValidator"/>
</property>
</bean>

View File

@@ -61,15 +61,7 @@
<bean id="fixedValidator" class="org.springframework.batch.item.validator.SpringValidator">
<property name="validator">
<bean id="tradeValidator" class="org.springmodules.validation.valang.ValangValidator">
<property name="valang">
<value>
<![CDATA[
{ isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12}
]]>
</value>
</property>
</bean>
<bean class="org.springframework.batch.sample.domain.trade.internal.validator.TradeValidator"/>
</property>
</bean>

View File

@@ -49,15 +49,7 @@
<bean id="fixedValidator" class="org.springframework.batch.item.validator.SpringValidator">
<property name="validator">
<bean id="tradeValidator" class="org.springmodules.validation.valang.ValangValidator">
<property name="valang">
<value>
<![CDATA[
{ isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12}
]]>
</value>
</property>
</bean>
<bean class="org.springframework.batch.sample.domain.trade.internal.validator.TradeValidator"/>
</property>
</bean>

View File

@@ -82,15 +82,7 @@
<bean id="fixedValidator"
class="org.springframework.batch.item.validator.SpringValidator">
<property name="validator">
<bean id="tradeValidator" class="org.springmodules.validation.valang.ValangValidator">
<property name="valang">
<value>
<![CDATA[
{ isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12}
]]>
</value>
</property>
</bean>
<bean class="org.springframework.batch.sample.domain.trade.internal.validator.TradeValidator"/>
</property>
</bean>

View File

@@ -48,15 +48,7 @@
<bean id="fixedValidator" class="org.springframework.batch.item.validator.SpringValidator">
<property name="validator">
<bean id="tradeValidator" class="org.springmodules.validation.valang.ValangValidator">
<property name="valang">
<value>
<![CDATA[
{ isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12}
]]>
</value>
</property>
</bean>
<bean class="org.springframework.batch.sample.domain.trade.internal.validator.TradeValidator"/>
</property>
</bean>

View File

@@ -3,31 +3,31 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<batch:job-repository />
<job id="tradeJob" xmlns="http://www.springframework.org/schema/batch">
<step id="step1" next="step2">
<tasklet>
<chunk reader="fileItemReader" processor="validatingProcessor" writer="tradeWriter"
<tasklet>
<chunk reader="fileItemReader" processor="validatingProcessor" writer="tradeWriter"
commit-interval="1">
<streams>
<stream ref="fileItemReader" />
</streams>
</chunk>
</streams>
</chunk>
<transaction-attributes isolation="READ_COMMITTED" />
</tasklet>
</tasklet>
</step>
<step id="step2" next="step3">
<tasklet>
<chunk reader="tradeSqlItemReader" writer="customerWriter" commit-interval="1" />
<tasklet>
<chunk reader="tradeSqlItemReader" writer="customerWriter" commit-interval="1" />
</tasklet>
</step>
<step id="step3">
<tasklet>
<chunk reader="customerSqlItemReader" writer="creditWriter" commit-interval="1" />
<tasklet>
<chunk reader="customerSqlItemReader" writer="creditWriter" commit-interval="1" />
</tasklet>
</step>
</job>
@@ -106,13 +106,7 @@
<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>
<bean class="org.springframework.batch.sample.domain.trade.internal.validator.TradeValidator"/>
</property>
</bean>