org.apache.turbine.services.template
Class BaseTemplateEngineService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.turbine.services.template.BaseTemplateEngineService
All Implemented Interfaces:
Initable, Service, TemplateEngineService
Direct Known Subclasses:
TurbineJspService, TurbineVelocityService

public abstract class BaseTemplateEngineService
extends TurbineBaseService
implements TemplateEngineService

The base implementation of Turbine TemplateEngineService.

Version:
$Id: BaseTemplateEngineService.java 534527 2007-05-02 16:10:59Z tv $
Author:
Daniel Rall, Jason van Zyl

Field Summary
 
Fields inherited from class org.apache.turbine.services.BaseService
name, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.template.TemplateEngineService
DEFAULT_ERROR_SCREEN, DEFAULT_LAYOUT, DEFAULT_LAYOUT_TEMPLATE, DEFAULT_NAVIGATION, DEFAULT_NAVIGATION_TEMPLATE, DEFAULT_PAGE, DEFAULT_SCREEN, DEFAULT_SCREEN_TEMPLATE, DEFAULT_TEMPLATE_EXTENSION, TEMPLATE_EXTENSIONS
 
Fields inherited from interface org.apache.turbine.services.Service
SERVICE_NAME
 
Constructor Summary
BaseTemplateEngineService()
           
 
Method Summary
 java.lang.String[] getAssociatedFileExtensions()
          Supplies the file extension to key this engine in TemplateService's registry with.
 java.util.Hashtable getTemplateEngineServiceConfiguration()
          Return the configuration of the template engine in the form of a Hashtable.
protected  void initConfiguration(java.lang.String defaultExt)
          Initialize the Template Engine Service.
 void registerConfiguration(java.lang.String defaultExt)
          Initializes file extension associations and registers with the template service.
abstract  boolean templateExists(java.lang.String template)
          Use the specific template engine to determine whether a given template exists.
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, setInitableBroker
 

Constructor Detail

BaseTemplateEngineService

public BaseTemplateEngineService()
Method Detail

registerConfiguration

public void registerConfiguration(java.lang.String defaultExt)
Description copied from interface: TemplateEngineService
Initializes file extension associations and registers with the template service.

Specified by:
registerConfiguration in interface TemplateEngineService
Parameters:
defaultExt - The default file extension association to use in case of properties file misconfiguration.
See Also:
TemplateEngineService.registerConfiguration(java.lang.String)

getTemplateEngineServiceConfiguration

public java.util.Hashtable getTemplateEngineServiceConfiguration()
Description copied from interface: TemplateEngineService
Return the configuration of the template engine in the form of a Hashtable.

Specified by:
getTemplateEngineServiceConfiguration in interface TemplateEngineService
See Also:
TemplateEngineService.getTemplateEngineServiceConfiguration()

getAssociatedFileExtensions

public java.lang.String[] getAssociatedFileExtensions()
Description copied from interface: TemplateEngineService
Supplies the file extension to key this engine in TemplateService's registry with.

Specified by:
getAssociatedFileExtensions in interface TemplateEngineService
See Also:
TemplateEngineService.getAssociatedFileExtensions()

initConfiguration

protected void initConfiguration(java.lang.String defaultExt)
Initialize the Template Engine Service. Note engine file extension associations. First attempts to pull a list of custom extensions from the property file value keyed by template.extension. If none are defined, uses the value keyed by template.default.extension, defaulting to the emergency value supplied by defaultExt.

Parameters:
defaultExt - The default used when the default defined in the properties file is missing or misconfigured.

templateExists

public abstract boolean templateExists(java.lang.String template)
Description copied from interface: TemplateEngineService
Use the specific template engine to determine whether a given template exists. This allows Turbine the TemplateService to delegate the search for a template to the template engine being used for the view. This gives us the advantage of fully utilizing the capabilities of template engine with respect to retrieving templates from arbitrary sources.

Specified by:
templateExists in interface TemplateEngineService
Parameters:
template - The name of the template to check the existance of.
Returns:
Whether the specified template exists.
See Also:
TemplateEngineService.templateExists(java.lang.String)


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.