org.apache.turbine.services.template
Class TurbineTemplate

java.lang.Object
  extended byorg.apache.turbine.services.template.TurbineTemplate

public abstract class TurbineTemplate
extends java.lang.Object

This is a simple static accessor to common TemplateService tasks such as getting a Screen that is associated with a screen template.

Version:
$Id: TurbineTemplate.java 534527 2007-05-02 16:10:59Z tv $
Author:
John D. McNally

Constructor Summary
TurbineTemplate()
           
 
Method Summary
static java.lang.String getDefaultExtension()
          Get the default extension given in the properties file.
static java.lang.String getDefaultLayout()
          Get the default layout module name of the template engine service corresponding to the default template name extension.
static java.lang.String getDefaultLayoutName(RunData data)
          Find the default layout module name for the given request.
static java.lang.String getDefaultLayoutName(java.lang.String template)
          Get the default layout module name of the template engine service corresponding to the template name extension of the named template.
static java.lang.String getDefaultLayoutTemplate()
          Get the default layout template given in the properties file.
static java.lang.String getDefaultLayoutTemplateName(java.lang.String template)
          Get the default layout template name of the template engine service corresponding to the template name extension of the named template.
static java.lang.String getDefaultNavigation()
          Get the default Navigation given in the properties file.
static java.lang.String getDefaultNavigationName(java.lang.String template)
          Get the default navigation module name of the template engine service corresponding to the template name extension of the named template.
static java.lang.String getDefaultPage()
          Get the default page module name of the template engine service corresponding to the default template name extension.
static java.lang.String getDefaultPageName(RunData data)
          Find the default page module name for the given request.
static java.lang.String getDefaultPageName(java.lang.String template)
          Get the default page module name of the template engine service corresponding to the template name extension of the named template.
static java.lang.String getDefaultScreen()
          Get the Screen template given in the properties file.
static java.lang.String getDefaultScreenName(java.lang.String template)
          Get the default screen module name of the template engine service corresponding to the template name extension of the named template.
static java.lang.String getDefaultTemplate()
          Returns the Default Template Name with the Default Extension.
static java.lang.String getExtension(java.lang.String template)
          Return Extension for a supplied template
static java.lang.String getLayoutName(java.lang.String template)
          Locate and return the name of the layout module to be used with the named layout template.
static java.lang.String getLayoutTemplateName(java.lang.String name)
          Locate and return the name of a layout template.
static java.lang.String getNavigationName(java.lang.String template)
          Locate and return the name of the navigation module to be used with the named navigation template.
static java.lang.String getNavigationTemplateName(java.lang.String key)
          Locate and return the name of a navigation template.
static java.lang.String getScreenName(java.lang.String name)
          Locate and return the name of a Screen module.
static java.lang.String getScreenTemplateName(java.lang.String key)
          Locate and return the name of a screen template.
static TemplateService getService()
          Utility method for accessing the service implementation
static TemplateEngineService getTemplateEngineService(java.lang.String template)
          The TemplateEngineService associated with the specified template's file extension.
static boolean isCaching()
          Returns true if the Template Service has caching activated
static void registerTemplateEngineService(TemplateEngineService service)
          Registers the provided template engine for use by the TemplateService.
static boolean templateExists(java.lang.String template, java.lang.String[] templatePaths)
          Deprecated. Use templateExists from the various Templating Engines
static java.lang.String[] translateTemplatePaths(java.lang.String[] templatePaths)
          Deprecated. Each template engine service should know how to translate a request onto a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurbineTemplate

public TurbineTemplate()
Method Detail

getService

public static TemplateService getService()
Utility method for accessing the service implementation

Returns:
a TemplateService implementation instance

isCaching

public static final boolean isCaching()
Returns true if the Template Service has caching activated

Returns:
true if Caching is active.

getDefaultExtension

public static final java.lang.String getDefaultExtension()
Get the default extension given in the properties file.

Returns:
A String with the extension.

getExtension

public static final java.lang.String getExtension(java.lang.String template)
Return Extension for a supplied template

Parameters:
template - The template name
Returns:
extension The extension for the supplied template

getDefaultTemplate

public static final java.lang.String getDefaultTemplate()
Returns the Default Template Name with the Default Extension. If the extension is unset, return only the template name

Returns:
The default template Name

getDefaultPage

public static final java.lang.String getDefaultPage()
Get the default page module name of the template engine service corresponding to the default template name extension.

Returns:
The default page module name.

getDefaultScreen

public static final java.lang.String getDefaultScreen()
Get the Screen template given in the properties file.

Returns:
A String which is the value of the TemplateService default.screen property.

getDefaultLayout

public static final java.lang.String getDefaultLayout()
Get the default layout module name of the template engine service corresponding to the default template name extension.

Returns:
The default layout module name.

getDefaultNavigation

public static final java.lang.String getDefaultNavigation()
Get the default Navigation given in the properties file.

