org.apache.jetspeed.services.template
Class JetspeedTemplateLocatorService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.template.JetspeedTemplateLocatorService
All Implemented Interfaces:
org.apache.turbine.services.Initable, org.apache.turbine.services.Service, TemplateLocatorService

public class JetspeedTemplateLocatorService
extends org.apache.turbine.services.TurbineBaseService
implements TemplateLocatorService

Implements all template location related operations. Template location algorithms are different from the Velocity template location, since Jetspeed has a specialized template directory structure. This is a fix to get us through unti the TurbineTemplateService can locate resources by NLS and mediatype. Then it can be removed

The directory structure is currently layout out in the following order: /templateType/mediaType/LanguageCode/CountryCode

Example: /screens/html/en/US/resource.vm

Version:
$Id: JetspeedTemplateLocatorService.java,v 1.22 2004/02/23 03:38:54 jford Exp $
Author:
David Sean Taylor, Raphael Luta, Paul Spener, Chris Kimpton, Scott T. Weaver

Field Summary
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.template.TemplateLocatorService
SERVICE_NAME
 
Constructor Summary
JetspeedTemplateLocatorService()
           
 
Method Summary
 void init()
           
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 java.lang.String locateControllerTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a controller template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locateControlTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a control template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locateEmailTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate an email template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locateEmailTemplate(org.apache.turbine.util.RunData data, java.lang.String template, java.util.Locale locale)
          Locate an email template using Jetspeed template location algorithm, searching by mediatype and language.
 java.lang.String locateLayoutTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a layout template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locateNavigationTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a controller template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locateParameterTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a parameter style template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locatePortletTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a portlet template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 java.lang.String locateScreenTemplate(org.apache.turbine.util.RunData data, java.lang.String template)
          Locate a screen template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.
 void shutdown()
          This is the shutdown method called by the Turbine Service framework
 boolean templateExists(java.lang.String templateKey, boolean useNameCache)
          Checks for the existence of a template resource given a key.
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init
 
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.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
 

Constructor Detail

JetspeedTemplateLocatorService

public JetspeedTemplateLocatorService()
Method Detail

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException

init

public void init()
          throws org.apache.turbine.services.InitializationException
Specified by:
init in interface org.apache.turbine.services.Initable
Throws:
org.apache.turbine.services.InitializationException

shutdown

public void shutdown()
This is the shutdown method called by the Turbine Service framework

Specified by:
shutdown in interface org.apache.turbine.services.Initable

locateScreenTemplate

public java.lang.String locateScreenTemplate(org.apache.turbine.util.RunData data,
                                             java.lang.String template)
Locate a screen template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateScreenTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the screens directory for the requested screen template, or null if not found.

locateLayoutTemplate

public java.lang.String locateLayoutTemplate(org.apache.turbine.util.RunData data,
                                             java.lang.String template)
Locate a layout template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateLayoutTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the layouts directory for the requested layout template, or null if not found.

locateNavigationTemplate

public java.lang.String locateNavigationTemplate(org.apache.turbine.util.RunData data,
                                                 java.lang.String template)
Locate a controller template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateNavigationTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the controllers directory for the requested controller template, or null if not found.

locatePortletTemplate

public java.lang.String locatePortletTemplate(org.apache.turbine.util.RunData data,
                                              java.lang.String template)
Locate a portlet template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locatePortletTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the portlets directory for the requested portlet template, or null if not found.

locateControlTemplate

public java.lang.String locateControlTemplate(org.apache.turbine.util.RunData data,
                                              java.lang.String template)
Locate a control template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateControlTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the controls directory for the requested control template, or null if not found.

locateControllerTemplate

public java.lang.String locateControllerTemplate(org.apache.turbine.util.RunData data,
                                                 java.lang.String template)
Locate a controller template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateControllerTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the controllers directory for the requested controller template, or null if not found.

locateEmailTemplate

public java.lang.String locateEmailTemplate(org.apache.turbine.util.RunData data,
                                            java.lang.String template)
Locate an email template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateEmailTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the emails directory for the requested email template, or null if not found.

locateEmailTemplate

public java.lang.String locateEmailTemplate(org.apache.turbine.util.RunData data,
                                            java.lang.String template,
                                            java.util.Locale locale)
Locate an email template using Jetspeed template location algorithm, searching by mediatype and language.

Specified by:
locateEmailTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
locale - The name of the language.
Returns:
The path relative to the emails directory for the requested email template, or null if not found.

locateParameterTemplate

public java.lang.String locateParameterTemplate(org.apache.turbine.util.RunData data,
                                                java.lang.String template)
Locate a parameter style template using Jetspeed template location algorithm, searching by mediatype and language criteria extracted from the request state in rundata.

Specified by:
locateParameterTemplate in interface TemplateLocatorService
Parameters:
data - The rundata for the request.
template - The name of the template.
Returns:
The path relative to the portlets directory for the requested portlet template, or null if not found.

templateExists

public boolean templateExists(java.lang.String templateKey,
                              boolean useNameCache)
Checks for the existence of a template resource given a key. The key are absolute paths to the templates, and are cached in a template cache for performance.

Returns:
True when the template is found, otherwise false.


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