From aa76ec4e26d506b48d0eae4ff9f1c91430bc2b78 Mon Sep 17 00:00:00 2001 From: robokaso Date: Wed, 27 Feb 2008 13:56:26 +0000 Subject: [PATCH] removed the empty AbstractTransactionalIoSource --- .../batch/io/file/FlatFileItemWriter.java | 3 +- .../AbstractTransactionalIoSource.java | 36 --------- .../AbstractTransactionalIoSourceTests.java | 74 ------------------- 3 files changed, 1 insertion(+), 112 deletions(-) delete mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java delete mode 100644 spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java index 61dfeb020..516c38d5c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java @@ -31,7 +31,6 @@ import org.springframework.batch.io.file.mapping.FieldSet; import org.springframework.batch.io.file.mapping.FieldSetCreator; import org.springframework.batch.io.file.transform.DelimitedLineAggregator; import org.springframework.batch.io.file.transform.LineAggregator; -import org.springframework.batch.io.support.AbstractTransactionalIoSource; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemWriter; @@ -66,7 +65,7 @@ import org.springframework.util.Assert; * @author Robert Kasanicky * @author Dave Syer */ -public class FlatFileItemWriter extends AbstractTransactionalIoSource implements ItemWriter, ItemStream, +public class FlatFileItemWriter implements ItemWriter, ItemStream, InitializingBean { private static final String LINE_SEPARATOR = System.getProperty("line.separator"); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java deleted file mode 100644 index 1224441e3..000000000 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java +++ /dev/null @@ -1,36 +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.io.support; - -import org.springframework.batch.item.ItemReader; -import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.item.stream.ItemStreamSupport; - -/** - *

- * Abstract class that abstracts away transaction handling from input and - * output. Any {@link ItemReader} or {@link ItemWriter} that wants to be - * notified of transaction events to maintain the contract that all calls to - * read or write can extend this base class to ensure that correct ordering is - * maintained regardless of rollbacks. - *

- * - * @author Lucas Ward - * @since 1.0 - */ -public abstract class AbstractTransactionalIoSource extends ItemStreamSupport { - -} diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java deleted file mode 100644 index b2c9e5bbe..000000000 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java +++ /dev/null @@ -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.io.support; - -import junit.framework.TestCase; - -import org.springframework.transaction.support.TransactionSynchronizationManager; -import org.springframework.util.Assert; - -/** - * @author Lucas Ward - * - */ -public class AbstractTransactionalIoSourceTests extends TestCase { - - private MockIoSource source; - - protected void setUp() throws Exception { - super.setUp(); - - source = new MockIoSource(); - if(TransactionSynchronizationManager.isSynchronizationActive()){ - TransactionSynchronizationManager.clearSynchronization(); - } - TransactionSynchronizationManager.initSynchronization(); - } - - public void testCommit(){ - source.mark(); - assertTrue(source.commitCalled); - assertFalse(source.rollbackCalled); - } - - public void testRollback(){ - source.reset(); - assertFalse(source.commitCalled); - assertTrue(source.rollbackCalled); - } - - private static class MockIoSource extends AbstractTransactionalIoSource { - - private boolean commitCalled = false; - private boolean rollbackCalled = false; - - public void mark() { - Assert.isTrue(!commitCalled, "Commit aleady called"); - commitCalled = true; - } - - public void reset() { - Assert.isTrue(!rollbackCalled, "Rollback aleady called"); - rollbackCalled = true; - } - - public Object read() throws Exception { - return null; - } - } - -}