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