@Deprecated public class LdifReader extends org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<LdapAttributes> implements org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<LdapAttributes>, InitializingBean
LdifReader is an adaptation of the FlatFileItemReader
built around an LdifParser.
Unlike the FlatFileItemReader, the LdifReader
does not require a mapper. Instead, this version of the LdifReader simply returns an LdapAttributes
object which can be consumed and manipulated as necessary by ItemProcessor or any
output service. Alternatively, the RecordMapper interface can be implemented and set in a
MappingLdifReader to map records to objects for return.
LdifReader usage is mimics that of the FlatFileItemReader
for all intensive purposes. Adjustments have been made to process records instead of lines, however. As such, the
recordsToSkip attribute indicates the number of records from the top of the file that should not be processed.
Implementations of the RecordCallbackHandler interface can be used to execute operations on those skipped records.
As with the FlatFileItemReader, the strict option differentiates
between whether or not to require the resource to exist before processing. In the case of a value set to false, a warning is logged instead of
an exception being thrown.
| Constructor and Description |
|---|
LdifReader()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Deprecated.
|
protected void |
doClose()
Deprecated.
|
protected void |
doOpen()
Deprecated.
|
protected LdapAttributes |
doRead()
Deprecated.
|
void |
setRecordsToSkip(int recordsToSkip)
Deprecated.
Public setter for the number of lines to skip at the start of a file.
|
void |
setResource(Resource resource)
Deprecated.
|
void |
setSkippedRecordsCallback(RecordCallbackHandler skippedRecordsCallback)
Deprecated.
RecordCallbackHandler implementations can be used to take action on skipped records. |
void |
setStrict(boolean strict)
Deprecated.
In strict mode the reader will throw an exception on
AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the
input resource does not exist. |
close, getCurrentItemCount, jumpToItem, open, read, setCurrentItemCount, setMaxItemCount, setName, setSaveState, updatepublic void setStrict(boolean strict)
AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the
input resource does not exist.strict - false by defaultpublic void setSkippedRecordsCallback(RecordCallbackHandler skippedRecordsCallback)
RecordCallbackHandler implementations can be used to take action on skipped records.skippedRecordsCallback - will be called for each one of the initial
skipped lines before any items are read.public void setRecordsToSkip(int recordsToSkip)
recordsToSkip - the number of lines to skipprotected void doClose()
throws Exception
doClose in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<LdapAttributes>Exceptionprotected void doOpen()
throws Exception
doOpen in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<LdapAttributes>Exceptionprotected LdapAttributes doRead() throws Exception
doRead in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<LdapAttributes>Exceptionpublic void setResource(Resource resource)
setResource in interface org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<LdapAttributes>public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanException