View Javadoc

1   package org.apache.turbine.services.template;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "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  {
34      String TEMPLATE_EXTENSIONS = "template.extension";
35      String DEFAULT_TEMPLATE_EXTENSION = "template.default.extension";
36      String DEFAULT_PAGE = "default.page";
37      String DEFAULT_SCREEN = "default.screen";
38      String DEFAULT_LAYOUT = "default.layout";
39      String DEFAULT_NAVIGATION = "default.navigation";
40      String DEFAULT_ERROR_SCREEN = "default.error.screen";
41      String DEFAULT_LAYOUT_TEMPLATE = "default.layout.template";
42      String DEFAULT_SCREEN_TEMPLATE = "default.screen.template";
43      String DEFAULT_NAVIGATION_TEMPLATE = "default.navigation.template";
44  
45      /***
46       * Return the configuration of the template engine in
47       * the form of a Hashtable.
48       */
49      Hashtable getTemplateEngineServiceConfiguration();
50  
51      /***
52       * Initializes file extension associations and registers with the
53       * template service.
54       *
55       * @param defaultExt The default file extension association to use
56       *                   in case of properties file misconfiguration.
57       */
58      void registerConfiguration(String defaultExt);
59  
60      /***
61       * Supplies the file extension to key this engine in {@link
62       * org.apache.turbine.services.template.TemplateService}'s
63       * registry with.
64       */
65      String[] getAssociatedFileExtensions();
66  
67      /***
68       * Use the specific template engine to determine whether
69       * a given template exists. This allows Turbine the TemplateService
70       * to delegate the search for a template to the template
71       * engine being used for the view. This gives us the
72       * advantage of fully utilizing the capabilities of
73       * template engine with respect to retrieving templates
74       * from arbitrary sources.
75       *
76       * @param template The name of the template to check the existance of.
77       * @return         Whether the specified template exists.
78       */
79      boolean templateExists(String template);
80  }