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.


Field Summary
static String DEFAULT_URL_TEMPLATE_CONFIG_FILE_PATH
          Default value for path from the web app to the URL templates.
 
Constructor Summary
URLTemplatesFactory()
           
 
Method Summary
 URLTemplates getTemplates(ServletContext servletContext)
          Parses the URL template config file, WEB-INF/url-template-config.xml, and returns the templates.
protected  URLTemplates getTemplatesFromConfig(UrlTemplateConfigDocument.UrlTemplateConfig urlTemplateConfig)
          Loads the templates from a parsed URL template config document.
 void setConfigFilePath(String configFilePath)
          Allow clients to set their own URL template config file name or path.
 void setKnownTokens(Collection knownTokens)
          Allow clients to define a set of known tokens for the template verification.
 void setParser(URLTemplateFileParser parser)
          Allow clients to set their own parser.
 void setRequiredTokens(Collection 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
 

Field Detail

DEFAULT_URL_TEMPLATE_CONFIG_FILE_PATH

public static final String DEFAULT_URL_TEMPLATE_CONFIG_FILE_PATH
Default value for path from the web app to the URL templates.

See Also:
Constant Field Values
Constructor Detail

URLTemplatesFactory

public URLTemplatesFactory()
Method Detail

setConfigFilePath

public void setConfigFilePath(String configFilePath)
Allow clients to set their own URL template config file name or path.

Parameters:
configFilePath - An absolute path from the web app root tothe URL template config file.

setParser

public 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 void setKnownTokens(Collection 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 void setRequiredTokens(Collection 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 URLTemplates getTemplates(ServletContext servletContext)
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.

getTemplatesFromConfig

protected 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.