1
|
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
package org.apache.hivemind.impl;
|
16
|
|
|
17
|
|
import java.net.URL;
|
18
|
|
import java.util.Collection;
|
19
|
|
import java.util.Iterator;
|
20
|
|
|
21
|
|
import org.apache.hivemind.ClassResolver;
|
22
|
|
import org.apache.hivemind.Element;
|
23
|
|
import org.apache.hivemind.HiveMind;
|
24
|
|
import org.apache.hivemind.Location;
|
25
|
|
import org.apache.hivemind.Occurances;
|
26
|
|
import org.apache.hivemind.Resource;
|
27
|
|
import org.apache.hivemind.events.RegistryShutdownListener;
|
28
|
|
import org.apache.hivemind.internal.ConfigurationPoint;
|
29
|
|
import org.apache.hivemind.internal.ExtensionPoint;
|
30
|
|
import org.apache.hivemind.internal.Module;
|
31
|
|
import org.apache.hivemind.internal.ServiceInterceptorContribution;
|
32
|
|
import org.apache.hivemind.internal.ServicePoint;
|
33
|
|
import org.apache.hivemind.parse.ContributionDescriptor;
|
34
|
|
import org.apache.hivemind.parse.DependencyDescriptor;
|
35
|
|
import org.apache.hivemind.schema.SchemaProcessor;
|
36
|
|
|
37
|
|
|
38
|
|
|
39
|
|
|
40
|
|
|
41
|
|
|
42
|
|
final class ImplMessages
|
43
|
|
{
|
44
|
|
private static final MessageFormatter _formatter = new MessageFormatter(ImplMessages.class,
|
45
|
|
"ImplStrings");
|
46
|
|
|
47
|
1
|
public static String recursiveServiceBuild(ServicePoint point)
|
48
|
|
{
|
49
|
1
|
return _formatter.format("recursive-service-build", point.getExtensionPointId());
|
50
|
|
}
|
51
|
|
|
52
|
0
|
public static String recursiveConfiguration(String pointId)
|
53
|
|
{
|
54
|
0
|
return _formatter.format("recursive-configuration", pointId);
|
55
|
|
}
|
56
|
|
|
57
|
3
|
public static String unableToConstructConfiguration(String pointId, Throwable exception)
|
58
|
|
{
|
59
|
3
|
return _formatter.format("unable-to-construct-configuration", pointId, exception
|
60
|
|
.getMessage());
|
61
|
|
}
|
62
|
|
|
63
|
2
|
public static String unknownServiceModel(String name)
|
64
|
|
{
|
65
|
2
|
return _formatter.format("unknown-service-model", name);
|
66
|
|
}
|
67
|
|
|
68
|
1
|
public static String unknownTranslatorName(String name, String configurationId)
|
69
|
|
{
|
70
|
1
|
return _formatter.format("unknown-translator-name", name, configurationId);
|
71
|
|
}
|
72
|
|
|
73
|
0
|
public static String duplicateTranslatorName(String name, Location oldLocation)
|
74
|
|
{
|
75
|
0
|
return _formatter.format("duplicate-translator-name", name, HiveMind
|
76
|
|
.getLocationString(oldLocation));
|
77
|
|
}
|
78
|
|
|
79
|
0
|
public static String translatorInstantiationFailure(Class translatorClass, Throwable cause)
|
80
|
|
{
|
81
|
0
|
return _formatter.format(
|
82
|
|
"translator-instantiation-failure",
|
83
|
|
translatorClass.getName(),
|
84
|
|
cause);
|
85
|
|
}
|
86
|
|
|
87
|
2
|
public static String noSuchServicePoint(String serviceId)
|
88
|
|
{
|
89
|
2
|
return _formatter.format("no-such-service-point", serviceId);
|
90
|
|
}
|
91
|
|
|
92
|
6
|
public static String unableToLoadClass(String name, ClassLoader loader, Throwable cause)
|
93
|
|
{
|
94
|
6
|
return _formatter.format("unable-to-load-class", name, loader, cause);
|
95
|
|
}
|
96
|
|
|
97
|
0
|
public static String nullInterceptor(ServiceInterceptorContribution contribution,
|
98
|
|
ServicePoint point)
|
99
|
|
{
|
100
|
0
|
return _formatter.format("null-interceptor", contribution.getFactoryServiceId(), point
|
101
|
|
.getExtensionPointId());
|
102
|
|
}
|
103
|
|
|
104
|
0
|
public static String interceptorDoesNotImplementInterface(Object interceptor,
|
105
|
|
ServiceInterceptorContribution contribution, ServicePoint point, Class serviceInterface)
|
106
|
|
{
|
107
|
0
|
return _formatter.format("interceptor-does-not-implement-interface", new Object[]
|
108
|
|
{ interceptor, contribution.getFactoryServiceId(), point.getExtensionPointId(),
|
109
|
|
serviceInterface.getName() });
|
110
|
|
}
|
111
|
|
|
112
|
0
|
public static String unableToReadMessages(URL url)
|
113
|
|
{
|
114
|
0
|
return _formatter.format("unable-to-read-messages", url);
|
115
|
|
}
|
116
|
|
|
117
|
0
|
public static String unableToParse(Resource resource, Throwable cause)
|
118
|
|
{
|
119
|
0
|
return _formatter.format("unable-to-parse", resource, cause);
|
120
|
|
}
|
121
|
|
|
122
|
0
|
public static String unableToFindModules(ClassResolver resolver, Throwable cause)
|
123
|
|
{
|
124
|
0
|
return _formatter.format("unable-to-find-modules", resolver, cause);
|
125
|
|
}
|
126
|
|
|
127
|
1
|
public static String duplicateModuleId(String moduleId, Location locationOfExisting,
|
128
|
|
Location locationOfDuplicate)
|
129
|
|
{
|
130
|
1
|
return _formatter.format(
|
131
|
|
"duplicate-module-id",
|
132
|
|
moduleId,
|
133
|
|
locationOfExisting.getResource(),
|
134
|
|
locationOfDuplicate.getResource());
|
135
|
|
}
|
136
|
|
|
137
|
2
|
public static String duplicateExtensionPointId(String pointId, ExtensionPoint existingPoint)
|
138
|
|
{
|
139
|
2
|
return _formatter.format("duplicate-extension-point", pointId, existingPoint.getLocation());
|
140
|
|
}
|
141
|
|
|
142
|
1
|
public static String unknownConfigurationPoint(String moduleId,
|
143
|
|
ContributionDescriptor descriptor)
|
144
|
|
{
|
145
|
1
|
return _formatter.format("unknown-configuration-extension-point", moduleId, descriptor
|
146
|
|
.getConfigurationId());
|
147
|
|
}
|
148
|
|
|
149
|
0
|
public static String unknownServicePoint(Module sourceModule, String pointId)
|
150
|
|
{
|
151
|
0
|
return _formatter.format(
|
152
|
|
"unknown-service-extension-point",
|
153
|
|
sourceModule.getModuleId(),
|
154
|
|
pointId);
|
155
|
|
}
|
156
|
|
|
157
|
2
|
public static String missingService(ServicePoint point)
|
158
|
|
{
|
159
|
2
|
return _formatter.format("missing-service", point.getExtensionPointId());
|
160
|
|
}
|
161
|
|
|
162
|
0
|
public static String duplicateFactory(Module sourceModule, String pointId,
|
163
|
|
ServicePointImpl existing)
|
164
|
|
{
|
165
|
0
|
return _formatter.format("duplicate-factory", sourceModule.getModuleId(), pointId, existing
|
166
|
|
.getServiceConstructor().getContributingModule().getModuleId());
|
167
|
|
}
|
168
|
|
|
169
|
2
|
public static String wrongNumberOfContributions(ConfigurationPoint point, int actualCount,
|
170
|
|
Occurances expectation)
|
171
|
|
{
|
172
|
2
|
return _formatter.format(
|
173
|
|
"wrong-number-of-contributions",
|
174
|
|
point.getExtensionPointId(),
|
175
|
|
contributionCount(actualCount),
|
176
|
|
occurances(expectation));
|
177
|
|
}
|
178
|
|
|
179
|
4
|
public static String occurances(Occurances occurances)
|
180
|
|
{
|
181
|
4
|
return _formatter.getMessage("occurances." + occurances.getName());
|
182
|
|
}
|
183
|
|
|
184
|
4
|
public static String contributionCount(int count)
|
185
|
|
{
|
186
|
4
|
return _formatter.format("contribution-count", new Integer(count));
|
187
|
|
}
|
188
|
|
|
189
|
2
|
public static String wrongNumberOfParameters(String factoryServiceId, int actualCount,
|
190
|
|
Occurances expectation)
|
191
|
|
{
|
192
|
2
|
return _formatter.format(
|
193
|
|
"wrong-number-of-parameters",
|
194
|
|
factoryServiceId,
|
195
|
|
contributionCount(actualCount),
|
196
|
|
occurances(expectation));
|
197
|
|
|
198
|
|
}
|
199
|
|
|
200
|
1
|
public static String noSuchConfiguration(String pointId)
|
201
|
|
{
|
202
|
1
|
return _formatter.format("no-such-configuration", pointId);
|
203
|
|
}
|
204
|
|
|
205
|
3
|
public static String noSuchSymbol(String name)
|
206
|
|
{
|
207
|
3
|
return _formatter.format("no-such-symbol", name);
|
208
|
|
}
|
209
|
|
|
210
|
3
|
public static String symbolSourceContribution()
|
211
|
|
{
|
212
|
3
|
return _formatter.getMessage("symbol-source-contribution");
|
213
|
|
}
|
214
|
|
|
215
|
1
|
public static String unknownAttribute(String name)
|
216
|
|
{
|
217
|
1
|
return _formatter.format("unknown-attribute", name);
|
218
|
|
}
|
219
|
|
|
220
|
1
|
public static String missingAttribute(String name)
|
221
|
|
{
|
222
|
1
|
return _formatter.format("missing-attribute", name);
|
223
|
|
}
|
224
|
|
|
225
|
1
|
public static String uniqueAttributeConstraintBroken(String name, String value,
|
226
|
|
Location priorLocation)
|
227
|
|
{
|
228
|
1
|
return _formatter.format("unique-attribute-constraint-broken", name, value, priorLocation);
|
229
|
|
}
|
230
|
|
|
231
|
2
|
public static String elementErrors(SchemaProcessor processor, Element element)
|
232
|
|
{
|
233
|
2
|
return _formatter.format("element-errors", processor.getElementPath(), element
|
234
|
|
.getLocation());
|
235
|
|
}
|
236
|
|
|
237
|
1
|
public static String unknownElement(SchemaProcessor processor, Element element)
|
238
|
|
{
|
239
|
1
|
return _formatter.format("unknown-element", processor.getElementPath());
|
240
|
|
}
|
241
|
|
|
242
|
1
|
public static String badInterface(String interfaceName, String pointId)
|
243
|
|
{
|
244
|
1
|
return _formatter.format("bad-interface", interfaceName, pointId);
|
245
|
|
}
|
246
|
|
|
247
|
1
|
public static String interfaceRequired(String interfaceName, String pointId)
|
248
|
|
{
|
249
|
1
|
return _formatter.format("interface-required", interfaceName, pointId);
|
250
|
|
}
|
251
|
|
|
252
|
1
|
public static String serviceWrongInterface(ServicePoint servicePoint, Class requestedInterface)
|
253
|
|
{
|
254
|
1
|
return _formatter.format(
|
255
|
|
"service-wrong-interface",
|
256
|
|
servicePoint.getExtensionPointId(),
|
257
|
|
requestedInterface.getName(),
|
258
|
|
servicePoint.getServiceInterface().getName());
|
259
|
|
}
|
260
|
|
|
261
|
1
|
public static String shutdownCoordinatorFailure(RegistryShutdownListener listener,
|
262
|
|
Throwable cause)
|
263
|
|
{
|
264
|
1
|
return _formatter.format("shutdown-coordinator-failure", listener, cause);
|
265
|
|
}
|
266
|
|
|
267
|
7
|
public static String unlocatedError(String message)
|
268
|
|
{
|
269
|
7
|
return _formatter.format("unlocated-error", message);
|
270
|
|
}
|
271
|
|
|
272
|
34
|
public static String locatedError(Location location, String message)
|
273
|
|
{
|
274
|
34
|
return _formatter.format("located-error", location, message);
|
275
|
|
}
|
276
|
|
|
277
|
16
|
public static String interceptorContribution()
|
278
|
|
{
|
279
|
16
|
return _formatter.getMessage("interceptor-contribution");
|
280
|
|
}
|
281
|
|
|
282
|
2
|
public static String registryAlreadyStarted()
|
283
|
|
{
|
284
|
2
|
return _formatter.getMessage("registry-already-started");
|
285
|
|
}
|
286
|
|
|
287
|
2
|
public static String noServicePointForInterface(Class interfaceClass)
|
288
|
|
{
|
289
|
2
|
return _formatter.format("no-service-point-for-interface", interfaceClass.getName());
|
290
|
|
}
|
291
|
|
|
292
|
1
|
public static String multipleServicePointsForInterface(Class interfaceClass,
|
293
|
|
Collection matchingPoints)
|
294
|
|
{
|
295
|
1
|
StringBuffer buffer = new StringBuffer("{");
|
296
|
|
|
297
|
1
|
boolean following = false;
|
298
|
|
|
299
|
1
|
Iterator i = matchingPoints.iterator();
|
300
|
1
|
while (i.hasNext())
|
301
|
|
{
|
302
|
2
|
if (following)
|
303
|
1
|
buffer.append(", ");
|
304
|
|
|
305
|
2
|
ServicePoint p = (ServicePoint) i.next();
|
306
|
|
|
307
|
2
|
buffer.append(p.getExtensionPointId());
|
308
|
|
|
309
|
2
|
following = true;
|
310
|
|
}
|
311
|
|
|
312
|
1
|
buffer.append("}");
|
313
|
|
|
314
|
1
|
return _formatter.format(
|
315
|
|
"multiple-service-points-for-interface",
|
316
|
|
interfaceClass.getName(),
|
317
|
|
buffer);
|
318
|
|
}
|
319
|
|
|
320
|
1
|
public static String incompleteTranslator(TranslatorContribution c)
|
321
|
|
{
|
322
|
1
|
return _formatter.format("incomplete-translator", c.getName());
|
323
|
|
}
|
324
|
|
|
325
|
2
|
public static String schemaStackViolation(SchemaProcessor processor)
|
326
|
|
{
|
327
|
2
|
return _formatter.format("schema-stack-violation", processor.getElementPath());
|
328
|
|
}
|
329
|
|
|
330
|
1
|
public static String subModuleDoesNotExist(Resource subModuleDescriptor)
|
331
|
|
{
|
332
|
1
|
return _formatter.format("sub-module-does-not-exist", subModuleDescriptor);
|
333
|
|
}
|
334
|
|
|
335
|
1
|
public static String dependencyOnUnknownModule(DependencyDescriptor dependency)
|
336
|
|
{
|
337
|
1
|
return _formatter.format("dependency-on-unknown-module", dependency.getModuleId());
|
338
|
|
}
|
339
|
|
|
340
|
1
|
public static String dependencyVersionMismatch(DependencyDescriptor dependency)
|
341
|
|
{
|
342
|
1
|
return _formatter.format(
|
343
|
|
"dependency-version-mismatch",
|
344
|
|
dependency.getModuleId(),
|
345
|
|
dependency.getVersion());
|
346
|
|
}
|
347
|
|
|
348
|
6
|
private static String convertModule(Module module)
|
349
|
|
{
|
350
|
6
|
if (module == null)
|
351
|
2
|
return _formatter.getMessage("null-module");
|
352
|
|
|
353
|
4
|
return _formatter.format("module", module.getModuleId());
|
354
|
|
}
|
355
|
|
|
356
|
2
|
public static String unableToResolveSchema(String schemaId)
|
357
|
|
{
|
358
|
2
|
return _formatter.format("unable-to-resolve-schema", schemaId);
|
359
|
|
}
|
360
|
|
|
361
|
2
|
public static String schemaNotVisible(String schemaId, String moduleId)
|
362
|
|
{
|
363
|
2
|
return _formatter.format("schema-not-visible", schemaId, moduleId);
|
364
|
|
}
|
365
|
|
|
366
|
4
|
public static String serviceNotVisible(String serviceId, Module module)
|
367
|
|
{
|
368
|
4
|
return _formatter.format("service-not-visible", serviceId, convertModule(module));
|
369
|
|
}
|
370
|
|
|
371
|
2
|
public static String configurationNotVisible(String configurationId, Module module)
|
372
|
|
{
|
373
|
2
|
return _formatter.format(
|
374
|
|
"configuration-not-visible",
|
375
|
|
configurationId,
|
376
|
|
convertModule(module));
|
377
|
|
}
|
378
|
|
|
379
|
1
|
public static String configurationPointNotVisible(ConfigurationPoint point,
|
380
|
|
Module contributingModule)
|
381
|
|
{
|
382
|
1
|
return _formatter.format(
|
383
|
|
"configuration-point-not-visible",
|
384
|
|
point.getExtensionPointId(),
|
385
|
|
contributingModule.getModuleId());
|
386
|
|
}
|
387
|
|
|
388
|
2
|
public static String servicePointNotVisible(ServicePoint point, Module contributingModule)
|
389
|
|
{
|
390
|
2
|
return _formatter.format(
|
391
|
|
"service-point-not-visible",
|
392
|
|
point.getExtensionPointId(),
|
393
|
|
contributingModule.getModuleId());
|
394
|
|
}
|
395
|
|
|
396
|
0
|
public static String unableToMapConfiguration(ConfigurationPoint point)
|
397
|
|
{
|
398
|
0
|
return _formatter.format("unable-to-map-configuration", point.getExtensionPointId());
|
399
|
|
}
|
400
|
|
}
|