com.atlassian.jira.imports.project.handler
Class ChainedSaxHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.atlassian.jira.imports.project.handler.ChainedSaxHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ChainedSaxHandler
extends org.xml.sax.helpers.DefaultHandler

A base class used for processing a JIRA backup file. This collects Entity information and calls the ImportEntityHandler.handleEntity(String,java.util.Map) method on its registered delegates. The attributes map includes any attributes that may be nested as sub-elements.
If you construct this with a TaskProgressSink then the progress of the XML processing will be relayed.

Since:
v3.13

Field Summary
static SecureXmlEntityResolver EMPTY_ENTITY_RESOLVER
           
 
Constructor Summary
ChainedSaxHandler()
          Simple constructor for creating an AbstractHandler without progress feedback.
ChainedSaxHandler(TaskProgressProcessor taskProgressProcessor)
          Constructor to create an AbstractHandler with progress feedback.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(String uri, String localName, String qName)
           
 long getEntityCount()
          Provides the number of actual XML elements that the parser encounters.
 void registerHandler(ImportEntityHandler handler)
           
 InputSource resolveEntity(String publicId, String systemId)
           
 void startDocument()
           
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ENTITY_RESOLVER

public static final SecureXmlEntityResolver EMPTY_ENTITY_RESOLVER
Constructor Detail

ChainedSaxHandler

public ChainedSaxHandler()
Simple constructor for creating an AbstractHandler without progress feedback.


ChainedSaxHandler

public ChainedSaxHandler(TaskProgressProcessor taskProgressProcessor)
Constructor to create an AbstractHandler with progress feedback.

Parameters:
taskProgressProcessor - the TaskProgressProcessor that relays the progress information.
Method Detail

registerHandler

public void registerHandler(ImportEntityHandler handler)

getEntityCount

public long getEntityCount()
Provides the number of actual XML elements that the parser encounters.

Returns:
number of actual XML elements the parser encounters

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws IOException,
                                 SAXException
Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Throws:
IOException
SAXException

startDocument

public final void startDocument()
                         throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

endDocument

public final void endDocument()
                       throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

startElement

public final void startElement(String uri,
                               String localName,
                               String qName,
                               Attributes attributes)
                        throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

characters

public final void characters(char[] ch,
                             int start,
                             int length)
                      throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException


Copyright © 2002-2013 Atlassian. All Rights Reserved.