com.ibm.commerce.foundation.dataload.datareader

Interface DataReader

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void close()
      This method closes the data source(s) after they are no longer needed.
      ConfigProperties getConfigProperties()
      Get the instance of the configuration 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()
      This method initializes the data reader.
      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.
      java.lang.Object next()
      This method returns one chunk of data read from a data source.
      void setConfigProperties(ConfigProperties aConfigProperties)
      Sets the ConfigProperties to the DataReader.
    • Field Detail

      • COPYRIGHT

        static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Method Detail

      • getConfigProperties

        ConfigProperties getConfigProperties()

        Get the instance of the configuration for this data reader.

        Call this method when you need to get more specific properties from the ConfigProperties.

        Returns:
        ConfigProperties The instance of the configuration for this data reader.
      • setConfigProperties

        void setConfigProperties(ConfigProperties aConfigProperties)
        Sets the ConfigProperties to the DataReader. You normally don't need to call this method unless you want to override the ConfigProperties which is initialized from a business object configuration file.
        Parameters:
        aConfigProperties - a ConfigProperties
      • init

        void init()
           throws DataLoadException

        This method initializes the data reader.

        Throws:
        DataLoadException - An application exception will be thrown if there was a problem initializing the data reader.
      • initConfig

        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.

        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

        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, the data returned is usually a HashMap which can be passed to the BaseBusinessObjectBuilder to populate a logic business object. For an XML reader, the data returned is usually a DataLoadBusinessObject which can be passed to a BusinessObjectMediator directly.
        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

        java.lang.Integer getSourcePosition()
        It returns the source position of the data object returned by the next() method you called last time. For CSV reader, it may be the line number in the CSV input file. For an XML reader, it may be the number of data objects it has returned. It may return null if the data reader didn't implement this interface.
        Returns:
        the source position of the data object.
      • close

        void close()
            throws DataLoadException

        This method closes the data source(s) after they are no longer needed.

        Throws:
        DataLoadException - An application exception will be thrown if there was a problem closing the data source.