org.springframework.batch.core.configuration.xml

## Class StepParserStepFactoryBean<I,O>

- java.lang.Object
- - org.springframework.batch.core.configuration.xml.StepParserStepFactoryBean<I,O>

- All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.FactoryBean<Step>
  Direct Known Subclasses:
    StepFactoryBean

      public class StepParserStepFactoryBean<I,O>
      extends java.lang.Object
      implements org.springframework.beans.factory.FactoryBean<Step>, org.springframework.beans.factory.BeanNameAware

  This `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`.
  Since:
    2.0
  Author:
    Dan Garrette, Josh Long, Michael Minella, Chris Schaefer
  See Also:
    `SimpleStepFactoryBean`, `FaultTolerantStepFactoryBean`, `TaskletStep`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StepParserStepFactoryBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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 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(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(ItemProcessor<? super I,? extends O> itemProcessor)`
    `void` | `setItemReader(ItemReader<? extends I> itemReader)`
    `void` | `setItemWriter(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 `RetryListener`s.
    `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(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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StepParserStepFactoryBean

          public StepParserStepFactoryBean()

  - ### Method Detail

    - #### setPartitionQueue

          public void setPartitionQueue(java.util.Queue<java.io.Serializable> queue)

      Parameters:
        `queue` - The `Queue` that is used for communication between `PartitionCollector` and `PartitionAnalyzer`

    - #### setPartitionLock

          public void setPartitionLock(java.util.concurrent.locks.ReentrantLock lock)

      Used to coordinate access to the partition queue between the `PartitionCollector` and `AbstractPartitionAnalyzer`
      Parameters:
        `lock` - a lock that will be locked around accessing the partition queue

    - #### getObject

          public Step getObject()
                         throws java.lang.Exception

      Create a `Step` from the configuration provided.
      Specified by:
        `getObject` in interface `org.springframework.beans.factory.FactoryBean<Step>`
      Throws:
        `java.lang.Exception`
      See Also:
        `FactoryBean.getObject()`

    - #### requiresTransactionManager

          public boolean requiresTransactionManager()

    - #### enhanceCommonStep

          protected void enhanceCommonStep(StepBuilderHelper<?> builder)

      Parameters:
        `builder` - `StepBuilderHelper` representing the step to be enhanced

    - #### createPartitionStep

          protected Step createPartitionStep()

    - #### createFaultTolerantStep

          protected Step createFaultTolerantStep()

    - #### getFaultTolerantStepBuilder

          protected FaultTolerantStepBuilder<I,O> getFaultTolerantStepBuilder(java.lang.String stepName)

    - #### registerItemListeners

          protected void registerItemListeners(SimpleStepBuilder<I,O> builder)

    - #### createSimpleStep

          protected Step createSimpleStep()

    - #### setChunk

          protected void setChunk(SimpleStepBuilder<I,O> builder)

    - #### getCompletionPolicy

          protected CompletionPolicy getCompletionPolicy()

    - #### getSimpleStepBuilder

          protected SimpleStepBuilder<I,O> getSimpleStepBuilder(java.lang.String stepName)

    - #### createTaskletStep

          protected TaskletStep createTaskletStep()

      Returns:
        a new `TaskletStep`

    - #### enhanceTaskletStepBuilder

          protected void enhanceTaskletStepBuilder(AbstractTaskletStepBuilder<?> builder)

    - #### createFlowStep

          protected Step createFlowStep()

    - #### validateFaultTolerantSettings

          protected void validateFaultTolerantSettings()

      Validates that all components required to build a fault tolerant step are set

    - #### isFaultTolerant

          protected boolean isFaultTolerant()

      Returns:
        true if the step is configured with any components that require fault tolerance

    - #### getObjectType

          public java.lang.Class<TaskletStep> getObjectType()

      Specified by:
        `getObjectType` in interface `org.springframework.beans.factory.FactoryBean<Step>`

    - #### isSingleton

          public boolean isSingleton()

      Specified by:
        `isSingleton` in interface `org.springframework.beans.factory.FactoryBean<Step>`

    - #### setBeanName

          public void setBeanName(java.lang.String name)

      Set the bean name property, which will become the name of the `Step` when it is created.
      Specified by:
        `setBeanName` in interface `org.springframework.beans.factory.BeanNameAware`
      See Also:
        `BeanNameAware.setBeanName(java.lang.String)`

    - #### setName

          public void setName(java.lang.String name)

      Parameters:
        `name` - the name to set

    - #### getName

          public java.lang.String getName()

    - #### setFlow

          public void setFlow(Flow flow)

      Parameters:
        `flow` - the flow to set

    - #### setJob

          public void setJob(Job job)

    - #### setJobParametersExtractor

          public void setJobParametersExtractor(JobParametersExtractor jobParametersExtractor)

    - #### setJobLauncher

          public void setJobLauncher(JobLauncher jobLauncher)

    - #### setPartitioner

          public void setPartitioner(Partitioner partitioner)

      Parameters:
        `partitioner` - the partitioner to set

    - #### setStepExecutionAggregator

          public void setStepExecutionAggregator(StepExecutionAggregator stepExecutionAggregator)

      Parameters:
        `stepExecutionAggregator` - the stepExecutionAggregator to set

    - #### getStepExecutionAggergator

          protected StepExecutionAggregator getStepExecutionAggergator()

      Returns:
        stepExecutionAggregator the current step's `StepExecutionAggregator`

    - #### setPartitionHandler

          public void setPartitionHandler(PartitionHandler partitionHandler)

      Parameters:
        `partitionHandler` - the partitionHandler to set

    - #### getPartitionHandler

          protected PartitionHandler getPartitionHandler()

      Returns:
        partitionHandler the current step's `PartitionHandler`

    - #### setGridSize

          public void setGridSize(int gridSize)

      Parameters:
        `gridSize` - the gridSize to set

    - #### setStep

          public void setStep(Step step)

      Parameters:
        `step` - the step to set

    - #### setAllowStartIfComplete

          public 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.
      Parameters:
        `allowStartIfComplete` - the shouldAllowStartIfComplete to set

    - #### getJobRepository

          public JobRepository getJobRepository()

      Returns:
        jobRepository

    - #### setJobRepository

          public void setJobRepository(JobRepository jobRepository)

      Public setter for `JobRepository`.
      Parameters:
        `jobRepository` -

    - #### setStartLimit

          public void setStartLimit(int startLimit)

      The number of times that the step should be allowed to start
      Parameters:
        `startLimit` -

    - #### setTasklet

          public void setTasklet(Tasklet tasklet)

      A preconfigured `Tasklet` to use.
      Parameters:
        `tasklet` -

    - #### getTasklet

          protected Tasklet getTasklet()

    - #### getTransactionManager

          public org.springframework.transaction.PlatformTransactionManager getTransactionManager()

      Returns:
        transactionManager

    - #### setTransactionManager

          public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)

      Parameters:
        `transactionManager` - the transaction manager to set

    - #### setListeners

          public void setListeners(java.lang.Object[] listeners)

      The listeners to inject into the `Step`. Any instance of `StepListener` can be used, and will then receive callbacks at the appropriate stage in the step.
      Parameters:
        `listeners` - an array of listeners

    - #### setNoRollbackExceptionClasses

          public 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.
      Parameters:
        `noRollbackExceptionClasses` - the noRollbackExceptionClasses to set

    - #### setTransactionTimeout

          public void setTransactionTimeout(int transactionTimeout)

      Parameters:
        `transactionTimeout` - the transactionTimeout to set

    - #### setIsolation

          public void setIsolation(org.springframework.transaction.annotation.Isolation isolation)

      Parameters:
        `isolation` - the isolation to set

    - #### setPropagation

          public void setPropagation(org.springframework.transaction.annotation.Propagation propagation)

      Parameters:
        `propagation` - the propagation to set

    - #### setBackOffPolicy

          public void setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)

      A backoff policy to be applied to retry process.
      Parameters:
        `backOffPolicy` - the `BackOffPolicy` to set

    - #### setRetryPolicy

          public void setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)

      A retry policy to apply when exceptions occur. If this is specified then the retry limit and retryable exceptions will be ignored.
      Parameters:
        `retryPolicy` - the `RetryPolicy` to set

    - #### setRetryContextCache

          public void setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache)

      Parameters:
        `retryContextCache` - the `RetryContextCache` to set

    - #### setKeyGenerator

          public void setKeyGenerator(KeyGenerator keyGenerator)

      A key generator that can be used to compare items with previously recorded items in a retry. Only used if the reader is a transactional queue.
      Parameters:
        `keyGenerator` - the `KeyGenerator` to set

    - #### setCacheCapacity

          public void setCacheCapacity(int cacheCapacity)

      Public setter for the capacity of the cache in the retry policy. If more items than this fail without being skipped or recovered an exception will be thrown. This is to guard against inadvertent infinite loops generated by item identity problems.
      The default value should be high enough and more for most purposes. To breach the limit in a single-threaded step typically you have to have this many failures in a single transaction. Defaults to the value in the `MapRetryContextCache`.
      Parameters:
        `cacheCapacity` - the cache capacity to set (greater than 0 else ignored)

    - #### setChunkCompletionPolicy

          public void setChunkCompletionPolicy(CompletionPolicy chunkCompletionPolicy)

      Public setter for the `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.
      Parameters:
        `chunkCompletionPolicy` - the chunkCompletionPolicy to set

    - #### setCommitInterval

          public void setCommitInterval(int commitInterval)

      Set the commit interval. Either set this or the chunkCompletionPolicy but not both.
      Parameters:
        `commitInterval` - 1 by default

    - #### getCommitInterval

          protected java.lang.Integer getCommitInterval()

    - #### setIsReaderTransactionalQueue

          public 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. The default is false and readers are assumed to be forward-only.
      Parameters:
        `isReaderTransactionalQueue` - the value of the flag

    - #### setProcessorTransactional

          public 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. If false then we can cache the processor results between transactions in the case of a rollback.
      Parameters:
        `processorTransactional` - the value to set

    - #### setRetryLimit

          public void setRetryLimit(int retryLimit)

      Public setter for the retry limit. Each item can be retried up to this limit. Note this limit includes the initial attempt to process the item, therefore `retryLimit == 1` by default.
      Parameters:
        `retryLimit` - the retry limit to set, must be greater or equal to 1.

    - #### setSkipLimit

          public void setSkipLimit(int skipLimit)

      Public setter for a limit that determines skip policy. If this value is positive then an exception in chunk processing will cause the item to be skipped and no exception propagated until the limit is reached. If it is zero then all exceptions will be propagated from the chunk and cause the step to abort.
      Parameters:
        `skipLimit` - the value to set. Default is 0 (never skip).

    - #### setSkipPolicy

          public void setSkipPolicy(SkipPolicy skipPolicy)

      Public setter for a skip policy. If this value is set then the skip limit and skippable exceptions are ignored.
      Parameters:
        `skipPolicy` - the `SkipPolicy` to set

    - #### setTaskExecutor

          public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)

      Public setter for the `TaskExecutor`. If this is set, then it will be used to execute the chunk processing inside the `Step`.
      Parameters:
        `taskExecutor` - the taskExecutor to set

    - #### setThrottleLimit

          public void setThrottleLimit(java.lang.Integer throttleLimit)

      Public setter for the throttle limit. This limits the number of tasks queued for concurrent processing to prevent thread pools from being overwhelmed. Defaults to `TaskExecutorRepeatTemplate.DEFAULT_THROTTLE_LIMIT`.
      Parameters:
        `throttleLimit` - the throttle limit to set.

    - #### setItemReader

          public void setItemReader(ItemReader<? extends I> itemReader)

      Parameters:
        `itemReader` - the `ItemReader` to set

    - #### setItemProcessor

          public void setItemProcessor(ItemProcessor<? super I,? extends O> itemProcessor)

      Parameters:
        `itemProcessor` - the `ItemProcessor` to set

    - #### setItemWriter

          public void setItemWriter(ItemWriter<? super O> itemWriter)

      Parameters:
        `itemWriter` - the `ItemWriter` to set

    - #### setRetryListeners

          public void setRetryListeners(org.springframework.retry.RetryListener... retryListeners)

      Public setter for the `RetryListener`s.
      Parameters:
        `retryListeners` - the `RetryListener`s to set

    - #### setSkippableExceptionClasses

          public 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.
      Parameters:
        `exceptionClasses` -

    - #### setRetryableExceptionClasses

          public 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.
      Parameters:
        `retryableExceptionClasses` - the retryableExceptionClasses to set

    - #### setStreams

          public void setStreams(ItemStream[] streams)

      The streams to inject into the `Step`. Any instance of `ItemStream` can be used, and will then receive callbacks at the appropriate stage in the step.
      Parameters:
        `streams` - an array of listeners

    - #### setHasChunkElement

          public void setHasChunkElement(boolean hasChunkElement)

      Parameters:
        `hasChunkElement` -

    - #### hasChunkElement

          protected boolean hasChunkElement()

      Returns:
        true if the defined step has a <chunk> element

    - #### hasTasklet

          protected boolean hasTasklet()

      Returns:
        true if the defined step has a <tasklet> element

    - #### hasPartitionElement

          protected boolean hasPartitionElement()

      Returns:
        true if the defined step has a <partition> element