com.ptc.windchill.upgrade.dust
Class BlobReportContentHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycom.ptc.windchill.upgrade.dust.BlobReportContentHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class BlobReportContentHandler
extends DefaultHandler

BlobReportContentHandler gathers the characters for each Instance element, then attempts to de-serialize. Emits a message when it fails. extends DefaultHandler


Field Summary
(package private)  String className
           
(package private)  boolean endReport
           
(package private)  boolean extraQueueDecode
           
(package private)  AttributesImpl instanceAtts
           
(package private)  boolean instanceElementStarted
           
(package private)  String instanceId
           
(package private)  StringBuffer objString
           
(package private)  ContentHandlerWriter outHandler
           
(package private)  boolean processingProperty
           
(package private)  AttributesImpl propertyAtts
           
(package private)  String propertyName
           
(package private)  boolean quickReport
           
private static String RESOURCE
           
 
Constructor Summary
(package private) BlobReportContentHandler(File outfile)
          Implements standard ContentHandler methods, writes to the file specified by the outfile parameter and marks property elements to be written as CDATA.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void doEndDocument()
          Called at the end of the document rather than the usual endDocument().
 void doStartDocument()
          Called at the beginning of the document rather than the usual startDocument().
 void endDocument()
           
 void endElement(String uri, String localName, String qName)
          De-serialize the object if this is an Instance element.
 void endPrefixMapping(String prefix)
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
private  boolean isClassQueueEntry(String className)
           
private  String makeObject(String str)
          De-serialize the object.
private  void makeString(char[] ch, int start, int length)
          Collect the value being read for the Property.
 void processingInstruction(String target, String data)
           
 void setQuickReport(boolean value)
           
private  void showStackTrace(Throwable e)
          This gets called when there is a de-serialization problem.
 void skippedEntity(String name)
           
 void startDocument()
           
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Traps the instance id, property name, and class name being processed.
private  void startInstanceIfNeeded()
           
 void startPrefixMapping(String prefix, String uri)
           
private  void writeEmptyElement(String uri_, String status_)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, setDocumentLocator, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE

outHandler

ContentHandlerWriter outHandler

processingProperty

boolean processingProperty

instanceElementStarted

boolean instanceElementStarted

extraQueueDecode

boolean extraQueueDecode

quickReport

boolean quickReport

endReport

boolean endReport

propertyName

String propertyName

instanceId

String instanceId

className

String className

objString

StringBuffer objString

propertyAtts

AttributesImpl propertyAtts

instanceAtts

AttributesImpl instanceAtts
Constructor Detail

BlobReportContentHandler

BlobReportContentHandler(File outfile)
Implements standard ContentHandler methods, writes to the file specified by the outfile parameter and marks property elements to be written as CDATA.

Method Detail

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Throws:
SAXException

doStartDocument

public void doStartDocument()
                     throws SAXException
Called at the beginning of the document rather than the usual startDocument(). The reason for this is because many file are being converted into one document and the calls to startDocument() are ignored.

Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Throws:
SAXException

doEndDocument

public void doEndDocument()
                   throws SAXException
Called at the end of the document rather than the usual endDocument(). The reason for this is because many file are being converted into one document and the calls to endDocument() are ignored.

Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Traps the instance id, property name, and class name being processed. Only writes instance elements if an exception is encountered while de-serializing.

Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
De-serialize the object if this is an Instance element.

Throws:
SAXException

showStackTrace

private void showStackTrace(Throwable e)
                     throws SAXException
This gets called when there is a de-serialization problem. Start an instance element, if it hasn't already been done; Start a property element, using the stack trace for its value End the property element. Do not end the instance element because there could be more properties coming for this instance.

Throws:
SAXException

writeEmptyElement

private void writeEmptyElement(String uri_,
                               String status_)
                        throws SAXException
Throws:
SAXException

startInstanceIfNeeded

private void startInstanceIfNeeded()
                            throws SAXException
Throws:
SAXException

makeObject

private String makeObject(String str)
                   throws IOException,
                          ClassNotFoundException,
                          Throwable
De-serialize the object. ClassNotFoundException will be thrown if there is a mis-match.

Throws:
ClassNotFoundException
IOException
Throwable

makeString

private void makeString(char[] ch,
                        int start,
                        int length)
Collect the value being read for the Property.


isClassQueueEntry

private boolean isClassQueueEntry(String className)
                           throws RuntimeException
Throws:
RuntimeException

setQuickReport

public void setQuickReport(boolean value)