01: package org.apache.turbine.services.template;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.Hashtable;
20:
21: /**
22: * This is the interface that all template engine services must adhere
23: * to. This includes the Velocity, WebMacro, FreeMarker, and JSP
24: * services.
25: *
26: * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
27: * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
28: * @version $Id: TemplateEngineService.java 264152 2005-08-29 14:50:22Z henning $ */
29: public interface TemplateEngineService {
30: String TEMPLATE_EXTENSIONS = "template.extension";
31: String DEFAULT_TEMPLATE_EXTENSION = "template.default.extension";
32: String DEFAULT_PAGE = "default.page";
33: String DEFAULT_SCREEN = "default.screen";
34: String DEFAULT_LAYOUT = "default.layout";
35: String DEFAULT_NAVIGATION = "default.navigation";
36: String DEFAULT_ERROR_SCREEN = "default.error.screen";
37: String DEFAULT_LAYOUT_TEMPLATE = "default.layout.template";
38: String DEFAULT_SCREEN_TEMPLATE = "default.screen.template";
39: String DEFAULT_NAVIGATION_TEMPLATE = "default.navigation.template";
40:
41: /**
42: * Return the configuration of the template engine in
43: * the form of a Hashtable.
44: */
45: Hashtable getTemplateEngineServiceConfiguration();
46:
47: /**
48: * Initializes file extension associations and registers with the
49: * template service.
50: *
51: * @param defaultExt The default file extension association to use
52: * in case of properties file misconfiguration.
53: */
54: void registerConfiguration(String defaultExt);
55:
56: /**
57: * Supplies the file extension to key this engine in {@link
58: * org.apache.turbine.services.template.TemplateService}'s
59: * registry with.
60: */
61: String[] getAssociatedFileExtensions();
62:
63: /**
64: * Use the specific template engine to determine whether
65: * a given template exists. This allows Turbine the TemplateService
66: * to delegate the search for a template to the template
67: * engine being used for the view. This gives us the
68: * advantage of fully utilizing the capabilities of
69: * template engine with respect to retrieving templates
70: * from arbitrary sources.
71: *
72: * @param template The name of the template to check the existance of.
73: * @return Whether the specified template exists.
74: */
75: boolean templateExists(String template);
76: }
|