IN PROGRESS - BATCH-85: Many warnings in Javadocs (e.g. missing links and parameter names)
cleaned up infrastructure module
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Fri Mar 07 10:10:07 GMT 2008
|
||||
#Tue Apr 22 11:16:17 CEST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
@@ -7,6 +7,7 @@ org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
@@ -26,9 +27,20 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#Fri Mar 07 10:10:32 GMT 2008
|
||||
#Tue Apr 22 10:18:03 CEST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
@@ -19,9 +20,20 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.springframework.batch.item;
|
||||
* Strategy interface for providing the data. <br/>
|
||||
*
|
||||
* Implementations are expected to be stateful and will be called multiple times
|
||||
* for each batch, with each call to {@link #next} returning a different value
|
||||
* for each batch, with each call to {@link #read()} returning a different value
|
||||
* and finally returning <code>null</code> when all input data is exhausted.<br/>
|
||||
*
|
||||
* Implementations need to be thread safe and clients of a {@link ItemReader}
|
||||
|
||||
@@ -33,14 +33,14 @@ public abstract class ItemStreamSupport implements ItemStream {
|
||||
|
||||
/**
|
||||
* No-op.
|
||||
* @see org.springframework.batch.item.ItemStream#open()
|
||||
* @see org.springframework.batch.item.ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return empty {@link ExecutionContext}.
|
||||
* @see org.springframework.batch.item.ExecutionContextProvider#update(ExecutionContext)
|
||||
* @see org.springframework.batch.item.ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
public void update(ExecutionContext executionContext) {
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public class MarkFailedException extends ItemReaderException {
|
||||
/**
|
||||
* Create a new {@link MarkFailedException} based on a message and another exception.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the other exception
|
||||
* @param msg the message for this exception
|
||||
* @param nested the other exception
|
||||
*/
|
||||
public MarkFailedException(String msg, Throwable nested) {
|
||||
super(msg, nested);
|
||||
|
||||
@@ -35,8 +35,8 @@ public class NoWorkFoundException extends ItemReaderException {
|
||||
/**
|
||||
* Create a new {@link NoWorkFoundException} based on a message and another exception.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the other exception
|
||||
* @param msg the message for this exception
|
||||
* @param nested the other exception
|
||||
*/
|
||||
public NoWorkFoundException(String msg, Throwable nested) {
|
||||
super(msg, nested);
|
||||
|
||||
@@ -34,8 +34,8 @@ public class ReaderNotOpenException extends ItemReaderException {
|
||||
/**
|
||||
* Create a new {@link ReaderNotOpenException} based on a message and another exception.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the other exception
|
||||
* @param msg the message for this exception
|
||||
* @param nested the other exception
|
||||
*/
|
||||
public ReaderNotOpenException(String msg, Throwable nested) {
|
||||
super(msg, nested);
|
||||
|
||||
@@ -35,8 +35,8 @@ public class ResetFailedException extends ItemReaderException {
|
||||
/**
|
||||
* Create a new {@link ResetFailedException} based on a message and another exception.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the other exception
|
||||
* @param msg the message for this exception
|
||||
* @param nested the other exception
|
||||
*/
|
||||
public ResetFailedException(String msg, Throwable nested) {
|
||||
super(msg, nested);
|
||||
|
||||
@@ -37,8 +37,8 @@ public class UnexpectedInputException extends ItemReaderException {
|
||||
/**
|
||||
* Create a new {@link UnexpectedInputException} based on a message and another exception.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the other exception
|
||||
* @param msg the message for this exception
|
||||
* @param nested the other exception
|
||||
*/
|
||||
public UnexpectedInputException(String msg, Throwable nested) {
|
||||
super(msg, nested);
|
||||
|
||||
@@ -156,14 +156,14 @@ public class AbstractMethodInvokingDelegator implements InitializingBean {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetMethod name of the method to be invoked on {@link #targetObject}.
|
||||
* @param targetMethod name of the method to be invoked on {@link #setTargetObject(Object)}.
|
||||
*/
|
||||
public void setTargetMethod(String targetMethod) {
|
||||
this.targetMethod = targetMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param arguments arguments values for the {{@link #targetMethod}.
|
||||
* @param arguments arguments values for the {{@link #setTargetMethod(String)}.
|
||||
* These are not expected to change during the lifetime of the delegator
|
||||
* and will be used only when the subclass tries to invoke the target method
|
||||
* without providing explicit argument values.
|
||||
|
||||
@@ -58,7 +58,7 @@ public class PropertyExtractingDelegatingItemWriter extends AbstractMethodInvoki
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fieldsUsedAsTargetMethodArguments the values of the these item's fields
|
||||
* @param fieldsUsedAsMethodArguments the values of the these item's fields
|
||||
* will be used as arguments for the delegate method. Nested property values are
|
||||
* supported, e.g. <code>address.city</code>
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,7 @@ public abstract class AbstractTransactionalResourceItemWriter implements ItemWri
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @see org.springframework.batch.io.OutputSource#write(java.lang.Object)
|
||||
* @see org.springframework.batch.item.ItemWriter#write(Object)
|
||||
*/
|
||||
public void write(Object output) throws Exception {
|
||||
bindTransactionResources();
|
||||
|
||||
@@ -96,8 +96,6 @@ public class BatchSqlUpdateItemWriter extends AbstractTransactionalResourceItemW
|
||||
|
||||
/**
|
||||
* Check mandatory properties - there must be a delegate.
|
||||
*
|
||||
* @see org.springframework.dao.support.DaoSupport#initDao()
|
||||
*/
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate, "BatchSqlUpdateItemWriter requires an data source.");
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Convenience class for driving query input sources. Input Sources of this type
|
||||
* Convenience class for driving query item readers. Item readers of this type
|
||||
* use a 'driving query' to return back a list of keys. A key can be defined as
|
||||
* anything that can uniquely identify a record so that a more detailed record
|
||||
* can be retrieved for each object. This allows a much smaller footprint to be
|
||||
@@ -95,9 +95,7 @@ public class DrivingQueryItemReader implements ItemReader, InitializingBean, Ite
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next key in the List. If the ItemReader has not been
|
||||
* initialized yet, then {@link AbstractDrivingQueryItemReader.open()} will
|
||||
* be called.
|
||||
* Return the next key in the List.
|
||||
*
|
||||
* @return next key in the list if not index is not at the last element,
|
||||
* null otherwise.
|
||||
@@ -140,10 +138,8 @@ public class DrivingQueryItemReader implements ItemReader, InitializingBean, Ite
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the input source by delegating to the subclass in order to
|
||||
* retrieve the keys. The input source will also be registered with the
|
||||
* {@link BatchTransactionSynchronizationManager} in order to ensure it is
|
||||
* notified about commits and rollbacks.
|
||||
* Initialize the item reader by delegating to the subclass in order to
|
||||
* retrieve the keys.
|
||||
*
|
||||
* @throws IllegalStateException if the keys list is null or initialized is
|
||||
* true.
|
||||
|
||||
@@ -85,8 +85,6 @@ public class HibernateAwareItemWriter extends AbstractTransactionalResourceItemW
|
||||
|
||||
/**
|
||||
* Check mandatory properties - there must be a delegate and hibernateTemplate.
|
||||
*
|
||||
* @see org.springframework.dao.support.DaoSupport#initDao()
|
||||
*/
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegate, "HibernateAwareItemWriter requires an ItemWriter as a delegate.");
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.springframework.util.ClassUtils;
|
||||
/**
|
||||
* {@link ItemReader} for reading database records built on top of Hibernate.
|
||||
*
|
||||
* It executes the HQL {@link #queryString} when initialized and iterates over
|
||||
* the result set as {@link #read()} method is called, returning an object
|
||||
* corresponding to current row.
|
||||
* It executes the HQL {@link #setQueryString(String)} when initialized and
|
||||
* iterates over the result set as {@link #read()} method is called, returning
|
||||
* an object corresponding to current row.
|
||||
*
|
||||
* Input source can be configured to use either {@link StatelessSession}
|
||||
* sufficient for simple mappings without the need to cascade to associated
|
||||
@@ -76,11 +76,11 @@ public class HibernateCursorItemReader extends ExecutionContextUserSupport imple
|
||||
}
|
||||
|
||||
public Object read() {
|
||||
|
||||
|
||||
if (cursor.next()) {
|
||||
currentProcessedRow++;
|
||||
Object[] data = cursor.get();
|
||||
if (data.length>1) {
|
||||
if (data.length > 1) {
|
||||
return data;
|
||||
}
|
||||
return data[0];
|
||||
|
||||
@@ -58,7 +58,7 @@ public class IbatisDrivingQueryItemReader extends DrivingQueryItemReader {
|
||||
/**
|
||||
* Set the {@link SqlMapClientTemplate} to use for this input source.
|
||||
*
|
||||
* @param sqlMapClientTemplate
|
||||
* @param sqlMapClient
|
||||
*/
|
||||
public void setSqlMapClient(
|
||||
SqlMapClient sqlMapClient) {
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Simple input source that opens a JDBC cursor and continually retrieves the
|
||||
* Simple item reader that opens a JDBC cursor and continually retrieves the
|
||||
* next row in the ResultSet. It is extremely important to note that the
|
||||
* JdbcDriver used must be version 3.0 or higher. This is because earlier
|
||||
* versions do not support holding a ResultSet open over commits.
|
||||
@@ -190,7 +190,6 @@ public class JdbcCursorItemReader extends ExecutionContextUserSupport implements
|
||||
*
|
||||
* @returns Object returned by RowMapper
|
||||
* @throws DataAccessException
|
||||
* @throws IllegalStateExceptino if mapper is null.
|
||||
*/
|
||||
public Object read() throws Exception {
|
||||
|
||||
@@ -223,7 +222,7 @@ public class JdbcCursorItemReader extends ExecutionContextUserSupport implements
|
||||
* will be closed. This must be called or the connection and cursor will be
|
||||
* held open indefinitely!
|
||||
*
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#close(ExecutionContext)
|
||||
* @see org.springframework.batch.item.ItemStream#close(ExecutionContext)
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) {
|
||||
initialized = false;
|
||||
|
||||
@@ -39,7 +39,6 @@ public interface KeyCollector {
|
||||
* for all KeyCollector implementations.
|
||||
*
|
||||
* @param key to be converted to restart data.
|
||||
* @return {@link ExecutionContext} representation of the key.
|
||||
* @throws IllegalArgumentException if key is null.
|
||||
* @throws IllegalArgumentException if key is an incompatible type.
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.springframework.jdbc.core.StatementCreatorUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* </p>Implementation of the {@link KeyMappingPreparedStatementSetter} interface that assumes all
|
||||
* </p>Implementation of the {@link ItemPreparedStatementSetter} interface that assumes all
|
||||
* keys are contained within a {@link Map} with the column name as the key. It assumes nothing
|
||||
* about ordering, and assumes that the order the entry set can be iterated over is the same as
|
||||
* the PreparedStatement should be set.</p>
|
||||
|
||||
@@ -46,7 +46,6 @@ public interface DataFieldMaxValueIncrementerFactory {
|
||||
|
||||
/**
|
||||
* Returns the list of supported database incrementer types
|
||||
* @return
|
||||
*/
|
||||
public String[] getSupportedIncrementerTypes();
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Jdbc implementation of the {@link KeyCollector} interface that works for
|
||||
* composite keys. (i.e. keys represented by multiple columns) A sql query to be
|
||||
* used to return the keys and a {@link KeyMappingPreparedStatementSetter} to map each
|
||||
* row in the resultset to an Object must be set in order to work correctly.
|
||||
* JDBC implementation of the {@link KeyCollector} interface that works for
|
||||
* composite keys. (i.e. keys represented by multiple columns) A SQL query to be
|
||||
* used to return the keys and a {@link ItemPreparedStatementSetter} to map each
|
||||
* row in the result set to an Object must be set in order to work correctly.
|
||||
* </p>
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @see DrivingQueryItemReader
|
||||
* @see KeyMappingPreparedStatementSetter
|
||||
* @see ItemPreparedStatementSetter
|
||||
*/
|
||||
public class MultipleColumnJdbcKeyCollector extends ExecutionContextUserSupport implements KeyCollector {
|
||||
|
||||
@@ -66,8 +66,7 @@ public class MultipleColumnJdbcKeyCollector extends ExecutionContextUserSupport
|
||||
* Construct a new ItemReader.
|
||||
*
|
||||
* @param jdbcTemplate
|
||||
* @param sql - Sql statement that returns all keys to process.
|
||||
* @param keyMapper - RowMapper that maps each row of the ResultSet to an
|
||||
* @param sql - SQL statement that returns all keys to process.
|
||||
* object.
|
||||
*/
|
||||
public MultipleColumnJdbcKeyCollector(JdbcTemplate jdbcTemplate, String sql) {
|
||||
@@ -128,7 +127,7 @@ public class MultipleColumnJdbcKeyCollector extends ExecutionContextUserSupport
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link KeyMappingPreparedStatementSetter} to be used to map a resultset
|
||||
* Set the {@link RowMapper} to be used to map a result set
|
||||
* to keys.
|
||||
*
|
||||
* @param keyMapper
|
||||
|
||||
@@ -101,7 +101,6 @@ public class SingleColumnJdbcKeyCollector extends ExecutionContextUserSupport im
|
||||
/**
|
||||
* Get the restart data representing the last processed key.
|
||||
*
|
||||
* @see KeyCollector#saveState(Object)
|
||||
* @throws IllegalArgumentException if key is null.
|
||||
*/
|
||||
public void updateContext(Object key, ExecutionContext executionContext) {
|
||||
|
||||
@@ -39,18 +39,21 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* This class represents a {@link ItemReader}, that reads lines from text file, tokenizes them to structured tuples ({@link FieldSet}s)
|
||||
* instances and maps the {@link FieldSet}s to domain objects. The location of the file is defined by the resource
|
||||
* property. To separate the structure of the file, {@link LineTokenizer} is used to parse data obtained from the file.
|
||||
* <br/>
|
||||
* This class represents a {@link ItemReader}, that reads lines from text file,
|
||||
* tokenizes them to structured tuples ({@link FieldSet}s) instances and maps
|
||||
* the {@link FieldSet}s to domain objects. The location of the file is defined
|
||||
* by the resource property. To separate the structure of the file,
|
||||
* {@link LineTokenizer} is used to parse data obtained from the file. <br/>
|
||||
*
|
||||
* A {@link FlatFileItemReader} is not thread safe because it maintains state in the form of a
|
||||
* {@link ResourceLineReader}. Be careful to configure a {@link FlatFileItemReader} using an appropriate factory or
|
||||
* scope so that it is not shared between threads.<br/>
|
||||
* A {@link FlatFileItemReader} is not thread safe because it maintains state in
|
||||
* the form of a {@link ResourceLineReader}. Be careful to configure a
|
||||
* {@link FlatFileItemReader} using an appropriate factory or scope so that it
|
||||
* is not shared between threads.<br/>
|
||||
*
|
||||
* <p>
|
||||
* This class supports restart, skipping invalid lines and storing statistics. It can be configured to setup
|
||||
* {@link FieldSet} column names from the file header, skip given number of lines at the beginning of the file.
|
||||
* This class supports restart, skipping invalid lines and storing statistics.
|
||||
* It can be configured to setup {@link FieldSet} column names from the file
|
||||
* header, skip given number of lines at the beginning of the file.
|
||||
* </p>
|
||||
*
|
||||
* @author Waseem Malik
|
||||
@@ -58,8 +61,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Robert Kasanicky
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class FlatFileItemReader extends ExecutionContextUserSupport implements ItemReader, ItemStream,
|
||||
InitializingBean {
|
||||
public class FlatFileItemReader extends ExecutionContextUserSupport implements ItemReader, ItemStream, InitializingBean {
|
||||
|
||||
private static Log log = LogFactory.getLog(FlatFileItemReader.class);
|
||||
|
||||
@@ -83,11 +85,12 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
private LineTokenizer tokenizer = new DelimitedLineTokenizer();
|
||||
|
||||
private FieldSetMapper fieldSetMapper;
|
||||
|
||||
|
||||
private boolean saveState = false;
|
||||
|
||||
/**
|
||||
* Encapsulates the state of the input source. If it is null then we are uninitialized.
|
||||
* Encapsulates the state of the input source. If it is null then we are
|
||||
* uninitialized.
|
||||
*/
|
||||
private LineReader reader;
|
||||
|
||||
@@ -144,13 +147,13 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
record = readLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Close and null out the reader.
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws ItemStreamException
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
try {
|
||||
@@ -158,16 +161,18 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
log.debug("Closing flat file for reading: " + resource);
|
||||
reader.close(null);
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
reader = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a line from input, tokenizes is it using the {@link #tokenizer} and maps to domain object using
|
||||
* {@link #fieldSetMapper}.
|
||||
* Reads a line from input, tokenizes is it using the
|
||||
* {@link #setLineTokenizer(LineTokenizer)} and maps to domain object using
|
||||
* {@link #setFieldSetMapper(FieldSetMapper)}.
|
||||
*
|
||||
* @see org.springframework.batch.io.ItemReader#read()
|
||||
* @see org.springframework.batch.item.ItemReader#read()
|
||||
*/
|
||||
public Object read() throws Exception {
|
||||
String line = readLine();
|
||||
@@ -176,34 +181,38 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
try {
|
||||
FieldSet tokenizedLine = tokenizer.tokenize(line);
|
||||
return fieldSetMapper.mapLine(tokenizedLine);
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
// add current line count to message and re-throw
|
||||
int lineCount = getReader().getPosition();
|
||||
throw new FlatFileParseException("Parsing error at line: " + lineCount + " in resource=" + resource.getDescription()
|
||||
+ ", input=[" + line + "]", ex, line, lineCount);
|
||||
throw new FlatFileParseException("Parsing error at line: " + lineCount + " in resource="
|
||||
+ resource.getDescription() + ", input=[" + line + "]", ex, line, lineCount);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the execution attributes for the reader. It returns the current Line Count which can be used
|
||||
* to reinitialise the batch job in case of restart.
|
||||
* This method returns the execution attributes for the reader. It returns
|
||||
* the current Line Count which can be used to reinitialise the batch job in
|
||||
* case of restart.
|
||||
*/
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if (reader == null) {
|
||||
throw new ItemStreamException("ItemStream not open or already closed.");
|
||||
}
|
||||
|
||||
if(saveState){
|
||||
|
||||
if (saveState) {
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
executionContext.putLong(getKey(LINES_READ_COUNT), reader.getPosition());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a single-threaded environment. The state backing
|
||||
* the mark is a single counter, keeping track of the current position, so multiple threads cannot be accommodated.
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemReader#mark()
|
||||
*/
|
||||
@@ -226,11 +235,14 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
private String readLine() {
|
||||
try {
|
||||
return (String) getReader().read();
|
||||
} catch (ItemStreamException e) {
|
||||
}
|
||||
catch (ItemStreamException e) {
|
||||
throw e;
|
||||
} catch (ItemReaderException e) {
|
||||
}
|
||||
catch (ItemReaderException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
@@ -247,7 +259,8 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for resource property. The location of an input stream that can be read.
|
||||
* Setter for resource property. The location of an input stream that can be
|
||||
* read.
|
||||
*
|
||||
* @param resource
|
||||
*/
|
||||
@@ -256,8 +269,9 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the recordSeparatorPolicy. Used to determine where the line endings are and do things like
|
||||
* continue over a line ending if inside a quoted string.
|
||||
* Public setter for the recordSeparatorPolicy. Used to determine where the
|
||||
* line endings are and do things like continue over a line ending if inside
|
||||
* a quoted string.
|
||||
*
|
||||
* @param recordSeparatorPolicy the recordSeparatorPolicy to set
|
||||
*/
|
||||
@@ -266,8 +280,8 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for comment prefixes. Can be used to ignore header lines as well by using e.g. the first couple of column
|
||||
* names as a prefix.
|
||||
* Setter for comment prefixes. Can be used to ignore header lines as well
|
||||
* by using e.g. the first couple of column names as a prefix.
|
||||
*
|
||||
* @param comments an array of comment line prefixes.
|
||||
*/
|
||||
@@ -277,8 +291,10 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether first line is a header. If the tokenizer is an {@link AbstractLineTokenizer} and the column
|
||||
* names haven't been set already then the header will be used to setup column names. Default is <code>false</code>.
|
||||
* Indicates whether first line is a header. If the tokenizer is an
|
||||
* {@link AbstractLineTokenizer} and the column names haven't been set
|
||||
* already then the header will be used to setup column names. Default is
|
||||
* <code>false</code>.
|
||||
*/
|
||||
public void setFirstLineIsHeader(boolean firstLineIsHeader) {
|
||||
this.firstLineIsHeader = firstLineIsHeader;
|
||||
@@ -301,8 +317,10 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the number of lines to skip at the start of a file. Can be used if the file contains a header
|
||||
* without useful (column name) information, and without a comment delimiter at the beginning of the lines.
|
||||
* Public setter for the number of lines to skip at the start of a file. Can
|
||||
* be used if the file contains a header without useful (column name)
|
||||
* information, and without a comment delimiter at the beginning of the
|
||||
* lines.
|
||||
*
|
||||
* @param linesToSkip the number of lines to skip
|
||||
*/
|
||||
@@ -311,9 +329,11 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the encoding for this input source. Default value is {@value #DEFAULT_CHARSET}.
|
||||
* Setter for the encoding for this input source. Default value is
|
||||
* {@link #DEFAULT_CHARSET}.
|
||||
*
|
||||
* @param encoding a properties object which possibly contains the encoding for this input file;
|
||||
* @param encoding a properties object which possibly contains the encoding
|
||||
* for this input file;
|
||||
*/
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
@@ -323,12 +343,12 @@ public class FlatFileItemReader extends ExecutionContextUserSupport implements I
|
||||
Assert.notNull(resource, "Input resource must not be null");
|
||||
Assert.notNull(fieldSetMapper, "FieldSetMapper must not be null.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the boolean indicating whether or not state should be saved
|
||||
* in the provided {@link ExecutionContext} during the {@link ItemStream}
|
||||
* call to update. Setting this to false means that it will always start
|
||||
* at the beginning.
|
||||
* Set the boolean indicating whether or not state should be saved in the
|
||||
* provided {@link ExecutionContext} during the {@link ItemStream} call to
|
||||
* update. Setting this to false means that it will always start at the
|
||||
* beginning.
|
||||
*
|
||||
* @param saveState
|
||||
*/
|
||||
|
||||
@@ -56,8 +56,6 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* Uses buffered writer to improve performance.<br/>
|
||||
*
|
||||
* Use {@link #write(String)} method to output a line to an item writer.
|
||||
*
|
||||
* <p>
|
||||
* This class will be updated in the future to use a buffering approach to
|
||||
* handling transactions, rather than outputting directly to the file and
|
||||
@@ -160,7 +158,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceLifecycle#close(ExecutionContext)
|
||||
* @see ItemStream#close(ExecutionContext)
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) {
|
||||
if (state != null) {
|
||||
@@ -193,7 +191,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implements I
|
||||
/**
|
||||
* Initialize the Output Template.
|
||||
*
|
||||
* @see ResourceLifecycle#open()
|
||||
* @see ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) {
|
||||
OutputState outputState = getOutputState();
|
||||
@@ -298,7 +296,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* @param properties
|
||||
* @param executionContext
|
||||
*/
|
||||
public void restoreFrom(ExecutionContext executionContext) {
|
||||
lastMarkedByteOffsetPosition = executionContext.getLong(getKey(RESTART_DATA_NAME));
|
||||
@@ -345,9 +343,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implements I
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param offset
|
||||
* @param length
|
||||
* @param line
|
||||
* @throws IOException
|
||||
*/
|
||||
public void write(String line) throws IOException {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar im
|
||||
|
||||
/**
|
||||
* The bean name (id) for an object that can be populated from the field set
|
||||
* that will be passed into {@link #mapLine(DefaultFieldSet)}. Typically a
|
||||
* that will be passed into {@link #mapLine(FieldSet)}. Typically a
|
||||
* prototype scoped bean so that a new instance is returned for each field
|
||||
* set mapped.
|
||||
*
|
||||
@@ -115,7 +115,7 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar im
|
||||
/**
|
||||
* Public setter for the type of bean to create instead of using a prototype
|
||||
* bean. An object of this type will be created from its default constructor
|
||||
* for every call to {@link #mapLine(DefaultFieldSet)}.<br/>
|
||||
* for every call to {@link #mapLine(FieldSet)}.<br/>
|
||||
*
|
||||
* Either this property or the prototype bean name must be specified, but
|
||||
* not both.
|
||||
@@ -150,7 +150,7 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar im
|
||||
* the {@link DataBinder} from {@link #createBinder(Object)} has errors
|
||||
* after binding).
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapLine(org.springframework.batch.item.file.mapping.DefaultFieldSet)
|
||||
* @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapLine(org.springframework.batch.item.file.mapping.FieldSet)
|
||||
*/
|
||||
public Object mapLine(FieldSet fs) {
|
||||
Object copy = getBean();
|
||||
@@ -173,7 +173,7 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar im
|
||||
* bind the properties form a field set into the target object. This
|
||||
* implementation creates a new {@link DataBinder} and calls out to
|
||||
* {@link #initBinder(DataBinder)} and
|
||||
* {@link #registerPropertyEditors(DataBinder)}.
|
||||
* {@link #registerCustomEditors(PropertyEditorRegistry)}.
|
||||
*
|
||||
* @param target
|
||||
* @return a {@link DataBinder} that can be used to bind properties to the
|
||||
@@ -194,10 +194,10 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar im
|
||||
* by {@link #createBinder(Object)}.
|
||||
* <p>
|
||||
* Note that registration of custom property editors should be done in
|
||||
* {@link #registerPropertyEditors(PropertyEditorRegistry)}, not here! This
|
||||
* {@link #registerCustomEditors(PropertyEditorRegistry)}, not here! This
|
||||
* method will only be called when a <b>new</b> data binder is created.
|
||||
* @param binder new binder instance
|
||||
* @see #createBinder(RequestContext, Object)
|
||||
* @see #createBinder(Object)
|
||||
*/
|
||||
protected void initBinder(DataBinder binder) {
|
||||
}
|
||||
|
||||
@@ -319,9 +319,7 @@ public interface FieldSet {
|
||||
* designated column <code>index</code>.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @param pattern the pattern describing the date and time format
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
* @see #DEFAULT_DATE_PATTERN
|
||||
*/
|
||||
Date readDate(int index);
|
||||
|
||||
@@ -330,10 +328,8 @@ public interface FieldSet {
|
||||
* with given <code>name</code>.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @param pattern the pattern describing the date and time format
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
* @see #DEFAULT_DATE_PATTERN
|
||||
*/
|
||||
Date readDate(String name);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.batch.item.ItemStream;
|
||||
public interface LineReader extends ItemReader, ItemStream {
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return position
|
||||
*/
|
||||
int getPosition();
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ResourceLineReader extends ItemStreamSupport implements LineReader,
|
||||
|
||||
private Collection comments = DEFAULT_COMMENTS;
|
||||
|
||||
// Encapsulates the state of the input source.
|
||||
// Encapsulates the state of the reader.
|
||||
private State state = null;
|
||||
|
||||
private RecordSeparatorPolicy recordSeparatorPolicy = new DefaultRecordSeparatorPolicy();
|
||||
@@ -113,7 +113,7 @@ public class ResourceLineReader extends ItemStreamSupport implements LineReader,
|
||||
*
|
||||
* @return a String.
|
||||
*
|
||||
* @see org.springframework.batch.item.adapter.support.ItemReader#read()
|
||||
* @see org.springframework.batch.item.ItemReader#read()
|
||||
*/
|
||||
public synchronized Object read() {
|
||||
// Make a copy of the recordSeparatorPolicy reference, in case it is
|
||||
@@ -147,9 +147,7 @@ public class ResourceLineReader extends ItemStreamSupport implements LineReader,
|
||||
}
|
||||
|
||||
/**
|
||||
* A no-op because the oobject is initialized with all it needs to open in the constructor.
|
||||
*
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#open()
|
||||
* Creates internal state object.
|
||||
*/
|
||||
public synchronized void open() {
|
||||
state = new State();
|
||||
|
||||
@@ -33,8 +33,6 @@ public class DelimitedLineAggregator implements LineAggregator {
|
||||
* Method used to create string representing object.
|
||||
*
|
||||
* @param fieldSet arrays of strings representing data to be stored
|
||||
* @param lineDescriptor for this implementation this parameter is not
|
||||
* used
|
||||
*/
|
||||
public String aggregate(FieldSet fieldSet) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
@@ -21,15 +21,15 @@ import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
|
||||
/**
|
||||
* Interface used to create string used to create string representing object.
|
||||
* @author tomas.slanina
|
||||
*
|
||||
* @author tomas.slanina
|
||||
*/
|
||||
public interface LineAggregator {
|
||||
/**
|
||||
* Method used to create a string to be stored from the array of values.
|
||||
*
|
||||
* @param fieldSet values to be converted
|
||||
* @return
|
||||
* @return string
|
||||
*/
|
||||
public String aggregate(FieldSet fieldSet);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class Range {
|
||||
|
||||
private final static int UPPER_BORDER_NOT_DEFINED = Integer.MAX_VALUE;
|
||||
public final static int UPPER_BORDER_NOT_DEFINED = Integer.MAX_VALUE;
|
||||
|
||||
private int min;
|
||||
private int max;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
|
||||
* '36, 14, 1-10, 15, 49-57' is equal to '36-48, 14-14, 1-10, 15-35, 49-57'
|
||||
* <p>
|
||||
* Property editor also allows to validate whether ranges are disjoint. Validation
|
||||
* can be turned on/off by using {@link #forceDisjointRanges}. By default
|
||||
* can be turned on/off by using {@link #setForceDisjointRanges(boolean)}. By default
|
||||
* validation is turned off.
|
||||
*
|
||||
* @author peter.zozom
|
||||
|
||||
@@ -111,7 +111,7 @@ public class JmsItemReader extends AbstractItemReader implements ItemRecoverer,
|
||||
* Send the message back to the proovider using the specified error
|
||||
* destination property of this provider.
|
||||
*
|
||||
* @see org.springframework.batch.item.AbstractItemReader#recover(java.lang.Object,
|
||||
* @see org.springframework.batch.item.ItemRecoverer#recover(Object,
|
||||
* Throwable)
|
||||
*/
|
||||
public boolean recover(Object item, Throwable cause) {
|
||||
@@ -140,7 +140,7 @@ public class JmsItemReader extends AbstractItemReader implements ItemRecoverer,
|
||||
* If the message is a {@link Message} then returns the JMS message ID.
|
||||
* Otherwise just delegate to parent class.
|
||||
*
|
||||
* @see org.springframework.batch.item.AbstractItemReader#getKey(java.lang.Object)
|
||||
* @see org.springframework.batch.item.ItemKeyGenerator#getKey(java.lang.Object)
|
||||
*
|
||||
* @throws UnexpectedInputException if the JMS id cannot be determined from
|
||||
* a JMS Message
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
* Simple aggregate {@link ExecutionContext} provider for the contributions
|
||||
* registered under the given key.
|
||||
*
|
||||
* @see org.springframework.batch.item.stream.StreamManager#getExecutionContext(java.lang.Object)
|
||||
* @see org.springframework.batch.item.ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
public void update(ExecutionContext executionContext) {
|
||||
synchronized (streams) {
|
||||
@@ -70,8 +70,6 @@ public class CompositeItemStream implements ItemStream {
|
||||
* Register a {@link ItemStream} as one of the interesting providers under
|
||||
* the provided key.
|
||||
*
|
||||
* @see org.springframework.batch.item.stream.StreamManager#register(java.lang.Object,
|
||||
* org.springframework.batch.item.ItemStream, ExecutionContext)
|
||||
*/
|
||||
public void register(ItemStream stream) {
|
||||
synchronized (streams) {
|
||||
@@ -82,7 +80,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast the call to close from this {@link StreamManager}.
|
||||
* Broadcast the call to close.
|
||||
* @throws ItemStreamException
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
@@ -95,7 +93,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast the call to open from this {@link StreamManager}.
|
||||
* Broadcast the call to open.
|
||||
* @throws ItemStreamException
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DelegatingItemWriter implements ItemWriter, InitializingBean {
|
||||
* delegate {@link ItemWriter}.
|
||||
* @throws Exception
|
||||
*
|
||||
* @see ItemWriter#process(java.lang.Object)
|
||||
* @see ItemWriter#write(Object)
|
||||
*/
|
||||
public void write(Object item) throws Exception {
|
||||
Object result = doProcess(item);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ItemTransformerItemWriter extends DelegatingItemWriter {
|
||||
private ItemTransformer itemTransformer;
|
||||
|
||||
/**
|
||||
* Transform the item using the {@link #itemTransformer}.
|
||||
* Transform the item using the {@link #setItemTransformer(ItemTransformer)}.
|
||||
*/
|
||||
protected Object doProcess(Object item) throws Exception {
|
||||
return itemTransformer.transform(item);
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface Validator {
|
||||
* Method used to validate if the value is valid.
|
||||
*
|
||||
* @param value object to be validated
|
||||
* @throws Exception if value is not valid.
|
||||
* @throws ValidationException if value is not valid.
|
||||
*/
|
||||
void validate(Object value) throws ValidationException;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class StaxEventItemReader extends ExecutionContextUserSupport implements
|
||||
* Read in the next root element from the file, and return it.
|
||||
*
|
||||
* @return the next available record, if none exist, return null
|
||||
* @see org.springframework.batch.io.ItemReader#read()
|
||||
* @see org.springframework.batch.item.ItemReader#read()
|
||||
*/
|
||||
public Object read() {
|
||||
if (!initialized) {
|
||||
|
||||
@@ -207,7 +207,7 @@ public class StaxEventItemWriter extends ExecutionContextUserSupport implements
|
||||
/**
|
||||
* Set "overwrite" flag for the output file. Flag is ignored when output file processing is restarted.
|
||||
*
|
||||
* @param shouldDeleteIfExists
|
||||
* @param overwriteOutput
|
||||
*/
|
||||
public void setOverwriteOutput(boolean overwriteOutput) {
|
||||
this.overwriteOutput = overwriteOutput;
|
||||
@@ -225,7 +225,7 @@ public class StaxEventItemWriter extends ExecutionContextUserSupport implements
|
||||
/**
|
||||
* Open the output source
|
||||
*
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#open()
|
||||
* @see org.springframework.batch.item.ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) {
|
||||
long startAtPosition = 0;
|
||||
@@ -334,7 +334,7 @@ public class StaxEventItemWriter extends ExecutionContextUserSupport implements
|
||||
/**
|
||||
* Flush and close the output source.
|
||||
*
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#close(ExecutionContext)
|
||||
* @see org.springframework.batch.item.ItemStream#close(ExecutionContext)
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) {
|
||||
flush();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DefaultTransactionalEventReader extends AbstractEventReaderWrapper
|
||||
/**
|
||||
* Creates instance of this class and wraps XMLEventReader.
|
||||
*
|
||||
* @param parent event reader to be wrapped.
|
||||
* @param wrappedReader event reader to be wrapped.
|
||||
*/
|
||||
public DefaultTransactionalEventReader(XMLEventReader wrappedReader) {
|
||||
super(wrappedReader);
|
||||
|
||||
@@ -38,8 +38,6 @@ class EventSequence {
|
||||
/**
|
||||
* Gets next XMLEvent from cache and moves cursor to next event.
|
||||
* If cache contains no more events, null is returned.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public XMLEvent nextEvent() {
|
||||
return (hasNext()) ? (XMLEvent)events.get(++currentIndex) :null;
|
||||
@@ -48,8 +46,6 @@ class EventSequence {
|
||||
/**
|
||||
* Gets next XMLEvent from cache but cursor remains on the same position.
|
||||
* If cache contains no more events, null is returned.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public XMLEvent peek() {
|
||||
return (hasNext()) ? (XMLEvent)events.get(currentIndex+1) :null;
|
||||
|
||||
@@ -99,8 +99,6 @@ public class ExitStatus implements Serializable {
|
||||
|
||||
/**
|
||||
* Getter for the exit description (defaults to blank)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getExitDescription() {
|
||||
return exitDescription;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ItemReaderRepeatCallback implements RepeatCallback {
|
||||
/**
|
||||
* Use the writer to process the next item if there is one. Return the
|
||||
* item processed, or null if nothing was available.
|
||||
* @see org.springframework.batch.repeat.RepeatCallback#doInIteration(org.springframework.batch.item.BatchContextAdapter)
|
||||
* @see org.springframework.batch.repeat.RepeatCallback#doInIteration(RepeatContext)
|
||||
* @param context the current context.
|
||||
* @return null if the data provider is exhausted.
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,7 @@ public class NestedRepeatCallback implements RepeatCallback {
|
||||
* batch process, or to break a process up into smaller chunks (e.g. to
|
||||
* change the transaction boundaries).
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatCallback#doInIteration(org.springframework.batch.support.BatchContextAdapter)
|
||||
* @see org.springframework.batch.repeat.RepeatCallback#doInIteration(RepeatContext)
|
||||
*/
|
||||
public ExitStatus doInIteration(RepeatContext context) throws Exception {
|
||||
return template.iterate(callback);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class RepeatContextCounter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience constructor with {@link #useParent}=false.
|
||||
* Convenience constructor with useParent=false.
|
||||
* @param context the current context.
|
||||
* @param countKey the key to use to store the counter in the context.
|
||||
*/
|
||||
|
||||
@@ -64,7 +64,7 @@ public class LogOrRethrowExceptionHandler implements ExceptionHandler {
|
||||
|
||||
/**
|
||||
* Setter for the {@link ExceptionClassifier} used by this handler. The default is to map all throwable instances to
|
||||
* {@value #RETHROW}.
|
||||
* {@link #RETHROW}.
|
||||
*
|
||||
* @param exceptionClassifier
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ public class LogOrRethrowExceptionHandler implements ExceptionHandler {
|
||||
*
|
||||
* @throws Throwable
|
||||
*
|
||||
* @see {@link ExceptionHandler#handleException(RepeatContext, Throwable)}
|
||||
* @see ExceptionHandler#handleException(RepeatContext, Throwable)
|
||||
*/
|
||||
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class RethrowOnThresholdExceptionHandler implements ExceptionHandler {
|
||||
/**
|
||||
* Setter for the {@link ExceptionClassifier} used by this handler. The
|
||||
* default is to map all throwable instances to
|
||||
* {@value ExceptionClassifierSupport#DEFAULT}, which are then mapped to a
|
||||
* {@link ExceptionClassifierSupport#DEFAULT}, which are then mapped to a
|
||||
* threshold of 0 by the {@link #setThresholds(Map)} map.
|
||||
*
|
||||
* @param exceptionClassifier
|
||||
@@ -112,7 +112,7 @@ public class RethrowOnThresholdExceptionHandler implements ExceptionHandler {
|
||||
* same type according to the classifier.
|
||||
*
|
||||
* @throws Throwable
|
||||
* @see {@link ExceptionHandler#handleException(RepeatContext, Throwable)}
|
||||
* @see ExceptionHandler#handleException(RepeatContext, Throwable)
|
||||
*/
|
||||
public void handleException(RepeatContext context, Throwable throwable)
|
||||
throws Throwable {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SimpleLimitExceptionHandler implements ExceptionHandler {
|
||||
* Rethrows only if the limit is breached for this context on the exception
|
||||
* type specified.
|
||||
*
|
||||
* @see #setType(Class)
|
||||
* @see #setExceptionClasses(Class[])
|
||||
* @see #setLimit(int)
|
||||
*
|
||||
* @see org.springframework.batch.repeat.exception.ExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext,
|
||||
@@ -138,7 +138,7 @@ public class SimpleLimitExceptionHandler implements ExceptionHandler {
|
||||
/**
|
||||
* Setter for the Throwable exceptionClasses that shouldn't be counted, but
|
||||
* rethrown immediately. This list has higher priority than
|
||||
* {@link #exceptionClasses}.
|
||||
* {@link #setExceptionClasses(Class[])}.
|
||||
*
|
||||
* @param fatalExceptionClasses defaults to {@link Error}
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CompositeRepeatListener implements RepeatListener {
|
||||
/**
|
||||
* Register additional listener.
|
||||
*
|
||||
* @param itemReaderListener
|
||||
* @param listener
|
||||
*/
|
||||
public void register(RepeatListener listener) {
|
||||
if (!listeners.contains(listener)) {
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class CountingCompletionPolicy extends DefaultResultCompletionPo
|
||||
/**
|
||||
* Extension point for subclasses. Inspect the context and update the state
|
||||
* of a counter in whatever way is appropriate. This will be added to the
|
||||
* session-level counter if {@link #useParent} is true.
|
||||
* session-level counter if {@link #setUseParent(boolean)} is true.
|
||||
*
|
||||
* @param context the current context.
|
||||
*
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SimpleCompletionPolicy extends DefaultResultCompletionPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.repeat.CompletionPolicy#isComplete(RepeatContext,
|
||||
* ExitStatus)
|
||||
* @throws Exception (normally terminating the batch) if the result is
|
||||
* @throws RuntimeException (normally terminating the batch) if the result is
|
||||
* itself an exception.
|
||||
*/
|
||||
public boolean isComplete(RepeatContext context, ExitStatus result) {
|
||||
|
||||
@@ -337,7 +337,7 @@ public class RepeatTemplate implements RepeatOperations {
|
||||
* @param state maintained by the implementation.
|
||||
* @return a finished result.
|
||||
*
|
||||
* @see {@link #isComplete(RepeatContext)}
|
||||
* @see #isComplete(RepeatContext)
|
||||
*/
|
||||
protected ExitStatus getNextResult(RepeatContext context, RepeatCallback callback, RepeatInternalState state)
|
||||
throws Throwable {
|
||||
@@ -355,7 +355,7 @@ public class RepeatTemplate implements RepeatOperations {
|
||||
* processes. By default does nothing and returns true.
|
||||
*
|
||||
* @param state the internal state.
|
||||
* @return true if {@link #canContinue(Object)} is true for all results
|
||||
* @return true if {@link #canContinue(ExitStatus)} is true for all results
|
||||
* retrieved.
|
||||
*/
|
||||
protected boolean waitForResults(RepeatInternalState state) {
|
||||
|
||||
@@ -4,10 +4,7 @@ import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
|
||||
/**
|
||||
* Interface for result holder. Should be implemented by subclasses so that
|
||||
* the contract for
|
||||
* {@link AbstracBatchemplate#getNextResult(RepeatContext, RepeatCallback, TerminationContext, List)}
|
||||
* can be satisfied.
|
||||
* Interface for result holder.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.batch.repeat.support;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatCallback;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
@@ -52,7 +50,7 @@ public class TaskExecutorRepeatTemplate extends RepeatTemplate {
|
||||
/**
|
||||
* Default limit for maximum number of concurrent unfinished results allowed
|
||||
* by the template.
|
||||
* {@link #getNextResult(RepeatContext, RepeatCallback, TerminationContext, List)}.
|
||||
* {@link #getNextResult(RepeatContext, RepeatCallback, RepeatInternalState)}.
|
||||
*/
|
||||
public static final int DEFAULT_THROTTLE_LIMIT = 4;
|
||||
|
||||
@@ -72,15 +70,12 @@ public class TaskExecutorRepeatTemplate extends RepeatTemplate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the {@link #taskExecutor} to generate a result. The internal state in
|
||||
* Use the {@link #setTaskExecutor(TaskExecutor)} to generate a result. The internal state in
|
||||
* this case is a queue of unfinished result holders of type
|
||||
* {@link ResultHolder}. The holder with the return value should not be on
|
||||
* the queue when this method exits. The queue is scoped in the calling
|
||||
* method so there is no need to synchronize access.
|
||||
*
|
||||
* @see org.springframework.batch.repeat.support.AbstracBatchemplate#getNextResult(org.springframework.batch.item.RepeatContext,
|
||||
* org.springframework.batch.repeat.RepeatCallback,
|
||||
* org.springframework.batch.TerminationContext, java.util.List)
|
||||
*/
|
||||
protected ExitStatus getNextResult(RepeatContext context, RepeatCallback callback, RepeatInternalState state)
|
||||
throws Throwable {
|
||||
@@ -257,7 +252,7 @@ public class TaskExecutorRepeatTemplate extends RepeatTemplate {
|
||||
* number of concurrent tasks that can be executing at one time - if a new
|
||||
* task arrives and the throttle limit is breached we wait for one of the
|
||||
* executing tasks to finish before submitting the new one to the
|
||||
* {@link TaskExecutor}. Default value is {@value #DEFAULT_THROTTLE_LIMIT}.
|
||||
* {@link TaskExecutor}. Default value is {@link #DEFAULT_THROTTLE_LIMIT}.
|
||||
* N.B. when used with a thread pooled {@link TaskExecutor} it doesn't make
|
||||
* sense for the throttle limit to be less than the thread pool size.
|
||||
*
|
||||
|
||||
@@ -57,7 +57,7 @@ public interface RetryPolicy {
|
||||
RetryContext open(RetryCallback callback, RetryContext parent);
|
||||
|
||||
/**
|
||||
* @param status a retry status created by the {@link #open(RetryCallback, RetryContext)}
|
||||
* @param context a retry status created by the {@link #open(RetryCallback, RetryContext)}
|
||||
* method of this manager.
|
||||
*/
|
||||
void close(RetryContext context);
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.batch.retry.RetryException;
|
||||
/**
|
||||
* Exception class signifiying that an attempt to back off using a
|
||||
* {@link BackOffPolicy} was interrupted, most likely by an
|
||||
* {@link InterruptedException} during a call to {@link Thread#sleep}.
|
||||
* {@link InterruptedException} during a call to {@link Thread#sleep(long)}.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @since 2.1
|
||||
|
||||
@@ -21,13 +21,13 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Implementation of {@link BackOffPolicy} that increases the back off period
|
||||
* for each retry attempt in a given set using the {@link Math#exp exponential}
|
||||
* function. <p/> This implementation is thread-safe and suitable for concurrent
|
||||
* access. Modifications to the configuration do not affect any retry sets that
|
||||
* are already in progress. <p/> The {@link #setExpSeed expSeed} property
|
||||
* controls the initial value passed to {@link Math#exp} and the
|
||||
* {@link #setIncrement increment} property controls by how much this value is
|
||||
* increased for each subsequent attempt.
|
||||
* for each retry attempt in a given set using the
|
||||
* {@link Math#exp(double) exponential} function. <p/> This implementation is
|
||||
* thread-safe and suitable for concurrent access. Modifications to the
|
||||
* configuration do not affect any retry sets that are already in progress. <p/>
|
||||
* The {@link #setInitialInterval(long)} property controls the initial value passed to
|
||||
* {@link Math#exp(double)} and the {@link #setMultiplier(double)} property controls by
|
||||
* how much this value is increased for each subsequent attempt.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Dave Syer
|
||||
@@ -103,7 +103,7 @@ public class ExponentialBackOffPolicy implements BackOffPolicy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link ExponentialBackOffContext} configured
|
||||
* Returns a new instance of {@link BackOffContext} configured
|
||||
* with the 'expSeed' and 'increment' values.
|
||||
*/
|
||||
public BackOffContext start(RetryContext context) {
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.batch.retry.backoff;
|
||||
|
||||
/**
|
||||
* Implementation of {@link BackOffPolicy} that pauses for a fixed period of
|
||||
* time before continuing. A pause is implemented using {@link Thread#sleep}.
|
||||
* <p/> {@link #backOff} is thread-safe and it is safe to call
|
||||
* time before continuing. A pause is implemented using {@link Thread#sleep(long)}.
|
||||
* <p/> {@link #setBackOffPeriod(long)} is thread-safe and it is safe to call
|
||||
* {@link #setBackOffPeriod} during execution from multiple threads, however
|
||||
* this may cause a single retry operation to have pauses of different
|
||||
* intervals.
|
||||
@@ -59,7 +59,7 @@ public class FixedBackOffPolicy extends StatelessBackOffPolicy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause for the {@link #backOffPeriod}.
|
||||
* Pause for the {@link #setBackOffPeriod(long)}.
|
||||
* @throws BackOffInterruptedException if interrupted during sleep.
|
||||
*/
|
||||
protected void doBackOff() throws BackOffInterruptedException {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ItemWriterRetryCallback implements RetryCallback {
|
||||
* be used instead (preferring the reader to the writer if both would be
|
||||
* appropriate).
|
||||
*
|
||||
* @param recoveryHandler
|
||||
* @param recoverer
|
||||
*/
|
||||
public void setRecoverer(ItemRecoverer recoverer) {
|
||||
this.recoverer = recoverer;
|
||||
|
||||
@@ -245,7 +245,6 @@ public class ItemWriterRetryPolicy extends AbstractStatefulRetryPolicy {
|
||||
*
|
||||
* @param failedItemIdentifier
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
protected boolean hasFailed(FailedItemIdentifier failedItemIdentifier, Object key) {
|
||||
if (failedItemIdentifier != null) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.batch.retry.policy;
|
||||
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.retry.RetryCallback;
|
||||
import org.springframework.batch.retry.RetryContext;
|
||||
import org.springframework.batch.retry.context.RetryContextSupport;
|
||||
@@ -113,14 +112,14 @@ public class SimpleRetryPolicy extends AbstractStatelessRetryPolicy {
|
||||
* thereof, will be re-thrown without retry. This list takes precedence over
|
||||
* the retryable list.
|
||||
*
|
||||
* @param retryableExceptionClasses defaults to {@link Exception}.
|
||||
* @param fatalExceptionClasses defaults to {@link Exception}.
|
||||
*/
|
||||
public final void setFatalExceptionClasses(Class[] fatalExceptionClasses) {
|
||||
fatalClassifier.setExceptionClasses(fatalExceptionClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.springframework.batch.retry.RetryManager#close(RepeatContext)
|
||||
* @see org.springframework.batch.retry.RetryPolicy#close(RetryContext)
|
||||
*/
|
||||
public void close(RetryContext status) {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TimeoutRetryPolicy extends AbstractStatelessRetryPolicy {
|
||||
private long timeout = DEFAULT_TIMEOUT;
|
||||
|
||||
/**
|
||||
* Setter for timeout. Default is {@value #DEFAULT_TIMEOUT}.
|
||||
* Setter for timeout. Default is {@link #DEFAULT_TIMEOUT}.
|
||||
* @param timeout
|
||||
*/
|
||||
public void setTimeout(long timeout) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.batch.retry.support;
|
||||
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatOperations;
|
||||
import org.springframework.batch.retry.RetryCallback;
|
||||
import org.springframework.batch.retry.RetryContext;
|
||||
@@ -29,7 +28,7 @@ import org.springframework.batch.retry.RetryOperations;
|
||||
* enclosing {@link RetryOperations}. But occasionally it might be helpful to
|
||||
* have lower level access to the ongoing {@link RetryContext} so we provide a
|
||||
* global accessor here. The mutator methods ({@link #clear()} and
|
||||
* {@link #register(RepeatContext)} should not be used except internally by
|
||||
* {@link #register(RetryContext)} should not be used except internally by
|
||||
* {@link RetryOperations} implementations.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -43,13 +43,12 @@ import org.springframework.batch.retry.policy.SimpleRetryPolicy;
|
||||
*
|
||||
* By default, an operation is retried if is throws any {@link Exception} or
|
||||
* subclass of {@link Exception}. This behaviour can be changed by using the
|
||||
* {@link #setRetryableExceptionClasses} method to specify exactly which
|
||||
* {@link Exception} classes to retry for. <br/>
|
||||
* {@link #setRetryPolicy(RetryPolicy)} method. <br/>
|
||||
*
|
||||
* Also by default, each operation is retried for a maximum of three attempts
|
||||
* with no back off in between. This behaviour can be configured using the
|
||||
* {@link #setRetryAttempts retryAttempts} and
|
||||
* {@link #setBackOffStrategy backOffStrategy} properties. The
|
||||
* {@link #setRetryPolicy(RetryPolicy)} and
|
||||
* {@link #setBackOffPolicy(BackOffPolicy)} properties. The
|
||||
* {@link org.springframework.batch.retry.backoff.BackOffPolicy} controls how
|
||||
* long the pause is between each individual retry attempt. <br/>
|
||||
*
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ExceptionClassifierSupport implements ExceptionClassifier {
|
||||
public static final String DEFAULT = "default";
|
||||
|
||||
/**
|
||||
* Always returns the value of {@value #DEFAULT}.
|
||||
* Always returns the value of {@link #DEFAULT}.
|
||||
*
|
||||
* @see org.springframework.batch.support.ExceptionClassifier#classify(java.lang.Throwable)
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,6 @@ public final class PropertiesConverter {
|
||||
* @param stringToParse String to parse.
|
||||
* @return Properties parsed from each string.
|
||||
* @see PropertiesPersister
|
||||
* @throws StringIOException
|
||||
*/
|
||||
public static Properties stringToProperties(String stringToParse) {
|
||||
|
||||
@@ -89,7 +88,6 @@ public final class PropertiesConverter {
|
||||
*
|
||||
* @param propertiesToParse
|
||||
* @return String representation of properties object
|
||||
* @throws StringIOException if IOException is thrown from StringWriter
|
||||
*/
|
||||
public static String propertiesToString(Properties propertiesToParse) {
|
||||
|
||||
|
||||
@@ -92,12 +92,11 @@ public class SubclassExceptionClassifier extends ExceptionClassifierSupport {
|
||||
* Comparator for classes to order by inheritance.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
private class ClassComparator implements Comparator {
|
||||
/**
|
||||
* @return 1 if arg0 is assignable from arg1
|
||||
* @return -1 otherwise
|
||||
* @return 1 if arg0 is assignable from arg1, -1 otherwise
|
||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public int compare(Object arg0, Object arg1) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class HibernateAwareItemWriterTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#initDao()}.
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#afterPropertiesSet()}.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -108,7 +108,7 @@ public class HibernateAwareItemWriterTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#initDao()}.
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#afterPropertiesSet()}.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -183,7 +183,7 @@ public class HibernateAwareItemWriterTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#close(org.springframework.batch.repeat.RepeatContext)}.
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#flush()}.
|
||||
*/
|
||||
public void testFlush() throws Exception{
|
||||
writer.flush();
|
||||
@@ -195,7 +195,7 @@ public class HibernateAwareItemWriterTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#close(org.springframework.batch.repeat.RepeatContext)}.
|
||||
* {@link org.springframework.batch.item.database.HibernateAwareItemWriter#clear()}.
|
||||
*/
|
||||
public void testClear() throws Exception{
|
||||
writer.clear();
|
||||
|
||||
@@ -30,16 +30,12 @@ import org.springframework.batch.item.support.CompositeItemStream;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class SimpleStreamManagerTests extends TestCase {
|
||||
public class CompositeItemStreamTests extends TestCase {
|
||||
|
||||
private CompositeItemStream manager = new CompositeItemStream();
|
||||
|
||||
private List list = new ArrayList();
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.support.CompositeItemStream#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testRegisterAndOpen() {
|
||||
ItemStreamSupport stream = new ItemStreamSupport() {
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
@@ -51,10 +47,6 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.support.CompositeItemStream#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testRegisterTwice() {
|
||||
ItemStreamSupport stream = new ItemStreamSupport() {
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
@@ -67,10 +59,6 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.support.CompositeItemStream#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testMark() {
|
||||
manager.register(new ItemStreamSupport() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
@@ -81,10 +69,6 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.support.CompositeItemStream#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testClose() {
|
||||
manager.register(new ItemStreamSupport() {
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
@@ -95,10 +79,6 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.support.CompositeItemStream#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testCloseDoesNotUnregister() {
|
||||
manager.setStreams(new ItemStream[] { new ItemStreamSupport() {
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
@@ -27,7 +27,7 @@ public class ExitStatusTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.repeat.ExitStatus#ExitStatus(boolean, int)}.
|
||||
* {@link org.springframework.batch.repeat.ExitStatus#ExitStatus(boolean, String)}.
|
||||
*/
|
||||
public void testExitStatusBooleanInt() {
|
||||
ExitStatus status = new ExitStatus(true, "10");
|
||||
@@ -37,7 +37,7 @@ public class ExitStatusTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.repeat.ExitStatus#ExitStatus(boolean, int)}.
|
||||
* {@link org.springframework.batch.repeat.ExitStatus#ExitStatus(boolean, String)}.
|
||||
*/
|
||||
public void testExitStatusConstantsContinuable() {
|
||||
ExitStatus status = ExitStatus.CONTINUABLE;
|
||||
@@ -47,7 +47,7 @@ public class ExitStatusTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.repeat.ExitStatus#ExitStatus(boolean, int)}.
|
||||
* {@link org.springframework.batch.repeat.ExitStatus#ExitStatus(boolean, String)}.
|
||||
*/
|
||||
public void testExitStatusConstantsFinished() {
|
||||
ExitStatus status = ExitStatus.FINISHED;
|
||||
|
||||
@@ -36,8 +36,7 @@ public class CompositeRepeatListenerTests extends TestCase {
|
||||
private List list = new ArrayList();
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.execution.listener.CompositeStepListener#setListeners(org.springframework.batch.core.domain.StepListener[])}.
|
||||
* Test method for {@link CompositeRepeatListener#setListeners(RepeatListener[])}.
|
||||
*/
|
||||
public void testSetListeners() {
|
||||
listener.setListeners(new RepeatListener[] { new RepeatListenerSupport() {
|
||||
@@ -55,7 +54,7 @@ public class CompositeRepeatListenerTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.execution.listener.CompositeStepListener#registerListener(org.springframework.batch.core.domain.StepListener)}.
|
||||
* {@link CompositeRepeatListener#register(RepeatListener)}.
|
||||
*/
|
||||
public void testSetListener() {
|
||||
listener.register(new RepeatListenerSupport() {
|
||||
@@ -67,10 +66,6 @@ public class CompositeRepeatListenerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.execution.listener.CompositeStepListener#beforeStep(StepExecution)}.
|
||||
*/
|
||||
public void testClose() {
|
||||
listener.register(new RepeatListenerSupport() {
|
||||
public void close(RepeatContext context) {
|
||||
@@ -81,10 +76,6 @@ public class CompositeRepeatListenerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.execution.listener.CompositeStepListener#beforeStep(StepExecution)}.
|
||||
*/
|
||||
public void testOnError() {
|
||||
listener.register(new RepeatListenerSupport() {
|
||||
public void onError(RepeatContext context, Throwable e) {
|
||||
|
||||
@@ -24,7 +24,7 @@ public class StubItemKeyGeneratorRecoverer implements ItemRecoverer, ItemKeyGene
|
||||
/**
|
||||
* Do nothing. Subclassses should override to implement recovery behaviour.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemReader#recover(java.lang.Object,
|
||||
* @see org.springframework.batch.item.ItemRecoverer#recover(java.lang.Object,
|
||||
* Throwable)
|
||||
*
|
||||
* @return false if nothing can be done (the default), or true if the item
|
||||
|
||||
@@ -84,8 +84,6 @@ public class RetrySynchronizationManagerTests extends TestCase {
|
||||
/**
|
||||
* Clear all contexts starting with the current one and continuing until
|
||||
* {@link RetrySynchronizationManager#clear()} returns null.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static RetryContext clearAll() {
|
||||
RetryContext result = null;
|
||||
|
||||
Reference in New Issue
Block a user