Class ReaderManager

java.lang.Object
de.hybris.platform.impex.jalo.ReaderManager

public class ReaderManager extends Object
Class holding a stack of CSVReader instances. The ImpExReader uses this class for managing its reader instances. The reader on top of the stack represents the current reader instance and the one at bottom the reader of the main script.
  • Constructor Details

    • ReaderManager

      public ReaderManager(CSVReader mainReader)
      Creates a new manager initialized with given reader, which represents the main reader and will be pushed to the bottom of the reader stack.
      Parameters:
      mainReader - main reader
  • Method Details

    • pushReader

      public void pushReader(CSVReader reader, int columnOffset, String locationText)
      Pushes a reader at the reader stack, so it will be the current one.
      Parameters:
      reader - new reader instance
      columnOffset - column offset used when reading with given reader
      locationText - location text used for logging of reader
    • popReader

      public CSVReader popReader()
      Closes, removes and returns current reader.
      Returns:
      current reader removed from stack or null if no reader is registered
    • getCurrentLocation

      public String getCurrentLocation()
      Gets the location of the current reading process by concatenating all locations of the reader at stack.
      Returns:
      location of reading process
    • clear

      public void clear()
      Clears the stack by calling popReader() for each reader at stack (includes closing of reader).
    • peekReader

      public CSVReader peekReader()
      Gets the current reader instance.
      Returns:
      current reader
    • getMainReader

      public CSVReader getMainReader()
      Gets the main reader (reader given at constructor).
      Returns:
      main reader
    • getCurrentColumnOffset

      public int getCurrentColumnOffset() throws JaloSystemException
      Gets the column offset configured for current reader instance.
      Returns:
      column offset of current reader
      Throws:
      JaloSystemException - if no reader is registered
    • readerCount

      public int readerCount()
      Gets the count of reader managed by this instance.
      Returns:
      amount of readers