|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.module.sitemesh.mapper.ConfigLoader
public class ConfigLoader
The ConfigLoader reads a configuration XML file that contains Decorator definitions (name, url, init-params) and path-mappings (pattern, name).
These can then be accessed by the getDecoratorByName() methods and getMappedName() methods respectively.
The DTD for the configuration file in old (deprecated) format is located at http://www.opensymphony.com/dtds/sitemesh_1_0_decorators.dtd .
The DTD for the configuration file in new format is located at http://www.opensymphony.com/dtds/sitemesh_1_5_decorators.dtd .
Editing the config file will cause it to be auto-reloaded.
This class is used by ConfigDecoratorMapper, and uses PathMapper for pattern matching.
ConfigDecoratorMapper
,
PathMapper
Field Summary | |
---|---|
private Config |
config
|
private File |
configFile
|
private String |
configFileName
|
private long |
configLastModified
|
private Map |
decorators
|
private PathMapper |
pathMapper
|
Constructor Summary | |
---|---|
ConfigLoader(File configFile)
Create new ConfigLoader using supplied File. |
|
ConfigLoader(String configFileName,
Config config)
Create new ConfigLoader using supplied filename and config. |
Method Summary | |
---|---|
private static String |
getAttribute(Element element,
String name)
Override default behavior of element.getAttribute (returns the empty string) to return null. |
private static String |
getContainedText(Node parent,
String childTagName)
With a given parent XML Element, find the text contents of the child element with supplied name. |
Decorator |
getDecoratorByName(String name)
Retrieve Decorator based on name specified in configuration file. |
String |
getMappedName(String path)
Get name of Decorator mapped to given path. |
private void |
loadConfig()
Load configuration from file. |
private void |
parseConfig(Document document)
Parse configuration from XML document. |
private void |
populatePathMapper(NodeList patternNodes,
String role,
String name)
Extracts each URL pattern and adds it to the pathMapper map. |
private void |
refresh()
Check if configuration file has been updated, and if so, reload. |
private void |
storeDecorator(Decorator d)
Store Decorator in Map |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Map decorators
private long configLastModified
private File configFile
private String configFileName
private PathMapper pathMapper
private Config config
Constructor Detail |
---|
public ConfigLoader(File configFile) throws ServletException
ServletException
public ConfigLoader(String configFileName, Config config) throws ServletException
ServletException
Method Detail |
---|
public Decorator getDecoratorByName(String name) throws ServletException
ServletException
public String getMappedName(String path) throws ServletException
ServletException
private void loadConfig() throws ServletException
ServletException
private void parseConfig(Document document)
private void populatePathMapper(NodeList patternNodes, String role, String name)
private static String getAttribute(Element element, String name)
private static String getContainedText(Node parent, String childTagName)
private void storeDecorator(Decorator d)
private void refresh() throws ServletException
ServletException
|
www.opensymphony.com/sitemesh/ | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |