org.apache.beehive.netui.core.urltemplates
Class URLTemplatesFactory

Object
  extended by URLTemplatesFactory

public class URLTemplatesFactory
extends Object

Methods for configuring and retrieving the URLTemplates object.


Constructor Summary
URLTemplatesFactory()
           
 
Method Summary
static URLTemplates getTemplates(ServletContext servletContext)
          Parses the URL template config file, WEB-INF/url-template-config.xml, and returns the templates.
protected static URLTemplates getTemplatesFromConfig(UrlTemplateConfigDocument.UrlTemplateConfig urlTemplateConfig)
          Loads the templates from a parsed URL template config document.
static void setKnownTokens(Collection<String> knownTokens)
          Allow clients to define a set of known tokens for the template verification.
static void setParser(URLTemplateFileParser parser)
          Allow clients to set their own parser.
static void setRequiredTokens(Collection<String> requiredTokens)
          Allow clients to define a set of required tokens for the template verification.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLTemplatesFactory

public URLTemplatesFactory()
Method Detail

setParser

public static void setParser(URLTemplateFileParser parser)
Allow clients to set their own parser.

The parser is used on the URL template config file, WEB-INF/url-template-config.xml. This can be used to support older file formats.

Parameters:
parser - The parser to use on the URL template config file.

setKnownTokens

public static void setKnownTokens(Collection<String> knownTokens)
Allow clients to define a set of known tokens for the template verification. Tokens are expected to be qualified in braces. E.g. {url:path}

The template verification will ensure the known tokens in the URL template conforms to a valid format.

Parameters:
knownTokens - The set of known tokens for a valid template.

setRequiredTokens

public static void setRequiredTokens(Collection<String> requiredTokens)
Allow clients to define a set of required tokens for the template verification. Tokens are expected to be qualified in braces. E.g. {url:path}

The template verification will ensure the URL template conforms to a valid format for known tokens and contains the required tokens.

Parameters:
requiredTokens - The set of required tokens in a valid template.

getTemplates

public static URLTemplates getTemplates(ServletContext servletContext)
                                 throws ServletException
Parses the URL template config file, WEB-INF/url-template-config.xml, and returns the templates.

Returns:
The URL templates found in the config file.
Throws:
ServletException

getTemplatesFromConfig

protected static URLTemplates getTemplatesFromConfig(UrlTemplateConfigDocument.UrlTemplateConfig urlTemplateConfig)
Loads the templates from a parsed URL template config document.

Parameters:
urlTemplateConfig - the parsed XMLBean document for the URL template config.
Returns:
The URL templates found in the config document.