org.apache.jetspeed.locator
Class JetspeedTemplateLocator

java.lang.Object
  extended by org.apache.jetspeed.locator.JetspeedTemplateLocator
All Implemented Interfaces:
TemplateLocator

public class JetspeedTemplateLocator
extends java.lang.Object
implements TemplateLocator

Jetspeed's default implementation of a template locator.

Version:
$Id: JetspeedTemplateLocator.java 587334 2007-10-23 00:30:49Z taylor $
Author:
David Sean Taylor

Constructor Summary
JetspeedTemplateLocator(java.util.List roots, java.util.List omClasses, java.lang.String defaultLocatorType, java.lang.String appRoot)
          Assemble with list resource directory roots and OM classes and a defaultLocatorType.
JetspeedTemplateLocator(java.util.List roots, java.lang.String appRoot)
          Minimal assembly with a list of resource directory roots.
JetspeedTemplateLocator(java.util.List roots, java.lang.String defaultLocatorType, java.lang.String appRoot)
          Construct with a root list and a default locator type.
 
Method Summary
 LocatorDescriptor createFromString(java.lang.String path)
          Creates a locator from a string of format (where brackets are optional]: template//[media-type/]/[language/]/[country/]]/name/
 LocatorDescriptor createLocatorDescriptor(java.lang.String type)
          Factory to create template locators of the given type.
 TemplateDescriptor locateTemplate(LocatorDescriptor locator)
          Locate an template using Jetspeed template location algorithm
 java.util.Iterator query(LocatorDescriptor locator)
          Query for a collection of templates given template locator criteria.
 void start()
           
 void stop()
           
 boolean templateExists(java.lang.String templateKey)
           
 boolean templateExists(java.lang.String templateKey, boolean useCache)
          Checks for the existence of a template resource given a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JetspeedTemplateLocator

public JetspeedTemplateLocator(java.util.List roots,
                               java.lang.String appRoot)
                        throws java.io.FileNotFoundException
Minimal assembly with a list of resource directory roots.

Parameters:
roots - A list of resource root directories where templates are located.
appRoot - Root from where this application runs
Throws:
java.io.FileNotFoundException

JetspeedTemplateLocator

public JetspeedTemplateLocator(java.util.List roots,
                               java.lang.String defaultLocatorType,
                               java.lang.String appRoot)
                        throws java.io.FileNotFoundException
Construct with a root list and a default locator type.

Parameters:
roots - A list of resource root directories where templates are located.
defaultLocatorType - Under root directories, subdirectories represent locator types. A locator type represents a classification of templates. Any value is allowed. Use locator types to group templates together.
Throws:
java.io.FileNotFoundException

JetspeedTemplateLocator

public JetspeedTemplateLocator(java.util.List roots,
                               java.util.List omClasses,
                               java.lang.String defaultLocatorType,
                               java.lang.String appRoot)
                        throws java.io.FileNotFoundException
Assemble with list resource directory roots and OM classes and a defaultLocatorType.

Parameters:
roots - A list of resource root directories where templates are located.
omClasses - Template replacable object model implementations for Template and TemplateLocator. Required order, with second optional: [ Template, TemplateLocator implementations.
defaultLocatorType - Under root directories, subdirectories represent locator types. A locator type represents a classification of templates. Any value is allowed. Use locator types to group templates together.
Throws:
java.io.FileNotFoundException
Method Detail

locateTemplate

public TemplateDescriptor locateTemplate(LocatorDescriptor locator)
Description copied from interface: TemplateLocator
Locate an template using Jetspeed template location algorithm

Specified by:
locateTemplate in interface TemplateLocator
Parameters:
locator - The template locator
Returns:
The template found, or null if not found.

templateExists

public boolean templateExists(java.lang.String templateKey,
                              boolean useCache)
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.

Parameters:
key - The absolute path to the template resource.
Returns:
True when the template is found, otherwise false.

templateExists

public boolean templateExists(java.lang.String templateKey)

createFromString

public LocatorDescriptor createFromString(java.lang.String path)
                                   throws TemplateLocatorException
Description copied from interface: TemplateLocator
Creates a locator from a string of format (where brackets are optional]: template//[media-type/]/[language/]/[country/]]/name/
Specified by:
createFromString in interface TemplateLocator
Parameters:
path - the string representation of a template locator
Throws:
TemplateLocatorException

createLocatorDescriptor

public LocatorDescriptor createLocatorDescriptor(java.lang.String type)
                                          throws TemplateLocatorException
Description copied from interface: TemplateLocator
Factory to create template locators of the given type. Known supported locator types, but not limited to: portlet email

Specified by:
createLocatorDescriptor in interface TemplateLocator
Returns:
a general template locator of the given type
Throws:
TemplateLocatorException - if factory exception or if not valid locator type

start

public void start()

stop

public void stop()

query

public java.util.Iterator query(LocatorDescriptor locator)
Description copied from interface: TemplateLocator
Query for a collection of templates given template locator criteria.

Specified by:
query in interface TemplateLocator
Parameters:
locator - The template locator criteria.
Returns:
The result list of Template objects matching the locator criteria.


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.