BATCH-220: Half way to rename StepHandler -> Tasklet
This commit is contained in:
@@ -22,7 +22,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.listener.MulticasterBatchListener;
|
||||
import org.springframework.batch.core.step.handler.StepHandler;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandler;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
@@ -114,7 +114,7 @@ public class ItemOrientedStepHandler<T, S> implements StepHandler {
|
||||
* {@link ItemProcessor} returns null, the write is omitted and another item
|
||||
* taken from the reader.
|
||||
*
|
||||
* @see org.springframework.batch.core.step.handler.StepHandler#handle(org.springframework.batch.core.StepContribution,
|
||||
* @see org.springframework.batch.core.step.tasklet.StepHandler#handle(org.springframework.batch.core.StepContribution,
|
||||
* AttributeAccessor)
|
||||
*/
|
||||
public ExitStatus handle(final StepContribution contribution, AttributeAccessor attributes) throws Exception {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.step.handler.StepHandlerStep;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandlerStep;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
|
||||
@@ -9,11 +9,11 @@ import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.SkipListener;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.step.handler.StepHandlerStep;
|
||||
import org.springframework.batch.core.step.skip.ItemSkipPolicy;
|
||||
import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy;
|
||||
import org.springframework.batch.core.step.skip.SkipLimitExceededException;
|
||||
import org.springframework.batch.core.step.skip.SkipListenerFailedException;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandlerStep;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.core.AttributeAccessorSupport;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.step.AbstractStep;
|
||||
import org.springframework.batch.core.step.StepExecutionSynchronizer;
|
||||
@@ -82,6 +83,13 @@ public class StepHandlerStep extends AbstractStep {
|
||||
|
||||
private StepExecutionSynchronizer synchronizer;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public StepHandlerStep() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
@@ -114,6 +122,9 @@ public class StepHandlerStep extends AbstractStep {
|
||||
*/
|
||||
public void setStepHandler(StepHandler stepHandler) {
|
||||
this.stepHandler = stepHandler;
|
||||
if (stepHandler instanceof StepExecutionListener) {
|
||||
registerStepExecutionListener((StepExecutionListener) stepHandler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,9 +206,9 @@ public class StepHandlerStep extends AbstractStep {
|
||||
* Process the step and update its context so that progress can be monitored
|
||||
* by the caller. The step is broken down into chunks, each one executing in
|
||||
* a transaction. The step and its execution and execution context are all
|
||||
* given an up to date {@link BatchStatus}, and the {@link JobRepository} is
|
||||
* used to store the result. Various reporting information are also added to
|
||||
* the current context (the {@link RepeatContext} governing the step
|
||||
* given an up to date {@link BatchStatus}, and the {@link JobRepository}
|
||||
* is used to store the result. Various reporting information are also added
|
||||
* to the current context (the {@link RepeatContext} governing the step
|
||||
* execution, which would normally be available to the caller somehow
|
||||
* through the step's {@link ExecutionContext}.<br/>
|
||||
*
|
||||
@@ -369,8 +380,8 @@ public class StepHandlerStep extends AbstractStep {
|
||||
}
|
||||
catch (Exception e) {
|
||||
/*
|
||||
* If we already failed to commit, it doesn't help to do this again
|
||||
* - it's better to allow the CommitFailedException to propagate
|
||||
* If we already failed to commit, it doesn't help to do this again -
|
||||
* it's better to allow the CommitFailedException to propagate
|
||||
*/
|
||||
if (!fatalException.hasException()) {
|
||||
fatalException.setException(e);
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
/**
|
||||
* Exception indicating failed execution of system command.
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.batch.core.step.handler.SystemCommandStepHandler;
|
||||
import org.springframework.batch.core.step.tasklet.SystemCommandStepHandler;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
@@ -28,10 +28,10 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.step.handler.BasicAttributeAccessor;
|
||||
import org.springframework.batch.core.step.item.SkipLimitStepFactoryBean.StatefulRetryStepHandler;
|
||||
import org.springframework.batch.core.step.skip.ItemSkipPolicy;
|
||||
import org.springframework.batch.core.step.skip.SkipLimitExceededException;
|
||||
import org.springframework.batch.core.step.tasklet.BasicAttributeAccessor;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
@@ -21,6 +21,7 @@ import static org.junit.Assert.fail;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.step.tasklet.CallableStepHandlerAdapter;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
public class CallableStepHandlerAdapterTests {
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.fail;
|
||||
@@ -7,7 +7,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.step.handler.ConfigurableSystemProcessExitCodeMapper;
|
||||
import org.springframework.batch.core.step.tasklet.ConfigurableSystemProcessExitCodeMapper;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.batch.core.step.handler.StepHandler;
|
||||
import org.springframework.batch.core.step.item.ItemOrientedStepHandler;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandler;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.PassthroughItemProcessor;
|
||||
@@ -1,8 +1,9 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.step.tasklet.SimpleSystemProcessExitCodeMapper;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.batch.core.repository.dao.MapJobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.SimpleJobRepository;
|
||||
import org.springframework.batch.core.step.StepExecutionSynchronizer;
|
||||
import org.springframework.batch.core.step.handler.StepHandlerStep;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandlerStep;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
|
||||
@@ -13,12 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandlerAdapter;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -39,7 +39,7 @@ import org.springframework.batch.core.repository.dao.MapJobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.MapJobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.handler.StepHandlerStep;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandlerStep;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -47,7 +47,7 @@ import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.SimpleJobRepository;
|
||||
import org.springframework.batch.core.step.JobRepositorySupport;
|
||||
import org.springframework.batch.core.step.StepInterruptionPolicy;
|
||||
import org.springframework.batch.core.step.handler.StepHandlerStep;
|
||||
import org.springframework.batch.core.step.tasklet.StepHandlerStep;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.core.step.handler;
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -15,6 +15,9 @@ import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.step.tasklet.SystemCommandException;
|
||||
import org.springframework.batch.core.step.tasklet.SystemCommandStepHandler;
|
||||
import org.springframework.batch.core.step.tasklet.SystemProcessExitCodeMapper;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
Reference in New Issue
Block a user