01: /*
02: * $Id: FatalHandler.java 10789 2008-02-12 20:04:43Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.example.errorhandler.handlers;
12:
13: import org.mule.api.lifecycle.FatalException;
14: import org.mule.example.errorhandler.ErrorMessage;
15: import org.mule.example.errorhandler.HandlerException;
16: import org.mule.example.errorhandler.LocaleMessage;
17: import org.mule.util.StringMessageUtils;
18:
19: import org.apache.commons.logging.Log;
20: import org.apache.commons.logging.LogFactory;
21:
22: /**
23: * <code>FatalBehaviour</code> TODO (document class)
24: */
25: public class FatalHandler extends DefaultHandler {
26: /** logger used by this class */
27: private static final Log logger = LogFactory
28: .getLog(FatalHandler.class);
29:
30: public FatalHandler() {
31: super ();
32: registerException(FatalException.class);
33: }
34:
35: public void processException(ErrorMessage message, Throwable t)
36: throws HandlerException {
37: String msg = LocaleMessage.fatalHandlerMessage();
38: System.out.println(StringMessageUtils.getBoilerPlate(msg));
39: logger.fatal(LocaleMessage.fatalHandlerException(t), t);
40: }
41: }
|