KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > services > impl > ImplMessages


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.services.impl;
16
17 import java.net.URL JavaDoc;
18 import java.util.ArrayList JavaDoc;
19 import java.util.Collection JavaDoc;
20 import java.util.List JavaDoc;
21 import java.util.Locale JavaDoc;
22
23 import javax.servlet.http.HttpServlet JavaDoc;
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  * @author Howard Lewis Ship
39  * @since 4.0
40  */

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