KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > impl > message > ExceptionPayload


1 /*
2  * $Id: ExceptionPayload.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.impl.message;
12
13 import org.mule.config.ExceptionHelper;
14 import org.mule.umo.UMOException;
15 import org.mule.umo.UMOExceptionPayload;
16
17 import java.util.Map JavaDoc;
18
19 /**
20  * <code>ExceptionPayload</code> TODO
21  *
22  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
23  * @version $Revision: 3798 $
24  */

25
26 public class ExceptionPayload implements UMOExceptionPayload
27 {
28     /**
29      * Serial version
30      */

31     private static final long serialVersionUID = -7114836033686599024L;
32
33     private int code = 0;
34     private String JavaDoc message = null;
35     private Map JavaDoc info = null;
36     private Throwable JavaDoc exception;
37
38     public ExceptionPayload(Throwable JavaDoc exception)
39     {
40         this.exception = exception;
41         UMOException muleRoot = ExceptionHelper.getRootMuleException(exception);
42         if (muleRoot != null)
43         {
44             message = muleRoot.getMessage();
45             code = muleRoot.getExceptionCode();
46             info = muleRoot.getInfo();
47         }
48         else
49         {
50             message = exception.getMessage();
51         }
52     }
53
54     public Throwable JavaDoc getRootException()
55     {
56         return ExceptionHelper.getRootException(exception);
57     }
58
59     public int getCode()
60     {
61         return code;
62     }
63
64     public String JavaDoc getMessage()
65     {
66         return message;
67     }
68
69     public Map JavaDoc getInfo()
70     {
71         return info;
72     }
73
74     public Throwable JavaDoc getException()
75     {
76         return exception;
77     }
78
79 }
80
Popular Tags