Returns:
A String which is the value of the TemplateService default.navigation property.

getDefaultLayoutTemplate

public static final java.lang.String getDefaultLayoutTemplate()
Get the default layout template given in the properties file.

Returns:
A String which is the value of the TemplateService default.layout.template property.

getDefaultPageName

public static final java.lang.String getDefaultPageName(java.lang.String template)
Get the default page module name of the template engine service corresponding to the template name extension of the named template.

Parameters:
template - The template name.
Returns:
The default page module name.

getDefaultScreenName

public static final java.lang.String getDefaultScreenName(java.lang.String template)
Get the default screen module name of the template engine service corresponding to the template name extension of the named template.

Parameters:
template - The template name.
Returns:
The default screen module name.

getDefaultLayoutName

public static final java.lang.String getDefaultLayoutName(java.lang.String template)
Get the default layout module name of the template engine service corresponding to the template name extension of the named template.

Parameters:
template - The template name.
Returns:
The default layout module name.

getDefaultNavigationName

public static final java.lang.String getDefaultNavigationName(java.lang.String template)
Get the default navigation module name of the template engine service corresponding to the template name extension of the named template.

Parameters:
template - The template name.
Returns:
The default navigation module name.

getDefaultLayoutTemplateName

public static final java.lang.String getDefaultLayoutTemplateName(java.lang.String template)
Get the default layout template name of the template engine service corresponding to the template name extension of the named template.

Parameters:
template - The template name.
Returns:
The default layout template name.

getDefaultPageName

public static final java.lang.String getDefaultPageName(RunData data)
Find the default page module name for the given request.

Parameters:
data - The encapsulation of the request to retrieve the default page for.
Returns:
The default page module name.

getDefaultLayoutName

public static final java.lang.String getDefaultLayoutName(RunData data)
Find the default layout module name for the given request.

Parameters:
data - The encapsulation of the request to retrieve the default layout for.
Returns:
The default layout module name.

getScreenName

public static final java.lang.String getScreenName(java.lang.String name)
                                            throws java.lang.Exception
Locate and return the name of a Screen module.

Parameters:
name - A String with the name of the template.
Returns:
A String with the name of the screen.
Throws:
Exception, - a generic exception.
java.lang.Exception

getLayoutName

public static final java.lang.String getLayoutName(java.lang.String template)
                                            throws java.lang.Exception
Locate and return the name of the layout module to be used with the named layout template.

Parameters:
template - The layout template name.
Returns:
The found layout module name.
Throws:
Exception, - a generic exception.
java.lang.Exception

getNavigationName

public static final java.lang.String getNavigationName(java.lang.String template)
                                                throws java.lang.Exception
Locate and return the name of the navigation module to be used with the named navigation template.

Parameters:
template - The navigation template name.
Returns:
The found navigation module name.
Throws:
Exception, - a generic exception.
java.lang.Exception

getScreenTemplateName

public static final java.lang.String getScreenTemplateName(java.lang.String key)
                                                    throws java.lang.Exception
Locate and return the name of a screen template.

Parameters:
key - A String which is the key to the template.
Returns:
A String with the screen template path.
Throws:
Exception, - a generic exception.
java.lang.Exception

getLayoutTemplateName

public static final java.lang.String getLayoutTemplateName(java.lang.String name)
                                                    throws java.lang.Exception
Locate and return the name of a layout template.

Parameters:
name - A String with the name of the template.
Returns:
A String with the layout template path.
Throws:
Exception, - a generic exception.
java.lang.Exception

getNavigationTemplateName

public static final java.lang.String getNavigationTemplateName(java.lang.String key)
                                                        throws java.lang.Exception
Locate and return the name of a navigation template.

Parameters:
key - A String which is the key to the template.
Returns:
A String with the navigation template path.
Throws:
Exception, - a generic exception.
java.lang.Exception

translateTemplatePaths

public static final java.lang.String[] translateTemplatePaths(java.lang.String[] templatePaths)
Deprecated. Each template engine service should know how to translate a request onto a file.

Translates the supplied template paths into their Turbine-canonical equivalent (probably absolute paths).

Parameters:
templatePaths - An array of template paths.
Returns:
An array of translated template paths.

templateExists

public static final boolean templateExists(java.lang.String template,
                                           java.lang.String[] templatePaths)
Deprecated. Use templateExists from the various Templating Engines

Delegates to the appropriate TemplateEngineService to check the existance of the specified template.

Parameters:
template - The template to check for the existance of.
templatePaths - The paths to check for the template.

registerTemplateEngineService

public static final void registerTemplateEngineService(TemplateEngineService service)
Registers the provided template engine for use by the TemplateService.

Parameters:
service - The TemplateEngineService to register.

getTemplateEngineService

public static final TemplateEngineService getTemplateEngineService(java.lang.String template)
The TemplateEngineService associated with the specified template's file extension.

Parameters:
template - The template name.
Returns:
The template engine service.


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