OPEN - issue BATCH-157: *Source does not need to extend ResourceLifecycle

http://opensource.atlassian.com/projects/spring/browse/BATCH-157
This commit is contained in:
dsyer
2007-10-04 15:34:32 +00:00
parent cb63406f6b
commit 3b2662a16b
6 changed files with 13 additions and 9 deletions

View File

@@ -16,7 +16,6 @@
package org.springframework.batch.io;
import org.springframework.batch.item.ResourceLifecycle;
/**
* Basic interface for generic input operations. Class implementing this
@@ -27,7 +26,7 @@ import org.springframework.batch.item.ResourceLifecycle;
*
* @author Dave Syer
*/
public interface InputSource extends ResourceLifecycle {
public interface InputSource {
/**
* Read record from input stream and map it to an object.

View File

@@ -29,6 +29,7 @@ import org.springframework.batch.io.InputSource;
import org.springframework.batch.io.exception.BatchEnvironmentException;
import org.springframework.batch.io.file.support.separator.DefaultRecordSeparatorPolicy;
import org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy;
import org.springframework.batch.item.ResourceLifecycle;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
@@ -46,13 +47,13 @@ import org.springframework.util.Assert;
* prefixes) and they will be ignored. The default is "#", so lines starting
* with a pound sign will be ignored.<br/>
*
* All the public methods that interact wit hthe underlying resource (open,
* All the public methods that interact with the underlying resource (open,
* close, read etc.) are synchronized on this.<br/>
*
* @author Dave Syer
* @author Rob Harrop
*/
public class ResourceLineReader implements InputSource, DisposableBean {
public class ResourceLineReader implements ResourceLifecycle, InputSource, DisposableBean {
private static final Collection DEFAULT_COMMENTS = Collections.singleton("#");

View File

@@ -40,14 +40,14 @@ import org.springframework.util.Assert;
*
* A {@link SimpleFlatFileInputSource} is not thread safe because it maintains
* state in the form of a {@link ResourceLineReader}. Be careful to configure a
* {@link SimpleFlatFileInputSource} using an appropiate factory or scope so
* {@link SimpleFlatFileInputSource} using an appropriate factory or scope so
* that it is not shared between threads.<br/>
*
* @see FieldSetInputSource
*
* @author Dave Syer
*/
public class SimpleFlatFileInputSource implements FieldSetInputSource, InitializingBean, DisposableBean {
public class SimpleFlatFileInputSource implements ResourceLifecycle, FieldSetInputSource, InitializingBean, DisposableBean {
// default encoding for input files - set to ISO-8859-1
public static final String DEFAULT_CHARSET = "ISO-8859-1";

View File

@@ -24,6 +24,7 @@ import java.util.Properties;
import javax.sql.DataSource;
import org.springframework.batch.io.InputSource;
import org.springframework.batch.item.ResourceLifecycle;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
import org.springframework.batch.restart.Restartable;
@@ -50,7 +51,7 @@ import org.springframework.util.Assert;
* @author Lucas Ward
*
*/
public class SingleKeySqlDrivingQueryInputSource implements InputSource, Restartable {
public class SingleKeySqlDrivingQueryInputSource implements ResourceLifecycle, InputSource, Restartable {
private static final String RESTART_KEY = "SingleKeySqlDrivingQueryInputSource.lastProcessedKey";

View File

@@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.io.InputSource;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ResourceLifecycle;
import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
@@ -38,6 +39,7 @@ import org.springframework.batch.restart.Restartable;
import org.springframework.batch.statistics.StatisticsProvider;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.jdbc.SQLWarningException;
import org.springframework.jdbc.core.RowMapper;
@@ -115,7 +117,7 @@ import org.springframework.util.Assert;
* @author Lucas Ward
* @author Peter Zozom
*/
public class SqlCursorInputSource implements InputSource, DisposableBean,
public class SqlCursorInputSource implements InputSource, ResourceLifecycle, DisposableBean,
InitializingBean, Restartable, StatisticsProvider, Skippable {
private static Log log = LogFactory.getLog(SqlCursorInputSource.class);

View File

@@ -14,6 +14,7 @@ import javax.xml.stream.events.StartElement;
import org.springframework.batch.io.InputSource;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ResourceLifecycle;
import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
@@ -37,7 +38,7 @@ import org.springframework.util.Assert;
*
* @author Robert Kasanicky
*/
public class StaxEventReaderInputSource implements InputSource, Skippable, Restartable, StatisticsProvider, InitializingBean, DisposableBean {
public class StaxEventReaderInputSource implements InputSource, ResourceLifecycle, Skippable, Restartable, StatisticsProvider, InitializingBean, DisposableBean {
public static final String READ_COUNT_STATISTICS_NAME = "StaxEventReaderInputSource.readCount";