org.springframework.ldap.ldif.batch

## Class MappingLdifReader<T>

- java.lang.Object
- - org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
  - - org.springframework.ldap.ldif.batch.MappingLdifReader<T>

- All Implemented Interfaces:
    org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<T>, org.springframework.batch.item.ItemReader<T>, org.springframework.batch.item.ItemStream, org.springframework.batch.item.ItemStreamReader<T>, InitializingBean

  Deprecated.
  Use the support provided in Spring Batch infrastructure

      @Deprecated
      public class MappingLdifReader<T>
      extends org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
      implements org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<T>, InitializingBean

  The `MappingLdifReader` is an adaptation of the `FlatFileItemReader` built around an `LdifParser`. It differs from the standard `LdifReader` in its ability to map `LdapAttributes` objects to POJOs.

  The `MappingLdifReader` requires an `RecordMapper` implementation. If mapping is not required, the `LdifReader` should be used instead. It simply returns an `LdapAttributes` object which can be consumed and manipulated as necessary by `ItemProcessor` or any output service.

  `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.

  Author:
    Keith Barlow

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MappingLdifReader()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Deprecated.
    `protected void` | `doClose()` Deprecated.
    `protected void` | `doOpen()` Deprecated.
    `protected T` | `doRead()` Deprecated.
    `void` | `setRecordMapper(RecordMapper<T> recordMapper)` Deprecated. Setter for object mapper.
    `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.

    - ### Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader

      `close, getCurrentItemCount, jumpToItem, open, read, setCurrentItemCount, setMaxItemCount, setName, setSaveState, update`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.springframework.batch.item.ItemStream

      `close, open, update`

    - ### Methods inherited from interface org.springframework.batch.item.ItemReader

      `read`

- - ### Constructor Detail

    - #### MappingLdifReader

          public MappingLdifReader()

      Deprecated.

  - ### Method Detail

    - #### setStrict

          public 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.
      Parameters:
        `strict` - false by default

    - #### setSkippedRecordsCallback

          public void setSkippedRecordsCallback(RecordCallbackHandler skippedRecordsCallback)

      Deprecated.
      `RecordCallbackHandler` implementations can be used to take action on skipped records.
      Parameters:
        `skippedRecordsCallback` - will be called for each one of the initial skipped lines before any items are read.

    - #### setRecordsToSkip

          public void setRecordsToSkip(int recordsToSkip)

      Deprecated.
      Public setter for the number of lines to skip at the start of a file. Can be used if the file contains a header without useful (column name) information, and without a comment delimiter at the beginning of the lines.
      Parameters:
        `recordsToSkip` - the number of lines to skip

    - #### setRecordMapper

          public void setRecordMapper(RecordMapper<T> recordMapper)

      Deprecated.
      Setter for object mapper. This property is required to be set.
      Parameters:
        `recordMapper` - maps record to an object

    - #### doClose

          protected void doClose()
                          throws Exception

      Deprecated.
      Specified by:
        `doClose` in class `org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>`
      Throws:
        `Exception`

    - #### doOpen

          protected void doOpen()
                         throws Exception

      Deprecated.
      Specified by:
        `doOpen` in class `org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>`
      Throws:
        `Exception`

    - #### doRead

          protected T doRead()
                      throws Exception

      Deprecated.
      Specified by:
        `doRead` in class `org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>`
      Throws:
        `Exception`

    - #### setResource

          public void setResource(Resource resource)

      Deprecated.
      Specified by:
        `setResource` in interface `org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<T>`

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws Exception

      Deprecated.
      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`
      Throws:
        `Exception`