1 package org.apache.turbine.services.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.util.Hashtable; 25 26 /** 27 * This is the interface that all template engine services must adhere 28 * to. This includes the Velocity, WebMacro, FreeMarker, and JSP 29 * services. 30 * 31 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> 32 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> 33 * @version $Id: TemplateEngineService.java 1078552 2011-03-06 19:58:46Z tv $ */ 34 public interface TemplateEngineService 35 { 36 static final String TEMPLATE_EXTENSIONS = "template.extension"; 37 static final String DEFAULT_TEMPLATE_EXTENSION = "template.default.extension"; 38 static final String DEFAULT_PAGE = "default.page"; 39 static final String DEFAULT_SCREEN = "default.screen"; 40 static final String DEFAULT_LAYOUT = "default.layout"; 41 static final String DEFAULT_NAVIGATION = "default.navigation"; 42 static final String DEFAULT_ERROR_SCREEN = "default.error.screen"; 43 static final String DEFAULT_LAYOUT_TEMPLATE = "default.layout.template"; 44 static final String DEFAULT_SCREEN_TEMPLATE = "default.screen.template"; 45 static final String DEFAULT_NAVIGATION_TEMPLATE = "default.navigation.template"; 46 47 /** 48 * Return the configuration of the template engine in 49 * the form of a Hashtable. 50 */ 51 Hashtable<String, Object> getTemplateEngineServiceConfiguration(); 52 53 /** 54 * Initializes file extension associations and registers with the 55 * template service. 56 * 57 * @param defaultExt The default file extension association to use 58 * in case of properties file misconfiguration. 59 */ 60 void registerConfiguration(String defaultExt); 61 62 /** 63 * Supplies the file extension to key this engine in {@link 64 * org.apache.turbine.services.template.TemplateService}'s 65 * registry with. 66 */ 67 String[] getAssociatedFileExtensions(); 68 69 /** 70 * Use the specific template engine to determine whether 71 * a given template exists. This allows Turbine the TemplateService 72 * to delegate the search for a template to the template 73 * engine being used for the view. This gives us the 74 * advantage of fully utilizing the capabilities of 75 * template engine with respect to retrieving templates 76 * from arbitrary sources. 77 * 78 * @param template The name of the template to check the existance of. 79 * @return Whether the specified template exists. 80 */ 81 boolean templateExists(String template); 82 }