1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.example.errorhandler; |
12 | |
|
13 | |
import org.mule.config.i18n.MessageFactory; |
14 | |
import org.mule.util.ObjectUtils; |
15 | |
import org.mule.util.StringMessageUtils; |
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | 0 | public class LocaleMessage extends MessageFactory |
23 | |
{ |
24 | 0 | private static final LocaleMessage factory = new LocaleMessage(); |
25 | |
|
26 | |
private static final String BUNDLE_PATH = "messages.errorhandler-example-messages"; |
27 | |
|
28 | |
public static String unretrievedException(Exception e) |
29 | |
{ |
30 | 0 | return factory.getString(BUNDLE_PATH, 1, e); |
31 | |
} |
32 | |
|
33 | |
public static String unhandledException(Class<?> class1, Class<?> class2) |
34 | |
{ |
35 | 0 | return factory.getString(BUNDLE_PATH, 2, StringMessageUtils.toString(class1), |
36 | |
StringMessageUtils.toString(class2)); |
37 | |
} |
38 | |
|
39 | |
public static String businessErrorManagerError() |
40 | |
{ |
41 | 0 | return factory.getString(BUNDLE_PATH, 3); |
42 | |
} |
43 | |
|
44 | |
public static String errorDetail(String detailMessage) |
45 | |
{ |
46 | 0 | return factory.getString(BUNDLE_PATH, 4, detailMessage); |
47 | |
} |
48 | |
|
49 | |
public static String errorClass(Class<?> class1) |
50 | |
{ |
51 | 0 | return factory.getString(BUNDLE_PATH, 5, class1.getName()); |
52 | |
} |
53 | |
|
54 | |
public static String handlerFailure(ExceptionHandler eh) |
55 | |
{ |
56 | 0 | String handlerDescription = ObjectUtils.toString(eh.getClass().getName(), "null"); |
57 | 0 | return factory.getString(BUNDLE_PATH, 6, handlerDescription); |
58 | |
} |
59 | |
|
60 | |
public static String defaultFatalHandling(Class<?> class1) |
61 | |
{ |
62 | 0 | return factory.getString(BUNDLE_PATH, 7, StringMessageUtils.toString(class1)); |
63 | |
} |
64 | |
|
65 | |
public static String fatalHandling(Exception e) |
66 | |
{ |
67 | 0 | return factory.getString(BUNDLE_PATH, 8, e); |
68 | |
} |
69 | |
|
70 | |
public static String defaultHandling(Class<?> class1, ExceptionHandler eh, Exception e) |
71 | |
{ |
72 | 0 | return factory.getString(BUNDLE_PATH, 9, StringMessageUtils.toString(class1), |
73 | |
ObjectUtils.toString(eh.getClass().getName() + " : " + e, "null")); |
74 | |
} |
75 | |
|
76 | |
public static String defaultException(Exception e) |
77 | |
{ |
78 | 0 | return factory.getString(BUNDLE_PATH, 10, e); |
79 | |
} |
80 | |
|
81 | |
public static String defaultHandlerException(HandlerException e) |
82 | |
{ |
83 | 0 | return factory.getString(BUNDLE_PATH, 11, e); |
84 | |
} |
85 | |
|
86 | |
public static String fatalException(Throwable t) |
87 | |
{ |
88 | 0 | return factory.getString(BUNDLE_PATH, 12, t); |
89 | |
} |
90 | |
|
91 | |
public static String businessHandlerMessage() |
92 | |
{ |
93 | 0 | return factory.getString(BUNDLE_PATH, 13); |
94 | |
} |
95 | |
|
96 | |
public static String defaultHandlerMessage() |
97 | |
{ |
98 | 0 | return factory.getString(BUNDLE_PATH, 14); |
99 | |
} |
100 | |
|
101 | |
public static String fatalHandlerMessage() |
102 | |
{ |
103 | 0 | return factory.getString(BUNDLE_PATH, 15); |
104 | |
} |
105 | |
|
106 | |
public static String fatalHandlerException(Throwable t) |
107 | |
{ |
108 | 0 | return factory.getString(BUNDLE_PATH, 16, t); |
109 | |
} |
110 | |
|
111 | |
@Override |
112 | |
protected ClassLoader getClassLoader() |
113 | |
{ |
114 | 0 | return getClass().getClassLoader(); |
115 | |
} |
116 | |
} |