/*
* Copyright 2006-2011 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.admin.sample;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
/**
* Workaround for BATCH-1692, BATCH-1693.
*
* @author Dave Syer
*
*/
public class RemoteStep implements Step {
private Step step;
private String name;
private int startLimit = Integer.MAX_VALUE;
private boolean allowStartIfComplete = false;
/**
* Set the name property.
*
* @param name {@link org.springframework.batch.core.Step#getName()}
*
*/
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
@Override
public int getStartLimit() {
return this.startLimit;
}
/**
* Public setter for the startLimit.
*
* @param startLimit the startLimit to set
*/
public void setStartLimit(int startLimit) {
this.startLimit = startLimit;
}
@Override
public boolean isAllowStartIfComplete() {
return this.allowStartIfComplete;
}
/**
* Public setter for flag that determines whether the step should start
* again if it is already complete. Defaults to false.
*
* @param allowStartIfComplete the value of the flag to set
*/
public void setAllowStartIfComplete(boolean allowStartIfComplete) {
this.allowStartIfComplete = allowStartIfComplete;
}
/**
* @param delegate the delegate to set
*/
public void setStep(Step delegate) {
this.step = delegate;
}
@Override
public void execute(StepExecution stepExecution) throws JobInterruptedException {
step.execute(stepExecution);
}
}