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

Object
  extended by URLTemplates

public class URLTemplates
extends Object

The key class to get information from url-template-config.


Constructor Summary
URLTemplates()
           
 
Method Summary
 void addTemplate(String templateName, URLTemplate template)
          Add a template from url-template-config by name.
 void addTemplateRefGroup(String refGroupName, Map<String,String> templateRefGroup)
          Add a template reference group from url-template-config by name.
 URLTemplate getTemplate(String templateName)
          Retrieve a template from url-template-config by name.
 String getTemplateNameByRef(String refGroupName, String key)
          Retrieve a template name from a reference group in url-template-config.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLTemplates

public URLTemplates()
Method Detail

addTemplate

public void addTemplate(String templateName,
                        URLTemplate template)
Add a template from url-template-config by name.

Parameters:
templateName - the name of the template.
template - the template to add.

getTemplate

public URLTemplate getTemplate(String templateName)
Retrieve a template from url-template-config by name. Always returns a copy of a URLTemplate with the same parsed template data but its own cleared set of token values for the substitue() methods. This allows multiple client requests access to the same parsed template structure, without requiring it to be parsed for each request.

Parameters:
templateName - the name of the template.
Returns:
a URLTemplate copy with its own empty map for storing token replacement values.

addTemplateRefGroup

public void addTemplateRefGroup(String refGroupName,
                                Map<String,String> templateRefGroup)
Add a template reference group from url-template-config by name.

Parameters:
refGroupName - the name of the template reference group.
templateRefGroup - the template reference group.

getTemplateNameByRef

public String getTemplateNameByRef(String refGroupName,
                                   String key)
Retrieve a template name from a reference group in url-template-config.

Parameters:
refGroupName - the name of the template reference group.
key - the key to the particular template reference in the group.
Returns:
a template name from the reference group.