Tidy up some exception class names
This commit is contained in:
@@ -17,7 +17,7 @@ package org.springframework.batch.core.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a job. Job is an explicit abstraction
|
||||
@@ -43,8 +43,8 @@ public interface Job {
|
||||
* and statistics as necessary.
|
||||
*
|
||||
* @param execution a {@link JobExecution}
|
||||
* @throws BatchCriticalException
|
||||
* @throws InfrastructureException
|
||||
*/
|
||||
void execute(JobExecution execution) throws BatchCriticalException;
|
||||
void execute(JobExecution execution) throws InfrastructureException;
|
||||
|
||||
}
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
|
||||
/**
|
||||
* Exception to indicate the the job has been interrupted. The exception state
|
||||
* indicated is not normally recoverable by batch application clients, but
|
||||
* internally it is useful to force a check. The exception will often be wrapped
|
||||
* in a runtime exception (usually {@link BatchCriticalException} before
|
||||
* in a runtime exception (usually {@link InfrastructureException} before
|
||||
* reaching the client.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the
|
||||
@@ -57,9 +57,9 @@ public interface Step {
|
||||
* @param stepExecution an entity representing the step to be executed
|
||||
*
|
||||
* @throws JobInterruptedException if the step is interrupted externally
|
||||
* @throws BatchCriticalException if there is a problem that needs to be
|
||||
* @throws InfrastructureException if there is a problem that needs to be
|
||||
* signalled to the caller
|
||||
*/
|
||||
void execute(StepExecution stepExecution) throws JobInterruptedException, BatchCriticalException;
|
||||
void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException;
|
||||
|
||||
}
|
||||
@@ -61,10 +61,12 @@ public interface JobRepository {
|
||||
* @throws JobExecutionAlreadyRunningException if there is a
|
||||
* {@link JobExecution} alrady running for the job instance that would
|
||||
* otherwise be returned
|
||||
* @throws JobRestartException if more than one JobInstance if found or if
|
||||
* JobInstance.getJobExecutionCount() is greater than Job.getStartLimit()
|
||||
*
|
||||
*/
|
||||
public JobExecution createJobExecution(Job job, JobParameters jobParameters)
|
||||
throws JobExecutionAlreadyRunningException;
|
||||
throws JobExecutionAlreadyRunningException, JobRestartException;
|
||||
|
||||
/**
|
||||
* Save or Update a {@link JobExecution}. If no ID is found a new instance
|
||||
|
||||
@@ -15,18 +15,18 @@
|
||||
*/
|
||||
package org.springframework.batch.core.repository;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
|
||||
/**
|
||||
* An exception indicating an illegal attempt to restart a job.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class BatchRestartException extends BatchCriticalException {
|
||||
public class JobRestartException extends JobException {
|
||||
|
||||
/**
|
||||
* @param string the message
|
||||
*/
|
||||
public BatchRestartException(String string) {
|
||||
public JobRestartException(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class BatchRestartException extends BatchCriticalException {
|
||||
* @param msg the cause
|
||||
* @param t the message
|
||||
*/
|
||||
public BatchRestartException(String msg, Throwable t) {
|
||||
public JobRestartException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.core.repository;
|
||||
|
||||
/**
|
||||
* This exception identifies that a batch domain object is invalid, which
|
||||
* is generally caused by an invalid ID. (An ID which doesn't exist in the database).
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchBatchDomainObjectException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 4399621765157283111L;
|
||||
|
||||
public NoSuchBatchDomainObjectException(String message){
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.Step;
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class JobSupport implements BeanNameAware, Job {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution)
|
||||
*/
|
||||
public void execute(JobExecution execution) throws BatchCriticalException {
|
||||
public void execute(JobExecution execution) throws InfrastructureException {
|
||||
throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass.");
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.core.domain;
|
||||
import org.springframework.batch.core.domain.JobInterruptedException;
|
||||
import org.springframework.batch.core.domain.Step;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ public class StepSupport implements Step, BeanNameAware {
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.Step#execute(org.springframework.batch.core.domain.StepExecution)
|
||||
*/
|
||||
public void execute(StepExecution stepExecution) throws JobInterruptedException, BatchCriticalException {
|
||||
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot process a StepExecution. Use a smarter subclass of StepSupport.");
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ import org.springframework.batch.core.AbstractExceptionTests;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class BatchRestartExceptionTests extends AbstractExceptionTests {
|
||||
public class JobRestartExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new BatchRestartException(msg);
|
||||
return new JobRestartException(msg);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -37,7 +37,7 @@ public class BatchRestartExceptionTests extends AbstractExceptionTests {
|
||||
* java.lang.Throwable)
|
||||
*/
|
||||
public Exception getException(String msg, Throwable t) throws Exception {
|
||||
return new BatchRestartException(msg, t);
|
||||
return new JobRestartException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.repository;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchBatchDomainObjectExceptionTests extends TestCase {
|
||||
|
||||
public void testCreateException() throws Exception {
|
||||
NoSuchBatchDomainObjectException e = new NoSuchBatchDomainObjectException("Foo");
|
||||
assertEquals("Foo", e.getMessage());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user