com.ibm.commerce.foundation.dataload.datareader

Class AbstractDataReader

  • java.lang.Object
    • com.ibm.commerce.foundation.dataload.datareader.AbstractDataReader
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      Close the data source used for reading data.
      ConfigProperties getConfigProperties()
      This method returns the configuration properties for this data reader.
      java.lang.Integer getSourcePosition()
      It returns the source position of the data object returned by the next() method you called last time.
      void init()
      It gets the input csv data file for a DataReader and gets limeDelimiter, tokenDelimeter and tokenValueDelimiter values.
      ConfigProperties initConfig(org.w3c.dom.Node dataReaderNode, ConfigProperties parentConfigProperties)
      This method parses the DataReader xml node read in from the business object configuration file and stores the configuration in memory.
      abstract java.lang.Object next()
      This method returns one chunk of data read from a data source.
      void setConfigProperties(ConfigProperties aConfigProperties)
      This method sets the configuration properties for this data reader.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractDataReader

        public AbstractDataReader()
    • Method Detail

      • getConfigProperties

        public ConfigProperties getConfigProperties()

        This method returns the configuration properties for this data reader.

        Specified by:
        getConfigProperties in interface DataReader
        Returns:
        ConfigProperties The configuration properties for this data reader.
      • setConfigProperties

        public void setConfigProperties(ConfigProperties aConfigProperties)

        This method sets the configuration properties for this data reader.

        Specified by:
        setConfigProperties in interface DataReader
        Parameters:
        aConfigProperties - The configuration properties for this data reader.
      • init

        public void init()
                  throws DataLoadException
        It gets the input csv data file for a DataReader and gets limeDelimiter, tokenDelimeter and tokenValueDelimiter values.
        Specified by:
        init in interface DataReader
        Throws:
        DataLoadException
      • initConfig

        public ConfigProperties initConfig(org.w3c.dom.Node dataReaderNode,
                                           ConfigProperties parentConfigProperties)
                                    throws DataLoadException

        This method parses the DataReader xml node read in from the business object configuration file and stores the configuration in memory.

        Specified by:
        initConfig in interface DataReader
        Parameters:
        dataReaderNode - The DataReader xml node read in from the business object configuration file.
        parentConfigProperties - The configuration properties for the parent data loader of this data reader.
        Returns:
        ConfigProperties The initialized configuration for this data reader.
        Throws:
        DataLoadException - An application exception will be thrown if there was a problem initializing the configuration for the data reader.
      • next

        public abstract java.lang.Object next()
                                       throws DataLoadException
        This method returns one chunk of data read from a data source. The returned data will be passed to one or more business object builders to build business objects and each business object will be passed to individual business object mediator to process the data. For a CSV reader, it usually returns a HashMap which can be passed to the BaseBusinessObjectBuilder to populate a logic business object. The BusinessObjectBuilder will construct a DataLoadBusinessObject and pass it to a BusinessObjectMediator to process. FOr an XML reader, it usually returns a DataLoadBusinessObject. SO a DummyBusinessObjectBuilder can be used to passed the DataLoadBusinessObject directly to a BusinessObjectMediator to process.
        Specified by:
        next in interface DataReader
        Returns:
        a chunk of data. It will return null if there are no more data to be read.
        Throws:
        DataLoadException - An application exception will be thrown if there was a problem reading data from the data source.
      • getSourcePosition

        public java.lang.Integer getSourcePosition()
        It returns the source position of the data object returned by the next() method you called last time. This abstract class returns null. The subclass should overwrite this to implement it.
        Specified by:
        getSourcePosition in interface DataReader
        Returns:
        the source position of the data object.
      • close

        public void close()
                   throws DataLoadException

        Close the data source used for reading data. It does nothing. The subclass can overwrite it to provide a specific implementation.

        Specified by:
        close in interface DataReader
        Throws:
        DataLoadException - An application exception will be thrown if there was a problem closing the data source.