BATCH-365: Added flush() and clear() to ItemWriter interface. These should be removed from ItemStream after the same is done for the ItemReader interface.
This commit is contained in:
@@ -34,7 +34,10 @@ public class JdbcGameDao extends JdbcDaoSupport implements ItemWriter {
|
||||
this.getJdbcTemplate().update(INSERT_GAME, args);
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
public void clear() throws Exception {
|
||||
}
|
||||
|
||||
public void flush() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,4 +31,10 @@ public class JdbcPlayerSummaryDao extends JdbcDaoSupport implements ItemWriter {
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
}
|
||||
|
||||
public void flush() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.domain.CustomerCredit;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.batch.sample.domain.CustomerCredit;
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
*/
|
||||
public class CustomerCreditIncreaseWriter implements ItemWriter {
|
||||
public class CustomerCreditIncreaseWriter extends AbstractItemWriter {
|
||||
|
||||
public static final BigDecimal FIXED_AMOUNT = new BigDecimal(1000);
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.domain.CustomerCredit;
|
||||
|
||||
|
||||
|
||||
public class CustomerCreditUpdateWriter implements ItemWriter {
|
||||
public class CustomerCreditUpdateWriter extends AbstractItemWriter {
|
||||
private double creditFilter = 800;
|
||||
private CustomerCreditDao dao;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.JdbcCustomerDebitWriter;
|
||||
import org.springframework.batch.sample.domain.CustomerDebit;
|
||||
import org.springframework.batch.sample.domain.Trade;
|
||||
@@ -27,7 +27,7 @@ import org.springframework.batch.sample.domain.Trade;
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
*/
|
||||
public class CustomerUpdateWriter implements ItemWriter {
|
||||
public class CustomerUpdateWriter extends AbstractItemWriter {
|
||||
private JdbcCustomerDebitWriter dao;
|
||||
|
||||
public void write(Object data) {
|
||||
|
||||
@@ -30,4 +30,10 @@ public class DummyItemWriter implements ItemWriter {
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
}
|
||||
|
||||
public void flush() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.domain.Person;
|
||||
|
||||
|
||||
|
||||
public class PersonWriter implements ItemWriter {
|
||||
public class PersonWriter extends AbstractItemWriter {
|
||||
private static Log log = LogFactory.getLog(PersonWriter.class);
|
||||
|
||||
public void write(Object data) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.PlayerDao;
|
||||
import org.springframework.batch.sample.domain.Player;
|
||||
|
||||
public class PlayerItemWriter implements ItemWriter {
|
||||
public class PlayerItemWriter extends AbstractItemWriter {
|
||||
|
||||
PlayerDao playerDao;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
|
||||
/**
|
||||
* Simulates temporary output trouble - requires to
|
||||
@@ -8,7 +8,7 @@ import org.springframework.batch.item.ItemWriter;
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
*/
|
||||
public class RetrySampleItemWriter implements ItemWriter {
|
||||
public class RetrySampleItemWriter extends AbstractItemWriter {
|
||||
|
||||
private int counter = 0;
|
||||
|
||||
|
||||
@@ -76,4 +76,10 @@ public class StagingItemWriter extends JdbcDaoSupport implements
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
}
|
||||
|
||||
public void flush() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.TradeDao;
|
||||
import org.springframework.batch.sample.domain.Trade;
|
||||
|
||||
|
||||
|
||||
public class TradeWriter implements ItemWriter {
|
||||
public class TradeWriter extends AbstractItemWriter {
|
||||
private static Log log = LogFactory.getLog(TradeWriter.class);
|
||||
private TradeDao dao;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.batch.sample.tasklet;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ExecutionContextProvider;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.writer.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.TradeDao;
|
||||
import org.springframework.batch.sample.domain.Trade;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.Assert;
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class SimpleTradeWriter implements ItemWriter, ExecutionContextProvider {
|
||||
public class SimpleTradeWriter extends AbstractItemWriter implements ExecutionContextProvider {
|
||||
|
||||
/*
|
||||
* writes a Trade object to output
|
||||
|
||||
Reference in New Issue
Block a user