org.apache.servicemix.validation.handler
Class MessageAggregatingErrorHandler

java.lang.Object
  extended by org.apache.servicemix.validation.handler.MessageAggregatingErrorHandler
All Implemented Interfaces:
MessageAwareErrorHandler, org.xml.sax.ErrorHandler

public class MessageAggregatingErrorHandler
extends java.lang.Object
implements MessageAwareErrorHandler

An implementation of ErrorHandler which aggregates all warnings and error messages into a StringBuffer.

Version:
$Revision: 359186 $

Constructor Summary
MessageAggregatingErrorHandler(java.lang.String rootPath, java.lang.String namespace, boolean includeStackTraces)
          Constructor.
 
Method Summary
 boolean capturesMessages()
          Does this ErrorHandler implementation capture error messages?
 void error(org.xml.sax.SAXParseException e)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
 int getErrorCount()
          Return the number of errors.
 int getFatalErrorCount()
          Return the number of fatal errors.
 java.lang.Object getMessagesAs(java.lang.Class format)
          Get the messages from this ErrorHandler in a particular format.
 int getWarningCount()
          Return the number of warnings.
 boolean hasErrors()
          Does the error handler contain any error messages?
 boolean supportsMessageFormat(java.lang.Class format)
          Does the message support a given format?
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageAggregatingErrorHandler

public MessageAggregatingErrorHandler(java.lang.String rootPath,
                                      java.lang.String namespace,
                                      boolean includeStackTraces)
                               throws java.lang.IllegalArgumentException
Constructor.

Parameters:
rootElement - The root element name of the fault xml message
namespace - The namespace for the fault xml message
includeStackTraces - Include stracktraces in the final output
Throws:
java.lang.IllegalArgumentException
Method Detail

hasErrors

public boolean hasErrors()
Description copied from interface: MessageAwareErrorHandler
Does the error handler contain any error messages?

Specified by:
hasErrors in interface MessageAwareErrorHandler
Returns:

getWarningCount

public int getWarningCount()
Description copied from interface: MessageAwareErrorHandler
Return the number of warnings.

Specified by:
getWarningCount in interface MessageAwareErrorHandler
Returns:

getErrorCount

public int getErrorCount()
Description copied from interface: MessageAwareErrorHandler
Return the number of errors.

Specified by:
getErrorCount in interface MessageAwareErrorHandler
Returns:

getFatalErrorCount

public int getFatalErrorCount()
Description copied from interface: MessageAwareErrorHandler
Return the number of fatal errors.

Specified by:
getFatalErrorCount in interface MessageAwareErrorHandler
Returns:

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Specified by:
warning in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

capturesMessages

public boolean capturesMessages()
Description copied from interface: MessageAwareErrorHandler
Does this ErrorHandler implementation capture error messages?

Specified by:
capturesMessages in interface MessageAwareErrorHandler
Returns:

getMessagesAs

public java.lang.Object getMessagesAs(java.lang.Class format)
                               throws javax.jbi.messaging.MessagingException
Description copied from interface: MessageAwareErrorHandler
Get the messages from this ErrorHandler in a particular format.

Specified by:
getMessagesAs in interface MessageAwareErrorHandler
Returns:
Throws:
javax.jbi.messaging.MessagingException

supportsMessageFormat

public boolean supportsMessageFormat(java.lang.Class format)
Description copied from interface: MessageAwareErrorHandler
Does the message support a given format?

Specified by:
supportsMessageFormat in interface MessageAwareErrorHandler
Returns:


Copyright © 2005-2011 FuseSource. All Rights Reserved.