1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
package org.apache.tapestry.services.impl; |
16 |
|
|
17 |
|
import java.net.URL; |
18 |
|
import java.util.ArrayList; |
19 |
|
import java.util.Collection; |
20 |
|
import java.util.List; |
21 |
|
import java.util.Locale; |
22 |
|
|
23 |
|
import javax.servlet.http.HttpServlet; |
24 |
|
|
25 |
|
import org.apache.hivemind.HiveMind; |
26 |
|
import org.apache.hivemind.Location; |
27 |
|
import org.apache.hivemind.Resource; |
28 |
|
import org.apache.hivemind.impl.MessageFormatter; |
29 |
|
import org.apache.tapestry.IComponent; |
30 |
|
import org.apache.tapestry.INamespace; |
31 |
|
import org.apache.tapestry.engine.IEngineService; |
32 |
|
import org.apache.tapestry.parse.OpenToken; |
33 |
|
import org.apache.tapestry.services.Infrastructure; |
34 |
|
import org.apache.tapestry.spec.IComponentSpecification; |
35 |
|
import org.apache.tapestry.spec.IContainedComponent; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
final class ImplMessages |
42 |
|
{ |
43 |
2 |
private static final MessageFormatter _formatter = new MessageFormatter(ImplMessages.class); |
44 |
|
|
45 |
|
|
46 |
0 |
private ImplMessages() { } |
47 |
|
|
48 |
|
static String unknownRequest() |
49 |
|
{ |
50 |
0 |
return _formatter.getMessage("unknown-request"); |
51 |
|
} |
52 |
|
|
53 |
|
static String initializerContribution() |
54 |
|
{ |
55 |
0 |
return _formatter.getMessage("initializer-contribution"); |
56 |
|
} |
57 |
|
|
58 |
|
static String noApplicationSpecification(HttpServlet servlet) |
59 |
|
{ |
60 |
1 |
return _formatter.format("no-application-specification", servlet.getServletName()); |
61 |
|
} |
62 |
|
|
63 |
|
static String errorInstantiatingEngine(Class engineClass, Throwable cause) |
64 |
|
{ |
65 |
1 |
return _formatter.format("error-instantiating-engine", engineClass.getName(), cause); |
66 |
|
} |
67 |
|
|
68 |
|
static String noTemplateForComponent(String componentId, Locale locale) |
69 |
|
{ |
70 |
0 |
return _formatter.format("no-template-for-component", componentId, locale); |
71 |
|
} |
72 |
|
|
73 |
|
static String noTemplateForPage(String pageName, Locale locale) |
74 |
|
{ |
75 |
0 |
return _formatter.format("no-template-for-page", pageName, locale); |
76 |
|
} |
77 |
|
|
78 |
|
static String unableToReadTemplate(Object template) |
79 |
|
{ |
80 |
0 |
return _formatter.format("unable-to-read-template", template); |
81 |
|
} |
82 |
|
|
83 |
|
static String unableToParseTemplate(Resource resource) |
84 |
|
{ |
85 |
0 |
return _formatter.format("unable-to-parse-template", resource); |
86 |
|
} |
87 |
|
|
88 |
|
static String unableToParseSpecification(Resource resource) |
89 |
|
{ |
90 |
0 |
return _formatter.format("unable-to-parse-specification", resource); |
91 |
|
} |
92 |
|
|
93 |
|
static String unableToReadInfrastructureProperty(String propertyName, Infrastructure service, |
94 |
|
Throwable cause) |
95 |
|
{ |
96 |
0 |
return _formatter.format( |
97 |
|
"unable-to-read-infrastructure-property", |
98 |
|
propertyName, |
99 |
|
service, |
100 |
|
cause); |
101 |
|
} |
102 |
|
|
103 |
|
static String multipleComponentReferences(IComponent component, String id) |
104 |
|
{ |
105 |
0 |
return _formatter.format("multiple-component-references", component.getExtendedId(), id); |
106 |
|
} |
107 |
|
|
108 |
|
static String dupeComponentId(String id, IContainedComponent containedComponent) |
109 |
|
{ |
110 |
0 |
return _formatter.format("dupe-component-id", id, HiveMind |
111 |
|
.getLocationString(containedComponent)); |
112 |
|
} |
113 |
|
|
114 |
|
static String unbalancedCloseTags() |
115 |
|
{ |
116 |
0 |
return _formatter.getMessage("unbalanced-close-tags"); |
117 |
|
} |
118 |
|
|
119 |
|
static String templateBindingForInformalParameter(IComponent loadComponent, |
120 |
|
String parameterName, IComponent component) |
121 |
|
{ |
122 |
0 |
return _formatter.format("template-binding-for-informal-parameter", loadComponent |
123 |
|
.getExtendedId(), parameterName, component.getExtendedId()); |
124 |
|
} |
125 |
|
|
126 |
|
static String templateBindingForReservedParameter(IComponent loadComponent, |
127 |
|
String parameterName, IComponent component) |
128 |
|
{ |
129 |
0 |
return _formatter.format("template-binding-for-reserved-parameter", loadComponent |
130 |
|
.getExtendedId(), parameterName, component.getExtendedId()); |
131 |
|
} |
132 |
|
|
133 |
|
static String missingComponentSpec(IComponent component, Collection ids) |
134 |
|
{ |
135 |
0 |
StringBuffer buffer = new StringBuffer(); |
136 |
0 |
List idList = new ArrayList(ids); |
137 |
0 |
int count = idList.size(); |
138 |
|
|
139 |
0 |
for (int i = 0; i < count; i++) |
140 |
|
{ |
141 |
0 |
if (i > 0) |
142 |
0 |
buffer.append(", "); |
143 |
|
|
144 |
0 |
buffer.append(idList.get(i)); |
145 |
|
} |
146 |
|
|
147 |
0 |
return _formatter.format("missing-component-spec", component.getExtendedId(), new Integer( |
148 |
|
count), buffer.toString()); |
149 |
|
} |
150 |
|
|
151 |
|
static String bodylessComponent() |
152 |
|
{ |
153 |
0 |
return _formatter.getMessage("bodyless-component"); |
154 |
|
} |
155 |
|
|
156 |
|
static String dupeTemplateBinding(String name, IComponent component, IComponent loadComponent) |
157 |
|
{ |
158 |
0 |
return _formatter.format( |
159 |
|
"dupe-template-binding", |
160 |
|
name, |
161 |
|
component.getExtendedId(), |
162 |
|
loadComponent.getExtendedId()); |
163 |
|
} |
164 |
|
|
165 |
|
static String unableToLoadProperties(URL url, Throwable cause) |
166 |
|
{ |
167 |
0 |
return _formatter.format("unable-to-load-properties", url, cause); |
168 |
|
} |
169 |
|
|
170 |
|
static String noSuchService(String name) |
171 |
|
{ |
172 |
4 |
return _formatter.format("no-such-service", name); |
173 |
|
} |
174 |
|
|
175 |
|
static String dupeService(String name, EngineServiceContribution existing) |
176 |
|
{ |
177 |
2 |
return _formatter.format("dupe-service", name, HiveMind.getLocationString(existing)); |
178 |
|
} |
179 |
|
|
180 |
|
static String unableToParseExpression(String expression, Throwable cause) |
181 |
|
{ |
182 |
1 |
return _formatter.format("unable-to-parse-expression", expression, cause); |
183 |
|
} |
184 |
|
|
185 |
|
static String parsedExpression() |
186 |
|
{ |
187 |
1 |
return _formatter.getMessage("parsed-expression"); |
188 |
|
} |
189 |
|
|
190 |
|
static String unableToReadExpression(String expression, Object target, Throwable cause) |
191 |
|
{ |
192 |
0 |
return _formatter.format("unable-to-read-expression", expression, target, cause); |
193 |
|
} |
194 |
|
|
195 |
|
static String unableToWriteExpression(String expression, Object target, Object value, |
196 |
|
Throwable cause) |
197 |
|
{ |
198 |
1 |
return _formatter.format("unable-to-write-expression", new Object[] |
199 |
|
{ expression, target, value, cause }); |
200 |
|
} |
201 |
|
|
202 |
|
static String isConstantExpressionError(String expression, Exception ex) |
203 |
|
{ |
204 |
1 |
return _formatter.format("is-constant-expression-error", expression, ex); |
205 |
|
} |
206 |
|
|
207 |
|
static String templateParameterName(String name) |
208 |
|
{ |
209 |
0 |
return _formatter.format("template-parameter-name", name); |
210 |
|
} |
211 |
|
|
212 |
|
static String componentPropertySourceDescription(IComponentSpecification spec) |
213 |
|
{ |
214 |
0 |
return _formatter.format("component-property-source-description", spec |
215 |
|
.getSpecificationLocation()); |
216 |
|
} |
217 |
|
|
218 |
|
static String namespacePropertySourceDescription(INamespace namespace) |
219 |
|
{ |
220 |
0 |
return _formatter |
221 |
|
.format("namespace-property-source-description", namespace.getExtendedId()); |
222 |
|
} |
223 |
|
|
224 |
|
static String invalidEncoding(String encoding, Throwable cause) |
225 |
|
{ |
226 |
1 |
return _formatter.format("invalid-encoding", encoding, cause); |
227 |
|
} |
228 |
|
|
229 |
|
static String errorResetting(Throwable cause) |
230 |
|
{ |
231 |
2 |
return _formatter.format("error-resetting", cause); |
232 |
|
} |
233 |
|
|
234 |
|
static String engineServiceInnerProxyToString(String serviceName) |
235 |
|
{ |
236 |
1 |
return _formatter.format("engine-service-inner-proxy-to-string", serviceName); |
237 |
|
} |
238 |
|
|
239 |
|
static String engineServiceOuterProxyToString(String serviceName) |
240 |
|
{ |
241 |
1 |
return _formatter.format("engine-service-outer-proxy-to-string", serviceName); |
242 |
|
} |
243 |
|
|
244 |
|
static String serviceNameMismatch(IEngineService service, String expectedName, String actualName) |
245 |
|
{ |
246 |
1 |
return _formatter.format("service-name-mismatch", service, expectedName, actualName); |
247 |
|
} |
248 |
|
|
249 |
|
static String infrastructureAlreadyInitialized(String newMode, String initializedMode) |
250 |
|
{ |
251 |
2 |
return _formatter.format("infrastructure-already-initialized", newMode, initializedMode); |
252 |
|
} |
253 |
|
|
254 |
|
static String duplicateInfrastructureContribution(InfrastructureContribution conflict, |
255 |
|
Location existingLocation) |
256 |
|
{ |
257 |
2 |
return _formatter.format( |
258 |
|
"duplicate-infrastructure-contribution", |
259 |
|
conflict.getProperty(), |
260 |
|
conflict.getMode(), |
261 |
|
existingLocation); |
262 |
|
} |
263 |
|
|
264 |
|
static String infrastructureNotInitialized() |
265 |
|
{ |
266 |
2 |
return _formatter.getMessage("infrastructure-not-initialized"); |
267 |
|
} |
268 |
|
|
269 |
|
static String missingInfrastructureProperty(String propertyName) |
270 |
|
{ |
271 |
2 |
return _formatter.format("missing-infrastructure-property", propertyName); |
272 |
|
} |
273 |
|
|
274 |
|
public static String usedTemplateParameterAlias(OpenToken token, String attributeName, |
275 |
|
String parameterName) |
276 |
|
{ |
277 |
0 |
return _formatter.format("used-template-parameter-alias", new Object[] |
278 |
|
{ HiveMind.getLocationString(token), token.getType(), attributeName, parameterName }); |
279 |
|
} |
280 |
|
|
281 |
|
static String engineClassNotFound(String engineClassName) |
282 |
|
{ |
283 |
1 |
return _formatter.format("engine-class-not-found", engineClassName); |
284 |
|
} |
285 |
|
|
286 |
|
static String serviceNameIsNull() |
287 |
|
{ |
288 |
2 |
return _formatter.getMessage("service-name-is-null"); |
289 |
|
} |
290 |
|
} |