@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.lang.Nullable;
|
||||
* Object representing a context for an {@link ItemStream}. It is a thin wrapper for a map
|
||||
* that allows optionally for type safety on reads. It also allows for dirty checking by
|
||||
* setting a 'dirty' flag whenever any put is called.
|
||||
*
|
||||
* <p>
|
||||
* Note that putting <code>null</code> value is equivalent to removing the entry for the
|
||||
* given key.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ public interface ItemProcessor<I, O> {
|
||||
* Process the provided item, returning a potentially modified or new item for
|
||||
* continued processing. If the returned result is {@code null}, it is assumed that
|
||||
* processing of the item should not continue.
|
||||
*
|
||||
* <p>
|
||||
* A {@code null} item will never reach this method because the only possible sources
|
||||
* are:
|
||||
* <ul>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.StringUtils;
|
||||
* Superclass for delegating classes which dynamically call a custom method of injected
|
||||
* object. Provides convenient API for dynamic method invocation shielding subclasses from
|
||||
* low-level details and exception handling.
|
||||
*
|
||||
* <p>
|
||||
* {@link Exception}s thrown by a successfully invoked delegate method are re-thrown
|
||||
* without wrapping. In case the delegate method throws a {@link Throwable} that doesn't
|
||||
* subclass {@link Exception} it will be wrapped by
|
||||
@@ -197,7 +197,7 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
|
||||
* @param arguments arguments values for the { {@link #setTargetMethod(String)}. These
|
||||
* will be used only when the subclass tries to invoke the target method without
|
||||
* providing explicit argument values.
|
||||
*
|
||||
* <p>
|
||||
* If arguments are set to not-null value {@link #afterPropertiesSet()} will check the
|
||||
* values are compatible with target method's signature. In case arguments are null
|
||||
* (not set) method signature will not be checked and it is assumed correct values
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,7 @@ import org.springframework.util.MethodInvoker;
|
||||
/**
|
||||
* Indicates an error has been encountered while trying to dynamically invoke a method
|
||||
* e.g. using {@link MethodInvoker}.
|
||||
*
|
||||
* <p>
|
||||
* The exception should be caused by a failed invocation of a method, it shouldn't be used
|
||||
* to wrap an exception thrown by successfully invoked method.
|
||||
*
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* An {@link ItemWriter} that serializes data to an {@link WritableResource} using Avro.
|
||||
*
|
||||
* <p>
|
||||
* This does not support restart on failure.
|
||||
*
|
||||
* <p>
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Iterator;
|
||||
* A base class that handles basic reading logic based on the paginated semantics of
|
||||
* Spring Data's paginated facilities. It also handles the semantics required for
|
||||
* restartability based on those facilities.
|
||||
*
|
||||
* <p>
|
||||
* This reader is <b>not</b> thread-safe.
|
||||
*
|
||||
* @author Michael Minella
|
||||
|
||||
@@ -59,8 +59,8 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @deprecated since 5.0 in favor of the item reader from
|
||||
* https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j
|
||||
* @deprecated since 5.0 in favor of the item reader from <a href=
|
||||
* "https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j">...</a>
|
||||
*/
|
||||
@Deprecated
|
||||
public class Neo4jItemReader<T> extends AbstractPaginatedDataItemReader<T> implements InitializingBean {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,8 +40,8 @@ import org.springframework.util.CollectionUtils;
|
||||
* @author Michael Minella
|
||||
* @author Glenn Renfro
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @deprecated since 5.0 in favor of the item writer from
|
||||
* https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j
|
||||
* @deprecated since 5.0 in favor of the item writer from <a href=
|
||||
* "https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j">...</a>
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2021 the original author or authors.
|
||||
* Copyright 2017-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,8 @@ import org.springframework.util.Assert;
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 4.0
|
||||
* @see Neo4jItemReader
|
||||
* @deprecated since 5.0 in favor of the item reader builder from
|
||||
* https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j
|
||||
* @deprecated since 5.0 in favor of the item reader builder from <a href=
|
||||
* "https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j">...</a>
|
||||
*/
|
||||
@Deprecated
|
||||
public class Neo4jItemReaderBuilder<T> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2021 the original author or authors.
|
||||
* Copyright 2017-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,8 +29,8 @@ import org.springframework.util.Assert;
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 4.0
|
||||
* @see Neo4jItemWriter
|
||||
* @deprecated since 5.0 in favor of the item writer builder from
|
||||
* https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j
|
||||
* @deprecated since 5.0 in favor of the item writer builder from <a href=
|
||||
* "https://github.com/spring-projects/spring-batch-extensions/blob/main/spring-batch-neo4j">...</a>
|
||||
*/
|
||||
@Deprecated
|
||||
public class Neo4jItemWriterBuilder<T> {
|
||||
|
||||
@@ -78,7 +78,7 @@ public class RepositoryItemWriterBuilder<T> {
|
||||
* {@link org.springframework.data.domain.Pageable} as the <em>last</em> argument.
|
||||
* This method can be used in place of {@link #repository(CrudRepository)},
|
||||
* {@link #methodName(String)}}.
|
||||
*
|
||||
* <p>
|
||||
* Note: The repository that is used by the repositoryMethodReference must be
|
||||
* non-final.
|
||||
* @param repositoryMethodReference of the used to get a repository and type-safe
|
||||
|
||||
@@ -345,7 +345,7 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
* set this flag to true then you must wrap the DataSource in a
|
||||
* {@link ExtendedConnectionDataSourceProxy} to prevent the connection from being
|
||||
* closed and released after each commit.
|
||||
*
|
||||
* <p>
|
||||
* When you set this option to <code>true</code> then the statement used to open the
|
||||
* cursor will be created with both 'READ_ONLY' and 'HOLD_CURSORS_OVER_COMMIT'
|
||||
* options. This allows holding the cursor open over transaction start and commits
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.util.MethodInvoker;
|
||||
* Implementation of {@link SmartDataSource} that is capable of keeping a single JDBC
|
||||
* Connection which is NOT closed after each use even if {@link Connection#close()} is
|
||||
* called.
|
||||
*
|
||||
* <p>
|
||||
* The connection can be kept open over multiple transactions when used together with any
|
||||
* of Spring's {@link org.springframework.transaction.PlatformTransactionManager}
|
||||
* implementations.
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.springframework.util.ClassUtils;
|
||||
* {@link #setQueryName(String)}, or a query provider strategy can be supplied via
|
||||
* {@link #setQueryProvider(HibernateQueryProvider)}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The reader can be configured to use either {@link StatelessSession} sufficient for
|
||||
* simple mappings without the need to cascade to associated objects or standard hibernate
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Helper methods for SQL statement parameter parsing.
|
||||
*
|
||||
* <p>
|
||||
* Only intended for internal use.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
@@ -38,7 +38,7 @@ public class JdbcParameterUtils {
|
||||
* literal, that is, surrounded by single or double quotes. This method will count
|
||||
* traditional placeholders in the form of a question mark ('?') as well as named
|
||||
* parameters indicated with a leading ':' or '&'.
|
||||
*
|
||||
* <p>
|
||||
* The code for this method is taken from an early version of the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterUtils} class. That
|
||||
* method was later removed after some refactoring, but the code is useful here for
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
* Copyright 2020-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
* corresponding to the current row. The query can be set directly using
|
||||
* {@link #setQueryString(String)}, or using a query provider via
|
||||
* {@link #setQueryProvider(JpaQueryProvider)}.
|
||||
*
|
||||
* <p>
|
||||
* The implementation is <b>not</b> thread-safe.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,12 +32,12 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* {@link org.springframework.batch.item.ItemWriter} that is using a JPA
|
||||
* EntityManagerFactory to merge any Entities that aren't part of the persistence context.
|
||||
*
|
||||
* <p>
|
||||
* It is required that {@link #write(Chunk)} is called inside a transaction.<br>
|
||||
*
|
||||
* The reader must be configured with an {@link jakarta.persistence.EntityManagerFactory}
|
||||
* that is capable of participating in Spring managed transactions.
|
||||
*
|
||||
* <p>
|
||||
* The writer is thread-safe after its properties are set (normal singleton behaviour), so
|
||||
* it can be used to write in multiple concurrent transactions.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -132,7 +132,7 @@ public class JdbcBatchItemWriterBuilder<T> {
|
||||
/**
|
||||
* Creates a {@link ColumnMapItemPreparedStatementSetter} to be used as your
|
||||
* {@link ItemPreparedStatementSetter}.
|
||||
*
|
||||
* <p>
|
||||
* NOTE: The item type for this {@link org.springframework.batch.item.ItemWriter} must
|
||||
* be castable to <code>Map<String,Object>></code>.
|
||||
* @return The current instance of the builder for chaining
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,13 +32,13 @@ import org.springframework.util.StringUtils;
|
||||
/**
|
||||
* Abstract SQL Paging Query Provider to serve as a base class for all provided SQL paging
|
||||
* query providers.
|
||||
*
|
||||
* <p>
|
||||
* Any implementation must provide a way to specify the select clause, from clause and
|
||||
* optionally a where clause. In addition a way to specify a single column sort key must
|
||||
* also be provided. This sort key will be used to provide the paging functionality. It is
|
||||
* recommended that there should be an index for the sort key to provide better
|
||||
* performance.
|
||||
*
|
||||
* <p>
|
||||
* Provides properties and preparation for the mandatory "selectClause" and "fromClause"
|
||||
* as well as for the optional "whereClause". Also provides property for the mandatory
|
||||
* "sortKeys". <b>Note:</b> The columns that make up the sort key must be a true key and
|
||||
|
||||
@@ -52,7 +52,7 @@ import static org.springframework.batch.support.DatabaseType.SYBASE;
|
||||
/**
|
||||
* Default implementation of the {@link DataFieldMaxValueIncrementerFactory} interface.
|
||||
* Valid database types are given by the {@link DatabaseType} enum.
|
||||
*
|
||||
* <p>
|
||||
* Note: For MySql databases, the
|
||||
* {@link MySQLMaxValueIncrementer#setUseNewConnection(boolean)} will be set to true.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,7 +26,7 @@ import org.springframework.jdbc.support.JdbcUtils;
|
||||
/**
|
||||
* Derby implementation of a {@link PagingQueryProvider} using standard SQL:2003 windowing
|
||||
* functions. These features are supported starting with Apache Derby version 10.4.1.3.
|
||||
*
|
||||
* <p>
|
||||
* As the OVER() function does not support the ORDER BY clause a sub query is instead used
|
||||
* to order the results before the ROW_NUM restriction is applied
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,7 @@ import org.springframework.util.StringUtils;
|
||||
* Postgres implementation of a
|
||||
* {@link org.springframework.batch.item.database.PagingQueryProvider} using database
|
||||
* specific features.
|
||||
*
|
||||
* <p>
|
||||
* When using the groupClause, this implementation expects all select fields not used in
|
||||
* aggregate functions to be included in the groupClause (the provider does not add them
|
||||
* for you).
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SqlWindowingPagingQueryProvider extends AbstractSqlPagingQueryProvi
|
||||
|
||||
/**
|
||||
* Generates ORDER BY attributes based on the sort keys.
|
||||
* @param provider
|
||||
* @param provider the paging query provider
|
||||
* @return a String that can be appended to an ORDER BY clause.
|
||||
*/
|
||||
private String buildSortClause(AbstractSqlPagingQueryProvider provider) {
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.ClassUtils;
|
||||
* Reads items from multiple resources sequentially - resource list is given by
|
||||
* {@link #setResources(Resource[])}, the actual reading is delegated to
|
||||
* {@link #setDelegate(ResourceAwareItemReaderItemStream)}.
|
||||
*
|
||||
* <p>
|
||||
* Input resources are ordered using {@link #setComparator(Comparator)} to make sure
|
||||
* resource ordering is preserved between job runs in restart scenario.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.util.ClassUtils;
|
||||
* when the count of items written in current resource exceeds
|
||||
* {@link #setItemCountLimitPerResource(int)}. Suffix creation can be customized with
|
||||
* {@link #setResourceSuffixCreator(ResourceSuffixCreator)}.
|
||||
*
|
||||
* <p>
|
||||
* Note that new resources are created only at chunk boundaries i.e. the number of items
|
||||
* written into one resource is between the limit set by
|
||||
* {@link #setItemCountLimitPerResource(int)} and (limit + chunk size).
|
||||
|
||||
@@ -66,9 +66,6 @@ public class SimpleBinaryBufferedReaderFactory implements BufferedReaderFactory
|
||||
|
||||
private final String ending;
|
||||
|
||||
/**
|
||||
* @param in
|
||||
*/
|
||||
private BinaryBufferedReader(Reader in, String ending) {
|
||||
super(in);
|
||||
this.ending = ending;
|
||||
|
||||
@@ -134,7 +134,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
* The bean name (id) for an object that can be populated from the field set that will
|
||||
* be passed into {@link #mapFieldSet(FieldSet)}. Typically a prototype scoped bean so
|
||||
* that a new instance is returned for each field set mapped.
|
||||
*
|
||||
* <p>
|
||||
* Either this property or the type property must be specified, but not both.
|
||||
* @param name the name of a prototype bean in the enclosing BeanFactory
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -109,8 +109,8 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
/**
|
||||
* Determine if the current line (or buffered concatenation of lines) contains an
|
||||
* unterminated quote, indicating that the record is continuing onto the next line.
|
||||
* @param line
|
||||
* @return
|
||||
* @param line the line to check
|
||||
* @return true if the quote is unterminated, false otherwise
|
||||
*/
|
||||
private boolean isQuoteUnterminated(String line) {
|
||||
return StringUtils.countOccurrencesOf(line, quoteCharacter) % 2 != 0;
|
||||
@@ -119,8 +119,8 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
/**
|
||||
* Determine if the current line (or buffered concatenation of lines) ends with the
|
||||
* continuation marker, indicating that the record is continuing onto the next line.
|
||||
* @param line
|
||||
* @return
|
||||
* @param line the line to check
|
||||
* @return true if the line ends with the continuation marker, false otherwise
|
||||
*/
|
||||
private boolean isContinued(String line) {
|
||||
if (line == null) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -627,6 +628,7 @@ public class DefaultFieldSet implements FieldSet {
|
||||
* @param index the offset in the token array to obtain the value to be trimmed.
|
||||
* @return null if the field value is <code>null</code>.
|
||||
*/
|
||||
@Nullable
|
||||
protected String readAndTrim(int index) {
|
||||
String value = tokens[index];
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2022 the original author or authors.
|
||||
* Copyright 2017-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.batch.item.mail.builder;
|
||||
|
||||
import org.springframework.batch.item.Chunk;
|
||||
import org.springframework.batch.item.mail.DefaultMailErrorHandler;
|
||||
import org.springframework.batch.item.mail.MailErrorHandler;
|
||||
import org.springframework.batch.item.mail.SimpleMailMessageItemWriter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
|
||||
* Abstract superclass for {@link ItemReader}s that supports restart by storing item count
|
||||
* in the {@link ExecutionContext} (therefore requires item ordering to be preserved
|
||||
* between runs).
|
||||
*
|
||||
* <p>
|
||||
* Subclasses are inherently <b>not</b> thread-safe.
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.batch.item.ItemStreamSupport;
|
||||
|
||||
/**
|
||||
* Base class for {@link ItemReader} implementations.
|
||||
*
|
||||
* <p>
|
||||
* This abstract reader is thread-safe.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.batch.item.ItemWriter;
|
||||
|
||||
/**
|
||||
* Base class for {@link ItemWriter} implementations.
|
||||
*
|
||||
* <p>
|
||||
* This abstract writer is thread-safe.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +24,7 @@ import org.springframework.lang.Nullable;
|
||||
/**
|
||||
* Calls one of a collection of ItemProcessors, based on a router pattern implemented
|
||||
* through the provided {@link Classifier}.
|
||||
*
|
||||
* <p>
|
||||
* Note the user is responsible for injecting a {@link Classifier} that returns an
|
||||
* ItemProcessor that conforms to the declared input and output types.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Calls one of a collection of ItemWriters for each item, based on a router pattern
|
||||
* implemented through the provided {@link Classifier}.
|
||||
*
|
||||
* <p>
|
||||
* The implementation is thread-safe if all delegates are thread-safe.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
* Copyright 2014-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class ScriptItemProcessor<I, O> implements ItemProcessor<I, O>, InitializingBean {
|
||||
|
||||
private static final String ITEM_BINDING_VARIABLE_NAME = "item";
|
||||
public static final String ITEM_BINDING_VARIABLE_NAME = "item";
|
||||
|
||||
private String language;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2022 the original author or authors.
|
||||
* Copyright 2015-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,13 +28,11 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* This is a simple ItemStreamReader decorator with a synchronized ItemReader.read()
|
||||
* method - which makes a non-thread-safe ItemReader thread-safe.
|
||||
*
|
||||
* <p>
|
||||
* However, if reprocessing an item is problematic then using this will make a job not
|
||||
* restartable.
|
||||
*
|
||||
* Here are some links about the motivation behind this class: -
|
||||
* https://projects.spring.io/spring-batch/faq.html#threading-reader} -
|
||||
* https://stackoverflow.com/a/20002493/2910265}
|
||||
* <p>
|
||||
* Here is the motivation behind this class: https://stackoverflow.com/a/20002493/2910265
|
||||
*
|
||||
* @author Matthew Ouyang
|
||||
* @since 3.0.4
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
* Copyright 2020-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* An {@link ItemStreamWriter} decorator with a synchronized
|
||||
* {@link SynchronizedItemStreamWriter#write write()} method.
|
||||
*
|
||||
* <p>
|
||||
* This decorator is useful when using a non thread-safe item writer in a multi-threaded
|
||||
* step. Typical delegate examples are the
|
||||
* {@link org.springframework.batch.item.json.JsonFileItemWriter JsonFileItemWriter} and
|
||||
|
||||
@@ -50,11 +50,11 @@ import org.springframework.util.xml.StaxUtils;
|
||||
|
||||
/**
|
||||
* Item reader for reading XML input based on StAX.
|
||||
*
|
||||
* <p>
|
||||
* It extracts fragments from the input XML document which correspond to records for
|
||||
* processing. The fragments are wrapped with StartDocument and EndDocument events so that
|
||||
* the fragments can be further processed like standalone XML documents.
|
||||
*
|
||||
* <p>
|
||||
* The implementation is <b>not</b> thread-safe.
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
@@ -170,7 +170,7 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
|
||||
/**
|
||||
* Responsible for moving the cursor before the StartElement of the fragment root.
|
||||
*
|
||||
* <p>
|
||||
* This implementation simply looks for the next corresponding element, it does not
|
||||
* care about element nesting. You will need to override this method to correctly
|
||||
* handle composite fragments.
|
||||
|
||||
@@ -64,10 +64,10 @@ import org.springframework.util.xml.StaxUtils;
|
||||
/**
|
||||
* An implementation of {@link ItemWriter} which uses StAX and {@link Marshaller} for
|
||||
* serializing object to XML.
|
||||
*
|
||||
* <p>
|
||||
* This item writer also provides restart, statistics and transaction features by
|
||||
* implementing corresponding interfaces.
|
||||
*
|
||||
* <p>
|
||||
* The implementation is <b>not</b> thread-safe.
|
||||
*
|
||||
* @author Peter Zozom
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.batch.repeat.context;
|
||||
|
||||
import org.springframework.core.AttributeAccessor;
|
||||
import org.springframework.core.AttributeAccessorSupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* An {@link AttributeAccessor} that synchronizes on a mutex (not this) before modifying
|
||||
@@ -141,6 +142,7 @@ public class SynchronizedAttributeAccessor implements AttributeAccessor {
|
||||
* @param value the value of the attribute
|
||||
* @return null if the attribute was not already set, the existing value otherwise.
|
||||
*/
|
||||
@Nullable
|
||||
public Object setAttributeIfAbsent(String name, Object value) {
|
||||
synchronized (support) {
|
||||
Object old = getAttribute(name);
|
||||
|
||||
@@ -121,10 +121,6 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
|
||||
+ ". The invocation was never called, so maybe there is a problem with the completion policy?");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param result
|
||||
* @return
|
||||
*/
|
||||
private boolean isComplete(Object result) {
|
||||
return result == null || (result instanceof Boolean) && !(Boolean) result;
|
||||
}
|
||||
@@ -139,10 +135,6 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
|
||||
@SuppressWarnings("serial")
|
||||
private static class RepeatOperationsInterceptorException extends RepeatException {
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param e
|
||||
*/
|
||||
public RepeatOperationsInterceptorException(String message, Throwable e) {
|
||||
super(message, e);
|
||||
}
|
||||
@@ -170,9 +162,6 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value
|
||||
*/
|
||||
public void setFinalValue(Object value) {
|
||||
if (ready) {
|
||||
// Only set the value the last time if the last time was also
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,6 @@ interface ResultHolder {
|
||||
* Get the result for client from this holder. Does not block if none is available
|
||||
* yet.
|
||||
* @return the result, or null if there is none.
|
||||
* @throws IllegalStateException
|
||||
*/
|
||||
RepeatStatus getResult();
|
||||
|
||||
@@ -41,7 +40,6 @@ interface ResultHolder {
|
||||
* Get the error for client from this holder if any. Does not block if none is
|
||||
* available yet.
|
||||
* @return the error, or null if there is none.
|
||||
* @throws IllegalStateException
|
||||
*/
|
||||
Throwable getError();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -43,7 +44,7 @@ public class MethodInvokerUtils {
|
||||
* @param paramsRequired boolean indicating whether the parameters are required, if
|
||||
* false, a no args version of the method will be searched for.
|
||||
* @param paramTypes - parameter types of the method to search for.
|
||||
* @return MethodInvoker if the method is found, null if it is not.
|
||||
* @return MethodInvoker if the method is found
|
||||
*/
|
||||
public static MethodInvoker getMethodInvokerByName(Object object, String methodName, boolean paramsRequired,
|
||||
Class<?>... paramTypes) {
|
||||
@@ -87,6 +88,7 @@ public class MethodInvokerUtils {
|
||||
* @param paramTypes - parameter types of the method to search for.
|
||||
* @return MethodInvoker if the method is found, null if it is not.
|
||||
*/
|
||||
@Nullable
|
||||
public static MethodInvoker getMethodInvokerForInterface(Class<?> cls, String methodName, Object object,
|
||||
Class<?>... paramTypes) {
|
||||
|
||||
@@ -141,6 +143,7 @@ public class MethodInvokerUtils {
|
||||
* @param target to be invoked
|
||||
* @return MethodInvoker for the provided annotation, null if none is found.
|
||||
*/
|
||||
@Nullable
|
||||
public static MethodInvoker getMethodInvokerByAnnotation(final Class<? extends Annotation> annotationType,
|
||||
final Object target) {
|
||||
Assert.notNull(target, "Target must not be null");
|
||||
|
||||
@@ -85,7 +85,7 @@ public class TransactionAwareBufferedWriter extends Writer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return the current buffer
|
||||
*/
|
||||
private StringBuilder getCurrentBuffer() {
|
||||
|
||||
@@ -166,7 +166,7 @@ public class TransactionAwareBufferedWriter extends Writer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return true if the actual transaction is active, false otherwise
|
||||
*/
|
||||
private boolean transactionActive() {
|
||||
return TransactionSynchronizationManager.isActualTransactionActive();
|
||||
|
||||
@@ -28,7 +28,8 @@ import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* Used to create test data. See http://avro.apache.org/docs/1.9.0/gettingstartedjava.html
|
||||
* Used to create test data. See
|
||||
* <a href="http://avro.apache.org/docs/1.9.0/gettingstartedjava.html">...</a>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author Mahmoud Ben Hassine
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* Autogenerated by Avro
|
||||
*
|
||||
* DO NOT EDIT DIRECTLY
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2022 the original author or authors.
|
||||
* Copyright 2008-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ class HibernateCursorItemReaderIntegrationTests extends AbstractHibernateCursorI
|
||||
|
||||
/**
|
||||
* Exception scenario.
|
||||
*
|
||||
* <p>
|
||||
* {@link HibernateCursorItemReader#setUseStatelessSession(boolean)} can be called
|
||||
* only in uninitialized state.
|
||||
*/
|
||||
|
||||
@@ -105,11 +105,6 @@ class JdbcPagingItemReaderAsyncTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws InterruptedException
|
||||
* @throws ExecutionException
|
||||
*/
|
||||
private void doTest() throws Exception, InterruptedException, ExecutionException {
|
||||
final ItemReader<Foo> reader = getItemReader();
|
||||
CompletionService<List<Foo>> completionService = new ExecutorCompletionService<>(
|
||||
|
||||
@@ -99,11 +99,6 @@ class JpaPagingItemReaderAsyncTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws InterruptedException
|
||||
* @throws ExecutionException
|
||||
*/
|
||||
private void doTest() throws Exception, InterruptedException, ExecutionException {
|
||||
final JpaPagingItemReader<Foo> reader = getItemReader();
|
||||
CompletionService<List<Foo>> completionService = new ExecutorCompletionService<>(
|
||||
|
||||
@@ -212,7 +212,6 @@ class FlatFileItemWriterTests {
|
||||
|
||||
/**
|
||||
* Regular usage of <code>write(String)</code> method
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testWriteString() throws Exception {
|
||||
@@ -237,7 +236,6 @@ class FlatFileItemWriterTests {
|
||||
|
||||
/**
|
||||
* Regular usage of <code>write(String)</code> method
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testWriteWithConverter() throws Exception {
|
||||
@@ -252,7 +250,6 @@ class FlatFileItemWriterTests {
|
||||
|
||||
/**
|
||||
* Regular usage of <code>write(String)</code> method
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testWriteWithConverterAndString() throws Exception {
|
||||
@@ -265,7 +262,6 @@ class FlatFileItemWriterTests {
|
||||
|
||||
/**
|
||||
* Regular usage of <code>write(String[], LineDescriptor)</code> method
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testWriteRecord() throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.item.sample;
|
||||
|
||||
/**
|
||||
* An XML customer.
|
||||
*
|
||||
* <p>
|
||||
* This is a complex type.
|
||||
*/
|
||||
public class Customer {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.item.sample;
|
||||
|
||||
/**
|
||||
* An XML line-item.
|
||||
*
|
||||
* <p>
|
||||
* This is a complex type.
|
||||
*/
|
||||
public class LineItem {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* An XML order.
|
||||
*
|
||||
* <p>
|
||||
* This is a complex type.
|
||||
*/
|
||||
public class Order {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.item.sample;
|
||||
|
||||
/**
|
||||
* An XML shipper.
|
||||
*
|
||||
* <p>
|
||||
* This is a complex type.
|
||||
*/
|
||||
public class Shipper {
|
||||
|
||||
@@ -28,8 +28,7 @@ import org.springframework.batch.item.ItemStreamWriter;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Common parent class for {@link SynchronizedItemStreamWriterTests} and
|
||||
* {@link org.springframework.batch.item.support.builder.SynchronizedItemStreamWriterBuilderTests}
|
||||
* Common parent class for {@link SynchronizedItemStreamWriter} related tests.
|
||||
*
|
||||
* @author Dimitrios Liapis
|
||||
* @author Mahmoud Ben Hassine
|
||||
|
||||
@@ -715,7 +715,7 @@ class StaxEventItemReaderTests {
|
||||
/**
|
||||
* A simple mapFragment implementation checking the StaxEventReaderItemReader
|
||||
* basic read functionality.
|
||||
* @param source
|
||||
* @param source to unmarshal
|
||||
* @return list of the events from fragment body
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -64,10 +64,9 @@ class SimpleLimitExceptionHandlerTests {
|
||||
assertSame(expected, throwable);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Other than nominated exception type should be rethrown, ignoring the exception
|
||||
* limit.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testNormalExceptionThrown() throws Throwable {
|
||||
@@ -83,9 +82,8 @@ class SimpleLimitExceptionHandlerTests {
|
||||
assertSame(expected, throwable);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* TransactionInvalidException should only be rethrown below the exception limit.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testLimitedExceptionTypeNotThrown() throws Throwable {
|
||||
@@ -97,9 +95,8 @@ class SimpleLimitExceptionHandlerTests {
|
||||
assertDoesNotThrow(() -> handler.handleException(new RepeatContextSupport(null), new RuntimeException("foo")));
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* TransactionInvalidException should only be rethrown below the exception limit.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testLimitedExceptionNotThrownFromSiblings() throws Throwable {
|
||||
@@ -120,9 +117,8 @@ class SimpleLimitExceptionHandlerTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* TransactionInvalidException should only be rethrown below the exception limit.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
void testLimitedExceptionThrownFromSiblingsWhenUsingParent() throws Throwable {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,10 +33,6 @@ public class ItemReaderRepeatCallback<T> implements RepeatCallback {
|
||||
|
||||
private final ItemWriter<T> writer;
|
||||
|
||||
/**
|
||||
* @param reader
|
||||
* @param writer
|
||||
*/
|
||||
public ItemReaderRepeatCallback(ItemReader<T> reader, ItemWriter<T> writer) {
|
||||
this.writer = writer;
|
||||
this.reader = reader;
|
||||
|
||||
@@ -244,7 +244,7 @@ class TaskExecutorRepeatTemplateBulkAsynchronousTests {
|
||||
* sufficiently long for another worker to be launched while it is busy, the early
|
||||
* completion tests will fail. "Sufficiently long" is the problem so we try and block
|
||||
* until we know someone else is busy?
|
||||
* @throws Exception
|
||||
* @throws Exception if interrupted while being busy
|
||||
*/
|
||||
private void beBusy() throws Exception {
|
||||
synchronized (this) {
|
||||
|
||||
Reference in New Issue
Block a user