public class StepParserStepFactoryBean<I,O> extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<Step>, org.springframework.beans.factory.BeanNameAware
FactoryBean is used by the batch namespace parser to create Step objects. Stores all of the
properties that are configurable on the <step/> (and its inner <tasklet/>). Based on which properties are
configured, the getObject() method will delegate to the appropriate class for generating the Step.SimpleStepFactoryBean,
FaultTolerantStepFactoryBean,
TaskletStep| Constructor and Description |
|---|
StepParserStepFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
protected Step |
createFaultTolerantStep() |
protected Step |
createFlowStep() |
protected Step |
createPartitionStep() |
protected Step |
createSimpleStep() |
protected TaskletStep |
createTaskletStep() |
protected void |
enhanceCommonStep(StepBuilderHelper<?> builder) |
protected void |
enhanceTaskletStepBuilder(AbstractTaskletStepBuilder<?> builder) |
protected java.lang.Integer |
getCommitInterval() |
protected org.springframework.batch.repeat.CompletionPolicy |
getCompletionPolicy() |
protected FaultTolerantStepBuilder<I,O> |
getFaultTolerantStepBuilder(java.lang.String stepName) |
JobRepository |
getJobRepository() |
java.lang.String |
getName() |
Step |
getObject()
Create a
Step from the configuration provided. |
java.lang.Class<TaskletStep> |
getObjectType() |
protected PartitionHandler |
getPartitionHandler() |
protected SimpleStepBuilder<I,O> |
getSimpleStepBuilder(java.lang.String stepName) |
protected StepExecutionAggregator |
getStepExecutionAggergator() |
protected Tasklet |
getTasklet() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
protected boolean |
hasChunkElement() |
protected boolean |
hasPartitionElement() |
protected boolean |
hasTasklet() |
protected boolean |
isFaultTolerant() |
boolean |
isSingleton() |
protected void |
registerItemListeners(SimpleStepBuilder<I,O> builder) |
boolean |
requiresTransactionManager() |
void |
setAllowStartIfComplete(boolean allowStartIfComplete)
Public setter for the flag to indicate that the step should be replayed on a restart, even if successful the
first time.
|
void |
setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
A backoff policy to be applied to retry process.
|
void |
setBeanName(java.lang.String name)
Set the bean name property, which will become the name of the
Step when it is created. |
void |
setCacheCapacity(int cacheCapacity)
Public setter for the capacity of the cache in the retry policy.
|
protected void |
setChunk(SimpleStepBuilder<I,O> builder) |
void |
setChunkCompletionPolicy(org.springframework.batch.repeat.CompletionPolicy chunkCompletionPolicy)
Public setter for the
CompletionPolicy applying to the chunk level. |
void |
setCommitInterval(int commitInterval)
Set the commit interval.
|
void |
setFlow(Flow flow) |
void |
setGridSize(int gridSize) |
void |
setHasChunkElement(boolean hasChunkElement) |
void |
setIsolation(org.springframework.transaction.annotation.Isolation isolation) |
void |
setIsReaderTransactionalQueue(boolean isReaderTransactionalQueue)
Flag to signal that the reader is transactional (usually a JMS consumer) so that items are re-presented after a
rollback.
|
void |
setItemProcessor(org.springframework.batch.item.ItemProcessor<? super I,? extends O> itemProcessor) |
void |
setItemReader(org.springframework.batch.item.ItemReader<? extends I> itemReader) |
void |
setItemWriter(org.springframework.batch.item.ItemWriter<? super O> itemWriter) |
void |
setJob(Job job) |
void |
setJobLauncher(JobLauncher jobLauncher) |
void |
setJobParametersExtractor(JobParametersExtractor jobParametersExtractor) |
void |
setJobRepository(JobRepository jobRepository)
Public setter for
JobRepository. |
void |
setKeyGenerator(KeyGenerator keyGenerator)
A key generator that can be used to compare items with previously recorded items in a retry.
|
void |
setListeners(java.lang.Object[] listeners)
The listeners to inject into the
Step. |
void |
setName(java.lang.String name) |
void |
setNoRollbackExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
Exception classes that may not cause a rollback if encountered in the right place.
|
void |
setPartitioner(Partitioner partitioner) |
void |
setPartitionHandler(PartitionHandler partitionHandler) |
void |
setPartitionLock(java.util.concurrent.locks.ReentrantLock lock)
Used to coordinate access to the partition queue between the
PartitionCollector and AbstractPartitionAnalyzer |
void |
setPartitionQueue(java.util.Queue<java.io.Serializable> queue) |
void |
setProcessorTransactional(java.lang.Boolean processorTransactional)
Flag to signal that the processor is transactional, in which case it should be called for every item in every
transaction.
|
void |
setPropagation(org.springframework.transaction.annotation.Propagation propagation) |
void |
setRetryableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> retryableExceptionClasses)
Public setter for exception classes that will retry the item when raised.
|
void |
setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache) |
void |
setRetryLimit(int retryLimit)
Public setter for the retry limit.
|
void |
setRetryListeners(org.springframework.retry.RetryListener... retryListeners)
Public setter for the
RetryListeners. |
void |
setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)
A retry policy to apply when exceptions occur.
|
void |
setSkipLimit(int skipLimit)
Public setter for a limit that determines skip policy.
|
void |
setSkippableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> exceptionClasses)
Public setter for exception classes that when raised won't crash the job but will result in transaction rollback
and the item which handling caused the exception will be skipped.
|
void |
setSkipPolicy(SkipPolicy skipPolicy)
Public setter for a skip policy.
|
void |
setStartLimit(int startLimit)
The number of times that the step should be allowed to start
|
void |
setStep(Step step) |
void |
setStepExecutionAggregator(StepExecutionAggregator stepExecutionAggregator) |
void |
setStreams(org.springframework.batch.item.ItemStream[] streams)
The streams to inject into the
Step. |
void |
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Public setter for the
TaskExecutor. |
void |
setTasklet(Tasklet tasklet)
A preconfigured
Tasklet to use. |
void |
setThrottleLimit(java.lang.Integer throttleLimit)
Public setter for the throttle limit.
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) |
void |
setTransactionTimeout(int transactionTimeout) |
protected void |
validateFaultTolerantSettings()
Validates that all components required to build a fault tolerant step are set
|
public void setPartitionQueue(java.util.Queue<java.io.Serializable> queue)
queue - The Queue that is used for communication between PartitionCollector and PartitionAnalyzerpublic void setPartitionLock(java.util.concurrent.locks.ReentrantLock lock)
PartitionCollector and AbstractPartitionAnalyzerlock - a lock that will be locked around accessing the partition queuepublic Step getObject() throws java.lang.Exception
Step from the configuration provided.getObject in interface org.springframework.beans.factory.FactoryBean<Step>java.lang.ExceptionFactoryBean.getObject()public boolean requiresTransactionManager()
protected void enhanceCommonStep(StepBuilderHelper<?> builder)
builder - StepBuilderHelper representing the step to be enhancedprotected Step createPartitionStep()
protected Step createFaultTolerantStep()
protected FaultTolerantStepBuilder<I,O> getFaultTolerantStepBuilder(java.lang.String stepName)
protected void registerItemListeners(SimpleStepBuilder<I,O> builder)
protected Step createSimpleStep()
protected void setChunk(SimpleStepBuilder<I,O> builder)
protected org.springframework.batch.repeat.CompletionPolicy getCompletionPolicy()
protected SimpleStepBuilder<I,O> getSimpleStepBuilder(java.lang.String stepName)
protected TaskletStep createTaskletStep()
TaskletStepprotected void enhanceTaskletStepBuilder(AbstractTaskletStepBuilder<?> builder)
protected Step createFlowStep()
protected void validateFaultTolerantSettings()
protected boolean isFaultTolerant()
public java.lang.Class<TaskletStep> getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBean<Step>public boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean<Step>public void setBeanName(java.lang.String name)
Step when it is created.setBeanName in interface org.springframework.beans.factory.BeanNameAwareBeanNameAware.setBeanName(java.lang.String)public void setName(java.lang.String name)
name - the name to setpublic java.lang.String getName()
public void setFlow(Flow flow)
flow - the flow to setpublic void setJob(Job job)
public void setJobParametersExtractor(JobParametersExtractor jobParametersExtractor)
public void setJobLauncher(JobLauncher jobLauncher)
public void setPartitioner(Partitioner partitioner)
partitioner - the partitioner to setpublic void setStepExecutionAggregator(StepExecutionAggregator stepExecutionAggregator)
stepExecutionAggregator - the stepExecutionAggregator to setprotected StepExecutionAggregator getStepExecutionAggergator()
StepExecutionAggregatorpublic void setPartitionHandler(PartitionHandler partitionHandler)
partitionHandler - the partitionHandler to setprotected PartitionHandler getPartitionHandler()
PartitionHandlerpublic void setGridSize(int gridSize)
gridSize - the gridSize to setpublic void setStep(Step step)
step - the step to setpublic void setAllowStartIfComplete(boolean allowStartIfComplete)
allowStartIfComplete - the shouldAllowStartIfComplete to setpublic JobRepository getJobRepository()
public void setJobRepository(JobRepository jobRepository)
JobRepository.jobRepository - JobRepository instance to be used by the step.public void setStartLimit(int startLimit)
startLimit - int containing the number of times a step should be allowed to start.public void setTasklet(Tasklet tasklet)
Tasklet to use.tasklet - Tasklet instance to be used by step.protected Tasklet getTasklet()
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
PlatformTransactionManager
used by the step.public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
transactionManager - the transaction manager to setpublic void setListeners(java.lang.Object[] listeners)
Step. Any instance of StepListener can be used, and will then
receive callbacks at the appropriate stage in the step.listeners - an array of listenerspublic void setNoRollbackExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
noRollbackExceptionClasses - the noRollbackExceptionClasses to setpublic void setTransactionTimeout(int transactionTimeout)
transactionTimeout - the transactionTimeout to setpublic void setIsolation(org.springframework.transaction.annotation.Isolation isolation)
isolation - the isolation to setpublic void setPropagation(org.springframework.transaction.annotation.Propagation propagation)
propagation - the propagation to setpublic void setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
backOffPolicy - the BackOffPolicy to setpublic void setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)
retryPolicy - the RetryPolicy to setpublic void setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache)
retryContextCache - the RetryContextCache to setpublic void setKeyGenerator(KeyGenerator keyGenerator)
keyGenerator - the KeyGenerator to setpublic void setCacheCapacity(int cacheCapacity)
MapRetryContextCache.cacheCapacity - the cache capacity to set (greater than 0 else ignored)public void setChunkCompletionPolicy(org.springframework.batch.repeat.CompletionPolicy chunkCompletionPolicy)
CompletionPolicy applying to the chunk level. A transaction will be committed when
this policy decides to complete. Defaults to a SimpleCompletionPolicy with chunk size equal to the
commitInterval property.chunkCompletionPolicy - the chunkCompletionPolicy to setpublic void setCommitInterval(int commitInterval)
commitInterval - 1 by defaultprotected java.lang.Integer getCommitInterval()
public void setIsReaderTransactionalQueue(boolean isReaderTransactionalQueue)
isReaderTransactionalQueue - the value of the flagpublic void setProcessorTransactional(java.lang.Boolean processorTransactional)
processorTransactional - the value to setpublic void setRetryLimit(int retryLimit)
retryLimit == 1 by default.retryLimit - the retry limit to set, must be greater or equal to 1.public void setSkipLimit(int skipLimit)
skipLimit - the value to set. Default is 0 (never skip).public void setSkipPolicy(SkipPolicy skipPolicy)
skipPolicy - the SkipPolicy to setpublic void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
TaskExecutor. If this is set, then it will be used to execute the chunk processing
inside the Step.taskExecutor - the taskExecutor to setpublic void setThrottleLimit(java.lang.Integer throttleLimit)
TaskExecutorRepeatTemplate.DEFAULT_THROTTLE_LIMIT.throttleLimit - the throttle limit to set.public void setItemReader(org.springframework.batch.item.ItemReader<? extends I> itemReader)
itemReader - the ItemReader to setpublic void setItemProcessor(org.springframework.batch.item.ItemProcessor<? super I,? extends O> itemProcessor)
itemProcessor - the ItemProcessor to setpublic void setItemWriter(org.springframework.batch.item.ItemWriter<? super O> itemWriter)
itemWriter - the ItemWriter to setpublic void setRetryListeners(org.springframework.retry.RetryListener... retryListeners)
RetryListeners.retryListeners - the RetryListeners to setpublic void setSkippableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> exceptionClasses)
exceptionClasses - Map containing the Throwables as
the keys and the values are Booleans, that if true the item is skipped.public void setRetryableExceptionClasses(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> retryableExceptionClasses)
retryableExceptionClasses - the retryableExceptionClasses to setpublic void setStreams(org.springframework.batch.item.ItemStream[] streams)
Step. Any instance of ItemStream can be used, and will then
receive callbacks at the appropriate stage in the step.streams - an array of listenerspublic void setHasChunkElement(boolean hasChunkElement)
hasChunkElement - true if step has <chunk/> element.protected boolean hasChunkElement()
protected boolean hasTasklet()
protected boolean hasPartitionElement()