com.sas.util.errorhandlers
Class CompositeErrorHandler

com.sas.util.errorhandlers.CompositeErrorHandler
All Implemented Interfaces:
ErrorHandlerInterface

public class CompositeErrorHandler
implements ErrorHandlerInterface

CompositeErrorHandler is a composite errorhandler. It is used to send error messages to two errorhandlers so that both can handle the error. An example of this is if an error should be put up in a messageBox and written to a log as well. To send error messages to more errorhandlers, use multiple CompositeErrorHandler objects:

 ErrorHandlerInterface fgh  = new CompositeErrorHandler(f, new CompositeErrorHandler(g, h));
 ErrorHandlerInterface fghi = new CompositeErrorHandler(new CompositeErrorHandler(f, g),
                                                  new CompositeErrorHandler(h, i));
 


Constructor Summary
CompositeErrorHandler(ErrorHandlerInterface firstErrorHandler, ErrorHandlerInterface secondErrorHandler)
          Default Constructor.
 
Method Summary
 ErrorHandlerInterface getFirst()
          Get the first errorhandler called in handleError.
 ErrorHandlerInterface getSecond()
          Get the second errorhandler called in handleError.
 void handleError(com.sas.ComponentInterface component, com.sas.text.Message message, java.lang.String messageCode)
          Calls handleError on the first and then the second errorhandler.
 void setFirst(ErrorHandlerInterface firstErrorHandler)
          Set the first errorhandler called in handleError.
 void setSecond(ErrorHandlerInterface secondErrorHandler)
          Set the second errorhandler called in handleError.
 

Constructor Detail

CompositeErrorHandler

public CompositeErrorHandler(ErrorHandlerInterface firstErrorHandler,
                             ErrorHandlerInterface secondErrorHandler)
Default Constructor.

Method Detail

getFirst

public ErrorHandlerInterface getFirst()
Get the first errorhandler called in handleError.

Returns:
the first errorhandler called in handleError.

setFirst

public void setFirst(ErrorHandlerInterface firstErrorHandler)
Set the first errorhandler called in handleError.

Parameters:
firstErrorHandler - the first errorhandler called in handleError.

getSecond

public ErrorHandlerInterface getSecond()
Get the second errorhandler called in handleError.

Returns:
the second errorhandler called in handleError.

setSecond

public void setSecond(ErrorHandlerInterface secondErrorHandler)
Set the second errorhandler called in handleError.

Parameters:
secondErrorHandler - the second errorhandler called in handleError.

handleError

public void handleError(com.sas.ComponentInterface component,
                        com.sas.text.Message message,
                        java.lang.String messageCode)
Calls handleError on the first and then the second errorhandler. If an errorhandler is null it is not called.

Specified by:
handleError in interface ErrorHandlerInterface
Parameters:
component - The component on which the error occured.
message - A Message object with formatted with the message to display. The object should also contain the necessary arguments for formatting the message.
messageCode - A non-translatable string which indicates the type of error that occured.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.