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:
@@ -24,16 +24,15 @@ import java.util.Properties;
|
||||
import org.springframework.batch.core.configuration.JobConfiguration;
|
||||
import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
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.repository.BatchRestartException;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
import org.springframework.batch.execution.repository.dao.JobDao;
|
||||
import org.springframework.batch.execution.repository.dao.StepDao;
|
||||
import org.springframework.batch.restart.GenericRestartData;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -117,8 +116,8 @@ public class SimpleJobRepository implements JobRepository {
|
||||
}
|
||||
else {
|
||||
// More than one job found, throw exception
|
||||
throw new IncorrectResultSizeDataAccessException("Error restarting job, more than one JobInstance found for: "
|
||||
+ jobConfiguration.toString(), 1, jobs.size());
|
||||
throw new BatchRestartException("Error restarting job, more than one JobInstance found for: "
|
||||
+ jobConfiguration.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
import org.springframework.batch.execution.runtime.ScheduledJobIdentifier;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.batch.execution.repository.dao;
|
||||
import java.util.List;
|
||||
|
||||
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.runtime.JobIdentifier;
|
||||
|
||||
/**
|
||||
* Data Access Object for jobs.
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
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.runtime.JobIdentifier;
|
||||
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
|
||||
|
||||
public class MapJobDao implements JobDao {
|
||||
|
||||
@@ -22,9 +22,9 @@ import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.domain.BatchStatus;
|
||||
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.repository.NoSuchBatchDomainObjectException;
|
||||
import org.springframework.batch.core.runtime.JobIdentifier;
|
||||
import org.springframework.batch.execution.runtime.ScheduledJobIdentifier;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@@ -1,69 +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.execution.step.simple;
|
||||
|
||||
import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.batch.execution.step.RepeatOperationsHolder;
|
||||
import org.springframework.batch.repeat.RepeatOperations;
|
||||
|
||||
/**
|
||||
* {@link StepConfiguration} implementation that allows full configuration of
|
||||
* the {@link RepeatOperations} that will be used in the chunk (inner loop).
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ChunkOperationsStepConfiguration extends AbstractStepConfiguration implements RepeatOperationsHolder {
|
||||
|
||||
// default StepExecutor is null
|
||||
private RepeatOperations chunkOperations;
|
||||
|
||||
public ChunkOperationsStepConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ChunkOperationsStepConfiguration(RepeatOperations repeatOperations) {
|
||||
this();
|
||||
this.chunkOperations = repeatOperations;
|
||||
}
|
||||
|
||||
public ChunkOperationsStepConfiguration(Tasklet module) {
|
||||
this();
|
||||
setTasklet(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* Public accessor for the chunkOperations property.
|
||||
*
|
||||
* @return the executor
|
||||
*/
|
||||
public RepeatOperations getChunkOperations() {
|
||||
return chunkOperations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the chunkOperations.
|
||||
*
|
||||
* @param chunkOperations the repeatOperations to set
|
||||
*/
|
||||
public void setChunkOperations(RepeatOperations chunkOperations) {
|
||||
this.chunkOperations = chunkOperations;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +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.execution.step.simple;
|
||||
|
||||
import org.springframework.batch.core.configuration.StepConfiguration;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
|
||||
/**
|
||||
* Simple {@link StepConfiguration} good enough for most purposes and easy to
|
||||
* configure simple properties, principally the commit interval.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class SimpleStepConfiguration extends AbstractStepConfiguration {
|
||||
|
||||
// default commit interval is one
|
||||
private int commitInterval = 1;
|
||||
|
||||
public SimpleStepConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SimpleStepConfiguration(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public SimpleStepConfiguration(Tasklet module) {
|
||||
this();
|
||||
setTasklet(module);
|
||||
}
|
||||
|
||||
public void setCommitInterval(int commitInterval) {
|
||||
this.commitInterval = commitInterval;
|
||||
}
|
||||
|
||||
public int getCommitInterval() {
|
||||
return commitInterval;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user