OPEN - issue BATCH-324: Step as factory for StepExecutor

http://jira.springframework.org/browse/BATCH-324

Substantial re-org of core domain packages to align concerns
This commit is contained in:
dsyer
2008-01-29 16:36:16 +00:00
parent d4d09d2ad8
commit f9619e345e
57 changed files with 333 additions and 384 deletions

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2006-2008 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.domain;
/**
* Checked exception indicating that an Incorrect number of jobs has
* been found.
*
* @author Lucas Ward
*
*/
public class IncorrectJobCountException extends JobException {
public IncorrectJobCountException(String msg) {
super(msg);
}
public IncorrectJobCountException(String msg, Throwable e) {
super(msg, e);
}
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.executor;
package org.springframework.batch.core.domain;
/**
* @author Dave Syer

View File

@@ -14,10 +14,8 @@
* limitations under the License.
*/
package org.springframework.batch.core.executor;
package org.springframework.batch.core.domain;
import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.repeat.ExitStatus;

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.batch.core.domain;
import org.springframework.batch.core.executor.StepExecutor;
/**
* Batch domain interface representing the configuration of a step. As with the

View File

@@ -0,0 +1,50 @@
/*
* 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.domain;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.repeat.ExitStatus;
/**
* Interface for processing a step. Implementations are free to process the step
* and return when finished, or to schedule the step for processing
* concurrently, or in the future. The status of the execution should be
* trackable with the step execution. The step should be treated as immutable.<br/>
*
* Because step execution parameters and policies can vary from step to step, a
* {@link StepExecutor} should be created by the caller using a {@link Step}.
*
* @author Lucas Ward
* @author Dave Syer
*
*/
public interface StepExecutor {
/**
* It is not safe to re-use an instance of {@link StepExecutor} to process
* multiple concurrent executions. Use the factory method in {@link Step} to
* create a new instance and execute that.
*
* @param stepExecution an entity representing the step to be executed
*
* @throws StepInterruptedException if the step is interrupted externally
* @throws BatchCriticalException if there is a problem that needs to be
* signalled to the caller
*/
ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException;
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.core.executor;
package org.springframework.batch.core.domain;
import org.springframework.batch.io.exception.BatchCriticalException;

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.batch.core.domain;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.beans.factory.BeanNameAware;
/**

View File

@@ -1,66 +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.executor;
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.repeat.ExitStatus;
/**
* Interface for processing a step. Implementations are free to process the step
* and return when finished, or to schedule the step for processing
* concurrently, or in the future. The status of the execution should be
* trackable with the step execution. The step should be treated as
* immutable.<br/>
*
* Because step execution parameters and policies can vary from step to step, a
* {@link StepExecutor} should be created by the caller using a
* {@link StepExecutorFactory}.
*
* @author Lucas Ward
* @author Dave Syer
*
*/
public interface StepExecutor {
/**
* Process the step according to the given step. Implementations
* can be expected to modify their state when this method is called, to take
* account of any policy information in the step. Thus it is not
* safe to re-use an instance of {@link StepExecutor} to process multiple
* concurrent executions.
*
* @param step
* the configuration to use when running the step. Contains a
* recipe for the business logic of an individual processing
* operation. Also used to determine policies for commit
* intervals and exception handling, for instance.
*
* @param stepExecution
* an entity representing the step to be executed
* @throws StepInterruptedException
* if the step is interrupted externally
* @throws BatchCriticalException
* if there is a problem that needs to be signalled to the
* caller
*/
ExitStatus process(Step step,
StepExecution stepExecution) throws StepInterruptedException,
BatchCriticalException;
}

View File

@@ -1,7 +0,0 @@
<html>
<body>
<p>
Interfaces and generic implementations of executor concerns.
</p>
</body>
</html>

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core.repository;
import org.springframework.batch.core.domain.Job;
/**
* Checked exception that indicates a name clash when registering

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core.repository;
import org.springframework.batch.core.domain.Job;
/**
* Base class for checked exceptions related to {@link Job}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.batch.core.repository;
import org.springframework.batch.core.executor.JobExecutionException;
import org.springframework.batch.core.domain.JobExecutionException;
/**
* @author Dave Syer

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core.repository;
import org.springframework.batch.core.domain.Job;
/**
* A runtime service locator interface for retrieving job configurations by

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core.repository;
import org.springframework.batch.core.domain.Job;
/**
* A runtime service registry interface for registering job configurations by

View File

@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core.repository;
import java.util.Collection;
import org.springframework.batch.core.domain.Job;
/**
* A listable extension of {@link JobRegistry}.
*

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core.repository;
import org.springframework.batch.core.domain.Job;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.executor;
package org.springframework.batch.core.runtime;
import org.springframework.batch.common.ExceptionClassifier;
import org.springframework.batch.repeat.ExitStatus;