BATCH-1915: Change minimum compiler level to 1.6 and use @Override everywhere
This commit is contained in:
@@ -349,6 +349,7 @@ public class ExecutionContext implements Serializable {
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ExecutionContext == false) {
|
||||
return false;
|
||||
@@ -365,6 +366,7 @@ public class ExecutionContext implements Serializable {
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return map.hashCode();
|
||||
}
|
||||
@@ -374,6 +376,7 @@ public class ExecutionContext implements Serializable {
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return map.toString();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public abstract class ItemStreamSupport implements ItemStream {
|
||||
* No-op.
|
||||
* @see org.springframework.batch.item.ItemStream#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
}
|
||||
|
||||
@@ -35,6 +36,7 @@ public abstract class ItemStreamSupport implements ItemStream {
|
||||
* No-op.
|
||||
* @see org.springframework.batch.item.ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
}
|
||||
|
||||
@@ -42,6 +44,7 @@ public abstract class ItemStreamSupport implements ItemStream {
|
||||
* Return empty {@link ExecutionContext}.
|
||||
* @see org.springframework.batch.item.ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) {
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(targetObject);
|
||||
Assert.hasLength(targetMethod);
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ItemProcessorAdapter<I,O> extends AbstractMethodInvokingDelegator<O
|
||||
*
|
||||
* @see ItemProcessor#process(Object)
|
||||
*/
|
||||
@Override
|
||||
public O process(I item) throws Exception {
|
||||
return invokeDelegateMethodWithArgument(item);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class ItemReaderAdapter<T> extends AbstractMethodInvokingDelegator<T> imp
|
||||
/**
|
||||
* @return return value of the target method.
|
||||
*/
|
||||
@Override
|
||||
public T read() throws Exception {
|
||||
return invokeDelegateMethod();
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.batch.item.ItemWriter;
|
||||
*/
|
||||
public class ItemWriterAdapter<T> extends AbstractMethodInvokingDelegator<T> implements ItemWriter<T> {
|
||||
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
for (T item : items) {
|
||||
invokeDelegateMethodWithArgument(item);
|
||||
|
||||
@@ -42,6 +42,7 @@ public class PropertyExtractingDelegatingItemWriter<T> extends AbstractMethodInv
|
||||
* fieldsUsedAsTargetMethodArguments and passes them as arguments to the
|
||||
* delegate method.
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
for (T item : items) {
|
||||
|
||||
@@ -58,6 +59,7 @@ public class PropertyExtractingDelegatingItemWriter<T> extends AbstractMethodInv
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notEmpty(fieldsUsedAsTargetMethodArguments);
|
||||
|
||||
@@ -39,6 +39,7 @@ public class AmqpItemReader<T> implements ItemReader<T> {
|
||||
this.amqpTemplate = amqpTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T read() {
|
||||
if (itemType != null && itemType.isAssignableFrom(Message.class)) {
|
||||
|
||||
@@ -43,6 +43,7 @@ public class AmqpItemWriter<T> implements ItemWriter<T> {
|
||||
this.amqpTemplate = amqpTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(final List<? extends T> items) throws Exception {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Writing to AMQP with " + items.size() + " items.");
|
||||
|
||||
@@ -145,6 +145,7 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
* @throws IllegalArgumentException if either data source or sql properties
|
||||
* not set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(dataSource, "DataSource must be provided");
|
||||
}
|
||||
@@ -370,6 +371,7 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
* Close the cursor and database connection. Make call to cleanupOnClose so sub classes can cleanup
|
||||
* any resources they have allocated.
|
||||
*/
|
||||
@Override
|
||||
protected void doClose() throws Exception {
|
||||
initialized = false;
|
||||
JdbcUtils.closeResultSet(this.rs);
|
||||
@@ -432,6 +434,7 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
* Read next row and map it to item, verify cursor position if
|
||||
* {@link #setVerifyCursorPosition(boolean)} is true.
|
||||
*/
|
||||
@Override
|
||||
protected T doRead() throws Exception {
|
||||
if (rs == null) {
|
||||
throw new ReaderNotOpenException("Reader must be open before it can be read.");
|
||||
@@ -466,6 +469,7 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
* Use {@link ResultSet#absolute(int)} if possible, otherwise scroll by
|
||||
* calling {@link ResultSet#next()}.
|
||||
*/
|
||||
@Override
|
||||
protected void jumpToItem(int itemIndex) throws Exception {
|
||||
if (driverSupportsAbsolute) {
|
||||
try {
|
||||
@@ -485,4 +489,4 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public abstract class AbstractPagingItemReader<T> extends AbstractItemCountingIt
|
||||
* Check mandatory properties.
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(pageSize > 0, "pageSize must be greater than zero");
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class BeanPropertyItemSqlParameterSourceProvider<T> implements ItemSqlPar
|
||||
* the provided item.
|
||||
* @param item the item to use for parameter values
|
||||
*/
|
||||
@Override
|
||||
public SqlParameterSource createSqlParameterSource(T item) {
|
||||
return new BeanPropertySqlParameterSource(item);
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
/**
|
||||
* @see SmartDataSource
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldClose(Connection connection) {
|
||||
boolean shouldClose = !isCloseSuppressionActive(connection);
|
||||
if (borrowedConnection && closeSuppressedConnection.equals(connection)) {
|
||||
@@ -170,12 +171,14 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
synchronized (this.connectionMonitor) {
|
||||
return initConnection(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
synchronized (this.connectionMonitor) {
|
||||
return initConnection(username, password);
|
||||
@@ -207,18 +210,22 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintWriter getLogWriter() throws SQLException {
|
||||
return dataSource.getLogWriter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLoginTimeout() throws SQLException {
|
||||
return dataSource.getLoginTimeout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogWriter(PrintWriter out) throws SQLException {
|
||||
dataSource.setLogWriter(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoginTimeout(int seconds) throws SQLException {
|
||||
dataSource.setLoginTimeout(seconds);
|
||||
}
|
||||
@@ -250,6 +257,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on ConnectionProxy interface coming in...
|
||||
|
||||
@@ -292,6 +300,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
* Performs only a 'shallow' non-recursive check of self's and delegate's
|
||||
* class to retain Java 5 compatibility.
|
||||
*/
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
if (iface.isAssignableFrom(SmartDataSource.class) || iface.isAssignableFrom(dataSource.getClass())) {
|
||||
return true;
|
||||
@@ -304,6 +313,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
* cast to supplied parameter class. Does *not* support recursive unwrapping
|
||||
* of the delegate to retain Java 5 compatibility.
|
||||
*/
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface.isAssignableFrom(SmartDataSource.class)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -318,6 +328,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
throw new SQLException("Unsupported class " + iface.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(dataSource);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStream
|
||||
|
||||
private Map<String, Object> parameterValues;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(fetchSize >= 0, "fetchSize must not be negative");
|
||||
helper.afterPropertiesSet();
|
||||
@@ -150,6 +151,7 @@ public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStream
|
||||
helper.setUseStatelessSession(useStatelessSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected T doRead() throws Exception {
|
||||
if (cursor.next()) {
|
||||
Object[] data = cursor.get();
|
||||
@@ -178,6 +180,7 @@ public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStream
|
||||
/**
|
||||
* Open hibernate session and create a forward-only cursor for the query.
|
||||
*/
|
||||
@Override
|
||||
protected void doOpen() throws Exception {
|
||||
Assert.state(!initialized, "Cannot open an already opened ItemReader, call close first");
|
||||
cursor = helper.getForwardOnlyCursor(fetchSize, parameterValues);
|
||||
@@ -215,6 +218,7 @@ public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStream
|
||||
/**
|
||||
* Close the cursor and hibernate session.
|
||||
*/
|
||||
@Override
|
||||
protected void doClose() throws Exception {
|
||||
|
||||
initialized = false;
|
||||
|
||||
@@ -94,6 +94,7 @@ public class HibernateItemReaderHelper<T> implements InitializingBean {
|
||||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Assert.state(sessionFactory != null, "A SessionFactory must be provided");
|
||||
|
||||
@@ -84,6 +84,7 @@ public class HibernateItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
/**
|
||||
* Check mandatory properties - there must be a hibernateTemplate.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(hibernateTemplate,
|
||||
"HibernateItemWriter requires a HibernateOperations");
|
||||
@@ -95,6 +96,7 @@ public class HibernateItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public final void write(List<? extends T> items) {
|
||||
doWrite(hibernateTemplate, items);
|
||||
hibernateTemplate.flush();
|
||||
|
||||
@@ -143,6 +143,7 @@ public class HibernatePagingItemReader<T> extends AbstractPagingItemReader<T> im
|
||||
helper.setUseStatelessSession(useStatelessSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.state(fetchSize >= 0, "fetchSize must not be negative");
|
||||
|
||||
@@ -102,6 +102,7 @@ public class IbatisBatchItemWriter<T> implements ItemWriter<T>, InitializingBean
|
||||
/**
|
||||
* Check mandatory properties - there must be an SqlMapClient and a statementId.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(sqlMapClientTemplate, "A SqlMapClient or a SqlMapClientTemplate is required.");
|
||||
Assert.notNull(statementId, "A statementId is required.");
|
||||
@@ -110,6 +111,7 @@ public class IbatisBatchItemWriter<T> implements ItemWriter<T>, InitializingBean
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void write(final List<? extends T> items) {
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
@@ -121,6 +123,7 @@ public class IbatisBatchItemWriter<T> implements ItemWriter<T>, InitializingBean
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BatchResult> results = (List<BatchResult>) sqlMapClientTemplate.execute(
|
||||
new SqlMapClientCallback() {
|
||||
@Override
|
||||
public Object doInSqlMapClient(SqlMapExecutor executor)
|
||||
throws SQLException {
|
||||
executor.startBatch();
|
||||
|
||||
@@ -107,6 +107,7 @@ public class IbatisPagingItemReader<T> extends AbstractPagingItemReader<T> {
|
||||
* Check mandatory properties.
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(sqlMapClient);
|
||||
|
||||
@@ -135,6 +135,7 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
* Check mandatory properties - there must be a SimpleJdbcTemplate and an SQL statement plus a
|
||||
* parameter source.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(namedParameterJdbcTemplate, "A DataSource or a NamedParameterJdbcTemplate is required.");
|
||||
Assert.notNull(sql, "An SQL statement is required.");
|
||||
@@ -157,6 +158,7 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void write(final List<? extends T> items) throws Exception {
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
@@ -177,6 +179,7 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
}
|
||||
else {
|
||||
updateCounts = (int[]) namedParameterJdbcTemplate.getJdbcOperations().execute(sql, new PreparedStatementCallback() {
|
||||
@Override
|
||||
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
|
||||
for (T item : items) {
|
||||
itemPreparedStatementSetter.setValues(item, ps);
|
||||
|
||||
@@ -102,6 +102,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
* @throws IllegalArgumentException if either data source or sql properties
|
||||
* not set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(sql, "The SQL query must be provided");
|
||||
@@ -109,7 +110,8 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
}
|
||||
|
||||
|
||||
protected void openCursor(Connection con) {
|
||||
@Override
|
||||
protected void openCursor(Connection con) {
|
||||
try {
|
||||
if (isUseSharedExtendedConnection()) {
|
||||
preparedStatement = con.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
|
||||
@@ -133,6 +135,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
|
||||
return (T) rowMapper.mapRow(rs, currentRow);
|
||||
@@ -141,6 +144,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
/**
|
||||
* Close the cursor and database connection.
|
||||
*/
|
||||
@Override
|
||||
protected void cleanupOnClose() throws Exception {
|
||||
JdbcUtils.closeStatement(this.preparedStatement);
|
||||
}
|
||||
|
||||
@@ -266,6 +266,7 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
|
||||
}
|
||||
|
||||
RowMapper startMapper = new RowMapper() {
|
||||
@Override
|
||||
public Object mapRow(ResultSet rs, int i) throws SQLException {
|
||||
return rs.getObject(1);
|
||||
}
|
||||
@@ -324,6 +325,7 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private class PagingRowMapper implements RowMapper {
|
||||
@Override
|
||||
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
startAfterValues = new LinkedHashMap<String, Object>();
|
||||
for (Map.Entry<String, Order> sortKey : queryProvider.getSortKeys().entrySet()) {
|
||||
|
||||
@@ -64,6 +64,7 @@ public class JpaItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
/**
|
||||
* Check mandatory properties - there must be an entityManagerFactory.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(entityManagerFactory, "An EntityManagerFactory is required");
|
||||
}
|
||||
@@ -74,6 +75,7 @@ public class JpaItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public final void write(List<? extends T> items) {
|
||||
EntityManager entityManager = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory);
|
||||
if (entityManager == null) {
|
||||
|
||||
@@ -126,6 +126,7 @@ public class JpaPagingItemReader<T> extends AbstractPagingItemReader<T> {
|
||||
this.parameterValues = parameterValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
|
||||
|
||||
@@ -142,13 +142,15 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
* @throws IllegalArgumentException if either data source or sql properties
|
||||
* not set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(procedureName, "The name of the stored procedure must be provided");
|
||||
Assert.notNull(rowMapper, "RowMapper must be provided");
|
||||
}
|
||||
|
||||
protected void openCursor(Connection con) {
|
||||
@Override
|
||||
protected void openCursor(Connection con) {
|
||||
|
||||
Assert.state(procedureName != null, "Procedure Name must not be null.");
|
||||
Assert.state(refCursorPosition >= 0,
|
||||
@@ -223,6 +225,7 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
|
||||
return (T) rowMapper.mapRow(rs, currentRow);
|
||||
@@ -231,6 +234,7 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
/**
|
||||
* Close the cursor and database connection.
|
||||
*/
|
||||
@Override
|
||||
protected void cleanupOnClose() throws Exception {
|
||||
JdbcUtils.closeStatement(this.callableStatement);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,12 @@ public abstract class AbstractHibernateQueryProvider implements HibernateQueryPr
|
||||
private StatelessSession statelessSession;
|
||||
private Session statefulSession;
|
||||
|
||||
@Override
|
||||
public void setStatelessSession(StatelessSession statelessSession) {
|
||||
this.statelessSession = statelessSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSession(Session statefulSession) {
|
||||
this.statefulSession = statefulSession;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public abstract class AbstractJpaQueryProvider implements JpaQueryProvider, Init
|
||||
*
|
||||
* @param entityManager
|
||||
*/
|
||||
@Override
|
||||
public void setEntityManager(EntityManager entityManager) {
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public class HibernateNativeQueryProvider<E> extends AbstractHibernateQueryProvi
|
||||
* stateless if both are available).
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public SQLQuery createQuery() {
|
||||
|
||||
if (isStatelessSession()) {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class JpaNativeQueryProvider<E> extends AbstractJpaQueryProvider {
|
||||
|
||||
private String sqlQuery;
|
||||
|
||||
@Override
|
||||
public Query createQuery() {
|
||||
return getEntityManager().createNativeQuery(sqlQuery, entityClass);
|
||||
}
|
||||
@@ -50,6 +51,7 @@ public class JpaNativeQueryProvider<E> extends AbstractJpaQueryProvider {
|
||||
this.entityClass = entityClazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(StringUtils.hasText(sqlQuery), "Native SQL query cannot be empty");
|
||||
Assert.notNull(entityClass, "Entity class cannot be NULL");
|
||||
|
||||
@@ -151,14 +151,17 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
*
|
||||
* @return sortKey key to use to sort and limit page content
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Order> getSortKeys() {
|
||||
return sortKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParameterCount() {
|
||||
return parameterCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsingNamedParameters() {
|
||||
return usingNamedParameters;
|
||||
}
|
||||
@@ -169,6 +172,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
*
|
||||
* @return place holder for sortKey.
|
||||
*/
|
||||
@Override
|
||||
public String getSortKeyPlaceHolder(String keyName) {
|
||||
return usingNamedParameters ? ":_" + keyName : "?";
|
||||
}
|
||||
@@ -177,6 +181,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
* Check mandatory properties.
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void init(DataSource dataSource) throws Exception {
|
||||
Assert.notNull(dataSource);
|
||||
Assert.hasLength(selectClause, "selectClause must be specified");
|
||||
@@ -209,6 +214,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
* @param pageSize number of rows to read per page
|
||||
* @return query string
|
||||
*/
|
||||
@Override
|
||||
public abstract String generateFirstPageQuery(int pageSize);
|
||||
|
||||
/**
|
||||
@@ -218,6 +224,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
* @param pageSize number of rows to read per page
|
||||
* @return query string
|
||||
*/
|
||||
@Override
|
||||
public abstract String generateRemainingPagesQuery(int pageSize);
|
||||
|
||||
/**
|
||||
@@ -228,6 +235,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
* @param pageSize number of rows to read per page
|
||||
* @return query string
|
||||
*/
|
||||
@Override
|
||||
public abstract String generateJumpToItemQuery(int itemIndex, int pageSize);
|
||||
|
||||
private String removeKeyWord(String keyWord, String clause) {
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ColumnMapItemPreparedStatementSetter implements ItemPreparedStatementSetter<Map<String, Object>> {
|
||||
|
||||
@Override
|
||||
public void setValues(Map<String, Object> item, PreparedStatement ps) throws SQLException {
|
||||
Assert.isInstanceOf(Map.class, item, "Input to map PreparedStatement parameters must be of type Map.");
|
||||
int counter = 1;
|
||||
|
||||
@@ -73,6 +73,7 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataFieldMaxValueIncrementer getIncrementer(String incrementerType, String incrementerName) {
|
||||
DatabaseType databaseType = DatabaseType.valueOf(incrementerType.toUpperCase());
|
||||
|
||||
@@ -110,6 +111,7 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupportedIncrementerType(String incrementerType) {
|
||||
for (DatabaseType type : DatabaseType.values()) {
|
||||
if (type.name().equals(incrementerType.toUpperCase())) {
|
||||
@@ -120,6 +122,7 @@ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxV
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSupportedIncrementerTypes() {
|
||||
|
||||
List<String> types = new ArrayList<String>();
|
||||
|
||||
@@ -57,10 +57,12 @@ public class DerbyPagingQueryProvider extends SqlWindowingPagingQueryProvider {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOverSubstituteClauseStart() {
|
||||
return " FROM (SELECT " + getSelectClause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOverSubstituteClauseEnd() {
|
||||
return " ) AS " + getOrderedQueryAlias();
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean {
|
||||
*
|
||||
* @see FactoryBean#getObject()
|
||||
*/
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
|
||||
DatabaseType type;
|
||||
@@ -181,6 +182,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean {
|
||||
*
|
||||
* @see FactoryBean#getObjectType()
|
||||
*/
|
||||
@Override
|
||||
public Class<PagingQueryProvider> getObjectType() {
|
||||
return PagingQueryProvider.class;
|
||||
}
|
||||
@@ -189,6 +191,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean {
|
||||
* Always returns true.
|
||||
* @see FactoryBean#isSingleton()
|
||||
*/
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.core.io.Resource;
|
||||
*/
|
||||
public class DefaultBufferedReaderFactory implements BufferedReaderFactory {
|
||||
|
||||
@Override
|
||||
public BufferedReader create(Resource resource, String encoding) throws UnsupportedEncodingException, IOException {
|
||||
return new BufferedReader(new InputStreamReader(resource.getInputStream(), encoding));
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
|
||||
/**
|
||||
* Public setter for the input resource.
|
||||
*/
|
||||
@Override
|
||||
public void setResource(Resource resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
@@ -272,6 +273,7 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
|
||||
noInput = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(lineMapper, "LineMapper is required");
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
*
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(lineAggregator, "A LineAggregator must be provided.");
|
||||
if (append) {
|
||||
@@ -149,6 +150,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
*
|
||||
* @param resource
|
||||
*/
|
||||
@Override
|
||||
public void setResource(Resource resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
@@ -246,6 +248,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
* @throws Exception if the transformer or file output fail,
|
||||
* WriterNotOpenException if the writer has not been initialized.
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
|
||||
if (!getOutputState().isInitialized()) {
|
||||
@@ -276,6 +279,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
/**
|
||||
* @see ItemStream#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
if (state != null) {
|
||||
try {
|
||||
@@ -308,6 +312,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
*
|
||||
* @see ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
|
||||
Assert.notNull(resource, "The resource must be set");
|
||||
@@ -344,6 +349,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
/**
|
||||
* @see ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if (state == null) {
|
||||
throw new ItemStreamException("ItemStream not open or already closed.");
|
||||
@@ -581,6 +587,7 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
final FileChannel channel = fileChannel;
|
||||
if (transactional) {
|
||||
TransactionAwareBufferedWriter writer = new TransactionAwareBufferedWriter(channel, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
closeStream();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
/**
|
||||
* Compares resource filenames.
|
||||
*/
|
||||
@Override
|
||||
public int compare(Resource r1, Resource r2) {
|
||||
return r1.getFilename().compareTo(r2.getFilename());
|
||||
}
|
||||
@@ -86,6 +87,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
/**
|
||||
* Reads the next item, jumping to next resource if necessary.
|
||||
*/
|
||||
@Override
|
||||
public T read() throws Exception, UnexpectedInputException, ParseException {
|
||||
|
||||
if (noInput) {
|
||||
@@ -142,6 +144,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
/**
|
||||
* Close the {@link #setDelegate(ResourceAwareItemReaderItemStream)} reader and reset instance variable values.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
delegate.close();
|
||||
noInput = false;
|
||||
@@ -151,6 +154,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
* Figure out which resource to start with in case of restart, open the delegate and restore delegate's position in
|
||||
* the resource.
|
||||
*/
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
|
||||
Assert.notNull(resources, "Resources must be set");
|
||||
@@ -189,6 +193,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
/**
|
||||
* Store the current resource index and position in the resource.
|
||||
*/
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) throws ItemStreamException {
|
||||
if (saveState) {
|
||||
executionContext.putInt(executionContextUserSupport.getKey(RESOURCE_KEY), currentResource);
|
||||
|
||||
@@ -70,6 +70,7 @@ public class MultiResourceItemWriter<T> extends ExecutionContextUserSupport impl
|
||||
setName(ClassUtils.getShortName(MultiResourceItemWriter.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
if (!opened) {
|
||||
File file = setResourceToDelegate();
|
||||
@@ -127,6 +128,7 @@ public class MultiResourceItemWriter<T> extends ExecutionContextUserSupport impl
|
||||
this.saveState = saveState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
resourceIndex = 1;
|
||||
currentResourceItemCount = 0;
|
||||
@@ -135,6 +137,7 @@ public class MultiResourceItemWriter<T> extends ExecutionContextUserSupport impl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
resourceIndex = executionContext.getInt(getKey(RESOURCE_INDEX_KEY), 1);
|
||||
currentResourceItemCount = executionContext.getInt(getKey(CURRENT_RESOURCE_ITEM_COUNT), 0);
|
||||
@@ -155,6 +158,7 @@ public class MultiResourceItemWriter<T> extends ExecutionContextUserSupport impl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) throws ItemStreamException {
|
||||
if (saveState) {
|
||||
if (opened) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public class ResourcesItemReader extends ExecutionContextUserSupport implements
|
||||
* Increments a counter and returns the next {@link Resource} instance from
|
||||
* the input, or null if none remain.
|
||||
*/
|
||||
@Override
|
||||
public synchronized Resource read() throws Exception {
|
||||
int index = counter.incrementAndGet() - 1;
|
||||
if (index >= resources.length) {
|
||||
@@ -64,13 +65,16 @@ public class ResourcesItemReader extends ExecutionContextUserSupport implements
|
||||
return resources[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
counter.set(executionContext.getInt(getKey("COUNT"), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) throws ItemStreamException {
|
||||
executionContext.putInt(getKey("COUNT"), counter.get());
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public class SimpleBinaryBufferedReaderFactory implements BufferedReaderFactory
|
||||
this.lineEnding = lineEnding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedReader create(Resource resource, String encoding) throws UnsupportedEncodingException, IOException {
|
||||
return new BinaryBufferedReader(new InputStreamReader(resource.getInputStream(), encoding), lineEnding);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package org.springframework.batch.item.file;
|
||||
*/
|
||||
public class SimpleResourceSuffixCreator implements ResourceSuffixCreator {
|
||||
|
||||
@Override
|
||||
public String getSuffix(int index) {
|
||||
return "." + index;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.validation.BindException;
|
||||
*/
|
||||
public class ArrayFieldSetMapper implements FieldSetMapper<String[]> {
|
||||
|
||||
@Override
|
||||
public String[] mapFieldSet(FieldSet fieldSet) throws BindException {
|
||||
return fieldSet.getValues();
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
* org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org
|
||||
* .springframework.beans.factory.BeanFactory)
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
@@ -161,6 +162,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
*
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(name != null || type != null, "Either name or type must be provided.");
|
||||
Assert.state(name == null || type == null, "Both name and type cannot be specified together.");
|
||||
@@ -178,6 +180,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
* field that cannot be mapped to a bean property.
|
||||
* @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapFieldSet(FieldSet)
|
||||
*/
|
||||
@Override
|
||||
public T mapFieldSet(FieldSet fs) throws BindException {
|
||||
T copy = getBean();
|
||||
DataBinder binder = createBinder(copy);
|
||||
|
||||
@@ -38,6 +38,7 @@ public class DefaultLineMapper<T> implements LineMapper<T>, InitializingBean {
|
||||
|
||||
private FieldSetMapper<T> fieldSetMapper;
|
||||
|
||||
@Override
|
||||
public T mapLine(String line, int lineNumber) throws Exception {
|
||||
return fieldSetMapper.mapFieldSet(tokenizer.tokenize(line));
|
||||
}
|
||||
@@ -50,6 +51,7 @@ public class DefaultLineMapper<T> implements LineMapper<T>, InitializingBean {
|
||||
this.fieldSetMapper = fieldSetMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(tokenizer, "The LineTokenizer must be set");
|
||||
Assert.notNull(fieldSetMapper, "The FieldSetMapper must be set");
|
||||
|
||||
@@ -33,6 +33,7 @@ public class JsonLineMapper implements LineMapper<Map<String, Object>> {
|
||||
*
|
||||
* @see LineMapper#mapLine(String, int)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> mapLine(String line, int lineNumber) throws Exception {
|
||||
Map<String, Object> result;
|
||||
JsonParser parser = factory.createJsonParser(line);
|
||||
|
||||
@@ -33,6 +33,7 @@ public class PassThroughFieldSetMapper implements FieldSetMapper<FieldSet> {
|
||||
* org.springframework.batch.item.file.FieldSetMapper#mapLine(org.springframework
|
||||
* .batch.io.file.FieldSet)
|
||||
*/
|
||||
@Override
|
||||
public FieldSet mapFieldSet(FieldSet fs) {
|
||||
return fs;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.item.file.LineMapper;
|
||||
*/
|
||||
public class PassThroughLineMapper implements LineMapper<String>{
|
||||
|
||||
@Override
|
||||
public String mapLine(String line, int lineNumber) throws Exception {
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class PatternMatchingCompositeLineMapper<T> implements LineMapper<T>, Ini
|
||||
* org.springframework.batch.item.file.mapping.LineMapper#mapLine(java.lang
|
||||
* .String, int)
|
||||
*/
|
||||
@Override
|
||||
public T mapLine(String line, int lineNumber) throws Exception {
|
||||
return patternMatcher.match(line).mapFieldSet(this.tokenizer.tokenize(line));
|
||||
}
|
||||
@@ -67,6 +68,7 @@ public class PatternMatchingCompositeLineMapper<T> implements LineMapper<T>, Ini
|
||||
* @see
|
||||
* org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
this.tokenizer.afterPropertiesSet();
|
||||
Assert.isTrue(this.patternMatcher != null, "The 'fieldSetMappers' property must be non-empty");
|
||||
|
||||
@@ -85,6 +85,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndOfRecord(String line) {
|
||||
return !isQuoteUnterminated(line) && !isContinued(line);
|
||||
}
|
||||
@@ -96,6 +97,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy#preProcess(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String preProcess(String line) {
|
||||
if (isQuoteUnterminated(line)) {
|
||||
return line + "\n";
|
||||
|
||||
@@ -41,6 +41,7 @@ public class JsonRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
*
|
||||
* @see RecordSeparatorPolicy#isEndOfRecord(String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndOfRecord(String line) {
|
||||
return StringUtils.countOccurrencesOf(line, "{") == StringUtils.countOccurrencesOf(line, "}")
|
||||
&& line.trim().endsWith("}");
|
||||
|
||||
@@ -31,6 +31,7 @@ public class SimpleRecordSeparatorPolicy implements RecordSeparatorPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndOfRecord(String line) {
|
||||
return true;
|
||||
}
|
||||
@@ -39,6 +40,7 @@ public class SimpleRecordSeparatorPolicy implements RecordSeparatorPolicy {
|
||||
* Pass the record through. Do nothing.
|
||||
* @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#postProcess(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String postProcess(String record) {
|
||||
return record;
|
||||
}
|
||||
@@ -47,6 +49,7 @@ public class SimpleRecordSeparatorPolicy implements RecordSeparatorPolicy {
|
||||
* Pass the line through. Do nothing.
|
||||
* @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#preProcess(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String preProcess(String line) {
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class SuffixRecordSeparatorPolicy extends DefaultRecordSeparatorPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndOfRecord(String line) {
|
||||
if (line == null) {
|
||||
return true;
|
||||
@@ -74,6 +75,7 @@ public class SuffixRecordSeparatorPolicy extends DefaultRecordSeparatorPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy#postProcess(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String postProcess(String record) {
|
||||
if (record==null) {
|
||||
return null;
|
||||
|
||||
@@ -101,6 +101,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
|
||||
*
|
||||
* @return the resulting tokens
|
||||
*/
|
||||
@Override
|
||||
public FieldSet tokenize(String line) {
|
||||
|
||||
if (line == null) {
|
||||
|
||||
@@ -48,6 +48,7 @@ public class BeanWrapperFieldExtractor<T> implements FieldExtractor<T>, Initiali
|
||||
/**
|
||||
* @see org.springframework.batch.item.file.transform.FieldExtractor#extract(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] extract(T item) {
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
|
||||
@@ -58,6 +59,7 @@ public class BeanWrapperFieldExtractor<T> implements FieldExtractor<T>, Initiali
|
||||
return values.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(names, "The 'names' property must be set.");
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#getNames()
|
||||
*/
|
||||
@Override
|
||||
public String[] getNames() {
|
||||
if (names == null) {
|
||||
throw new IllegalStateException("Field names are not known");
|
||||
@@ -130,6 +131,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.FieldSet#hasNames()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNames() {
|
||||
return names != null;
|
||||
}
|
||||
@@ -139,6 +141,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#getValues()
|
||||
*/
|
||||
@Override
|
||||
public String[] getValues() {
|
||||
return tokens.clone();
|
||||
}
|
||||
@@ -149,6 +152,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readString(int)
|
||||
*/
|
||||
@Override
|
||||
public String readString(int index) {
|
||||
return readAndTrim(index);
|
||||
}
|
||||
@@ -160,6 +164,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readString(java
|
||||
* .lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String readString(String name) {
|
||||
return readString(indexOf(name));
|
||||
}
|
||||
@@ -170,6 +175,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readRawString(int)
|
||||
*/
|
||||
@Override
|
||||
public String readRawString(int index) {
|
||||
return tokens[index];
|
||||
}
|
||||
@@ -181,6 +187,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readRawString(java
|
||||
* .lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String readRawString(String name) {
|
||||
return readRawString(indexOf(name));
|
||||
}
|
||||
@@ -191,6 +198,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBoolean(int)
|
||||
*/
|
||||
@Override
|
||||
public boolean readBoolean(int index) {
|
||||
return readBoolean(index, "true");
|
||||
}
|
||||
@@ -202,6 +210,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBoolean(java
|
||||
* .lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean readBoolean(String name) {
|
||||
return readBoolean(indexOf(name));
|
||||
}
|
||||
@@ -213,6 +222,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBoolean(int,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean readBoolean(int index, String trueValue) {
|
||||
Assert.notNull(trueValue, "'trueValue' cannot be null.");
|
||||
|
||||
@@ -228,6 +238,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBoolean(java
|
||||
* .lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean readBoolean(String name, String trueValue) {
|
||||
return readBoolean(indexOf(name), trueValue);
|
||||
}
|
||||
@@ -237,6 +248,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readChar(int)
|
||||
*/
|
||||
@Override
|
||||
public char readChar(int index) {
|
||||
String value = readAndTrim(index);
|
||||
|
||||
@@ -252,6 +264,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readChar(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
public char readChar(String name) {
|
||||
return readChar(indexOf(name));
|
||||
}
|
||||
@@ -261,6 +274,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readByte(int)
|
||||
*/
|
||||
@Override
|
||||
public byte readByte(int index) {
|
||||
return Byte.parseByte(readAndTrim(index));
|
||||
}
|
||||
@@ -272,6 +286,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readByte(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
public byte readByte(String name) {
|
||||
return readByte(indexOf(name));
|
||||
}
|
||||
@@ -281,6 +296,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readShort(int)
|
||||
*/
|
||||
@Override
|
||||
public short readShort(int index) {
|
||||
return Short.parseShort(readAndTrim(index));
|
||||
}
|
||||
@@ -292,6 +308,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readShort(java.
|
||||
* lang.String)
|
||||
*/
|
||||
@Override
|
||||
public short readShort(String name) {
|
||||
return readShort(indexOf(name));
|
||||
}
|
||||
@@ -301,6 +318,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readInt(int)
|
||||
*/
|
||||
@Override
|
||||
public int readInt(int index) {
|
||||
return parseNumber(readAndTrim(index)).intValue();
|
||||
}
|
||||
@@ -312,6 +330,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readInt(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
public int readInt(String name) {
|
||||
return readInt(indexOf(name));
|
||||
}
|
||||
@@ -322,6 +341,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readInt(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public int readInt(int index, int defaultValue) {
|
||||
String value = readAndTrim(index);
|
||||
|
||||
@@ -335,6 +355,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readInt(java.lang
|
||||
* .String, int)
|
||||
*/
|
||||
@Override
|
||||
public int readInt(String name, int defaultValue) {
|
||||
return readInt(indexOf(name), defaultValue);
|
||||
}
|
||||
@@ -344,6 +365,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readLong(int)
|
||||
*/
|
||||
@Override
|
||||
public long readLong(int index) {
|
||||
return parseNumber(readAndTrim(index)).longValue();
|
||||
}
|
||||
@@ -355,6 +377,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readLong(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
public long readLong(String name) {
|
||||
return readLong(indexOf(name));
|
||||
}
|
||||
@@ -365,6 +388,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readLong(int,
|
||||
* long)
|
||||
*/
|
||||
@Override
|
||||
public long readLong(int index, long defaultValue) {
|
||||
String value = readAndTrim(index);
|
||||
|
||||
@@ -378,6 +402,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readLong(java.lang
|
||||
* .String, long)
|
||||
*/
|
||||
@Override
|
||||
public long readLong(String name, long defaultValue) {
|
||||
return readLong(indexOf(name), defaultValue);
|
||||
}
|
||||
@@ -387,6 +412,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readFloat(int)
|
||||
*/
|
||||
@Override
|
||||
public float readFloat(int index) {
|
||||
return parseNumber(readAndTrim(index)).floatValue();
|
||||
}
|
||||
@@ -398,6 +424,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readFloat(java.
|
||||
* lang.String)
|
||||
*/
|
||||
@Override
|
||||
public float readFloat(String name) {
|
||||
return readFloat(indexOf(name));
|
||||
}
|
||||
@@ -408,6 +435,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readDouble(int)
|
||||
*/
|
||||
@Override
|
||||
public double readDouble(int index) {
|
||||
return (Double) parseNumber(readAndTrim(index)).doubleValue();
|
||||
}
|
||||
@@ -419,6 +447,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readDouble(java
|
||||
* .lang.String)
|
||||
*/
|
||||
@Override
|
||||
public double readDouble(String name) {
|
||||
return readDouble(indexOf(name));
|
||||
}
|
||||
@@ -429,6 +458,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBigDecimal(int)
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal readBigDecimal(int index) {
|
||||
return readBigDecimal(index, null);
|
||||
}
|
||||
@@ -440,6 +470,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBigDecimal(
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal readBigDecimal(String name) {
|
||||
return readBigDecimal(name, null);
|
||||
}
|
||||
@@ -451,6 +482,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBigDecimal(int,
|
||||
* java.math.BigDecimal)
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal readBigDecimal(int index, BigDecimal defaultValue) {
|
||||
String candidate = readAndTrim(index);
|
||||
|
||||
@@ -478,6 +510,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readBigDecimal(
|
||||
* java.lang.String, java.math.BigDecimal)
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal readBigDecimal(String name, BigDecimal defaultValue) {
|
||||
try {
|
||||
return readBigDecimal(indexOf(name), defaultValue);
|
||||
@@ -495,6 +528,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readDate(int)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(int index) {
|
||||
return parseDate(readAndTrim(index), dateFormat);
|
||||
}
|
||||
@@ -505,6 +539,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.transform.FieldSet#readDate(int,
|
||||
* java.util.Date)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(int index, Date defaultValue) {
|
||||
try {
|
||||
return readDate(index);
|
||||
@@ -521,6 +556,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readDate(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(String name) {
|
||||
try {
|
||||
return readDate(indexOf(name));
|
||||
@@ -536,6 +572,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.transform.FieldSet#readDate(int,
|
||||
* java.util.Date)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(String name, Date defaultValue) {
|
||||
try {
|
||||
return readDate(name);
|
||||
@@ -551,6 +588,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readDate(int,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(int index, String pattern) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
sdf.setLenient(false);
|
||||
@@ -563,6 +601,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readDate(int,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(int index, String pattern, Date defaultValue) {
|
||||
try {
|
||||
return readDate(index, pattern);
|
||||
@@ -579,6 +618,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#readDate(java.lang
|
||||
* .String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(String name, String pattern) {
|
||||
try {
|
||||
return readDate(indexOf(name), pattern);
|
||||
@@ -594,6 +634,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see org.springframework.batch.item.file.mapping.IFieldSet#readDate(int,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Date readDate(String name, String pattern, Date defaultValue) {
|
||||
try {
|
||||
return readDate(name, pattern);
|
||||
@@ -609,6 +650,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#getFieldCount()
|
||||
*/
|
||||
@Override
|
||||
public int getFieldCount() {
|
||||
return tokens.length;
|
||||
}
|
||||
@@ -647,6 +689,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
throw new IllegalArgumentException("Cannot access column [" + name + "] from " + names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (names != null) {
|
||||
return getProperties().toString();
|
||||
@@ -658,6 +701,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof DefaultFieldSet) {
|
||||
DefaultFieldSet fs = (DefaultFieldSet) object;
|
||||
@@ -673,6 +717,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// this algorithm was taken from java 1.5 jdk Arrays.hashCode(Object[])
|
||||
if (tokens == null) {
|
||||
@@ -694,6 +739,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @see
|
||||
* org.springframework.batch.item.file.mapping.IFieldSet#getProperties()
|
||||
*/
|
||||
@Override
|
||||
public Properties getProperties() {
|
||||
if (names == null) {
|
||||
throw new IllegalStateException("Cannot create properties without meta data");
|
||||
|
||||
@@ -38,6 +38,7 @@ public class DefaultFieldSetFactory implements FieldSetFactory {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public FieldSet create(String[] values, String[] names) {
|
||||
DefaultFieldSet fieldSet = new DefaultFieldSet(values, names);
|
||||
return enhance(fieldSet);
|
||||
@@ -46,6 +47,7 @@ public class DefaultFieldSetFactory implements FieldSetFactory {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public FieldSet create(String[] values) {
|
||||
DefaultFieldSet fieldSet = new DefaultFieldSet(values);
|
||||
return enhance(fieldSet);
|
||||
|
||||
@@ -48,6 +48,7 @@ public abstract class ExtractorLineAggregator<T> implements LineAggregator<T> {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.transform.LineAggregator#aggregate(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public String aggregate(T item) {
|
||||
Assert.notNull(item);
|
||||
Object[] fields = this.fieldExtractor.extract(item);
|
||||
|
||||
@@ -96,6 +96,7 @@ public class FixedLengthTokenizer extends AbstractLineTokenizer {
|
||||
* @throws IncorrectLineLengthException if line length is greater than or
|
||||
* less than the max range set.
|
||||
*/
|
||||
@Override
|
||||
protected List<String> doTokenize(String line) {
|
||||
List<String> tokens = new ArrayList<String>(ranges.length);
|
||||
int lineLength;
|
||||
|
||||
@@ -46,6 +46,7 @@ public class PassThroughFieldExtractor<T> implements FieldExtractor<T> {
|
||||
* @param item the object to convert
|
||||
* @return an array of objects as close as possible to the original item
|
||||
*/
|
||||
@Override
|
||||
public Object[] extract(T item) {
|
||||
|
||||
if (item.getClass().isArray()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ public class PassThroughLineAggregator<T> implements LineAggregator<T> {
|
||||
*
|
||||
* @see org.springframework.batch.item.file.transform.LineAggregator#aggregate(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public String aggregate(T item) {
|
||||
return item.toString();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public class PatternMatchingCompositeLineTokenizer implements LineTokenizer, Ini
|
||||
* org.springframework.batch.item.file.transform.LineTokenizer#tokenize(
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public FieldSet tokenize(String line) {
|
||||
return tokenizers.match(line).tokenize(line);
|
||||
}
|
||||
@@ -55,6 +56,7 @@ public class PatternMatchingCompositeLineTokenizer implements LineTokenizer, Ini
|
||||
* @see
|
||||
* org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(this.tokenizers != null, "The 'tokenizers' property must be non-empty");
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class Range {
|
||||
return max != UPPER_BORDER_NOT_DEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return hasMaxValue() ? min + "-" + max : String.valueOf(min);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RangeArrayPropertyEditor extends PropertyEditorSupport {
|
||||
this.forceDisjointRanges = forceDisjointRanges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
|
||||
//split text into ranges
|
||||
@@ -93,6 +94,7 @@ public class RangeArrayPropertyEditor extends PropertyEditorSupport {
|
||||
setValue(ranges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsText() {
|
||||
Range[] ranges = (Range[])getValue();
|
||||
|
||||
@@ -117,6 +119,7 @@ public class RangeArrayPropertyEditor extends PropertyEditorSupport {
|
||||
|
||||
//sort array of Ranges
|
||||
Arrays.sort(c, new Comparator<Integer>() {
|
||||
@Override
|
||||
public int compare(Integer r1, Integer r2) {
|
||||
return ranges[r1].getMin()-ranges[r2].getMin();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public class RecursiveCollectionLineAggregator<T> implements LineAggregator<Coll
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.file.transform.LineAggregator#aggregate(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public String aggregate(Collection<T> items) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (T value : items) {
|
||||
@@ -55,4 +56,4 @@ public class RecursiveCollectionLineAggregator<T> implements LineAggregator<Coll
|
||||
return builder.delete(builder.length()-LINE_SEPARATOR.length(),builder.length()).toString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ public class JmsItemReader<T> implements ItemReader<T>, InitializingBean {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T read() {
|
||||
if (itemType != null && itemType.isAssignableFrom(Message.class)) {
|
||||
@@ -89,6 +90,7 @@ public class JmsItemReader<T> implements ItemReader<T>, InitializingBean {
|
||||
return (T) result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.jmsTemplate, "The 'jmsTemplate' is required.");
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public class JmsItemWriter<T> implements ItemWriter<T> {
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
@@ -40,6 +40,7 @@ public class JmsMethodArgumentsKeyGenerator implements MethodArgumentsKeyGenerat
|
||||
* a JMS Message
|
||||
* @throws IllegalArgumentException if the arguments are empty
|
||||
*/
|
||||
@Override
|
||||
public Object getKey(Object[] items) {
|
||||
for (Object item : items) {
|
||||
if (item instanceof Message) {
|
||||
|
||||
@@ -47,6 +47,7 @@ public class JmsMethodInvocationRecoverer<T> implements MethodInvocationRecovere
|
||||
* @see org.springframework.retry.interceptor.MethodInvocationRecoverer#recover(Object[],
|
||||
* Throwable)
|
||||
*/
|
||||
@Override
|
||||
public T recover(Object[] items, Throwable cause) {
|
||||
try {
|
||||
for (Object item : items) {
|
||||
|
||||
@@ -37,6 +37,7 @@ public class JmsNewMethodArgumentsIdentifier<T> implements NewMethodArgumentsIde
|
||||
*
|
||||
* @see org.springframework.retry.interceptor.NewMethodArgumentsIdentifier#isNew(java.lang.Object[])
|
||||
*/
|
||||
@Override
|
||||
public boolean isNew(Object[] args) {
|
||||
|
||||
for (Object item : args) {
|
||||
|
||||
@@ -53,6 +53,7 @@ public class DefaultMailErrorHandler implements MailErrorHandler {
|
||||
* @throws MailException a translation of the Exception
|
||||
* @see MailErrorHandler#handle(MailMessage, Exception)
|
||||
*/
|
||||
@Override
|
||||
public void handle(MailMessage message, Exception exception) throws MailException {
|
||||
String msg = message.toString();
|
||||
throw new MailSendException("Mail server send failed: "
|
||||
|
||||
@@ -86,6 +86,7 @@ public class SimpleMailMessageItemWriter implements ItemWriter<SimpleMailMessage
|
||||
*
|
||||
* @see InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws IllegalStateException {
|
||||
Assert.state(mailSender != null, "A MailSender must be provided.");
|
||||
}
|
||||
@@ -94,6 +95,7 @@ public class SimpleMailMessageItemWriter implements ItemWriter<SimpleMailMessage
|
||||
* @param items the items to send
|
||||
* @see ItemWriter#write(List)
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends SimpleMailMessage> items) throws MailException {
|
||||
try {
|
||||
mailSender.send(items.toArray(new SimpleMailMessage[items.size()]));
|
||||
|
||||
@@ -99,6 +99,7 @@ public class MimeMessageItemWriter implements ItemWriter<MimeMessage> {
|
||||
* @param items the items to send
|
||||
* @see ItemWriter#write(List)
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends MimeMessage> items) throws MailException {
|
||||
try {
|
||||
mailSender.send(items.toArray(new MimeMessage[items.size()]));
|
||||
|
||||
@@ -77,6 +77,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> implements Ite
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final T read() throws Exception, UnexpectedInputException, ParseException {
|
||||
if (currentItemCount >= maxItemCount) {
|
||||
return null;
|
||||
@@ -118,6 +119,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> implements Ite
|
||||
this.maxItemCount = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
currentItemCount = 0;
|
||||
try {
|
||||
@@ -128,6 +130,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> implements Ite
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
|
||||
try {
|
||||
@@ -161,6 +164,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> implements Ite
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) throws ItemStreamException {
|
||||
if (saveState) {
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ClassifierCompositeItemWriter<T> implements ItemWriter<T> {
|
||||
* Delegates to injected {@link ItemWriter} instances according to their
|
||||
* classification by the {@link Classifier}.
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
|
||||
Map<ItemWriter<? super T>, List<T>> map = new HashMap<ItemWriter<? super T>, List<T>>();
|
||||
|
||||
@@ -37,6 +37,7 @@ public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, Initia
|
||||
|
||||
private List<ItemProcessor<Object, Object>> delegates;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public O process(I item) throws Exception {
|
||||
Object result = item;
|
||||
@@ -50,6 +51,7 @@ public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, Initia
|
||||
return (O) result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegates, "The 'delgates' may not be null");
|
||||
Assert.notEmpty(delegates, "The 'delgates' may not be empty");
|
||||
|
||||
@@ -68,6 +68,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) {
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.update(executionContext);
|
||||
@@ -78,6 +79,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
* Broadcast the call to close.
|
||||
* @throws ItemStreamException
|
||||
*/
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.close();
|
||||
@@ -88,6 +90,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
* Broadcast the call to open.
|
||||
* @throws ItemStreamException
|
||||
*/
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.open(executionContext);
|
||||
|
||||
@@ -45,12 +45,14 @@ public class CompositeItemWriter<T> implements ItemStreamWriter<T>, Initializing
|
||||
this.ignoreItemStream = ignoreItemStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(List<? extends T> item) throws Exception {
|
||||
for (ItemWriter<? super T> writer : delegates) {
|
||||
writer.write(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegates, "The 'delgates' may not be null");
|
||||
Assert.notEmpty(delegates, "The 'delgates' may not be empty");
|
||||
@@ -60,6 +62,7 @@ public class CompositeItemWriter<T> implements ItemStreamWriter<T>, Initializing
|
||||
this.delegates = delegates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
for (ItemWriter<? super T> writer : delegates) {
|
||||
if (!ignoreItemStream && (writer instanceof ItemStream)) {
|
||||
@@ -68,6 +71,7 @@ public class CompositeItemWriter<T> implements ItemStreamWriter<T>, Initializing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
for (ItemWriter<? super T> writer : delegates) {
|
||||
if (!ignoreItemStream && (writer instanceof ItemStream)) {
|
||||
@@ -76,6 +80,7 @@ public class CompositeItemWriter<T> implements ItemStreamWriter<T>, Initializing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) throws ItemStreamException {
|
||||
for (ItemWriter<? super T> writer : delegates) {
|
||||
if (!ignoreItemStream && (writer instanceof ItemStream)) {
|
||||
|
||||
@@ -63,6 +63,7 @@ public class IteratorItemReader<T> implements ItemReader<T> {
|
||||
* Implementation of {@link ItemReader#read()} that just iterates over the
|
||||
* iterator provided.
|
||||
*/
|
||||
@Override
|
||||
public T read() throws Exception, UnexpectedInputException, ParseException {
|
||||
if (iterator.hasNext())
|
||||
return iterator.next();
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ListItemReader<T> implements ItemReader<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T read() {
|
||||
if (!list.isEmpty()) {
|
||||
return list.remove(0);
|
||||
|
||||
@@ -35,8 +35,9 @@ public class PassThroughItemProcessor<T> implements ItemProcessor<T, T> {
|
||||
* @return the item
|
||||
* @see ItemProcessor#process(Object)
|
||||
*/
|
||||
@Override
|
||||
public T process(T item) throws Exception {
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
|
||||
*
|
||||
* @see ItemReader#read()
|
||||
*/
|
||||
@Override
|
||||
public T read() throws Exception, UnexpectedInputException, ParseException {
|
||||
if (next != null) {
|
||||
T item = next;
|
||||
@@ -85,6 +86,7 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
|
||||
*
|
||||
* @see PeekableItemReader#peek()
|
||||
*/
|
||||
@Override
|
||||
public T peek() throws Exception, UnexpectedInputException, ParseException {
|
||||
if (next == null) {
|
||||
updateDelegate(executionContext);
|
||||
@@ -100,6 +102,7 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
|
||||
* @throws ItemStreamException if there is a problem
|
||||
* @see ItemStream#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() throws ItemStreamException {
|
||||
next = null;
|
||||
if (delegate instanceof ItemStream) {
|
||||
@@ -116,6 +119,7 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
|
||||
* @throws ItemStreamException if there is a problem
|
||||
* @see ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
next = null;
|
||||
if (delegate instanceof ItemStream) {
|
||||
@@ -133,6 +137,7 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
|
||||
* @throws ItemStreamException if there is a problem
|
||||
* @see ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) throws ItemStreamException {
|
||||
if (next != null) {
|
||||
// Get the last state from the delegate instead of using
|
||||
|
||||
@@ -38,6 +38,7 @@ public class SpringValidator<T> implements Validator<T>, InitializingBean {
|
||||
/**
|
||||
* @see Validator#validate(Object)
|
||||
*/
|
||||
@Override
|
||||
public void validate(T item) throws ValidationException {
|
||||
|
||||
if (!validator.supports(item.getClass())) {
|
||||
@@ -81,6 +82,7 @@ public class SpringValidator<T> implements Validator<T>, InitializingBean {
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(validator, "validator must be set");
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ public class ValidatingItemProcessor<T> implements ItemProcessor<T, T>, Initiali
|
||||
* @return the input item
|
||||
* @throws ValidationException if validation fails
|
||||
*/
|
||||
@Override
|
||||
public T process(T item) throws ValidationException {
|
||||
try {
|
||||
validator.validate(item);
|
||||
@@ -87,6 +88,7 @@ public class ValidatingItemProcessor<T> implements ItemProcessor<T, T>, Initiali
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(validator, "Validator must not be null.");
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
this.strict = strict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResource(Resource resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
@@ -112,6 +113,7 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
* the root element is empty.
|
||||
* @throws IllegalStateException if the Resource does not exist.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(unmarshaller, "The Unmarshaller must not be null.");
|
||||
Assert.hasLength(fragmentRootElementName, "The FragmentRootElementName must not be null");
|
||||
@@ -157,6 +159,7 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doClose() throws Exception {
|
||||
try {
|
||||
if (fragmentReader != null) {
|
||||
@@ -173,6 +176,7 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doOpen() throws Exception {
|
||||
Assert.notNull(resource, "The Resource must not be null.");
|
||||
|
||||
@@ -202,6 +206,7 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
/**
|
||||
* Move to next fragment and map it to item.
|
||||
*/
|
||||
@Override
|
||||
protected T doRead() throws Exception {
|
||||
|
||||
if (noInput) {
|
||||
|
||||
@@ -151,6 +151,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
*
|
||||
* @param resource the output file
|
||||
*/
|
||||
@Override
|
||||
public void setResource(Resource resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
@@ -322,6 +323,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
* @throws Exception
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(marshaller);
|
||||
if (rootTagName.contains("{")) {
|
||||
@@ -339,6 +341,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#open(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void open(ExecutionContext executionContext) {
|
||||
|
||||
Assert.notNull(resource, "The resource must be set");
|
||||
@@ -411,6 +414,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
final FileChannel channel = fileChannel;
|
||||
if (transactional) {
|
||||
TransactionAwareBufferedWriter writer = new TransactionAwareBufferedWriter(channel, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
closeStream();
|
||||
}
|
||||
@@ -570,6 +574,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
XMLEventFactory factory = createXmlEventFactory();
|
||||
@@ -633,6 +638,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
* @throws IOException
|
||||
* @throws XmlMappingException
|
||||
*/
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws XmlMappingException, Exception {
|
||||
|
||||
currentRecordCount += items.size();
|
||||
@@ -657,6 +663,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void update(ExecutionContext executionContext) {
|
||||
|
||||
if (saveState) {
|
||||
|
||||
@@ -34,39 +34,48 @@ abstract class AbstractEventReaderWrapper implements XMLEventReader {
|
||||
this.wrappedEventReader = wrappedEventReader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws XMLStreamException {
|
||||
wrappedEventReader.close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getElementText() throws XMLStreamException {
|
||||
return wrappedEventReader.getElementText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
return wrappedEventReader.getProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return wrappedEventReader.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEvent nextEvent() throws XMLStreamException {
|
||||
return wrappedEventReader.nextEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEvent nextTag() throws XMLStreamException {
|
||||
return wrappedEventReader.nextTag();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEvent peek() throws XMLStreamException {
|
||||
return wrappedEventReader.peek();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object next() {
|
||||
return wrappedEventReader.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
wrappedEventReader.remove();
|
||||
}
|
||||
|
||||
@@ -36,38 +36,47 @@ abstract class AbstractEventWriterWrapper implements XMLEventWriter {
|
||||
this.wrappedEventWriter = wrappedEventWriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(XMLEvent event) throws XMLStreamException {
|
||||
wrappedEventWriter.add(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(XMLEventReader reader) throws XMLStreamException {
|
||||
wrappedEventWriter.add(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws XMLStreamException {
|
||||
wrappedEventWriter.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws XMLStreamException {
|
||||
wrappedEventWriter.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceContext getNamespaceContext() {
|
||||
return wrappedEventWriter.getNamespaceContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(String uri) throws XMLStreamException {
|
||||
return wrappedEventWriter.getPrefix(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultNamespace(String uri) throws XMLStreamException {
|
||||
wrappedEventWriter.setDefaultNamespace(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
|
||||
wrappedEventWriter.setNamespaceContext(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix, String uri) throws XMLStreamException {
|
||||
wrappedEventWriter.setPrefix(prefix, uri);
|
||||
}
|
||||
|
||||
@@ -77,11 +77,13 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
|
||||
endDocumentEvent = XMLEventFactory.newInstance().createEndDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markStartFragment() {
|
||||
startFragmentFollows = true;
|
||||
fragmentRootName = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
try {
|
||||
if (peek() != null) {
|
||||
@@ -94,6 +96,7 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object next() {
|
||||
try {
|
||||
return nextEvent();
|
||||
@@ -103,6 +106,7 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEvent nextEvent() throws XMLStreamException {
|
||||
if (fakeDocumentEnd) {
|
||||
throw new NoSuchElementException();
|
||||
@@ -161,6 +165,7 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEvent peek() throws XMLStreamException {
|
||||
if (fakeDocumentEnd) {
|
||||
return null;
|
||||
@@ -172,6 +177,7 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
|
||||
* Finishes reading the fragment in case the fragment was processed without
|
||||
* being read until the end.
|
||||
*/
|
||||
@Override
|
||||
public void markFragmentProcessed() {
|
||||
if (insideFragment|| startFragmentFollows) {
|
||||
try {
|
||||
@@ -186,6 +192,7 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
|
||||
fakeDocumentEnd = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
insideFragment = false;
|
||||
startFragmentFollows = false;
|
||||
|
||||
@@ -33,6 +33,7 @@ public class NoStartEndDocumentStreamWriter extends AbstractEventWriterWrapper {
|
||||
super(wrappedEventWriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(XMLEvent event) throws XMLStreamException {
|
||||
if ((!event.isStartDocument()) && (!event.isEndDocument())) {
|
||||
wrappedEventWriter.add(event);
|
||||
|
||||
@@ -46,6 +46,7 @@ public class DirectPoller<S> implements Poller<S> {
|
||||
*
|
||||
* @see Poller#poll(Callable)
|
||||
*/
|
||||
@Override
|
||||
public Future<S> poll(Callable<S> callable) throws Exception {
|
||||
return new DirectPollingFuture<S>(interval, callable);
|
||||
}
|
||||
@@ -67,11 +68,13 @@ public class DirectPoller<S> implements Poller<S> {
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
cancelled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public S get() throws InterruptedException, ExecutionException {
|
||||
try {
|
||||
return get(-1, TimeUnit.MILLISECONDS);
|
||||
@@ -81,6 +84,7 @@ public class DirectPoller<S> implements Poller<S> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public S get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
|
||||
try {
|
||||
@@ -121,10 +125,12 @@ public class DirectPoller<S> implements Poller<S> {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
return cancelled || result != null;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class NestedRepeatCallback implements RepeatCallback {
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatCallback#doInIteration(RepeatContext)
|
||||
*/
|
||||
@Override
|
||||
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
|
||||
return template.iterate(callback);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#isCompleteOnly()
|
||||
*/
|
||||
@Override
|
||||
public boolean isCompleteOnly() {
|
||||
return completeOnly;
|
||||
}
|
||||
@@ -62,6 +63,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#setCompleteOnly()
|
||||
*/
|
||||
@Override
|
||||
public void setCompleteOnly() {
|
||||
completeOnly = true;
|
||||
}
|
||||
@@ -71,6 +73,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#isTerminateOnly()
|
||||
*/
|
||||
@Override
|
||||
public boolean isTerminateOnly() {
|
||||
return terminateOnly;
|
||||
}
|
||||
@@ -80,6 +83,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#setTerminateOnly()
|
||||
*/
|
||||
@Override
|
||||
public void setTerminateOnly() {
|
||||
terminateOnly = true;
|
||||
setCompleteOnly();
|
||||
@@ -90,6 +94,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#getParent()
|
||||
*/
|
||||
@Override
|
||||
public RepeatContext getParent() {
|
||||
return parent;
|
||||
}
|
||||
@@ -106,6 +111,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#getStartedCount()
|
||||
*/
|
||||
@Override
|
||||
public synchronized int getStartedCount() {
|
||||
return count;
|
||||
}
|
||||
@@ -117,6 +123,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
* org.springframework.batch.repeat.RepeatContext#registerDestructionCallback
|
||||
* (java.lang.String, java.lang.Runnable)
|
||||
*/
|
||||
@Override
|
||||
public void registerDestructionCallback(String name, Runnable callback) {
|
||||
synchronized (callbacks) {
|
||||
Set<Runnable> set = callbacks.get(name);
|
||||
@@ -133,6 +140,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
*
|
||||
* @see org.springframework.batch.repeat.RepeatContext#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
List<RuntimeException> errors = new ArrayList<RuntimeException>();
|
||||
|
||||
@@ -42,6 +42,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.core.AttributeAccessor#attributeNames()
|
||||
*/
|
||||
@Override
|
||||
public String[] attributeNames() {
|
||||
synchronized (support) {
|
||||
return support.attributeNames();
|
||||
@@ -52,6 +53,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
@@ -75,6 +77,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.core.AttributeAccessor#getAttribute(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
synchronized (support) {
|
||||
return support.getAttribute(name);
|
||||
@@ -85,6 +88,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.core.AttributeAccessor#hasAttribute(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean hasAttribute(String name) {
|
||||
synchronized (support) {
|
||||
return support.hasAttribute(name);
|
||||
@@ -95,6 +99,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return support.hashCode();
|
||||
}
|
||||
@@ -103,6 +108,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.core.AttributeAccessor#removeAttribute(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object removeAttribute(String name) {
|
||||
synchronized (support) {
|
||||
return support.removeAttribute(name);
|
||||
@@ -114,6 +120,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* @see org.springframework.core.AttributeAccessor#setAttribute(java.lang.String,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
synchronized (support) {
|
||||
support.setAttribute(name, value);
|
||||
@@ -142,6 +149,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer("SynchronizedAttributeAccessor: [");
|
||||
synchronized (support) {
|
||||
|
||||
@@ -40,6 +40,7 @@ public class CompositeExceptionHandler implements ExceptionHandler {
|
||||
*
|
||||
* @see ExceptionHandler#handleException(RepeatContext, Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
|
||||
for (int i = 0; i < handlers.length; i++) {
|
||||
ExceptionHandler handler = handlers[i];
|
||||
|
||||
@@ -32,6 +32,7 @@ public class DefaultExceptionHandler implements ExceptionHandler {
|
||||
* @see org.springframework.batch.repeat.exception.ExceptionHandler#handleException(RepeatContext,
|
||||
* Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
|
||||
throw throwable;
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ public class LogOrRethrowExceptionHandler implements ExceptionHandler {
|
||||
*
|
||||
* @see ExceptionHandler#handleException(RepeatContext, Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
|
||||
|
||||
Level key = exceptionClassifier.classify(throwable);
|
||||
|
||||
@@ -44,6 +44,7 @@ public class RethrowOnThresholdExceptionHandler implements ExceptionHandler {
|
||||
protected final Log logger = LogFactory.getLog(RethrowOnThresholdExceptionHandler.class);
|
||||
|
||||
private Classifier<? super Throwable, IntegerHolder> exceptionClassifier = new Classifier<Throwable, IntegerHolder>() {
|
||||
@Override
|
||||
public RethrowOnThresholdExceptionHandler.IntegerHolder classify(Throwable classifiable) {
|
||||
return ZERO;
|
||||
}
|
||||
@@ -92,6 +93,7 @@ public class RethrowOnThresholdExceptionHandler implements ExceptionHandler {
|
||||
* @throws Throwable
|
||||
* @see ExceptionHandler#handleException(RepeatContext, Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
|
||||
|
||||
IntegerHolder key = exceptionClassifier.classify(throwable);
|
||||
|
||||
@@ -52,6 +52,7 @@ public class SimpleLimitExceptionHandler implements ExceptionHandler, Initializi
|
||||
*
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (limit <= 0) {
|
||||
return;
|
||||
@@ -108,6 +109,7 @@ public class SimpleLimitExceptionHandler implements ExceptionHandler, Initializi
|
||||
* @see org.springframework.batch.repeat.exception.ExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext,
|
||||
* Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
|
||||
delegate.handleException(context, throwable);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
|
||||
*
|
||||
* @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
|
||||
*/
|
||||
@Override
|
||||
public Object invoke(final MethodInvocation invocation) throws Throwable {
|
||||
|
||||
final ResultHolder result = new ResultHolder();
|
||||
@@ -75,6 +76,7 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
|
||||
try {
|
||||
repeatOperations.iterate(new RepeatCallback() {
|
||||
|
||||
@Override
|
||||
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
|
||||
try {
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user