|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.core.config.ConfigurationParser
public class ConfigurationParser
Configuration parser base class. This class provides the basic functionality for parsing Jackrabbit configuration files. Subclasses extend this functionality with knowledge of the exact structure of the different configuration files. Each configuration parser instance contains a set of parser variables that are used for variable replacement in the configuration file.
Field Summary | |
---|---|
static String |
CLASS_ATTRIBUTE
Name of the bean implementation class configuration attribute. |
static String |
NAME_ATTRIBUTE
Name of the bean parameter name configuration attribute. |
static String |
PARAM_ELEMENT
Name of the bean parameter configuration element. |
static String |
VALUE_ATTRIBUTE
Name of the bean parameter value configuration attribute. |
Constructor Summary | |
---|---|
ConfigurationParser(Properties variables)
Creates a new configuration parser with the given parser variables. |
Method Summary | |
---|---|
protected String |
getAttribute(Element element,
String name)
Returns the value of the named attribute of the given element. |
protected String |
getAttribute(Element element,
String name,
String def)
Returns the value of the named attribute of the given element. |
protected Element |
getElement(Element parent,
String name)
Returns the named child of the given parent element. |
protected Element |
getElement(Element parent,
String name,
boolean required)
Returns the named child of the given parent element. |
Properties |
getVariables()
Returns the variables. |
protected BeanConfig |
parseBeanConfig(Element parent,
String name)
Parses a named bean configuration from the given element. |
protected Properties |
parseParameters(Element element)
Parses the configuration parameters of the given element. |
protected Element |
parseXML(InputSource xml)
Parses the given XML document and returns the DOM root element. |
protected String |
replaceVariables(String value)
Performs variable replacement on the given string value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PARAM_ELEMENT
public static final String CLASS_ATTRIBUTE
public static final String NAME_ATTRIBUTE
public static final String VALUE_ATTRIBUTE
Constructor Detail |
---|
public ConfigurationParser(Properties variables)
variables
- parser variablesMethod Detail |
---|
public Properties getVariables()
protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException
<BeanName class="..."> <param name="..." value="..."/> ... </BeanName>
The returned bean configuration object contains the configured class name and configuration parameters. Variable replacement is performed on the parameter values.
parent
- parent elementname
- name of the bean configuration element
ConfigurationException
- if the configuration element does not
exist or is brokenprotected Properties parseParameters(Element element) throws ConfigurationException
<param name="..." value="..."/>
child elements. This method parses all param elements,
performs variable replacement
on parameter values, and returns the resulting name-value pairs.
element
- configuration element
ConfigurationException
- if a param
element does
not contain the name
and
value
attributesprotected String replaceVariables(String value) throws ConfigurationException
${...}
sequence within the given value is replaced
with the value of the named parser variable. The replacement is not
done if the named variable does not exist.
value
- original value
ConfigurationException
- if the replacement of a referenced
variable is not foundprotected Element parseXML(InputSource xml) throws ConfigurationException
xml
- xml document
ConfigurationException
- if the configuration document could
not be read or parsedConfigurationEntityResolver
protected Element getElement(Element parent, String name) throws ConfigurationException
parent
- parent elementname
- name of the child element
ConfigurationException
ConfigurationException
- if the child element is not foundprotected Element getElement(Element parent, String name, boolean required) throws ConfigurationException
parent
- parent elementname
- name of the child elementrequired
- indicates if the child element is required
null
if not found and
required
is false
.
ConfigurationException
- if the child element is not found and
required
is true
.protected String getAttribute(Element element, String name) throws ConfigurationException
element
- elementname
- attribute name
ConfigurationException
- if the attribute is not foundprotected String getAttribute(Element element, String name, String def)
element
- elementname
- attribute namedef
- default value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |