Class EventAddonParser

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class EventAddonParser
    extends SAXAdapter
    Parser for event addon messages. Maps these messages into an EQMessage with a product link.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  EventAddonParser.EventAddon
      Data structure for event addon message.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.text.SimpleDateFormat ADDON_DATE_FORMAT
      Date format used in event addon message.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      EventAddonParser.EventAddon getAddon()
      Get parsed addon.
      void onEndElement​(java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String content)
      SAXAdapter end element handler.
      void onStartElement​(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
      SAXAdapter start element handler.
      gov.usgs.ansseqmsg.EQMessage parseMessage​(EIDSMessageEvent event)
      Takes a EIDSMessage event and returns the EQMessage
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

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

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

      • ADDON_DATE_FORMAT

        public static final java.text.SimpleDateFormat ADDON_DATE_FORMAT
        Date format used in event addon message.
    • Constructor Detail

      • EventAddonParser

        public EventAddonParser()
    • Method Detail

      • parseMessage

        public gov.usgs.ansseqmsg.EQMessage parseMessage​(EIDSMessageEvent event)
                                                  throws java.lang.Exception
        Takes a EIDSMessage event and returns the EQMessage
        Parameters:
        event - EIDSMessageEvent to parse
        Returns:
        an EQmessage
        Throws:
        java.lang.Exception - if error occurs
      • onStartElement

        public void onStartElement​(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qName,
                                   org.xml.sax.Attributes attributes)
                            throws org.xml.sax.SAXException
        SAXAdapter start element handler.
        Overrides:
        onStartElement in class SAXAdapter
        Parameters:
        uri - element uri.
        localName - element localName.
        qName - element qName.
        attributes - element attributes.
        Throws:
        org.xml.sax.SAXException - if there is an error.
      • onEndElement

        public void onEndElement​(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 java.lang.String content)
                          throws org.xml.sax.SAXException
        SAXAdapter end element handler. Content only includes characters that were read from this element, NOT any characters from child elements.
        Overrides:
        onEndElement in class SAXAdapter
        Parameters:
        uri - element uri.
        localName - element localName.
        qName - element qName.
        content - element content.
        Throws:
        org.xml.sax.SAXException - if onEndElement throws a SAXException.