1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.hivemind.service.impl; |
16 |
| |
17 |
| import java.beans.EventSetDescriptor; |
18 |
| |
19 |
| import javassist.CtClass; |
20 |
| import javassist.CtMethod; |
21 |
| |
22 |
| import org.apache.hivemind.InterceptorStack; |
23 |
| import org.apache.hivemind.Location; |
24 |
| import org.apache.hivemind.impl.MessageFormatter; |
25 |
| import org.apache.hivemind.service.MethodSignature; |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| class ServiceMessages |
33 |
| { |
34 |
| protected static MessageFormatter _formatter = new MessageFormatter(ServiceMessages.class); |
35 |
| |
36 |
3
| static String unableToInitializeService(String serviceId, String methodName,
|
37 |
| Class serviceClass, Throwable ex) |
38 |
| { |
39 |
3
| return _formatter.format("unable-to-initialize-service", new Object[]
|
40 |
| { serviceId, methodName, serviceClass.getName(), ex }); |
41 |
| } |
42 |
| |
43 |
0
| static String errorInstantiatingInterceptor(String serviceId, InterceptorStack stack,
|
44 |
| Class interceptorClass, Throwable cause) |
45 |
| { |
46 |
0
| return _formatter.format("error-instantiating-interceptor", new Object[]
|
47 |
| { serviceId, stack.getServiceInterface().getName(), stack.getServiceExtensionPointId(), |
48 |
| interceptorClass.getName(), cause }); |
49 |
| } |
50 |
| |
51 |
0
| static String unableToAddField(String fieldName, CtClass ctClass, Throwable cause)
|
52 |
| { |
53 |
0
| return _formatter.format("unable-to-add-field", fieldName, ctClass.getName(), cause);
|
54 |
| } |
55 |
| |
56 |
1
| static String unableToAddMethod(MethodSignature methodSignature, CtClass ctClass,
|
57 |
| Throwable cause) |
58 |
| { |
59 |
1
| return _formatter.format("unable-to-add-method", methodSignature, ctClass.getName(), cause);
|
60 |
| } |
61 |
| |
62 |
1
| static String unableToAddConstructor(CtClass ctClass, Throwable cause)
|
63 |
| { |
64 |
1
| return _formatter.format("unable-to-add-constructor", ctClass.getName(), cause);
|
65 |
| } |
66 |
| |
67 |
3
| static String unableToWriteClass(CtClass ctClass, Throwable cause)
|
68 |
| { |
69 |
3
| return _formatter.format("unable-to-write-class", ctClass.getName(), cause);
|
70 |
| } |
71 |
| |
72 |
0
| static String unableToCreateClass(String name, Class superClass, Throwable cause)
|
73 |
| { |
74 |
0
| return _formatter.format("unable-to-create-class", name, superClass.getName(), cause);
|
75 |
| } |
76 |
| |
77 |
0
| static String unableToLookupClass(String name, Throwable cause)
|
78 |
| { |
79 |
0
| return _formatter.format("unable-to-lookup", name, cause);
|
80 |
| } |
81 |
| |
82 |
1
| static String notCompatibleWithEvent(Object consumer, EventSetDescriptor set, Object producer)
|
83 |
| { |
84 |
1
| return _formatter.format("not-compatible-with-event", new Object[]
|
85 |
| { consumer, set.getListenerType().getName(), set.getName(), producer }); |
86 |
| } |
87 |
| |
88 |
1
| static String noSuchEventSet(Object producer, String name)
|
89 |
| { |
90 |
1
| return _formatter.format("no-such-event-set", producer, name);
|
91 |
| } |
92 |
| |
93 |
2
| static String noEventMatches(Object consumer, Object producer)
|
94 |
| { |
95 |
2
| return _formatter.format("no-event-matches", consumer, producer);
|
96 |
| } |
97 |
| |
98 |
0
| static String unableToAddListener(Object producer, EventSetDescriptor set, Object consumer,
|
99 |
| Location location, Throwable cause) |
100 |
| { |
101 |
0
| return _formatter.format("unable-to-add-listener", new Object[]
|
102 |
| { consumer, producer, set.getName(), location, cause }); |
103 |
| } |
104 |
| |
105 |
0
| static String unableToIntrospectClass(Class targetClass, Throwable cause)
|
106 |
| { |
107 |
0
| return _formatter.format("unable-to-introspect-class", targetClass.getName(), cause);
|
108 |
| } |
109 |
| |
110 |
1
| static String unableToAddCatch(Class exceptionClass, CtMethod method, Throwable cause)
|
111 |
| { |
112 |
1
| return _formatter.format("unable-to-add-catch", exceptionClass.getName(), method
|
113 |
| .getDeclaringClass().getName(), cause); |
114 |
| } |
115 |
| |
116 |
1
| static String duplicateMethodInClass(MethodSignature ms, ClassFabImpl cf)
|
117 |
| { |
118 |
1
| return _formatter.format("duplicate-method-in-class", ms, cf.getName());
|
119 |
| } |
120 |
| |
121 |
1
| static String unableToExtendMethod(MethodSignature ms, String className, Throwable cause)
|
122 |
| { |
123 |
1
| return _formatter.format("unable-to-extend-method", ms, className, cause);
|
124 |
| } |
125 |
| |
126 |
1
| static String invalidProviderSelector(String selector)
|
127 |
| { |
128 |
1
| return _formatter.format("invalid-provider-selector", selector);
|
129 |
| } |
130 |
| |
131 |
1
| static String unknownProviderPrefix(String prefix)
|
132 |
| { |
133 |
1
| return _formatter.format("unknown-provider-prefix", prefix);
|
134 |
| } |
135 |
| |
136 |
0
| static String duplicateProviderPrefix(String prefix, Location priorLocation)
|
137 |
| { |
138 |
0
| return _formatter.format("duplicate-provider-prefix", prefix, priorLocation);
|
139 |
| } |
140 |
| |
141 |
2
| static String invalidServicePropertyLocator(String locator)
|
142 |
| { |
143 |
2
| return _formatter.format("invalid-service-property-locator", locator);
|
144 |
| } |
145 |
| |
146 |
1
| static String failureBuildingService(String serviceId, Throwable cause)
|
147 |
| { |
148 |
1
| return _formatter.format("failure-building-service", serviceId, cause);
|
149 |
| } |
150 |
| |
151 |
0
| static String autowirePropertyFailure(String propertyName, String serviceId, Throwable cause)
|
152 |
| { |
153 |
0
| return _formatter.format("autowire-property-failure", propertyName, serviceId, cause);
|
154 |
| } |
155 |
| |
156 |
1
| static String unableToFindAutowireConstructor()
|
157 |
| { |
158 |
1
| return _formatter.getMessage("unable-to-find-autowire-constructor");
|
159 |
| } |
160 |
| |
161 |
| |
162 |
1
| static String unableToCreateInterface(String name, Exception cause)
|
163 |
| { |
164 |
1
| return _formatter.format("unable-to-create-interface", name, cause);
|
165 |
| } |
166 |
| |
167 |
| |
168 |
| |
169 |
1
| static String threadCleanupException(Throwable cause)
|
170 |
| { |
171 |
1
| return _formatter.format("thread-cleanup-exception", cause);
|
172 |
| } |
173 |
| } |