org.springframework.data.hadoop.mapreduce
Class JobTasklet

java.lang.Object
  extended by org.springframework.data.hadoop.mapreduce.JobTasklet
All Implemented Interfaces:
Tasklet, BeanFactoryAware, InitializingBean

public class JobTasklet
extends Object
implements Tasklet

Batch tasklet for executing one Hadoop job. Can be configured to not wait for the job to finish - by default the tasklet waits for the job submitted to finish.

Author:
Costin Leau

Constructor Summary
JobTasklet()
           
 
Method Summary
 void afterPropertiesSet()
           
 RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
           
protected  void executeJobs()
           
 void setBeanFactory(BeanFactory beanFactory)
           
 void setJob(Job job)
          Sets the job to execute.
 void setJobNames(String... jobName)
          Sets the jobs to execute by (bean) name.
 void setJobs(Collection<Job> jobs)
          Sets the jobs to execute.
 void setVerbose(boolean verbose)
          Indicates whether the job execution is verbose (the default) or not.
 void setWaitForJob(boolean waitForJob)
          Indicates whether the tasklet should return for the job to complete (default) after submission or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobTasklet

public JobTasklet()
Method Detail

execute

public RepeatStatus execute(StepContribution contribution,
                            ChunkContext chunkContext)
                     throws Exception
Specified by:
execute in interface Tasklet
Throws:
Exception

afterPropertiesSet

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

executeJobs

protected void executeJobs()
                    throws Exception
Throws:
Exception

setJob

public void setJob(Job job)
Sets the job to execute.

Parameters:
job - The job to execute.

setJobs

public void setJobs(Collection<Job> jobs)
Sets the jobs to execute.

Parameters:
jobs - The job to execute.

setJobNames

public void setJobNames(String... jobName)
Sets the jobs to execute by (bean) name. This is the default method used by the hdp name space to allow lazy initialization and potential scoping to kick in.

Parameters:
jobName - The job to execute.

setWaitForJob

public void setWaitForJob(boolean waitForJob)
Indicates whether the tasklet should return for the job to complete (default) after submission or not.

Parameters:
waitForJob - whether to wait for the job to complete or not.

setVerbose

public void setVerbose(boolean verbose)
Indicates whether the job execution is verbose (the default) or not.

Parameters:
verbose - whether the job execution is verbose or not.

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException
Specified by:
setBeanFactory in interface BeanFactoryAware
Throws:
BeansException