RESOLVED - issue BATCH-158: Dependency cycle between execution.step and execution.step.simple
http://opensource.atlassian.com/projects/spring/browse/BATCH-158 StepConfiguration had to pick up an extra flag in the interface, and the configuration implementations had to be separate from the executor implementations. Also fixed a cycle in core (JobIdentifier is part of domain).
This commit is contained in:
@@ -40,10 +40,16 @@ public interface StepConfiguration {
|
||||
Tasklet getTasklet();
|
||||
|
||||
/**
|
||||
* @return true if a job that is already marked as complete can be started
|
||||
* @return true if a step that is already marked as complete can be started
|
||||
* again.
|
||||
*/
|
||||
boolean isAllowStartIfComplete();
|
||||
|
||||
/**
|
||||
* Flag to indicate if restart data needs to be saved for this step.
|
||||
* @return true if restart data should be saved
|
||||
*/
|
||||
boolean isSaveRestartData();
|
||||
|
||||
/**
|
||||
* @return the number of times a job can be started with the same
|
||||
|
||||
@@ -30,6 +30,7 @@ public class StepConfigurationSupport implements StepConfiguration {
|
||||
private int startLimit = Integer.MAX_VALUE;
|
||||
private Tasklet tasklet;
|
||||
private boolean allowStartIfComplete;
|
||||
private boolean saveRestartData = false;
|
||||
|
||||
/**
|
||||
* Default constructor for {@link StepConfigurationSupport}.
|
||||
@@ -114,4 +115,12 @@ public class StepConfigurationSupport implements StepConfiguration {
|
||||
this.allowStartIfComplete = allowStartIfComplete;
|
||||
}
|
||||
|
||||
public void setSaveRestartData(boolean saveRestartData) {
|
||||
this.saveRestartData = saveRestartData;
|
||||
}
|
||||
|
||||
public boolean isSaveRestartData() {
|
||||
return saveRestartData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.sql.Timestamp;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
/**
|
||||
* Identifier strategy for {@link JobInstance}. Different batch projects can
|
||||
* have different approaches and requirements regarding the identity of a job.
|
||||
* The minimum requirement is to provide a unique name to identify a job. Other
|
||||
* applications or projects might add other properties like a schedule date, or
|
||||
* an additional label (code).
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobIdentifier {
|
||||
|
||||
/**
|
||||
* A name property for jobs provided by the {@link JobIdentifier} strategy.
|
||||
*
|
||||
* @return the name of the job
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
}
|
||||
@@ -19,7 +19,6 @@ package org.springframework.batch.core.domain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a job instance. A job instance is defined as
|
||||
|
||||
@@ -18,10 +18,10 @@ package org.springframework.batch.core.repository;
|
||||
|
||||
import org.springframework.batch.core.configuration.JobConfiguration;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepInstance;
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.batch.core.runtime;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
/**
|
||||
* A factory for {@link JobIdentifier} instances. A job configuration can be
|
||||
* executed with many possible runtime parameters, which identify the instance
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
|
||||
/**
|
||||
* Factory for {@link SimpleJobIdentifier} instances.
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.batch.core.domain;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SimpleJobIdentifierFactoryTests extends TestCase {
|
||||
|
||||
Reference in New Issue
Block a user