com.ibm.commerce.foundation.dataload.datawriter

Class AbstractDataWriter

  • java.lang.Object
    • com.ibm.commerce.foundation.dataload.datawriter.AbstractDataWriter
  • All Implemented Interfaces:
    DataWriter
    Direct Known Subclasses:
    AbstractExtractDataWriter, JDBCDataWriter, NativeDBDataWriter


    public abstract class AbstractDataWriter
    extends java.lang.Object
    implements DataWriter
    This abstract class implements the DataWriter interface. The subclass needs to implement the abstract method processData(). The subclass may overwrite the init() and close() methods to provide additional implementations.
    • Field Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      Close the data writer.
      ConfigProperties getConfigProperties()
      Get the instance of the ConfigProperties of the DataWriter.
      void init()
      Do some initialization for the data writer.
      ConfigProperties initConfig(org.w3c.dom.Node dataWriterNode, ConfigProperties parentConfigProperties)
      This method parses the DataWriter xml node read in from the data load configuration file and stores the configuration in memory.
      void save(java.lang.Object obj)
      Save the physical data object.
      void setConfigProperties(ConfigProperties aConfigProperties)
      Sets the ConfigProperties to the DataWriter.
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

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

      • AbstractDataWriter

        public AbstractDataWriter()
    • Method Detail

      • getConfigProperties

        public ConfigProperties getConfigProperties()
        Get the instance of the ConfigProperties of the DataWriter. Call this method when you need to get more specific properties from the ConfigProperties.
        Specified by:
        getConfigProperties in interface DataWriter
        Returns:
        the ConfigProperties
      • setConfigProperties

        public void setConfigProperties(ConfigProperties aConfigProperties)
        Sets the ConfigProperties to the DataWriter. You normally don't need to call this method unless you wnat to override the ConfigProperties which is initialized from a data load configuration file.
        Specified by:
        setConfigProperties in interface DataWriter
        Parameters:
        aConfigProperties - a ConfigProperties
      • init

        public void init()
                  throws DataLoadException
        Do some initialization for the data writer. It only calls the setDataCacheInvalidationEnabled(). The subclass may provide more initialization implementations, but it should always call the super.init() first.
        Specified by:
        init in interface DataWriter
        Throws:
        DataLoadException - this exception is thrown if there is some problem during the initialization.
      • initConfig

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

        This method parses the DataWriter xml node read in from the data load configuration file and stores the configuration in memory.

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

        public void save(java.lang.Object obj)
                  throws DataLoadException
        Save the physical data object. In this implementation, we assume the obj is a TableDataObject or a List whose element is a TableDataObject. For each TableDataObject, it calls preProcessData(), processData(), postProcessData().
        Specified by:
        save in interface DataWriter
        Parameters:
        obj - a single physical object or a list of physical objects.
        Throws:
        DataLoadException - this exception is thrown if there is some problem to save the physical data objects. AN DataLoadApplicationException will be thrown if the obj is not a TableDataObject and it is not a list of TableDataObject.
      • close

        public void close()
                   throws DataLoadException
        Close the data writer. It calls the invalidateDataCache(). The subclass may provide additional implementation, but it should always call super.close().
        Specified by:
        close in interface DataWriter
        Throws:
        DataLoadException - this exception is thrown if there is an error to close.