1 /** 2007, Digitalis Informatica. All rights reserved. 2 * 3 * Distribuicao e Gestao de Informatica, Lda. 4 * Estrada de Paco de Arcos num.9 - Piso -1 5 * 2780-666 Paco de Arcos 6 * Telefone: (351) 21 4408990 7 * Fax: (351) 21 4408999 8 * http://www.digitalis.pt 9 */ 10 package pt.digitalis.dif.controller.interfaces; 11 12 import pt.digitalis.dif.exception.controller.BusinessFlowException; 13 import pt.digitalis.dif.exception.controller.ControllerException; 14 15 /** 16 * Defines an error handler for the Controller errors and resulting actions 17 * 18 * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a> 19 * @created Dec 21, 2007 20 */ 21 public interface IDispatcherErrorHandler { 22 23 /** The original request that caused the error attribute name */ 24 final static public String ORIGINAL_REQUEST = "Original Request"; 25 26 /** The exception that caused the error attribute name */ 27 final static public String EXCEPTION = "Exception"; 28 29 /** 30 * Gets the default error response 31 * 32 * @param originalrequest 33 * the request that generated the error 34 * @param exception 35 * the exception that caused the error if available (null otherwise) 36 * @return the default error response 37 */ 38 public IDIFResponse getDefaultErrorResponse(IDIFRequest originalrequest, Exception exception); 39 40 /** 41 * Process an exception and determine the resulting action response 42 * 43 * @param originalRequest 44 * the request that generated the error 45 * @param businessFlowException 46 * @return the calculated response to the given error 47 */ 48 public IDIFResponse processException(IDIFRequest originalRequest, BusinessFlowException businessFlowException); 49 50 /** 51 * Process an exception and determine the resulting action response 52 * 53 * @param originalRequest 54 * the request that generated the error 55 * @param runtimeException 56 * @return the calculated response to the given error 57 */ 58 public IDIFResponse processException(IDIFRequest originalRequest, RuntimeException runtimeException); 59 60 /** 61 * Process an exception and determine the resulting action response 62 * 63 * @param originalRequest 64 * the request that generated the error 65 * @param controllerException 66 * @return the calculated response to the given error 67 */ 68 public IDIFResponse processException(IDIFRequest originalRequest, ControllerException controllerException); 69 }