Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TemplateService |
|
| 1.0;1 |
1 | package org.apache.fulcrum.template; | |
2 | ||
3 | ||
4 | /* | |
5 | * Licensed to the Apache Software Foundation (ASF) under one | |
6 | * or more contributor license agreements. See the NOTICE file | |
7 | * distributed with this work for additional information | |
8 | * regarding copyright ownership. The ASF licenses this file | |
9 | * to you under the Apache License, Version 2.0 (the | |
10 | * "License"); you may not use this file except in compliance | |
11 | * with the License. You may obtain a copy of the License at | |
12 | * | |
13 | * http://www.apache.org/licenses/LICENSE-2.0 | |
14 | * | |
15 | * Unless required by applicable law or agreed to in writing, | |
16 | * software distributed under the License is distributed on an | |
17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
18 | * KIND, either express or implied. See the License for the | |
19 | * specific language governing permissions and limitations | |
20 | * under the License. | |
21 | */ | |
22 | ||
23 | ||
24 | import java.io.OutputStream; | |
25 | import java.io.Writer; | |
26 | ||
27 | /** | |
28 | * This service provides a method for mapping templates to their | |
29 | * appropriate Screens or Navigations. It also allows templates to | |
30 | * define a layout/navigations/screen modularization within the | |
31 | * template structure. It also performs caching if turned on in the | |
32 | * properties file. | |
33 | * | |
34 | * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a> | |
35 | * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> | |
36 | * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> | |
37 | * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a> | |
38 | * @version $Id: TemplateService.java 535465 2007-05-05 06:58:06Z tv $ | |
39 | */ | |
40 | public interface TemplateService | |
41 | { | |
42 | ||
43 | String ROLE = TemplateService.class.getName(); | |
44 | ||
45 | /** | |
46 | * The key to the template context. | |
47 | */ | |
48 | public static final String CONTEXT = "TEMPLATE_CONTEXT"; | |
49 | ||
50 | /** | |
51 | * Translates the supplied template paths into their Turbine-canonical | |
52 | * equivalent (probably absolute paths). | |
53 | * | |
54 | * @param templatePaths An array of template paths. | |
55 | * @return An array of translated template paths. | |
56 | */ | |
57 | public String[] translateTemplatePaths(String[] templatePaths); | |
58 | ||
59 | /** | |
60 | * Delegates to the appropriate {@link | |
61 | * org.apache.fulcrum.template.TemplateEngineService} to | |
62 | * check the existance of the specified template. | |
63 | * | |
64 | * @param template The template to check for the existance of. | |
65 | * @param templatePaths The paths to check for the template. | |
66 | */ | |
67 | public boolean templateExists(String template, | |
68 | String[] templatePaths); | |
69 | ||
70 | /** | |
71 | * Registers the provided template engine for use by the | |
72 | * <code>TemplateService</code>. | |
73 | * | |
74 | * @param service The <code>TemplateEngineService</code> to register. | |
75 | */ | |
76 | public void registerTemplateEngineService(TemplateEngineService service); | |
77 | ||
78 | public String handleRequest(TemplateContext context, String template) | |
79 | throws TemplateException; | |
80 | ||
81 | public void handleRequest(TemplateContext context, String template, | |
82 | OutputStream outputStream) | |
83 | throws TemplateException; | |
84 | ||
85 | public void handleRequest(TemplateContext context, String template, | |
86 | Writer writer) | |
87 | throws TemplateException; | |
88 | ||
89 | public TemplateContext getTemplateContext(); | |
90 | ||
91 | public boolean templateExists(String template); | |
92 | } |