Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
Infrastructure |
|
| 1.0;1 |
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; |
|
16 | ||
17 | import java.util.Locale; |
|
18 | ||
19 | import org.apache.hivemind.ClassResolver; |
|
20 | import org.apache.hivemind.Resource; |
|
21 | import org.apache.tapestry.IRequestCycle; |
|
22 | import org.apache.tapestry.asset.AssetFactory; |
|
23 | import org.apache.tapestry.coerce.ValueConverter; |
|
24 | import org.apache.tapestry.describe.HTMLDescriber; |
|
25 | import org.apache.tapestry.engine.IPageSource; |
|
26 | import org.apache.tapestry.engine.IPropertySource; |
|
27 | import org.apache.tapestry.engine.IScriptSource; |
|
28 | import org.apache.tapestry.engine.ISpecificationSource; |
|
29 | import org.apache.tapestry.engine.state.ApplicationStateManager; |
|
30 | import org.apache.tapestry.error.ExceptionPresenter; |
|
31 | import org.apache.tapestry.error.RequestExceptionReporter; |
|
32 | import org.apache.tapestry.error.StaleLinkExceptionPresenter; |
|
33 | import org.apache.tapestry.error.StaleSessionExceptionPresenter; |
|
34 | import org.apache.tapestry.listener.ListenerInvoker; |
|
35 | import org.apache.tapestry.listener.ListenerMapSource; |
|
36 | import org.apache.tapestry.markup.MarkupWriterSource; |
|
37 | import org.apache.tapestry.spec.IApplicationSpecification; |
|
38 | import org.apache.tapestry.web.WebRequest; |
|
39 | import org.apache.tapestry.web.WebResponse; |
|
40 | ||
41 | /** |
|
42 | * Tapestry infrastructure ... key services required by the |
|
43 | * {@link org.apache.tapestry.IEngine} instance. |
|
44 | * |
|
45 | * @author Howard Lewis Ship |
|
46 | * @since 4.0 |
|
47 | */ |
|
48 | public interface Infrastructure |
|
49 | { |
|
50 | ||
51 | /** |
|
52 | * Initializes the Infrastructure for a particular mode. |
|
53 | * |
|
54 | * @throws IllegalStateException |
|
55 | * if the Infrastructure has already been initialized. |
|
56 | */ |
|
57 | ||
58 | void initialize(String mode); |
|
59 | ||
60 | /** |
|
61 | * Returns a named property. |
|
62 | * |
|
63 | * @throws IllegalStateException |
|
64 | * if the Infrastructure has not yet been initialized. |
|
65 | * @throws org.apache.hivemind.ApplicationRuntimeException |
|
66 | * if no value has been contributed for specified property name. |
|
67 | */ |
|
68 | ||
69 | Object getProperty(String propertyName); |
|
70 | ||
71 | /** |
|
72 | * Returns the {@link org.apache.tapestry.spec.IApplicationSpecification} for |
|
73 | * the current application. |
|
74 | */ |
|
75 | ||
76 | IApplicationSpecification getApplicationSpecification(); |
|
77 | ||
78 | /** |
|
79 | * Returns an {@link IPropertySource} configured to search the |
|
80 | * application specification, etc. See |
|
81 | * <code>tapestry.ApplicationPropertySource</code>. |
|
82 | */ |
|
83 | IPropertySource getApplicationPropertySource(); |
|
84 | ||
85 | /** |
|
86 | * Returns an {@link IPropertySource} configured to search the |
|
87 | * servlet, servlet context, and factory defaults. |
|
88 | */ |
|
89 | ||
90 | IPropertySource getGlobalPropertySource(); |
|
91 | ||
92 | /** |
|
93 | * Returns the coordinator to be notified of reset events (which will, in |
|
94 | * turn, notify other services that they should discard cached data). |
|
95 | */ |
|
96 | ||
97 | ResetEventHub getResetEventHub(); |
|
98 | ||
99 | /** |
|
100 | * Returns the source of component message bundles. |
|
101 | */ |
|
102 | ||
103 | ComponentMessagesSource getComponentMessagesSource(); |
|
104 | ||
105 | /** |
|
106 | * Returns component or page template contents. |
|
107 | */ |
|
108 | ||
109 | TemplateSource getTemplateSource(); |
|
110 | ||
111 | /** |
|
112 | * Returns the source of all application, page, component and library |
|
113 | * specifications. |
|
114 | */ |
|
115 | ||
116 | ISpecificationSource getSpecificationSource(); |
|
117 | ||
118 | /** |
|
119 | * Returns a generic, shared ObjectPool instance. |
|
120 | */ |
|
121 | ObjectPool getObjectPool(); |
|
122 | ||
123 | /** |
|
124 | * Returns the source for pages. The source is a cache of pages, but also |
|
125 | * can create new instances when needed. |
|
126 | */ |
|
127 | ||
128 | IPageSource getPageSource(); |
|
129 | ||
130 | /** |
|
131 | * Returns the ClassResolver used by the Tapestry HiveMind module, which |
|
132 | * should be sufficient for use throughout the application. |
|
133 | */ |
|
134 | ||
135 | ClassResolver getClassResolver(); |
|
136 | ||
137 | /** |
|
138 | * The DataSqueezer, used when constructing and decoding values stored in |
|
139 | * URLs (as query parameters or hidden form fields). |
|
140 | */ |
|
141 | ||
142 | DataSqueezer getDataSqueezer(); |
|
143 | ||
144 | /** |
|
145 | * The source for ready-to-execute versions of Tapestry script templates. |
|
146 | */ |
|
147 | ||
148 | IScriptSource getScriptSource(); |
|
149 | ||
150 | /** |
|
151 | * The object from which engine services are obtained. |
|
152 | */ |
|
153 | ||
154 | ServiceMap getServiceMap(); |
|
155 | ||
156 | /** |
|
157 | * Service used to report exceptions to the console. |
|
158 | */ |
|
159 | ||
160 | RequestExceptionReporter getRequestExceptionReporter(); |
|
161 | ||
162 | /** |
|
163 | * Renders the active page as the response. |
|
164 | */ |
|
165 | ||
166 | ResponseRenderer getResponseRenderer(); |
|
167 | ||
168 | /** |
|
169 | * Constructs {@link org.apache.tapestry.engine.ILink} instances for |
|
170 | * {@link org.apache.tapestry.engine.IEngineService}s. |
|
171 | */ |
|
172 | ||
173 | LinkFactory getLinkFactory(); |
|
174 | ||
175 | /** |
|
176 | * Used by the {@link org.apache.tapestry.IEngine} to create instances |
|
177 | * of {@link org.apache.tapestry.IRequestCycle}. |
|
178 | */ |
|
179 | ||
180 | RequestCycleFactory getRequestCycleFactory(); |
|
181 | ||
182 | /** |
|
183 | * Accesses application state objects (Visit and Global from Tapestry 3.0, |
|
184 | * but now more can be created). |
|
185 | */ |
|
186 | ||
187 | ApplicationStateManager getApplicationStateManager(); |
|
188 | ||
189 | /** |
|
190 | * Returns the request for the current request cycle. |
|
191 | */ |
|
192 | ||
193 | WebRequest getRequest(); |
|
194 | ||
195 | /** |
|
196 | * Returns the response for the current request cycle. |
|
197 | */ |
|
198 | ||
199 | WebResponse getResponse(); |
|
200 | ||
201 | /** |
|
202 | * Returns the context path, which identifies the application within the |
|
203 | * application server. Context path should be used as a prefix for any URLs |
|
204 | * generated. The context path may be the empty string, and will not end in |
|
205 | * a slash (servlet paths should start with a slash). |
|
206 | */ |
|
207 | ||
208 | String getContextPath(); |
|
209 | ||
210 | /** |
|
211 | * Returns the application's id; a unique name that is incorporated into |
|
212 | * various session attribute keys and into certain paths when searching for |
|
213 | * resources. For a servlet-based Tapestry application, the id is the name |
|
214 | * of the servlet. |
|
215 | */ |
|
216 | ||
217 | String getApplicationId(); |
|
218 | ||
219 | /** |
|
220 | * Returns the root context resource, which is the starting point when |
|
221 | * looking for resources within the application. |
|
222 | */ |
|
223 | ||
224 | Resource getContextRoot(); |
|
225 | ||
226 | /** |
|
227 | * Returns an object used to access component meta-data properties. |
|
228 | */ |
|
229 | ||
230 | ComponentPropertySource getComponentPropertySource(); |
|
231 | ||
232 | /** |
|
233 | * Invoked when the locale for the current thread is changed. |
|
234 | * |
|
235 | * @see org.apache.tapestry.IEngine#setLocale(Locale) |
|
236 | */ |
|
237 | ||
238 | void setLocale(Locale value); |
|
239 | ||
240 | String getOutputEncoding(); |
|
241 | ||
242 | MarkupWriterSource getMarkupWriterSource(); |
|
243 | ||
244 | HTMLDescriber getHTMLDescriber(); |
|
245 | ||
246 | /** |
|
247 | * Responsible for presenting an exception error report to the user. |
|
248 | */ |
|
249 | ||
250 | ExceptionPresenter getExceptionPresenter(); |
|
251 | ||
252 | /** |
|
253 | * The source for {@link org.apache.tapestry.listener.ListenerMap}s, for |
|
254 | * components or other objects. |
|
255 | */ |
|
256 | ||
257 | ListenerMapSource getListenerMapSource(); |
|
258 | ||
259 | /** |
|
260 | * The service responsible for reporting |
|
261 | * {@link org.apache.tapestry.StaleSessionException}s. |
|
262 | */ |
|
263 | ||
264 | StaleSessionExceptionPresenter getStaleSessionExceptionPresenter(); |
|
265 | ||
266 | /** |
|
267 | * The service responsible for reporting |
|
268 | * {@link org.apache.tapestry.StaleLinkException}s. |
|
269 | */ |
|
270 | ||
271 | StaleLinkExceptionPresenter getStaleLinkExceptionPresenter(); |
|
272 | ||
273 | /** |
|
274 | * Service used to convert and coerce types. |
|
275 | */ |
|
276 | ||
277 | ValueConverter getValueConverter(); |
|
278 | ||
279 | /** |
|
280 | * Service (possibly a pipeline) that will invoke |
|
281 | * {@link org.apache.tapestry.IActionListener} objects. |
|
282 | */ |
|
283 | ||
284 | ListenerInvoker getListenerInvoker(); |
|
285 | ||
286 | /** |
|
287 | * Service that is used to convert {@link org.apache.hivemind.Resource}s |
|
288 | * into {@link org.apache.tapestry.IAsset}s. |
|
289 | */ |
|
290 | ||
291 | AssetFactory getAssetFactory(); |
|
292 | ||
293 | /** |
|
294 | * Service used to access HTTP Cookies. This is only available for Servlet |
|
295 | * Tapestry; a placeholder will be provided for Portlet Tapestry. |
|
296 | */ |
|
297 | ||
298 | CookieSource getCookieSource(); |
|
299 | ||
300 | /** |
|
301 | * Used to search for a class name within a list of packages. |
|
302 | */ |
|
303 | ||
304 | ClassFinder getClassFinder(); |
|
305 | ||
306 | /** |
|
307 | * Returns the request cycle for the current thread. |
|
308 | */ |
|
309 | IRequestCycle getRequestCycle(); |
|
310 | } |