BATCH-273: JobConfiguration renamed to Job
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<p>
|
||||
Interfaces and generic implementations of configuration concerns.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -13,21 +13,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
/**
|
||||
* Checked exception that indicates a name clash when registering
|
||||
* {@link JobConfiguration} instances.
|
||||
* {@link Job} instances.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class DuplicateJobConfigurationException extends JobConfigurationException {
|
||||
public class DuplicateJobException extends JobException {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public DuplicateJobConfigurationException(String msg) {
|
||||
public DuplicateJobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DuplicateJobConfigurationException extends JobConfigurationExceptio
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public DuplicateJobConfigurationException(String msg, Throwable e) {
|
||||
public DuplicateJobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -23,17 +23,17 @@ import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a job configuration. JobConfiguration is an
|
||||
* explicit abstraction representing the configuration of a job specified by a
|
||||
* developer. It should be noted that restart policy is applied to the job as a
|
||||
* whole and not to a step.
|
||||
* Batch domain object representing a job. Job is an explicit abstraction
|
||||
* representing the configuration of a job specified by a developer. It should
|
||||
* be noted that restart policy is applied to the job as a whole and not to a
|
||||
* step.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class JobConfiguration implements BeanNameAware {
|
||||
public class Job implements BeanNameAware {
|
||||
|
||||
private List stepConfigurations = new ArrayList();
|
||||
private List steps = new ArrayList();
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class JobConfiguration implements BeanNameAware {
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public JobConfiguration() {
|
||||
public Job() {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class JobConfiguration implements BeanNameAware {
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public JobConfiguration(String name) {
|
||||
public Job(String name) {
|
||||
super();
|
||||
this.name = name;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class JobConfiguration implements BeanNameAware {
|
||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
||||
*/
|
||||
public void setBeanName(String name) {
|
||||
if (this.name==null) {
|
||||
if (this.name == null) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -88,17 +88,17 @@ public class JobConfiguration implements BeanNameAware {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List getStepConfigurations() {
|
||||
return stepConfigurations;
|
||||
public List getSteps() {
|
||||
return steps;
|
||||
}
|
||||
|
||||
public void setSteps(List stepConfigurations) {
|
||||
this.stepConfigurations.clear();
|
||||
this.stepConfigurations.addAll(stepConfigurations);
|
||||
public void setSteps(List steps) {
|
||||
this.steps.clear();
|
||||
this.steps.addAll(steps);
|
||||
}
|
||||
|
||||
public void addStep(StepConfiguration stepConfiguration) {
|
||||
this.stepConfigurations.add(stepConfiguration);
|
||||
public void addStep(Step step) {
|
||||
this.steps.add(step);
|
||||
}
|
||||
|
||||
public int getStartLimit() {
|
||||
@@ -116,8 +116,8 @@ public class JobConfiguration implements BeanNameAware {
|
||||
public boolean isRestartable() {
|
||||
return restartable;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return ClassUtils.getShortName(JobConfiguration.class) + ": [name="+name+"]";
|
||||
return ClassUtils.getShortName(Job.class) + ": [name=" + name + "]";
|
||||
}
|
||||
}
|
||||
@@ -13,21 +13,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
/**
|
||||
* Base class for checked exceptions related to {@link JobConfiguration}
|
||||
* Base class for checked exceptions related to {@link Job}
|
||||
* creation, registration or use.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobConfigurationException extends Exception {
|
||||
public class JobException extends Exception {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public JobConfigurationException(String msg) {
|
||||
public JobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class JobConfigurationException extends Exception {
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public JobConfigurationException(String msg, Throwable e) {
|
||||
public JobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*/
|
||||
public class JobInstance extends Entity {
|
||||
|
||||
private List steps = new ArrayList();
|
||||
private List stepInstances = new ArrayList();
|
||||
|
||||
private JobIdentifier identifier;
|
||||
|
||||
@@ -65,16 +65,16 @@ public class JobInstance extends Entity {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List getSteps() {
|
||||
return steps;
|
||||
public List getStepInstances() {
|
||||
return stepInstances;
|
||||
}
|
||||
|
||||
public void setSteps(List steps) {
|
||||
this.steps = steps;
|
||||
public void setStepInstances(List stepInstances) {
|
||||
this.stepInstances = stepInstances;
|
||||
}
|
||||
|
||||
public void addStep(StepInstance step) {
|
||||
this.steps.add(step);
|
||||
public void addStepInstance(StepInstance stepInstance) {
|
||||
this.stepInstances.add(stepInstance);
|
||||
}
|
||||
|
||||
public int getJobExecutionCount() {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
/**
|
||||
* A runtime service locator interface for retrieving job configurations by
|
||||
@@ -22,17 +22,17 @@ package org.springframework.batch.core.configuration;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobConfigurationLocator {
|
||||
public interface JobLocator {
|
||||
|
||||
/**
|
||||
* Locates a {@link JobConfiguration} at runtime.
|
||||
* Locates a {@link Job} at runtime.
|
||||
*
|
||||
* @param name the name of the {@link JobConfiguration} which should be
|
||||
* @param name the name of the {@link Job} which should be
|
||||
* unique
|
||||
* @return a {@link JobConfiguration} identified by the given name
|
||||
* @return a {@link Job} identified by the given name
|
||||
*
|
||||
* @throws NoSuchJobConfigurationException if the required configuratio can
|
||||
* @throws NoSuchJobException if the required configuratio can
|
||||
* not be found.
|
||||
*/
|
||||
JobConfiguration getJobConfiguration(String name) throws NoSuchJobConfigurationException;
|
||||
Job getJob(String name) throws NoSuchJobException;
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
/**
|
||||
* A runtime service registry interface for registering job configurations by
|
||||
@@ -22,23 +22,23 @@ package org.springframework.batch.core.configuration;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobConfigurationRegistry extends JobConfigurationLocator {
|
||||
public interface JobRegistry extends JobLocator {
|
||||
|
||||
/**
|
||||
* Registers a {@link JobConfiguration} at runtime.
|
||||
* Registers a {@link Job} at runtime.
|
||||
*
|
||||
* @param jobConfiguration the {@link JobConfiguration} to be registered
|
||||
* @param jobConfiguration the {@link Job} to be registered
|
||||
*
|
||||
* @throws DuplicateJobConfigurationException if a configuration with the
|
||||
* @throws DuplicateJobException if a configuration with the
|
||||
* same name has already been registered.
|
||||
*/
|
||||
void register(JobConfiguration jobConfiguration) throws DuplicateJobConfigurationException;
|
||||
void register(Job jobConfiguration) throws DuplicateJobException;
|
||||
|
||||
/**
|
||||
* Unregisters a previously registered {@link JobConfiguration}. If it was
|
||||
* Unregisters a previously registered {@link Job}. If it was
|
||||
* not previously registered there is no error.
|
||||
*
|
||||
* @param jobConfiguration the {@link JobConfiguration} to unregister.
|
||||
* @param jobConfiguration the {@link Job} to unregister.
|
||||
*/
|
||||
void unregister(JobConfiguration jobConfiguration);
|
||||
void unregister(Job jobConfiguration);
|
||||
}
|
||||
@@ -13,23 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A listable extension of {@link JobConfigurationRegistry}.
|
||||
* A listable extension of {@link JobRegistry}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface ListableJobConfigurationRegistry extends JobConfigurationRegistry {
|
||||
public interface ListableJobRegistry extends JobRegistry {
|
||||
|
||||
/**
|
||||
* Provides the currently registered configurations. The return value is
|
||||
* unmodifiable and disconnected from the underlying registry storage.
|
||||
*
|
||||
* @return a collection of {@link JobConfiguration} instances. Empty if none
|
||||
* @return a collection of {@link Job} instances. Empty if none
|
||||
* are registered.
|
||||
*/
|
||||
Collection getJobConfigurations();
|
||||
@@ -13,22 +13,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
|
||||
/**
|
||||
* Checked exception to indicate that a required {@link JobConfiguration} is not
|
||||
* Checked exception to indicate that a required {@link Job} is not
|
||||
* available.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchJobConfigurationException extends JobConfigurationException {
|
||||
public class NoSuchJobException extends JobException {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public NoSuchJobConfigurationException(String msg) {
|
||||
public NoSuchJobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class NoSuchJobConfigurationException extends JobConfigurationException {
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public NoSuchJobConfigurationException(String msg, Throwable e) {
|
||||
public NoSuchJobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the
|
||||
* (@link JobConfiguration), step configuration is meant to explicitly represent
|
||||
* (@link Job), step configuration is meant to explicitly represent
|
||||
* a the configuration of a step by a developer. This allows for the separation
|
||||
* of what a developer configures from the myriad of concerns required for
|
||||
* executing a job.
|
||||
@@ -27,7 +27,7 @@ import org.springframework.batch.core.tasklet.Tasklet;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface StepConfiguration {
|
||||
public interface Step {
|
||||
|
||||
/**
|
||||
* @return the name of this step configuration.
|
||||
@@ -13,19 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
* Basic no-op support implementation for use as base class for
|
||||
* {@link StepConfiguration}.
|
||||
* {@link Step}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class StepConfigurationSupport implements StepConfiguration,
|
||||
public class StepSupport implements Step,
|
||||
BeanNameAware {
|
||||
|
||||
private String name;
|
||||
@@ -35,16 +35,16 @@ public class StepConfigurationSupport implements StepConfiguration,
|
||||
private boolean saveRestartData = false;
|
||||
|
||||
/**
|
||||
* Default constructor for {@link StepConfigurationSupport}.
|
||||
* Default constructor for {@link StepSupport}.
|
||||
*/
|
||||
public StepConfigurationSupport() {
|
||||
public StepSupport() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public StepConfigurationSupport(String string) {
|
||||
public StepSupport(String string) {
|
||||
super();
|
||||
this.name = string;
|
||||
}
|
||||
@@ -16,21 +16,21 @@
|
||||
|
||||
package org.springframework.batch.core.executor;
|
||||
|
||||
import org.springframework.batch.core.configuration.JobConfiguration;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Interface for running a job from its configuration.
|
||||
* Interface for running a job.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
* @see JobConfiguration
|
||||
* @see Job
|
||||
* @see JobExecution
|
||||
*/
|
||||
public interface JobExecutor {
|
||||
|
||||
public ExitStatus run(JobConfiguration configuration, JobExecution execution) throws BatchCriticalException;
|
||||
public ExitStatus run(Job job, JobExecution execution) throws BatchCriticalException;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.core.executor;
|
||||
|
||||
import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
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;
|
||||
@@ -25,7 +25,7 @@ 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 configuration should be treated as
|
||||
* 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
|
||||
@@ -39,13 +39,13 @@ import org.springframework.batch.repeat.ExitStatus;
|
||||
public interface StepExecutor {
|
||||
|
||||
/**
|
||||
* Process the step according to the given configuration. Implementations
|
||||
* 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 configuration. Thus it is not
|
||||
* 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 configuration
|
||||
* @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
|
||||
@@ -59,7 +59,7 @@ public interface StepExecutor {
|
||||
* if there is a problem that needs to be signalled to the
|
||||
* caller
|
||||
*/
|
||||
ExitStatus process(StepConfiguration configuration,
|
||||
ExitStatus process(Step step,
|
||||
StepExecution stepExecution) throws StepInterruptedException,
|
||||
BatchCriticalException;
|
||||
|
||||
@@ -69,5 +69,5 @@ public interface StepExecutor {
|
||||
*
|
||||
* @param configuration
|
||||
*/
|
||||
void applyConfiguration(StepConfiguration configuration);
|
||||
void applyConfiguration(Step configuration);
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package org.springframework.batch.core.executor;
|
||||
|
||||
import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
import org.springframework.batch.core.domain.Step;
|
||||
|
||||
/**
|
||||
* Factory interface for creating or locating {@link StepExecutor} instances.
|
||||
* 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}. The factory is responsible for ensuring that
|
||||
* the returned instance is appropriate for the configuration supplied. If the
|
||||
* the returned instance is appropriate for the step supplied. If the
|
||||
* {@link StepExecutor} instance is stateful (which is normal) the factory
|
||||
* should return a different instance for each call.
|
||||
*
|
||||
@@ -32,13 +32,13 @@ import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
public interface StepExecutorFactory {
|
||||
|
||||
/**
|
||||
* Use the configuration given to create or locate a suitable
|
||||
* Use the step given to create or locate a suitable
|
||||
* {@link StepExecutor}.
|
||||
*
|
||||
* @param configuration a {@link StepConfiguration} instance.
|
||||
* @param step a {@link Step} instance.
|
||||
* @return a {@link StepExecutor} that can be used to execute a step with
|
||||
* the given configuration
|
||||
* the given step
|
||||
*/
|
||||
StepExecutor getExecutor(StepConfiguration configuration);
|
||||
StepExecutor getExecutor(Step step);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.core.repository;
|
||||
|
||||
import org.springframework.batch.core.configuration.JobConfiguration;
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
@@ -65,7 +65,7 @@ public interface JobRepository {
|
||||
* job instance that would otherwise be returned
|
||||
*
|
||||
*/
|
||||
public JobExecution findOrCreateJob(JobConfiguration jobConfiguration,
|
||||
public JobExecution findOrCreateJob(Job job,
|
||||
JobIdentifier jobIdentifier)
|
||||
throws JobExecutionAlreadyRunningException;
|
||||
|
||||
@@ -78,7 +78,7 @@ public interface JobRepository {
|
||||
* @param job
|
||||
* @see JobInstance
|
||||
*/
|
||||
public void update(JobInstance job);
|
||||
public void update(JobInstance jobInstance);
|
||||
|
||||
/**
|
||||
* Save or Update a {@link JobExecution}. If no ID is found a new instance
|
||||
@@ -104,7 +104,7 @@ public interface JobRepository {
|
||||
* @param step
|
||||
* @see StepInstance
|
||||
*/
|
||||
public void update(StepInstance step);
|
||||
public void update(StepInstance stepInstance);
|
||||
|
||||
/**
|
||||
* Save or Update a StepExecution. If no ID is found a new instance will be
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.batch.core.runtime;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
/**
|
||||
* A factory for {@link JobIdentifier} instances. A job configuration can be
|
||||
* A factory for {@link JobIdentifier} instances. A job can be
|
||||
* executed with many possible runtime parameters, which identify the instance
|
||||
* of the job. This factory allows job identifiers to be created with different
|
||||
* properties according to the {@link JobIdentifier} strategy required. For
|
||||
@@ -37,7 +37,7 @@ public interface JobIdentifierFactory {
|
||||
* Get a new {@link JobIdentifier} instance.
|
||||
*
|
||||
* @param name
|
||||
* the name of the job configuration.
|
||||
* the name of the job.
|
||||
* @return a {@link JobIdentifier} with the same name.
|
||||
*/
|
||||
public JobIdentifier getJobIdentifier(String name);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.core.tasklet;
|
||||
|
||||
import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
import org.springframework.batch.core.domain.Step;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ import org.springframework.batch.repeat.ExitStatus;
|
||||
* of this interface useful for differentiating different batch job types, or
|
||||
* for creating more flexibility within their batch jobs.
|
||||
*
|
||||
* @see StepConfiguration
|
||||
* @see Step
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user