Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TemplateEngineService |
|
| 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 is the interface that all template engine services must adhere | |
29 | * to. This includes the Velocity, WebMacro, FreeMarker, and JSP | |
30 | * services. | |
31 | * | |
32 | * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> | |
33 | * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> | |
34 | * @version $Id: TemplateEngineService.java 535465 2007-05-05 06:58:06Z tv $ */ | |
35 | public interface TemplateEngineService | |
36 | { | |
37 | public static final String TEMPLATE_EXTENSIONS = "template.extension"; | |
38 | public static final String DEFAULT_TEMPLATE_EXTENSION = "template.default.extension"; | |
39 | public static final String DEFAULT_LAYOUT_TEMPLATE = "default.page.template"; | |
40 | public static final String DEFAULT_PAGE_TEMPLATE = "default.layout.template"; | |
41 | ||
42 | /** | |
43 | * Return the configuration of the template engine in | |
44 | * the form of a Hashtable. | |
45 | */ | |
46 | //public Hashtable getTemplateEngineServiceConfiguration(); | |
47 | ||
48 | /** | |
49 | * Initializes file extension associations and registers with the | |
50 | * template service. | |
51 | * | |
52 | * @param defaultExt The default file extension association to use | |
53 | * in case of properties file misconfiguration. | |
54 | */ | |
55 | //public void registerConfiguration(String defaultExt); | |
56 | ||
57 | /** | |
58 | * Supplies the file extension to key this engine in {@link | |
59 | * org.apache.fulcrum.template.TemplateService}'s | |
60 | * registry with. | |
61 | */ | |
62 | public String[] getAssociatedFileExtensions(); | |
63 | ||
64 | /** | |
65 | * Use the specific template engine to determine whether | |
66 | * a given template exists. This allows Turbine the TemplateService | |
67 | * to delegate the search for a template to the template | |
68 | * engine being used for the view. This gives us the | |
69 | * advantage of fully utilizing the capabilities of | |
70 | * template engine with respect to retrieving templates | |
71 | * from arbitrary sources. | |
72 | * | |
73 | * @param template The name of the template to check the existance of. | |
74 | * @return Whether the specified template exists. | |
75 | */ | |
76 | public boolean templateExists(String template); | |
77 | ||
78 | /** | |
79 | * @see org.apache.fulcrum.template.TemplateEngineService | |
80 | */ | |
81 | public abstract String handleRequest(TemplateContext context, | |
82 | String template) | |
83 | throws TemplateException; | |
84 | ||
85 | /** | |
86 | * @see org.apache.fulcrum.template.TemplateEngineService | |
87 | */ | |
88 | public abstract void handleRequest(TemplateContext context, | |
89 | String template, | |
90 | OutputStream outputStream) | |
91 | throws TemplateException; | |
92 | ||
93 | /** | |
94 | * @see org.apache.fulcrum.template.TemplateEngineService | |
95 | */ | |
96 | void handleRequest(TemplateContext context, String template, Writer writer) | |
97 | throws TemplateException; | |
98 | } |