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