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

Object
  extended by URLTemplates
All Implemented Interfaces:
Serializable

public class URLTemplates
extends Object
implements Serializable

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

See Also:
Serialized Form

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 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.
 URLTemplate[] getTemplates()
          Returns the URL templates from url-template-config by name.
 
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.

getTemplates

public URLTemplate[] getTemplates()
Returns the URL templates from url-template-config by name. Always returns a copy of the URLTemplates with the same parsed template data but with cleared set of token values. This allows multiple client requests access to the same parsed template structure, without requiring it to be parsed for each request.

Returns:
an array of the URL templates with the template names as the key.

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