org.springframework.batch.core.job
Class AbstractJob

java.lang.Object
  extended by org.springframework.batch.core.job.AbstractJob
All Implemented Interfaces:
Job, BeanNameAware, InitializingBean
Direct Known Subclasses:
SimpleJob

public abstract class AbstractJob
extends Object
implements Job, BeanNameAware, InitializingBean

Batch domain object representing a job. Job is an explicit abstraction representing the configuration of a job specified by a developer. It should be noted that restart policy is applied to the job as a whole and not to a step.

Author:
Lucas Ward, Dave Syer

Constructor Summary
AbstractJob()
          Default constructor.
AbstractJob(String name)
          Convenience constructor to immediately add name (which is mandatory but not final).
 
Method Summary
 void addStep(Step step)
           
 void afterPropertiesSet()
           
protected  CompositeExecutionJobListener getCompositeListener()
           
protected  JobRepository getJobRepository()
           
 String getName()
           
 List getSteps()
           
 boolean isRestartable()
           
 void registerJobExecutionListener(JobExecutionListener listener)
          Register a single listener for the JobExecutionListener callbacks.
 void setBeanName(String name)
          Set the name property if it is not already set.
 void setJobExecutionListeners(JobExecutionListener[] listeners)
          Public setter for injecting JobExecutionListeners.
 void setJobRepository(JobRepository jobRepository)
          Public setter for the JobRepository that is needed to manage the state of the batch meta domain (jobs, steps, executions) during the life of a job.
 void setName(String name)
          Set the name property.
 void setRestartable(boolean restartable)
           
 void setSteps(List steps)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.batch.core.Job
execute
 

Constructor Detail

AbstractJob

public AbstractJob()
Default constructor.


AbstractJob

public AbstractJob(String name)
Convenience constructor to immediately add name (which is mandatory but not final).

Parameters:
name -
Method Detail

setBeanName

public void setBeanName(String name)
Set the name property if it is not already set. Because of the order of the callbacks in a Spring container the name property will be set first if it is present. Care is needed with bean definition inheritance - if a parent bean has a name, then its children need an explicit name as well, otherwise they will not be unique.

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

setName

public void setName(String name)
Set the name property. Always overrides the default value if this object is a Spring bean.

See Also:
setBeanName(java.lang.String)

getName

public String getName()
Specified by:
getName in interface Job

getSteps

public List getSteps()
Specified by:
getSteps in interface Job
Returns:
the Steps executed as part of this job.

setSteps

public void setSteps(List steps)

addStep

public void addStep(Step step)

setRestartable

public void setRestartable(boolean restartable)

isRestartable

public boolean isRestartable()
Specified by:
isRestartable in interface Job

toString

public String toString()
Overrides:
toString in class Object

setJobExecutionListeners

public void setJobExecutionListeners(JobExecutionListener[] listeners)
Public setter for injecting JobExecutionListeners. They will all be given the listener callbacks at the appropriate point in the job.

Parameters:
listeners - the listeners to set.

registerJobExecutionListener

public void registerJobExecutionListener(JobExecutionListener listener)
Register a single listener for the JobExecutionListener callbacks.

Parameters:
listener - a JobExecutionListener

setJobRepository

public void setJobRepository(JobRepository jobRepository)
Public setter for the JobRepository that is needed to manage the state of the batch meta domain (jobs, steps, executions) during the life of a job.

Parameters:
jobRepository -

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getJobRepository

protected JobRepository getJobRepository()

getCompositeListener

protected CompositeExecutionJobListener getCompositeListener()


Copyright © 2009 SpringSource. All Rights Reserved.