com.ibm.commerce.foundation.dataload.xmlhandler

Class AbstractXmlHandler

  • java.lang.Object
    • org.xml.sax.helpers.DefaultHandler
      • com.ibm.commerce.foundation.dataload.xmlhandler.AbstractXmlHandler
  • All Implemented Interfaces:
    XmlHandler, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
    Direct Known Subclasses:
    NVPXmlHandler


    public abstract class AbstractXmlHandler
    extends org.xml.sax.helpers.DefaultHandler
    implements XmlHandler
    This is an abstract implementation of the XmlHandler interface. All other XmlHandler implementation should extend this class. The subclass should implement the startElement() and endElement() methods. The subclass should call processDataObject() for each data object it handles.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void characters(char[] chars, int start, int length)
      Handle the characters event in the xml.
      void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
      Handle the end element event in the xml.
      void error(org.xml.sax.SAXParseException exception)
      Report error using FINE trace level.
      void fatalError(org.xml.sax.SAXParseException exception)
      Report fatal error
      ConfigProperties getConfigProperties()
      Get the instance of the configuration for this XML handler.
      com.ibm.commerce.foundation.dataload.DataLoader getDataLoader()
      Gets the data loader object.
      void init()
      Does some initialization.
      void setConfigProperties(ConfigProperties aConfigProperties)
      Sets the ConfigProperties to the XML handler.
      void setDataLoader(com.ibm.commerce.foundation.dataload.DataLoader dataLoader)
      Sets the data loader object
      void setDocumentLocator(org.xml.sax.Locator locator)
      Set the document locator.
      void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
      Handle the start element event in the xml.
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.xml.sax.ContentHandler

        endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, skippedEntity, startDocument, startPrefixMapping
      • Methods inherited from interface org.xml.sax.DTDHandler

        notationDecl, unparsedEntityDecl
      • Methods inherited from interface org.xml.sax.EntityResolver

        resolveEntity
      • Methods inherited from interface org.xml.sax.ErrorHandler

        warning
    • Constructor Detail

      • AbstractXmlHandler

        public AbstractXmlHandler()
    • Method Detail

      • setDocumentLocator

        public void setDocumentLocator(org.xml.sax.Locator locator)
        Set the document locator.
        Specified by:
        setDocumentLocator in interface org.xml.sax.ContentHandler
        Overrides:
        setDocumentLocator in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        locator - the locator
      • error

        public void error(org.xml.sax.SAXParseException exception)
                   throws org.xml.sax.SAXException
        Report error using FINE trace level.
        Specified by:
        error in interface org.xml.sax.ErrorHandler
        Overrides:
        error in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        exception - a SAXParseException
        Throws:
        org.xml.sax.SAXException - if super.error() throws the exception.
      • fatalError

        public void fatalError(org.xml.sax.SAXParseException exception)
                        throws org.xml.sax.SAXException
        Report fatal error
        Specified by:
        fatalError in interface org.xml.sax.ErrorHandler
        Overrides:
        fatalError in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        exception - a SAXParseException
        Throws:
        org.xml.sax.SAXException
      • setDataLoader

        public void setDataLoader(com.ibm.commerce.foundation.dataload.DataLoader dataLoader)
        Sets the data loader object
        Specified by:
        setDataLoader in interface XmlHandler
        Parameters:
        dataLoader - a data loader object
      • getDataLoader

        public com.ibm.commerce.foundation.dataload.DataLoader getDataLoader()
        Gets the data loader object.
        Specified by:
        getDataLoader in interface XmlHandler
        Returns:
        the data load object.
      • characters

        public void characters(char[] chars,
                               int start,
                               int length)
                        throws org.xml.sax.SAXException
        Handle the characters event in the xml.
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        chars - the char array
        start - the start index position in the char array
        length - the length
        Throws:
        org.xml.sax.SAXException - if there are some errors to handle it.
      • startElement

        public void startElement(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes attributes)
                          throws org.xml.sax.SAXException
        Handle the start element event in the xml.
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        uri - the uri of the element
        localName - the location name of the element
        qName - the qualified name of the element
        attributes - the attributes in the element.
        Throws:
        org.xml.sax.SAXException - if there are some errors to handle it.
      • endElement

        public void endElement(java.lang.String uri,
                               java.lang.String localName,
                               java.lang.String qName)
                        throws org.xml.sax.SAXException
        Handle the end element event in the xml.
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        uri - the uri of the element
        localName - the location name of the element
        qName - the qualified name of the element
        Throws:
        org.xml.sax.SAXException - if there are some errors to handle it.
      • init

        public void init()
                  throws DataLoadException
        Does some initialization. The subclass can overwrite this method to provide additional
        Specified by:
        init in interface XmlHandler
        Throws:
        DataLoadException - if there are some errors in the initialization.
      • getConfigProperties

        public ConfigProperties getConfigProperties()

        Get the instance of the configuration for this XML handler.

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

        Specified by:
        getConfigProperties in interface XmlHandler
        Returns:
        ConfigProperties The instance of the configuration for this XML handler.
      • setConfigProperties

        public void setConfigProperties(ConfigProperties aConfigProperties)
        Sets the ConfigProperties to the XML handler. 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.
        Specified by:
        setConfigProperties in interface XmlHandler
        Parameters:
        aConfigProperties - a ConfigProperties