org.springframework.batch.core.step.item
Class AbstractStepFactoryBean

java.lang.Object
  extended by org.springframework.batch.core.step.item.AbstractStepFactoryBean
All Implemented Interfaces:
BeanNameAware, FactoryBean
Direct Known Subclasses:
RepeatOperationsStepFactoryBean, SimpleStepFactoryBean

public abstract class AbstractStepFactoryBean
extends Object
implements FactoryBean, BeanNameAware

Base class for factory beans for ItemOrientedStep. Ensures that all the mandatory properties are set, and provides basic support for the Step interface responsibilities like start limit. Supports registration of ItemStreams and StepListeners.

Author:
Dave Syer
See Also:
SimpleStepFactoryBean, RepeatOperationsStepFactoryBean

Constructor Summary
AbstractStepFactoryBean()
           
 
Method Summary
protected  void applyConfiguration(ItemOrientedStep step)
           
protected  ItemReader getItemReader()
          Protected getter for the ItemReader for subclasses to use.
protected  ItemWriter getItemWriter()
          Protected getter for the ItemWriter for subclasses to use
protected  StepListener[] getListeners()
          Protected getter for the StepListeners.
 String getName()
          Public getter for the String.
 Object getObject()
          Create a Step from the configuration provided.
 Class getObjectType()
           
protected  TransactionAttribute getTransactionAttribute()
          Protected getter for the TransactionAttribute for subclasses only.
 boolean isSingleton()
          Returns true by default, but in most cases a Step should not be treated as thread safe.
 void setAllowStartIfComplete(boolean allowStartIfComplete)
          Public setter for the shouldAllowStartIfComplete.
 void setBeanName(String name)
          Set the bean name property, which will become the name of the Step when it is created.
 void setItemReader(ItemReader itemReader)
           
 void setItemWriter(ItemWriter itemWriter)
           
 void setJobRepository(JobRepository jobRepository)
          Public setter for JobRepository.
 void setListeners(StepListener[] listeners)
          The listeners to inject into the Step.
 void setSingleton(boolean singleton)
          Public setter for the singleton flag.
 void setStartLimit(int startLimit)
          Public setter for the startLimit.
 void setStreams(ItemStream[] streams)
          The streams to inject into the Step.
 void setTransactionAttribute(TransactionAttribute transactionAttribute)
          Public setter for the TransactionAttribute.
 void setTransactionManager(PlatformTransactionManager transactionManager)
          Public setter for the PlatformTransactionManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractStepFactoryBean

public AbstractStepFactoryBean()
Method Detail

setBeanName

public void setBeanName(String name)
Set the bean name property, which will become the name of the Step when it is created.

Specified by:
setBeanName in interface BeanNameAware
See Also:
BeanNameAware.setBeanName(java.lang.String)

getName

public String getName()
Public getter for the String.

Returns:
the name

setStartLimit

public void setStartLimit(int startLimit)
Public setter for the startLimit.

Parameters:
startLimit - the startLimit to set

setAllowStartIfComplete

public void setAllowStartIfComplete(boolean allowStartIfComplete)
Public setter for the shouldAllowStartIfComplete.

Parameters:
allowStartIfComplete - the shouldAllowStartIfComplete to set

setItemReader

public void setItemReader(ItemReader itemReader)
Parameters:
itemReader - the itemReader to set

setItemWriter

public void setItemWriter(ItemWriter itemWriter)
Parameters:
itemWriter - the itemWriter 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

setListeners

public void setListeners(StepListener[] 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

getListeners

protected StepListener[] getListeners()
Protected getter for the StepListeners.

Returns:
the listeners

getItemReader

protected ItemReader getItemReader()
Protected getter for the ItemReader for subclasses to use.

Returns:
the itemReader

getItemWriter

protected ItemWriter getItemWriter()
Protected getter for the ItemWriter for subclasses to use

Returns:
the itemWriter

setJobRepository

public void setJobRepository(JobRepository jobRepository)
Public setter for JobRepository.

Parameters:
jobRepository - is a mandatory dependence (no default).

setTransactionManager

public void setTransactionManager(PlatformTransactionManager transactionManager)
Public setter for the PlatformTransactionManager.

Parameters:
transactionManager - the transaction manager to set

setTransactionAttribute

public void setTransactionAttribute(TransactionAttribute transactionAttribute)
Public setter for the TransactionAttribute.

Parameters:
transactionAttribute - the TransactionAttribute to set

getTransactionAttribute

protected TransactionAttribute getTransactionAttribute()
Protected getter for the TransactionAttribute for subclasses only.

Returns:
the transactionAttribute

getObject

public final Object getObject()
                       throws Exception
Create a Step from the configuration provided.

Specified by:
getObject in interface FactoryBean
Throws:
Exception
See Also:
FactoryBean.getObject()

applyConfiguration

protected void applyConfiguration(ItemOrientedStep step)
Parameters:
step -

getObjectType

public Class getObjectType()
Specified by:
getObjectType in interface FactoryBean

isSingleton

public boolean isSingleton()
Returns true by default, but in most cases a Step should not be treated as thread safe. Clients are recommended to create a new step for each job execution.

Specified by:
isSingleton in interface FactoryBean
See Also:
FactoryBean.isSingleton()

setSingleton

public void setSingleton(boolean singleton)
Public setter for the singleton flag.

Parameters:
singleton - the value to set. Defaults to true.


Copyright © 2009 SpringSource. All Rights Reserved.