Package gov.usgs.earthquake.indexer
Class SearchResponseXmlProductSource
java.lang.Object
org.xml.sax.helpers.DefaultHandler
gov.usgs.earthquake.product.io.XmlProductSource
gov.usgs.earthquake.indexer.SearchResponseXmlProductSource
- All Implemented Interfaces:
ProductSource,ContentHandler,DTDHandler,EntityResolver,ErrorHandler
Used by SearchResponseParser to store products during parsing.
Creates a "background" storage thread for storing, while this classes
startElement, characters, and endElement methods are called by the
"foreground" xml parsing thread.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a SearchResponseXmlProductSource. -
Method Summary
Modifier and TypeMethodDescriptionvoidendElement(String uri, String localName, String qName) Override DefaultHandler endElement.protected voidsetProduct(Product product) Method used by storage to provide the parsed product.voidsetStorage(FileProductStorage storage) voidstartElement(String uri, String localName, String qName, Attributes attributes) Override DefaultHandler startElement.voidstreamTo(ProductHandler handler) Called by the underlying product storage as part os storeProductSource.Methods inherited from class gov.usgs.earthquake.product.io.XmlProductSource
characters, close, closeContent, getHandler, openContentStream, setHandlerMethods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
SearchResponseXmlProductSource
Construct a SearchResponseXmlProductSource.- Parameters:
storage- the storage where the parsed product is stored.
-
-
Method Details
-
streamTo
Called by the underlying product storage as part os storeProductSource. This method notifies the XML parsing thread that parsing may continue, since the handler is now setup.- Specified by:
streamToin interfaceProductSource- Overrides:
streamToin classXmlProductSource- Parameters:
handler- the receiving ProductOutput.
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException Description copied from class:XmlProductSourceOverride DefaultHandler startElement. Adds a new element content buffer and calls onStartElement.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classXmlProductSource- Parameters:
uri- element uri.localName- element localName.qName- element qName.attributes- element attributes.- Throws:
SAXException- if onStartElement throws a SAXException.
-
endElement
Description copied from class:XmlProductSourceOverride DefaultHandler endElement. Retrieves element content buffer and passes it to onEndElement.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classXmlProductSource- Parameters:
uri- element uri.localName- element localName.qName- element qName.- Throws:
SAXException- if onEndElement throws a SAXException.
-
setStorage
- Parameters:
storage- FileProductStorage to set
-
getStorage
- Returns:
- FileProductStorage
-
getProduct
- Returns:
- the parsed, stored product.
-
setProduct
Method used by storage to provide the parsed product.- Parameters:
product- to set
-