BATCHADM-69: add error rendering to JSON views

+ Make execution the default view after a job launch not from UI
This commit is contained in:
Dave Syer
2010-09-21 12:48:05 +02:00
committed by Michael Minella
parent 88638ce05f
commit 0f10341479
3 changed files with 13 additions and 14 deletions

View File

@@ -19,8 +19,7 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParameters;
/**
* Encapsulation of a {@link Job} and its {@link JobParameters} forming a
* request for a job to be launched.
* Encapsulation of a {@link Job} and its {@link JobParameters} forming a request for a job to be launched.
*
* @author Dave Syer
*
@@ -28,6 +27,7 @@ import org.springframework.batch.core.JobParameters;
public class JobLaunchRequest {
private final Job job;
private final JobParameters jobParameters;
/**
@@ -54,4 +54,9 @@ public class JobLaunchRequest {
return this.jobParameters;
}
@Override
public String toString() {
return "JobLaunchRequest: " + job.getName() + ", parameters=" + jobParameters;
}
}

View File

@@ -17,6 +17,7 @@
package org.springframework.batch.integration.launch;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionException;
/**
* Interface for handling a {@link JobLaunchRequest} and returning a {@link JobExecution}.
@@ -25,6 +26,6 @@ import org.springframework.batch.core.JobExecution;
*/
public interface JobLaunchRequestHandler {
JobExecution launch(JobLaunchRequest request);
JobExecution launch(JobLaunchRequest request) throws JobExecutionException;
}

View File

@@ -20,13 +20,11 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionException;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.integration.annotation.ServiceActivator;
/**
* Message handler which uses strategies to convert a Message into a job and a
* set of job parameters
* Message handler which uses strategies to convert a Message into a job and a set of job parameters
* @author Jonas Partner
* @author Dave Syer
*
@@ -44,17 +42,12 @@ public class JobLaunchingMessageHandler implements JobLaunchRequestHandler {
}
@ServiceActivator
public JobExecution launch(JobLaunchRequest request) {
public JobExecution launch(JobLaunchRequest request) throws JobExecutionException {
Job job = request.getJob();
JobParameters jobParameters = request.getJobParameters();
try {
JobExecution execution = jobLauncher.run(job, jobParameters);
return execution;
}
catch (JobExecutionException e) {
throw new UnexpectedJobExecutionException("Exception executing job: ["+request+"]", e);
}
JobExecution execution = jobLauncher.run(job, jobParameters);
return execution;
}
}