BATCH-378:Moved and renamed packages for listeners, added support objects, and tests, and removed the ItemFailureHandler.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2006-2008 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;
|
||||
|
||||
/**
|
||||
* Marker interface that acts as a parent to all Batch
|
||||
* domain listeners, such as: {@link StepListener},
|
||||
* {@link ChunkListener}, {@link ItemReadListener} and
|
||||
* {@link ItemWriteListener}
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface BatchListener {
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ package org.springframework.batch.core.domain;
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface ChunkListener {
|
||||
public interface ChunkListener extends BatchListener {
|
||||
|
||||
void beforeChunk();
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2008 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;
|
||||
|
||||
/**
|
||||
* Interface for defining the contract to log out read and write
|
||||
* failures encountered during batch processing.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*/
|
||||
public interface ItemFailureHandler {
|
||||
|
||||
/**
|
||||
* Handle read failure. This will usually be done
|
||||
* by logging out the details of the exception to either a
|
||||
* file or database table. It is expected that any implementors of this
|
||||
* of this method will not throw an exception.
|
||||
*
|
||||
* @param ex
|
||||
*/
|
||||
void handleReadFailure(Exception ex);
|
||||
|
||||
/**
|
||||
* Handle read failure. This will usually be done
|
||||
* by logging out the details of the exception to either a
|
||||
* file or database table. It is expected that any implementors of this
|
||||
* of this method will not throw an exception.
|
||||
*
|
||||
* @param ex
|
||||
*/
|
||||
void handleWriteFailure(Object item, Exception ex);
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import org.springframework.batch.item.ItemWriter;
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface ItemReadListener {
|
||||
public interface ItemReadListener extends BatchListener {
|
||||
|
||||
/**
|
||||
* Called before {@link ItemReader#read()}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.batch.item.ItemWriter;
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface ItemWriteListener {
|
||||
public interface ItemWriteListener extends BatchListener {
|
||||
|
||||
/**
|
||||
* Called before {@link ItemWriter#write(Object)}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.batch.repeat.ExitStatus;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface StepListener {
|
||||
public interface StepListener extends BatchListener {
|
||||
|
||||
/**
|
||||
* Initialise the state of the listener with the {@link StepExecution} from
|
||||
|
||||
@@ -1,72 +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.core.interceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.domain.ChunkListener;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class CompositeChunkListener implements ChunkListener {
|
||||
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
*
|
||||
* @param listeners
|
||||
*/
|
||||
public void setListeners(ChunkListener[] listeners) {
|
||||
this.listeners = Arrays.asList(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional listener.
|
||||
*
|
||||
* @param stepListener
|
||||
*/
|
||||
public void register(ChunkListener chunkListener) {
|
||||
if (!listeners.contains(chunkListener)) {
|
||||
listeners.add(chunkListener);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#afterChunk()
|
||||
*/
|
||||
public void afterChunk() {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ChunkListener listener = (ChunkListener) iterator.next();
|
||||
listener.afterChunk();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#beforeChunk()
|
||||
*/
|
||||
public void beforeChunk() {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ChunkListener listener = (ChunkListener) iterator.next();
|
||||
listener.beforeChunk();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +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.core.interceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.domain.ChunkListener;
|
||||
import org.springframework.batch.core.domain.ItemReadListener;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class CompositeItemReadListener implements ItemReadListener {
|
||||
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
*
|
||||
* @param listeners
|
||||
*/
|
||||
public void setListeners(ChunkListener[] listeners) {
|
||||
this.listeners = Arrays.asList(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional listener.
|
||||
*
|
||||
* @param itemReaderListener
|
||||
*/
|
||||
public void register(ItemReadListener itemReaderListener) {
|
||||
if (!listeners.contains(itemReaderListener)) {
|
||||
listeners.add(itemReaderListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void afterRead(Object item) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemReadListener listener = (ItemReadListener) iterator.next();
|
||||
listener.afterRead(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void beforeRead() {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemReadListener listener = (ItemReadListener) iterator.next();
|
||||
listener.beforeRead();
|
||||
}
|
||||
}
|
||||
|
||||
public void onReadError(Exception ex) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemReadListener listener = (ItemReadListener) iterator.next();
|
||||
listener.onReadError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +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.core.interceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.domain.ChunkListener;
|
||||
import org.springframework.batch.core.domain.ItemReadListener;
|
||||
import org.springframework.batch.core.domain.ItemWriteListener;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class CompositeItemWriteListener implements ItemWriteListener {
|
||||
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
*
|
||||
* @param listeners
|
||||
*/
|
||||
public void setListeners(ChunkListener[] listeners) {
|
||||
this.listeners = Arrays.asList(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional listener.
|
||||
*
|
||||
* @param itemReaderListener
|
||||
*/
|
||||
public void register(ItemWriteListener itemReaderListener) {
|
||||
if (!listeners.contains(itemReaderListener)) {
|
||||
listeners.add(itemReaderListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void afterWrite() {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemWriteListener listener = (ItemWriteListener) iterator.next();
|
||||
listener.afterWrite();
|
||||
}
|
||||
}
|
||||
|
||||
public void beforeWrite(Object item) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemWriteListener listener = (ItemWriteListener) iterator.next();
|
||||
listener.beforeWrite(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void onWriteError(Exception ex, Object item) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemWriteListener listener = (ItemWriteListener) iterator.next();
|
||||
listener.onWriteError(ex, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +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.core.interceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobListener;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class CompositeJobListener implements JobListener {
|
||||
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
*
|
||||
* @param listeners
|
||||
*/
|
||||
public void setListeners(JobListener[] listeners) {
|
||||
this.listeners = Arrays.asList(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional listener.
|
||||
*
|
||||
* @param stepListener
|
||||
*/
|
||||
public void register(JobListener stepListener) {
|
||||
if (!listeners.contains(stepListener)) {
|
||||
listeners.add(stepListener);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#close()
|
||||
*/
|
||||
public void afterJob() {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
JobListener listener = (JobListener) iterator.next();
|
||||
listener.afterJob();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#open(org.springframework.batch.core.domain.JobParameters)
|
||||
*/
|
||||
public void beforeJob(JobExecution jobExecution) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
JobListener listener = (JobListener) iterator.next();
|
||||
listener.beforeJob(jobExecution);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,90 +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.core.interceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepListener;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class CompositeStepListener implements StepListener {
|
||||
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
*
|
||||
* @param listeners
|
||||
*/
|
||||
public void setListeners(StepListener[] listeners) {
|
||||
this.listeners = Arrays.asList(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional listener.
|
||||
*
|
||||
* @param stepListener
|
||||
*/
|
||||
public void register(StepListener stepListener) {
|
||||
if (!listeners.contains(stepListener)) {
|
||||
listeners.add(stepListener);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#close()
|
||||
*/
|
||||
public ExitStatus afterStep() {
|
||||
ExitStatus status = null;
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
StepListener listener = (StepListener) iterator.next();
|
||||
ExitStatus close = listener.afterStep();
|
||||
status = status!=null ? status.and(close): close;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#open(org.springframework.batch.core.domain.JobParameters)
|
||||
*/
|
||||
public void beforeStep(StepExecution stepExecution) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
StepListener listener = (StepListener) iterator.next();
|
||||
listener.beforeStep(stepExecution);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#onError(java.lang.Throwable)
|
||||
*/
|
||||
public ExitStatus onErrorInStep(Throwable e) {
|
||||
ExitStatus status = null;
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
StepListener listener = (StepListener) iterator.next();
|
||||
ExitStatus close = listener.onErrorInStep(e);
|
||||
status = status!=null ? status.and(close): close;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2006-2008 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.listener;
|
||||
|
||||
import org.springframework.batch.core.domain.BatchListener;
|
||||
import org.springframework.batch.core.domain.ChunkListener;
|
||||
import org.springframework.batch.core.domain.ItemReadListener;
|
||||
import org.springframework.batch.core.domain.ItemWriteListener;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepListener;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* Basic no-op implementations of all {@link BatchListener} implementations.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class BatchListenerSupport implements StepListener, ChunkListener,
|
||||
ItemReadListener, ItemWriteListener {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#afterStep()
|
||||
*/
|
||||
public ExitStatus afterStep() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#beforeStep(org.springframework.batch.core.domain.StepExecution)
|
||||
*/
|
||||
public void beforeStep(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#onErrorInStep(java.lang.Throwable)
|
||||
*/
|
||||
public ExitStatus onErrorInStep(Throwable e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#afterChunk()
|
||||
*/
|
||||
public void afterChunk() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#beforeChunk()
|
||||
*/
|
||||
public void beforeChunk() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
public void afterRead(Object item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#beforeRead()
|
||||
*/
|
||||
public void beforeRead() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception)
|
||||
*/
|
||||
public void onReadError(Exception ex) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#afterWrite()
|
||||
*/
|
||||
public void afterWrite() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#beforeWrite(java.lang.Object)
|
||||
*/
|
||||
public void beforeWrite(Object item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#onWriteError(java.lang.Exception, java.lang.Object)
|
||||
*/
|
||||
public void onWriteError(Exception ex, Object item) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2006-2008 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.listener;
|
||||
|
||||
import org.springframework.batch.core.domain.ChunkListener;
|
||||
|
||||
/**
|
||||
* Basic support implementation of {@link ChunkListener}
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class ChunkListenerSupport implements ChunkListener {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#afterChunk()
|
||||
*/
|
||||
public void afterChunk() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#beforeChunk()
|
||||
*/
|
||||
public void beforeChunk() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2006-2008 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.listener;
|
||||
|
||||
import org.springframework.batch.core.domain.ItemReadListener;
|
||||
import org.springframework.batch.core.domain.ItemWriteListener;
|
||||
|
||||
/**
|
||||
* Basic no-op implementation of both the {@link ItemWriteListener} and
|
||||
* {@link ItemReadListener} interfaces. Both are implemented, since it is
|
||||
* very common that both may need to be implemented at once.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class ItemListenerSupport implements ItemWriteListener, ItemReadListener {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#afterWrite()
|
||||
*/
|
||||
public void afterWrite() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#beforeWrite(java.lang.Object)
|
||||
*/
|
||||
public void beforeWrite(Object item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#onWriteError(java.lang.Exception, java.lang.Object)
|
||||
*/
|
||||
public void onWriteError(Exception ex, Object item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
public void afterRead(Object item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#beforeRead()
|
||||
*/
|
||||
public void beforeRead() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception)
|
||||
*/
|
||||
public void onReadError(Exception ex) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.interceptor;
|
||||
package org.springframework.batch.core.listener;
|
||||
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobListener;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.interceptor;
|
||||
package org.springframework.batch.core.listener;
|
||||
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepListener;
|
||||
Reference in New Issue
Block a user