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