net.shibboleth.metadata.dom
Class AbstractXSLProcessingStage.StatusInfoAppendingErrorListener

java.lang.Object
  extended by net.shibboleth.metadata.dom.AbstractXSLProcessingStage.StatusInfoAppendingErrorListener
All Implemented Interfaces:
ErrorListener
Enclosing class:
AbstractXSLProcessingStage

public class AbstractXSLProcessingStage.StatusInfoAppendingErrorListener
extends Object
implements ErrorListener

Transformer ErrorListener that sets an ErrorStatus or WarningStatus on its Item depending on the TransformerException message. If the message begins with "[ERROR]" the remainder of the error message is used as the message for the added ErrorStatus. If the message begins with "[WARN]" the remainder of the error message is used as the message for the added WarningStatus. If the message begins with "[INFO]" the remainder of the error message is used as the message for the added InfoStatus. If the message does not begin with either prefix the exception is re-thrown to be handed by the Transformer. This listener works well in conjunction with <xsl:message>


Field Summary
static String ERROR_PREFIX
          Prefix used by messages that result in an ErrorStatus.
static String INFO_PREFIX
          Prefix used by messages that result in an InfoStatus.
private  Item<?> item
          Item to which the status info will be appended.
static String WARN_PREFIX
          Prefix used by messages that result in an WarningStatus.
 
Constructor Summary
AbstractXSLProcessingStage.StatusInfoAppendingErrorListener(Item<?> receivingItem)
          Constructor.
 
Method Summary
 void error(TransformerException e)
          
 void fatalError(TransformerException e)
          
private  void parseAndAppendStatusInfo(TransformerException e)
          Parses the error message and appends the appropriate status info to the Item.
 void warning(TransformerException e)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_PREFIX

public static final String ERROR_PREFIX
Prefix used by messages that result in an ErrorStatus.

See Also:
Constant Field Values

WARN_PREFIX

public static final String WARN_PREFIX
Prefix used by messages that result in an WarningStatus.

See Also:
Constant Field Values

INFO_PREFIX

public static final String INFO_PREFIX
Prefix used by messages that result in an InfoStatus.

See Also:
Constant Field Values

item

private Item<?> item
Item to which the status info will be appended.

Constructor Detail

AbstractXSLProcessingStage.StatusInfoAppendingErrorListener

public AbstractXSLProcessingStage.StatusInfoAppendingErrorListener(@Nonnull
                                                                   Item<?> receivingItem)
Constructor.

Parameters:
receivingItem - that Item to which the status info will be appended
Method Detail

error

public void error(@Nonnull
                  TransformerException e)
           throws TransformerException

Specified by:
error in interface ErrorListener
Throws:
TransformerException

fatalError

public void fatalError(@Nonnull
                       TransformerException e)
                throws TransformerException

Specified by:
fatalError in interface ErrorListener
Throws:
TransformerException

warning

public void warning(@Nonnull
                    TransformerException e)
             throws TransformerException

Specified by:
warning in interface ErrorListener
Throws:
TransformerException

parseAndAppendStatusInfo

private void parseAndAppendStatusInfo(@Nonnull
                                      TransformerException e)
                               throws TransformerException
Parses the error message and appends the appropriate status info to the Item.

Parameters:
e - the error to parse
Throws:
TransformerException - thrown if the error does not contain the appropriate message prefix


Copyright © 1999-2012. All Rights Reserved.