KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > samples > errorhandler > BusinessErrorManager


1 /*
2  * $Id: BusinessErrorManager.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.samples.errorhandler;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15 import org.mule.umo.UMOEventContext;
16 import org.mule.umo.UMOException;
17 import org.mule.umo.lifecycle.Callable;
18 import org.mule.util.StringMessageUtils;
19
20 import java.util.ArrayList JavaDoc;
21 import java.util.List JavaDoc;
22
23 /**
24  * <code>BusinessErrorManager</code> TODO (document class)
25  *
26  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
27  * @version $Revision: 3798 $
28  */

29 public class BusinessErrorManager implements Callable
30 {
31     /** logger used by this class */
32     private static transient Log logger = LogFactory.getLog(BusinessErrorManager.class);
33
34     /*
35      * (non-Javadoc)
36      *
37      * @see org.mule.umo.lifecycle.AsynchronousCallable#onEvent(org.mule.umo.UMOEvent)
38      */

39     public Object JavaDoc onCall(UMOEventContext context) throws UMOException
40     {
41         ErrorMessage msg = (ErrorMessage)context.getTransformedMessage();
42         // Do something with the error message
43
List JavaDoc msgs = new ArrayList JavaDoc();
44         msgs.add("Received Error Message in the Sample Business Error Manager.");
45         msgs.add("Error is: " + msg.getException().getDetailMessage());
46         msgs.add("Error class: " + msg.getException().getClass().getName());
47
48         logger.info("\n" + StringMessageUtils.getBoilerPlate(msgs, '*', 80));
49         context.setStopFurtherProcessing(true);
50         return null;
51     }
52
53 }
54
Popular Tags