org.apache.turbine.services.template

## Class BaseTemplateEngineService

- java.lang.Object
- - org.apache.turbine.services.BaseInitable
  - - org.apache.turbine.services.BaseService
    - - org.apache.turbine.services.TurbineBaseService
      - - org.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 1723699 2016-01-08 11:29:21Z 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

    Constructors
    Constructor and Description
    `BaseTemplateEngineService()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getAssociatedFileExtensions()` Supplies the file extension to key this engine in `TemplateService`'s registry with.
    `Hashtable<String,Object>` | `getTemplateEngineServiceConfiguration()` Return the configuration of the template engine in the form of a Hashtable.
    `protected void` | `initConfiguration(String defaultExt)` Initialize the Template Engine Service.
    `void` | `registerConfiguration(String defaultExt)` Initializes file extension associations and registers with the template service.
    `abstract boolean` | `templateExists(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, 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(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 Hashtable<String,Object> 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`
      Returns:
        the template engine service configuration map
      See Also:
        `TemplateEngineService.getTemplateEngineServiceConfiguration()`

    - #### getAssociatedFileExtensions

          public 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`
      Returns:
        the list of extensions this engine supports
      See Also:
        `TemplateEngineService.getAssociatedFileExtensions()`

    - #### initConfiguration

          protected void initConfiguration(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(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 existence of.
      Returns:
        Whether the specified template exists.
      See Also:
        `TemplateEngineService.templateExists(java.lang.String)`

Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.