IN PROGRESS - issue BATCH-267: Re-organise I/O (io) packages
http://jira.springframework.org/browse/BATCH-267 Initial draft - separating flat file and xml processing
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support;
|
||||
package org.springframework.batch.io.file;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support;
|
||||
package org.springframework.batch.io.file;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@@ -28,11 +28,11 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.batch.io.ItemWriter;
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.io.exception.BatchEnvironmentException;
|
||||
import org.springframework.batch.io.file.support.transform.Converter;
|
||||
import org.springframework.batch.io.file.transform.Converter;
|
||||
import org.springframework.batch.io.support.AbstractTransactionalIoSource;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.ResourceLifecycle;
|
||||
import org.springframework.batch.restart.GenericRestartData;
|
||||
import org.springframework.batch.restart.RestartData;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support;
|
||||
package org.springframework.batch.io.file;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -26,8 +26,8 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchEnvironmentException;
|
||||
import org.springframework.batch.io.file.support.separator.DefaultRecordSeparatorPolicy;
|
||||
import org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy;
|
||||
import org.springframework.batch.io.file.separator.DefaultRecordSeparatorPolicy;
|
||||
import org.springframework.batch.io.file.separator.RecordSeparatorPolicy;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ResourceLifecycle;
|
||||
import org.springframework.batch.item.provider.AbstractItemReader;
|
||||
@@ -14,17 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support;
|
||||
package org.springframework.batch.io.file;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.batch.io.exception.FlatFileParsingException;
|
||||
import org.springframework.batch.io.file.FieldSet;
|
||||
import org.springframework.batch.io.file.FieldSetMapper;
|
||||
import org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy;
|
||||
import org.springframework.batch.io.file.support.transform.AbstractLineTokenizer;
|
||||
import org.springframework.batch.io.file.support.transform.DelimitedLineTokenizer;
|
||||
import org.springframework.batch.io.file.support.transform.LineTokenizer;
|
||||
import org.springframework.batch.io.file.separator.RecordSeparatorPolicy;
|
||||
import org.springframework.batch.io.file.transform.AbstractLineTokenizer;
|
||||
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;
|
||||
import org.springframework.batch.io.file.transform.LineTokenizer;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ResourceLifecycle;
|
||||
import org.springframework.batch.item.provider.AbstractItemReader;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.mapping;
|
||||
package org.springframework.batch.io.file.mapping;
|
||||
|
||||
import java.beans.PropertyEditor;
|
||||
import java.util.ArrayList;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.io.file.support.mapping;
|
||||
package org.springframework.batch.io.file.mapping;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.mapping;
|
||||
package org.springframework.batch.io.file.mapping;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.ArrayList;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.separator;
|
||||
package org.springframework.batch.io.file.separator;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
* "), and does not end with a continuation marker ('\'). The test for the
|
||||
* continuation marker ignores whitespace at the end of the line.
|
||||
*
|
||||
* @see org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
*/
|
||||
public boolean isEndOfRecord(String line) {
|
||||
return !isQuoteUnterminated(line) && !isContinued(line);
|
||||
@@ -94,7 +94,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
|
||||
* remove the continuation marker (plus whitespace at the end) if it is
|
||||
* there.
|
||||
*
|
||||
* @see org.springframework.batch.io.file.support.separator.SimpleRecordSeparatorPolicy#preProcess(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.SimpleRecordSeparatorPolicy#preProcess(java.lang.String)
|
||||
*/
|
||||
public String preProcess(String line) {
|
||||
if (isQuoteUnterminated(line)) {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.separator;
|
||||
package org.springframework.batch.io.file.separator;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.separator;
|
||||
package org.springframework.batch.io.file.separator;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public class SimpleRecordSeparatorPolicy implements RecordSeparatorPolicy {
|
||||
/**
|
||||
* Always returns true.
|
||||
*
|
||||
* @see org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
*/
|
||||
public boolean isEndOfRecord(String line) {
|
||||
return true;
|
||||
@@ -37,7 +37,7 @@ public class SimpleRecordSeparatorPolicy implements RecordSeparatorPolicy {
|
||||
|
||||
/**
|
||||
* Pass the record through. Do nothing.
|
||||
* @see org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy#postProcess(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.RecordSeparatorPolicy#postProcess(java.lang.String)
|
||||
*/
|
||||
public String postProcess(String record) {
|
||||
return record;
|
||||
@@ -45,7 +45,7 @@ public class SimpleRecordSeparatorPolicy implements RecordSeparatorPolicy {
|
||||
|
||||
/**
|
||||
* Pass the line through. Do nothing.
|
||||
* @see org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy#preProcess(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.RecordSeparatorPolicy#preProcess(java.lang.String)
|
||||
*/
|
||||
public String preProcess(String line) {
|
||||
return line;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.separator;
|
||||
package org.springframework.batch.io.file.separator;
|
||||
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ public class SuffixRecordSeparatorPolicy extends DefaultRecordSeparatorPolicy {
|
||||
* whitespace is trimmed before the comparison. Also returns true if the
|
||||
* line is null, but not if it is empty.
|
||||
*
|
||||
* @see org.springframework.batch.io.file.support.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
|
||||
*/
|
||||
public boolean isEndOfRecord(String line) {
|
||||
if (line == null) {
|
||||
@@ -72,7 +72,7 @@ public class SuffixRecordSeparatorPolicy extends DefaultRecordSeparatorPolicy {
|
||||
/**
|
||||
* Remove the suffix from the end of the record.
|
||||
*
|
||||
* @see org.springframework.batch.io.file.support.separator.SimpleRecordSeparatorPolicy#postProcess(java.lang.String)
|
||||
* @see org.springframework.batch.io.file.separator.SimpleRecordSeparatorPolicy#postProcess(java.lang.String)
|
||||
*/
|
||||
public String postProcess(String record) {
|
||||
if (record==null) {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
/**
|
||||
* Generic converter interface for transforming an object into another form for
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import org.springframework.batch.io.file.FieldSet;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.transform;
|
||||
package org.springframework.batch.io.file.transform;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Arrays;
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.springframework.batch.io.support;
|
||||
|
||||
import org.springframework.batch.io.ItemWriter;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.batch.io.ItemWriter;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatInterceptor;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support;
|
||||
package org.springframework.batch.io.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -13,11 +13,11 @@ import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.events.StartElement;
|
||||
|
||||
import org.springframework.batch.io.Skippable;
|
||||
import org.springframework.batch.io.file.support.stax.DefaultFragmentEventReader;
|
||||
import org.springframework.batch.io.file.support.stax.DefaultTransactionalEventReader;
|
||||
import org.springframework.batch.io.file.support.stax.FragmentDeserializer;
|
||||
import org.springframework.batch.io.file.support.stax.FragmentEventReader;
|
||||
import org.springframework.batch.io.file.support.stax.TransactionalEventReader;
|
||||
import org.springframework.batch.io.xml.stax.DefaultFragmentEventReader;
|
||||
import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader;
|
||||
import org.springframework.batch.io.xml.stax.FragmentDeserializer;
|
||||
import org.springframework.batch.io.xml.stax.FragmentEventReader;
|
||||
import org.springframework.batch.io.xml.stax.TransactionalEventReader;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ResourceLifecycle;
|
||||
import org.springframework.batch.item.provider.AbstractItemReader;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support;
|
||||
package org.springframework.batch.io.xml;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -14,10 +14,10 @@ import javax.xml.stream.XMLEventWriter;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.springframework.batch.io.ItemWriter;
|
||||
import org.springframework.batch.io.file.support.stax.NoStartEndDocumentStreamWriter;
|
||||
import org.springframework.batch.io.file.support.stax.ObjectToXmlSerializer;
|
||||
import org.springframework.batch.io.support.FileUtils;
|
||||
import org.springframework.batch.io.xml.stax.NoStartEndDocumentStreamWriter;
|
||||
import org.springframework.batch.io.xml.stax.ObjectToXmlSerializer;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.ResourceLifecycle;
|
||||
import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager;
|
||||
import org.springframework.batch.restart.GenericRestartData;
|
||||
@@ -367,7 +367,7 @@ public class StaxEventWriterItemWriter implements ItemWriter, ResourceLifecycle,
|
||||
* Write the value object to XML stream.
|
||||
*
|
||||
* @param output the value object
|
||||
* @see org.springframework.batch.io.ItemWriter#write(java.lang.Object)
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.lang.Object)
|
||||
*/
|
||||
public void write(Object output) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.springframework.batch.io.file.support.oxm;
|
||||
package org.springframework.batch.io.xml.oxm;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.stream.XMLEventWriter;
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
import org.springframework.batch.io.file.support.stax.ObjectToXmlSerializer;
|
||||
import org.springframework.batch.io.xml.stax.ObjectToXmlSerializer;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
import org.springframework.xml.transform.StaxResult;
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.springframework.batch.io.file.support.oxm;
|
||||
package org.springframework.batch.io.xml.oxm;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
|
||||
import org.springframework.batch.io.file.support.stax.FragmentDeserializer;
|
||||
import org.springframework.batch.io.xml.stax.FragmentDeserializer;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.stream.XMLEventWriter;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.stream.XMLEventWriter;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.io.file.support.stax;
|
||||
package org.springframework.batch.io.xml.stax;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io;
|
||||
package org.springframework.batch.item;
|
||||
|
||||
/**
|
||||
* Basic interface for generic output operations. Class implementing this
|
||||
@@ -2,9 +2,9 @@ package org.springframework.batch.item.processor;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.batch.io.ItemWriter;
|
||||
import org.springframework.batch.io.Skippable;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.restart.GenericRestartData;
|
||||
import org.springframework.batch.restart.RestartData;
|
||||
import org.springframework.batch.restart.Restartable;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.batch.item.processor;
|
||||
|
||||
import org.springframework.batch.io.ItemWriter;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user