| 1 | /* |
| 2 | * Copyright 2006-2008 the original author or authors. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.springframework.batch.core.listener; |
| 17 | |
| 18 | import org.springframework.batch.core.StepListener; |
| 19 | import org.springframework.batch.core.ChunkListener; |
| 20 | import org.springframework.batch.core.ItemReadListener; |
| 21 | import org.springframework.batch.core.ItemWriteListener; |
| 22 | import org.springframework.batch.core.StepExecution; |
| 23 | import org.springframework.batch.core.StepExecutionListener; |
| 24 | import org.springframework.batch.repeat.ExitStatus; |
| 25 | |
| 26 | /** |
| 27 | * Basic no-op implementations of all {@link StepListener} implementations. |
| 28 | * |
| 29 | * @author Lucas Ward |
| 30 | * |
| 31 | */ |
| 32 | public class StepListenerSupport implements StepExecutionListener, ChunkListener, |
| 33 | ItemReadListener, ItemWriteListener { |
| 34 | |
| 35 | /* (non-Javadoc) |
| 36 | * @see org.springframework.batch.core.domain.StepListener#afterStep(StepExecution stepExecution) |
| 37 | */ |
| 38 | public ExitStatus afterStep(StepExecution stepExecution) { |
| 39 | return null; |
| 40 | } |
| 41 | |
| 42 | /* (non-Javadoc) |
| 43 | * @see org.springframework.batch.core.domain.StepListener#beforeStep(org.springframework.batch.core.domain.StepExecution) |
| 44 | */ |
| 45 | public void beforeStep(StepExecution stepExecution) { |
| 46 | } |
| 47 | |
| 48 | /* (non-Javadoc) |
| 49 | * @see org.springframework.batch.core.domain.StepListener#onErrorInStep(java.lang.Throwable) |
| 50 | */ |
| 51 | public ExitStatus onErrorInStep(StepExecution stepExecution, Throwable e) { |
| 52 | return null; |
| 53 | } |
| 54 | |
| 55 | /* (non-Javadoc) |
| 56 | * @see org.springframework.batch.core.domain.ChunkListener#afterChunk() |
| 57 | */ |
| 58 | public void afterChunk() { |
| 59 | } |
| 60 | |
| 61 | /* (non-Javadoc) |
| 62 | * @see org.springframework.batch.core.domain.ChunkListener#beforeChunk() |
| 63 | */ |
| 64 | public void beforeChunk() { |
| 65 | } |
| 66 | |
| 67 | /* (non-Javadoc) |
| 68 | * @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object) |
| 69 | */ |
| 70 | public void afterRead(Object item) { |
| 71 | } |
| 72 | |
| 73 | /* (non-Javadoc) |
| 74 | * @see org.springframework.batch.core.domain.ItemReadListener#beforeRead() |
| 75 | */ |
| 76 | public void beforeRead() { |
| 77 | } |
| 78 | |
| 79 | /* (non-Javadoc) |
| 80 | * @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception) |
| 81 | */ |
| 82 | public void onReadError(Exception ex) { |
| 83 | } |
| 84 | |
| 85 | /* (non-Javadoc) |
| 86 | * @see org.springframework.batch.core.domain.ItemWriteListener#afterWrite() |
| 87 | */ |
| 88 | public void afterWrite(Object item) { |
| 89 | } |
| 90 | |
| 91 | /* (non-Javadoc) |
| 92 | * @see org.springframework.batch.core.domain.ItemWriteListener#beforeWrite(java.lang.Object) |
| 93 | */ |
| 94 | public void beforeWrite(Object item) { |
| 95 | } |
| 96 | |
| 97 | /* (non-Javadoc) |
| 98 | * @see org.springframework.batch.core.domain.ItemWriteListener#onWriteError(java.lang.Exception, java.lang.Object) |
| 99 | */ |
| 100 | public void onWriteError(Exception ex, Object item) { |
| 101 | } |
| 102 | |
| 103 | } |