Spring for Apache Hadoop

org.springframework.yarn.batch.support
Class YarnJobLauncher

java.lang.Object
  extended by org.springframework.yarn.batch.support.YarnJobLauncher
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationEventPublisherAware

@Component
public class YarnJobLauncher
extends java.lang.Object
implements org.springframework.context.ApplicationEventPublisherAware

Utility class to launch Spring Batch jobs. Runs all jobs in the surrounding context by default. Can also be used to launch a specific job by providing a jobName

Author:
Dave Syer, Janne Valkealahti

Constructor Summary
YarnJobLauncher()
           
 
Method Summary
protected  void executeJob(org.springframework.batch.core.Job job, org.springframework.batch.core.JobParameters jobParameters)
           
 org.springframework.batch.core.explore.JobExplorer getJobExplorer()
           
 org.springframework.batch.core.launch.JobLauncher getJobLauncher()
          Gets the job launcher.
 java.lang.String getJobName()
          Gets the enabled job name.
 org.springframework.batch.core.configuration.JobRegistry getJobRegistry()
           
 java.util.Collection<org.springframework.batch.core.Job> getJobs()
          Gets the jobs.
protected  void launchJobFromProperties(java.util.Properties properties)
          Launch jobs using Properties.
 void run(java.util.Properties properties)
          Run the jobs.
 void run(java.lang.String... args)
          Run the jobs.
 void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
           
 void setJobExplorer(org.springframework.batch.core.explore.JobExplorer jobExplorer)
           
 void setJobLauncher(org.springframework.batch.core.launch.JobLauncher jobLauncher)
          Sets the job launcher.
 void setJobName(java.lang.String jobName)
          Sets the enabled job name.
 void setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter converter)
           
 void setJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry)
           
 void setJobs(java.util.Collection<org.springframework.batch.core.Job> jobs)
          Sets the jobs.
 void setYarnBatchProperties(YarnBatchProperties yarnBatchProperties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YarnJobLauncher

public YarnJobLauncher()
Method Detail

setApplicationEventPublisher

public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
Specified by:
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware

run

public void run(java.lang.String... args)
         throws org.springframework.batch.core.JobExecutionException
Run the jobs.

Parameters:
args - the args
Throws:
org.springframework.batch.core.JobExecutionException - the job execution exception

run

public void run(java.util.Properties properties)
         throws org.springframework.batch.core.JobExecutionException
Run the jobs.

Parameters:
properties - the job properties
Throws:
org.springframework.batch.core.JobExecutionException - the job execution exception

setJobName

public void setJobName(java.lang.String jobName)
Sets the enabled job name. Moreover this name can also be a simple pattern supported by PatternMatchUtils.simpleMatch(String, String) and multiple patterns can be matched if delimited by a comma.

Parameters:
jobName - the new job name

getJobName

public java.lang.String getJobName()
Gets the enabled job name.

Returns:
the job name
See Also:
setJobName(String)

setJobLauncher

@Autowired
public void setJobLauncher(org.springframework.batch.core.launch.JobLauncher jobLauncher)
Sets the job launcher.

Parameters:
jobLauncher - the new job launcher

getJobLauncher

public org.springframework.batch.core.launch.JobLauncher getJobLauncher()
Gets the job launcher.

Returns:
the job launcher

setJobRegistry

@Autowired(required=false)
public void setJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry)

getJobRegistry

public org.springframework.batch.core.configuration.JobRegistry getJobRegistry()

setJobParametersConverter

@Autowired(required=false)
public void setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter converter)

setJobExplorer

@Autowired(required=false)
public void setJobExplorer(org.springframework.batch.core.explore.JobExplorer jobExplorer)

getJobExplorer

public org.springframework.batch.core.explore.JobExplorer getJobExplorer()

setJobs

@Autowired(required=false)
public void setJobs(java.util.Collection<org.springframework.batch.core.Job> jobs)
Sets the jobs.

Parameters:
jobs - the new jobs

getJobs

public java.util.Collection<org.springframework.batch.core.Job> getJobs()
Gets the jobs.

Returns:
the jobs

setYarnBatchProperties

@Autowired(required=false)
public void setYarnBatchProperties(YarnBatchProperties yarnBatchProperties)

launchJobFromProperties

protected void launchJobFromProperties(java.util.Properties properties)
                                throws org.springframework.batch.core.JobExecutionException
Launch jobs using Properties.

Parameters:
properties - the properties
Throws:
org.springframework.batch.core.JobExecutionException - the job execution exception

executeJob

protected void executeJob(org.springframework.batch.core.Job job,
                          org.springframework.batch.core.JobParameters jobParameters)
                   throws org.springframework.batch.core.JobExecutionException
Throws:
org.springframework.batch.core.JobExecutionException

Spring for Apache Hadoop