View Javadoc

1   package org.apache.turbine.services.template;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
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  {
31      String TEMPLATE_EXTENSIONS = "template.extension";
32      String DEFAULT_TEMPLATE_EXTENSION = "template.default.extension";
33      String DEFAULT_PAGE = "default.page";
34      String DEFAULT_SCREEN = "default.screen";
35      String DEFAULT_LAYOUT = "default.layout";
36      String DEFAULT_NAVIGATION = "default.navigation";
37      String DEFAULT_ERROR_SCREEN = "default.error.screen";
38      String DEFAULT_LAYOUT_TEMPLATE = "default.layout.template";
39      String DEFAULT_SCREEN_TEMPLATE = "default.screen.template";
40      String DEFAULT_NAVIGATION_TEMPLATE = "default.navigation.template";
41  
42      /***
43       * Return the configuration of the template engine in
44       * the form of a Hashtable.
45       */
46      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      void registerConfiguration(String defaultExt);
56  
57      /***
58       * Supplies the file extension to key this engine in {@link
59       * org.apache.turbine.services.template.TemplateService}'s
60       * registry with.
61       */
62      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      boolean templateExists(String template);
77  }