public class SimpleStepFactoryBean<T,S> extends Object implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.BeanNameAware
Step
implementation manually.
This factory does not support configuration of fault-tolerant behavior, use
appropriate subclass of this factory bean to configure skip or retry.FaultTolerantStepFactoryBean
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
SimpleStepFactoryBean()
Default constructor for
SimpleStepFactoryBean . |
Modifier and Type | Method and Description |
---|---|
protected void |
applyConfiguration(TaskletStep step) |
protected SimpleChunkProcessor<T,S> |
configureChunkProcessor()
Extension point for creating appropriate
ChunkProcessor . |
protected SimpleChunkProvider<T> |
configureChunkProvider()
Extension point for creating appropriate
ChunkProvider . |
protected RepeatOperations |
getChunkOperations()
Protected getter for the chunk operations to make them available in
subclasses.
|
protected int |
getCommitInterval()
Accessor for commit interval if needed in sub classes.
|
protected ExceptionHandler |
getExceptionHandler()
Protected getter for the
ExceptionHandler . |
protected ItemProcessor<? super T,? extends S> |
getItemProcessor()
Protected getter for the
ItemProcessor for subclasses to use |
protected ItemReader<? extends T> |
getItemReader()
Protected getter for the
ItemReader for subclasses to use. |
protected ItemWriter<? super S> |
getItemWriter()
Protected getter for the
ItemWriter for subclasses to use |
protected StepListener[] |
getListeners()
Protected getter for the
StepListener s. |
String |
getName()
Public getter for the name of the step.
|
Object |
getObject()
Create a
Step from the configuration provided. |
Class<TaskletStep> |
getObjectType() |
protected RepeatOperations |
getStepOperations()
Protected getter for the step operations to make them available in
subclasses.
|
protected org.springframework.core.task.TaskExecutor |
getTaskExecutor()
Mkae the
TaskExecutor available to subclasses |
protected org.springframework.transaction.interceptor.TransactionAttribute |
getTransactionAttribute()
Getter for the
TransactionAttribute for subclasses only. |
protected boolean |
isReaderTransactionalQueue()
Convenience method for subclasses.
|
boolean |
isSingleton()
Returns true by default, but in most cases a
Step should not be
treated as thread safe. |
protected void |
registerChunkListeners(TaskletStep step,
StepListener listener) |
protected void |
registerStreams(TaskletStep step,
ItemStream[] streams)
Register the streams with the step.
|
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 |
setBeanName(String name)
Set the bean name property, which will become the name of the
Step when it is created. |
void |
setChunkCompletionPolicy(CompletionPolicy chunkCompletionPolicy)
Public setter for the
CompletionPolicy applying to the chunk
level. |
void |
setChunkOperations(RepeatOperations chunkOperations)
Public setter for the chunkOperations.
|
void |
setCommitInterval(int commitInterval)
Set the commit interval.
|
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
Public setter for the
ExceptionHandler . |
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 T,? extends S> itemProcessor) |
void |
setItemReader(ItemReader<? extends T> itemReader) |
void |
setItemWriter(ItemWriter<? super S> itemWriter) |
void |
setJobRepository(JobRepository jobRepository)
Public setter for
JobRepository . |
void |
setListeners(StepListener[] listeners)
The listeners to inject into the
Step . |
void |
setPropagation(org.springframework.transaction.annotation.Propagation propagation) |
void |
setSingleton(boolean singleton)
Public setter for the singleton flag.
|
void |
setStartLimit(int startLimit)
Public setter for the start limit for the step.
|
void |
setStepOperations(RepeatOperations stepOperations)
Public setter for the stepOperations.
|
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 |
setThrottleLimit(int throttleLimit)
Public setter for the throttle limit.
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Public setter for the
PlatformTransactionManager . |
void |
setTransactionTimeout(int transactionTimeout)
The timeout for an individual transaction in the step.
|
public SimpleStepFactoryBean()
SimpleStepFactoryBean
.public void setIsReaderTransactionalQueue(boolean isReaderTransactionalQueue)
isReaderTransactionalQueue
- the value of the flagprotected boolean isReaderTransactionalQueue()
public void setBeanName(String name)
Step
when it is created.setBeanName
in interface org.springframework.beans.factory.BeanNameAware
BeanNameAware.setBeanName(java.lang.String)
public String getName()
public void setTransactionTimeout(int transactionTimeout)
transactionTimeout
- the transaction timeout to set, defaults to
infinitepublic void setPropagation(org.springframework.transaction.annotation.Propagation propagation)
propagation
- the propagation to set for business transactionspublic void setIsolation(org.springframework.transaction.annotation.Isolation isolation)
isolation
- the isolation to set for business transactionspublic void setStartLimit(int startLimit)
startLimit
- the startLimit to setpublic void setAllowStartIfComplete(boolean allowStartIfComplete)
allowStartIfComplete
- the shouldAllowStartIfComplete to setpublic void setItemReader(ItemReader<? extends T> itemReader)
itemReader
- the ItemReader
to setpublic void setItemWriter(ItemWriter<? super S> itemWriter)
itemWriter
- the ItemWriter
to setpublic void setItemProcessor(ItemProcessor<? super T,? extends S> itemProcessor)
itemProcessor
- the ItemProcessor
to setpublic void setStreams(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 setListeners(StepListener[] 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 listenersprotected StepListener[] getListeners()
StepListener
s.protected ItemReader<? extends T> getItemReader()
ItemReader
for subclasses to use.protected ItemWriter<? super S> getItemWriter()
ItemWriter
for subclasses to useprotected ItemProcessor<? super T,? extends S> getItemProcessor()
ItemProcessor
for subclasses to usepublic void setJobRepository(JobRepository jobRepository)
JobRepository
.jobRepository
- is a mandatory dependence (no default).public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
PlatformTransactionManager
.transactionManager
- the transaction manager to setprotected org.springframework.transaction.interceptor.TransactionAttribute getTransactionAttribute()
TransactionAttribute
for subclasses only.public final Object getObject() throws Exception
Step
from the configuration provided.getObject
in interface org.springframework.beans.factory.FactoryBean
Exception
FactoryBean.getObject()
public Class<TaskletStep> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean
public boolean isSingleton()
Step
should not be
treated as thread safe. Clients are recommended to create a new step for
each job execution.isSingleton
in interface org.springframework.beans.factory.FactoryBean
FactoryBean.isSingleton()
public void setSingleton(boolean singleton)
singleton
- the value to set. Defaults to true.public void setCommitInterval(int commitInterval)
commitInterval
- 1 by defaultprotected int getCommitInterval()
public void setChunkCompletionPolicy(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 setprotected RepeatOperations getStepOperations()
public void setStepOperations(RepeatOperations stepOperations)
stepOperations
- the stepOperations to setpublic void setChunkOperations(RepeatOperations chunkOperations)
chunkOperations
- the chunkOperations to setprotected RepeatOperations getChunkOperations()
public void setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler
.exceptionHandler
- the exceptionHandler to setprotected ExceptionHandler getExceptionHandler()
ExceptionHandler
.ExceptionHandler
public 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 setprotected org.springframework.core.task.TaskExecutor getTaskExecutor()
TaskExecutor
available to subclassespublic void setThrottleLimit(int throttleLimit)
TaskExecutorRepeatTemplate.DEFAULT_THROTTLE_LIMIT
.throttleLimit
- the throttle limit to set.protected void applyConfiguration(TaskletStep step)
step
- protected void registerStreams(TaskletStep step, ItemStream[] streams)
step
- the TaskletStep
streams
- the streams to registerprotected SimpleChunkProvider<T> configureChunkProvider()
ChunkProvider
. Return
value must subclass SimpleChunkProvider
due to listener
registration.protected SimpleChunkProcessor<T,S> configureChunkProcessor()
ChunkProcessor
. Return
value must subclass SimpleChunkProcessor
due to listener
registration.protected void registerChunkListeners(TaskletStep step, StepListener listener)
Copyright © 2013 SpringSource. All rights reserved.